#include "MeasureGUI_CheckSelfIntersectionsDlg.h"
#include "MeasureGUI.h"
-#include "MeasureGUI_Widgets.h"
#include <SUIT_OverrideCursor.h>
#include <SUIT_Session.h>
#include <GEOMBase.h>
#include <GEOMImpl_Types.hxx>
+#include <QListWidget>
+
#define TEXTEDIT_FONT_FAMILY "Courier"
#define TEXTEDIT_FONT_SIZE 11
// true to construct a modal dialog.
//=================================================================================
MeasureGUI_CheckSelfIntersectionsDlg::MeasureGUI_CheckSelfIntersectionsDlg (GeometryGUI* GUI, QWidget* parent)
- : GEOMBase_Skeleton(GUI, parent, false)
+ : GEOMBase_Skeleton (GUI, parent, false),
+ myTextView (0),
+ mySelButton (0),
+ myEditObjName (0),
+ myInteList (0),
+ myShapeList (0)
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_CHECK_SELF_INTERSECTIONS")));
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
- myGrp = new MeasureGUI_1Sel1TextView2ListBox (centralWidget());
- myGrp->GroupBox1->setTitle(tr("GEOM_CHECK_INFOS"));
- myGrp->TextLabel1->setText(tr("GEOM_OBJECT"));
+ QGroupBox *aGrp = new QGroupBox(tr("GEOM_CHECK_INFOS"));
+ QLabel *anObjLbl = new QLabel(tr("GEOM_OBJECT"));
+ QLabel *anInteLbl = new QLabel(tr("GEOM_CHECK_BLOCKS_COMPOUND_ERRORS"));
+ QLabel *aShapeLbl = new QLabel(tr("GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES"));
+ QFont aFont (TEXTEDIT_FONT_FAMILY, TEXTEDIT_FONT_SIZE);
- myGrp->TextView1->setReadOnly(true);
- QFont aFont (TEXTEDIT_FONT_FAMILY, TEXTEDIT_FONT_SIZE);
aFont.setStyleHint(QFont::TypeWriter, QFont::PreferAntialias);
- myGrp->TextView1->setFont(aFont);
-
- myGrp->PushButton1->setIcon(image1);
- myGrp->LineEdit1->setReadOnly(true);
-
- myGrp->TextLabel2->setText(tr("GEOM_CHECK_BLOCKS_COMPOUND_ERRORS"));
- myGrp->TextLabel3->setText(tr("GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES"));
-
- myGrp->ListBox2->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ myTextView = new QTextBrowser;
+ myTextView->setReadOnly(true);
+ myTextView->setFont(aFont);
+
+ mySelButton = new QPushButton;
+ mySelButton->setIcon(image1);
+ mySelButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+
+ myEditObjName = new QLineEdit;
+ myEditObjName->setReadOnly(true);
+
+ myInteList = new QListWidget;
+ myShapeList = new QListWidget;
+ myShapeList->setSelectionMode(QAbstractItemView::ExtendedSelection);
+
+ QGridLayout *aGrpLayout = new QGridLayout(aGrp);
+
+ aGrpLayout->setMargin(9);
+ aGrpLayout->setSpacing(6);
+ aGrpLayout->addWidget(anObjLbl, 0, 0);
+ aGrpLayout->addWidget(anInteLbl, 2, 0);
+ aGrpLayout->addWidget(aShapeLbl, 2, 2);
+ aGrpLayout->addWidget(myTextView, 1, 0, 1, 3);
+ aGrpLayout->addWidget(mySelButton, 0, 1);
+ aGrpLayout->addWidget(myEditObjName, 0, 2);
+ aGrpLayout->addWidget(myInteList, 3, 0, 1, 2);
+ aGrpLayout->addWidget(myShapeList, 3, 2);
QVBoxLayout* layout = new QVBoxLayout (centralWidget());
layout->setMargin(0); layout->setSpacing(6);
- layout->addWidget(myGrp);
+ layout->addWidget(aGrp);
/***************************************************************/
this, SLOT(ClickOnCancel()));
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
- connect(myGrp->PushButton1, SIGNAL(clicked()),
+ connect(mySelButton, SIGNAL(clicked()),
this, SLOT(SetEditCurrentArgument()));
- connect(myGrp->ListBox1, SIGNAL(itemSelectionChanged()),
+ connect(myInteList, SIGNAL(itemSelectionChanged()),
SLOT(onInteListSelectionChanged()));
- connect(myGrp->ListBox2, SIGNAL(itemSelectionChanged()),
+ connect(myShapeList, SIGNAL(itemSelectionChanged()),
SLOT(onSubShapesListSelectionChanged()));
LightApp_SelectionMgr* aSel = myGeomGUI->getApp()->selectionMgr();
//=================================================================================
void MeasureGUI_CheckSelfIntersectionsDlg::SetEditCurrentArgument()
{
- myGrp->LineEdit1->setFocus();
+ myEditObjName->setFocus();
SelectionIntoArgument();
}
}
if (aSelectedObject->_is_nil()) {
- myGrp->LineEdit1->setText("");
+ myEditObjName->setText("");
processObject();
erasePreview();
return;
}
myObj = aSelectedObject;
- myGrp->LineEdit1->setText(GEOMBase::GetName(myObj));
+ myEditObjName->setText(GEOMBase::GetName(myObj));
processObject();
DISPLAY_PREVIEW_MACRO;
}
//=================================================================================
void MeasureGUI_CheckSelfIntersectionsDlg::processObject()
{
- disconnect(myGrp->ListBox1, SIGNAL(itemSelectionChanged()), this, 0 );
- disconnect(myGrp->ListBox2, SIGNAL(itemSelectionChanged()), this, 0 );
- myGrp->ListBox1->clear();
- myGrp->ListBox2->clear();
- connect(myGrp->ListBox1, SIGNAL(itemSelectionChanged()),
+ disconnect(myInteList, SIGNAL(itemSelectionChanged()), this, 0 );
+ disconnect(myShapeList, SIGNAL(itemSelectionChanged()), this, 0 );
+ myInteList->clear();
+ myShapeList->clear();
+ connect(myInteList, SIGNAL(itemSelectionChanged()),
SLOT(onInteListSelectionChanged()));
- connect(myGrp->ListBox2, SIGNAL(itemSelectionChanged()),
+ connect(myShapeList, SIGNAL(itemSelectionChanged()),
SLOT(onSubShapesListSelectionChanged()));
erasePreview();
QString anErrMsg("");
if (!findSelfIntersections(hasSelfInte, anErrMsg)) {
- myGrp->TextView1->setText(anErrMsg);
+ myTextView->setText(anErrMsg);
return;
}
aMsg += anErrMsg;
}
- myGrp->TextView1->setText(aMsg);
+ myTextView->setText(aMsg);
// Pairs
QStringList anInteList;
anInteList.append(anInteStr);
}
- myGrp->ListBox1->addItems(anInteList);
+ myInteList->addItems(anInteList);
}
//=================================================================================
void MeasureGUI_CheckSelfIntersectionsDlg::onInteListSelectionChanged()
{
erasePreview();
- int aCurItem = myGrp->ListBox1->currentRow();
+ int aCurItem = myInteList->currentRow();
if (aCurItem < 0)
return;
if (!aType.isEmpty())
aSubShapeList.append(QString("%1_%2").arg(aType).arg(myInters[aCurItem*2 + 1]));
}
- myGrp->ListBox2->clear();
- myGrp->ListBox2->addItems(aSubShapeList);
+ myShapeList->clear();
+ myShapeList->addItems(aSubShapeList);
}
//=================================================================================
erasePreview();
// Current pair
- int aErrCurItem = myGrp->ListBox1->currentRow();
+ int aErrCurItem = myInteList->currentRow();
if (aErrCurItem < 0)
return;
// Selected IDs
QList<int> aIds;
- for (int i = 0, n = myGrp->ListBox2->count(); i < n; i++) {
- if (myGrp->ListBox2->item(i)->isSelected())
+ for (int i = 0, n = myShapeList->count(); i < n; i++) {
+ if (myShapeList->item(i)->isSelected())
aIds.append(i);
}
if (aIds.count() < 1)
return false;
}
- const int aNbInteSelected = myGrp->ListBox1->selectedItems().size();
+ const int aNbInteSelected = myInteList->selectedItems().size();
const bool isPublishAllInte = (aNbInteSelected < 1);
const bool isPublishAllShapes =
- (aNbInteSelected != 1 || myGrp->ListBox2->selectedItems().empty());
+ (aNbInteSelected != 1 || myShapeList->selectedItems().empty());
int i;
- const int n = myGrp->ListBox1->count();
+ const int n = myInteList->count();
TColStd_IndexedMapOfInteger aMapIndex;
// Collect the map of indices.
// Collect the both of two indices.
aMapIndex.Add(myInters[i*2]);
aMapIndex.Add(myInters[i*2 + 1]);
- } else if (myGrp->ListBox1->item(i)->isSelected()) {
+ } else if (myInteList->item(i)->isSelected()) {
if (isPublishAllShapes) {
// Collect the both of two indices.
aMapIndex.Add(myInters[i*2]);
aMapIndex.Add(myInters[i*2 + 1]);
- } else if (myGrp->ListBox2->count() == 2) {
+ } else if (myShapeList->count() == 2) {
// Collect only selected items.
- if (myGrp->ListBox2->item(0)->isSelected()) {
+ if (myShapeList->item(0)->isSelected()) {
aMapIndex.Add(myInters[i*2]);
}
- if (myGrp->ListBox2->item(1)->isSelected()) {
+ if (myShapeList->item(1)->isSelected()) {
aMapIndex.Add(myInters[i*2 + 1]);
}
}