X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetFileSelector.cpp;h=ac79ba82330ead050dcd9f6b306741734b812950;hb=247fc0bd6c6e04ce1f7a6e67f8d3c80ce17acab0;hp=259560e382bddebbf27832b31f65cd2a432a1faf;hpb=dcd54507eb794c21a02c95ad26c1779c36481274;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp b/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp index 259560e38..ac79ba823 100644 --- a/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + /* * ModuleBase_WidgetFileSelector.cpp * @@ -24,7 +26,7 @@ #include #include -#include +#include #include ModuleBase_WidgetFileSelector::ModuleBase_WidgetFileSelector(QWidget* theParent, @@ -35,22 +37,22 @@ ModuleBase_WidgetFileSelector::ModuleBase_WidgetFileSelector(QWidget* theParent, myTitle = QString::fromStdString(theData->getProperty("title")); myDefaultPath = QString::fromStdString(theData->getProperty("path")); - myMainWidget = new QWidget(theParent); - QGridLayout* aMainLay = new QGridLayout(myMainWidget); + QGridLayout* aMainLay = new QGridLayout(this); ModuleBase_Tools::adjustMargins(aMainLay); - QLabel* aTitleLabel = new QLabel(myTitle, myMainWidget); + QLabel* aTitleLabel = new QLabel(myTitle, this); aTitleLabel->setIndent(1); aMainLay->addWidget(aTitleLabel, 0, 0); - myPathField = new QLineEdit(myMainWidget); + myPathField = new QLineEdit(this); aMainLay->addWidget(myPathField, 1, 0); - QPushButton* aSelectPathBtn = new QPushButton("...", myMainWidget); + QPushButton* aSelectPathBtn = new QPushButton("...", this); + aSelectPathBtn->setToolTip(tr("Select file...")); aSelectPathBtn->setMaximumWidth(20); aSelectPathBtn->setMaximumHeight(20); aMainLay->addWidget(aSelectPathBtn, 1, 1); aMainLay->setColumnStretch(0, 1); myPathField->setMinimumHeight(20); aMainLay->setHorizontalSpacing(1); - myMainWidget->setLayout(aMainLay); + this->setLayout(aMainLay); connect(myPathField, SIGNAL(textChanged(const QString&)), this, SLOT(onPathChanged())); @@ -62,7 +64,7 @@ ModuleBase_WidgetFileSelector::~ModuleBase_WidgetFileSelector() { } -bool ModuleBase_WidgetFileSelector::storeValue() const +bool ModuleBase_WidgetFileSelector::storeValueCustom() const { // A rare case when plugin was not loaded. if(!myFeature) @@ -90,15 +92,10 @@ bool ModuleBase_WidgetFileSelector::restoreValue() return true; } -QWidget* ModuleBase_WidgetFileSelector::getControl() const -{ - return myMainWidget; -} - QList ModuleBase_WidgetFileSelector::getControls() const { QList result; - //QPushButton * aButton = myMainWidget->findChild(); + //QPushButton * aButton = this->findChild(); //result << aButton; result << myPathField; return result; @@ -114,7 +111,7 @@ bool ModuleBase_WidgetFileSelector::isCurrentPathValid() void ModuleBase_WidgetFileSelector::onPathSelectionBtn() { QString aFilter = formatsString(); - QString aFileName = QFileDialog::getOpenFileName(myMainWidget, myTitle, myDefaultPath, aFilter); + QString aFileName = QFileDialog::getOpenFileName(this, myTitle, myDefaultPath, aFilter); if (!aFileName.isEmpty()) { myPathField->setText(aFileName); }