From 6c403ff37eee4bb8d4bdc6ef7e58ed8e6b0521f7 Mon Sep 17 00:00:00 2001 From: sbh Date: Mon, 10 Nov 2014 19:44:02 +0300 Subject: [PATCH] Proper highlight of active "shape selector" widget --- src/ModuleBase/ModuleBase_WidgetChoice.cpp | 1 - .../ModuleBase_WidgetDoubleValue.cpp | 1 - src/ModuleBase/ModuleBase_WidgetFeature.cpp | 1 - .../ModuleBase_WidgetShapeSelector.cpp | 25 +++---------------- .../ModuleBase_WidgetShapeSelector.h | 4 --- src/PartSet/PartSet_WidgetSketchLabel.cpp | 4 +-- src/PartSet/PartSet_WidgetSketchLabel.h | 1 - 7 files changed, 4 insertions(+), 33 deletions(-) diff --git a/src/ModuleBase/ModuleBase_WidgetChoice.cpp b/src/ModuleBase/ModuleBase_WidgetChoice.cpp index 3a3ed7459..65c6c1890 100644 --- a/src/ModuleBase/ModuleBase_WidgetChoice.cpp +++ b/src/ModuleBase/ModuleBase_WidgetChoice.cpp @@ -74,7 +74,6 @@ bool ModuleBase_WidgetChoice::focusTo() QList ModuleBase_WidgetChoice::getControls() const { QList aControls; - aControls.append(myLabel); aControls.append(myCombo); return aControls; } diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index 922ab9151..7400d7f7d 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -122,7 +122,6 @@ bool ModuleBase_WidgetDoubleValue::restoreValue() QList ModuleBase_WidgetDoubleValue::getControls() const { QList aList; - aList.append(myLabel); aList.append(mySpinBox); return aList; } diff --git a/src/ModuleBase/ModuleBase_WidgetFeature.cpp b/src/ModuleBase/ModuleBase_WidgetFeature.cpp index faf664fe5..0b84e8444 100644 --- a/src/ModuleBase/ModuleBase_WidgetFeature.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFeature.cpp @@ -155,7 +155,6 @@ QWidget* ModuleBase_WidgetFeature::getControl() const QList ModuleBase_WidgetFeature::getControls() const { QList aList; - aList.append(myLabel); aList.append(myEditor); return aList; } diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index 86f7a3471..76c2da206 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -101,11 +101,6 @@ ModuleBase_WidgetShapeSelector::ModuleBase_WidgetShapeSelector(QWidget* theParen myTextLine->setToolTip(aToolTip); myTextLine->installEventFilter(this); - myBasePalet = myTextLine->palette(); - myInactivePalet = myBasePalet; - myInactivePalet.setBrush(QPalette::Base, QBrush(Qt::gray, Qt::Dense6Pattern)); - myTextLine->setPalette(myInactivePalet); - aLayout->addWidget(myTextLine, 1); std::string aTypes = theData->getProperty("shape_types"); @@ -180,7 +175,6 @@ bool ModuleBase_WidgetShapeSelector::restoreValue() QList ModuleBase_WidgetShapeSelector::getControls() const { QList aControls; - aControls.append(myLabel); aControls.append(myTextLine); return aControls; } @@ -333,17 +327,8 @@ void ModuleBase_WidgetShapeSelector::updateSelectionName() myTextLine->setText(QString::fromStdString(aName)); } else { if (myIsActive) { - QString aMsg = tr("Select a "); - int i = 0; - foreach (QString aType, myShapeTypes) { - if (i > 0) - aMsg += " or "; - aMsg += aType; - i++; - } - myTextLine->setText(aMsg); - } else - myTextLine->setText(tr("No object selected")); + myTextLine->setText(""); + } } } @@ -352,10 +337,6 @@ void ModuleBase_WidgetShapeSelector::updateSelectionName() void ModuleBase_WidgetShapeSelector::activateSelection(bool toActivate) { myIsActive = toActivate; - if (myIsActive) - myTextLine->setPalette(myBasePalet); - else - myTextLine->setPalette(myInactivePalet); updateSelectionName(); if (myIsActive) { @@ -405,7 +386,7 @@ void ModuleBase_WidgetShapeSelector::raisePanel() const bool ModuleBase_WidgetShapeSelector::focusTo() { activateSelection(true); - return true; + return ModuleBase_ModelWidget::focusTo(); } //******************************************************************** diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h index eee5389a1..ad3d3b857 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h @@ -15,7 +15,6 @@ #include #include -#include class Config_WidgetAPI; class QWidget; @@ -111,9 +110,6 @@ Q_OBJECT /// If true then local selector has to be activated in context bool myUseSubShapes; - QPalette myBasePalet; - QPalette myInactivePalet; - bool myIsActive; Handle(ModuleBase_ObjectTypesFilter) myObjTypeFilter; diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 6c0c3aaae..b6f18fb7f 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -27,9 +27,7 @@ PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel(QWidget* theParent, QList PartSet_WidgetSketchLabel::getControls() const { - QList aLst; - aLst << myLabel; - return aLst; + return QList(); } QWidget* PartSet_WidgetSketchLabel::getControl() const diff --git a/src/PartSet/PartSet_WidgetSketchLabel.h b/src/PartSet/PartSet_WidgetSketchLabel.h index 442f31907..5ad06d65d 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.h +++ b/src/PartSet/PartSet_WidgetSketchLabel.h @@ -23,7 +23,6 @@ Q_OBJECT virtual ~PartSet_WidgetSketchLabel() { } - ; /// Saves the internal parameters to the given feature /// \param theFeature a model feature to be changed -- 2.39.2