Salome HOME
Process tool tip property for radio buttons
authorvsv <vsv@opencascade.com>
Wed, 19 Sep 2018 09:18:04 +0000 (12:18 +0300)
committervsv <vsv@opencascade.com>
Wed, 19 Sep 2018 09:18:04 +0000 (12:18 +0300)
src/ModuleBase/ModuleBase_PagedContainer.cpp
src/ModuleBase/ModuleBase_PagedContainer.h
src/ModuleBase/ModuleBase_WidgetFactory.cpp
src/ModuleBase/ModuleBase_WidgetRadiobox.cpp
src/ModuleBase/ModuleBase_WidgetRadiobox.h
src/ModuleBase/ModuleBase_WidgetSwitch.cpp
src/ModuleBase/ModuleBase_WidgetSwitch.h
src/ModuleBase/ModuleBase_WidgetToolbox.cpp
src/ModuleBase/ModuleBase_WidgetToolbox.h

index b02d23b47346fd6788816e3904b84173133bae51..586b33b816198237cb51876b2f99ae7423484b86 100644 (file)
@@ -50,7 +50,8 @@ ModuleBase_PagedContainer::~ModuleBase_PagedContainer()
 
 int ModuleBase_PagedContainer::addPage(ModuleBase_PageBase* thePage,
                                       const QString& theName, const QString& theCaseId,
-                                      const QPixmap& theIcon )
+                                      const QPixmap& theIcon,
+                                      const QString& theTooltip)
 {
   if (!myPages.count()) {
     setDefaultValue(theCaseId.toStdString());
index 265b3474f1af9cbdfa49a3f77e6323788ad2123e..689e0ca9aa7a451ccb7f81a0d2fd8e92acf521fe 100644 (file)
@@ -48,7 +48,8 @@ class MODULEBASE_EXPORT ModuleBase_PagedContainer : public ModuleBase_ModelWidge
   virtual int addPage( ModuleBase_PageBase* theWidget,
                        const QString& theName,
                        const QString& theCaseId,
-                       const QPixmap& theIcon );
+                       const QPixmap& theIcon,
+                       const QString& theTooltip);
 
   /// Redefinition of virtual function
   virtual QList<QWidget*> getControls() const;
index 80f8419d165714565bf6966bd8d4d97a06394f3d..af75ebd125bef3e64edd9aedf62c634a1d965e6f 100644 (file)
@@ -132,6 +132,7 @@ void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase* thePage, bool a
         if (myWidgetApi->toChildWidget()) {
           do {
             QString aPageName = qs(myWidgetApi->getProperty(CONTAINER_PAGE_NAME));
+            QString aTooltip = qs(myWidgetApi->getProperty(FEATURE_TOOLTIP));
             QString aCaseId = qs(myWidgetApi->getProperty(_ID));
             ModuleBase_PageBase* aPage = new ModuleBase_PageWidget(aWidget);
             createWidget(aPage);
@@ -141,7 +142,7 @@ void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase* thePage, bool a
 
               QString anIconPath = qs( myWidgetApi->getProperty( CONTAINER_PAGE_ICON ) );
               QPixmap anIcon = ModuleBase_IconFactory::loadPixmap( anIconPath );
-              aContainer->addPage( aPage, aPageName, aCaseId, anIcon );
+              aContainer->addPage( aPage, aPageName, aCaseId, anIcon, aTooltip);
             }
           } while (myWidgetApi->toNextWidget());
         }
index 11f4a0642c9680df17838ab145d15c31e18bc0a1..f939ad513bcde9b2e3a1aecdf057bb2ba3ab8289 100644 (file)
@@ -46,19 +46,23 @@ ModuleBase_WidgetRadiobox::~ModuleBase_WidgetRadiobox()
 int ModuleBase_WidgetRadiobox::addPage(ModuleBase_PageBase* thePage,
                                         const QString& theName,
                                         const QString& theCaseId,
-                                        const QPixmap& theIcon)
+                                        const QPixmap& theIcon,
+                                        const QString& theTooltip)
 {
-  ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon);
+  ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon, theTooltip);
   QWidget* aWgt = new QWidget(this);
   QVBoxLayout* aLay = new QVBoxLayout(aWgt);
   aLay->setContentsMargins(0, 0, 0, 0);
 
   QRadioButton* aButton;
-  if (theIcon.isNull())
+  if (theIcon.isNull()) {
     aButton = new QRadioButton(theName, aWgt);
-  else
+    aButton->setToolTip(theTooltip);
+  }
+  else {
     aButton = new QRadioButton(aWgt);
-  aButton->setToolTip(theName);
+    aButton->setToolTip(theName);
+  }
   aLay->addStretch();
   aLay->addWidget(aButton);
   aLay->addStretch();
index 81713d8247b8dcd397f049ce1073b1b9ccab376f..29c42cfdc97d01dfb2766806f9c9d1f6554e0248 100644 (file)
@@ -47,7 +47,8 @@ public:
   virtual int addPage(ModuleBase_PageBase* theWidget,
     const QString& theName,
     const QString& theCaseId,
-    const QPixmap& theIcon);
+    const QPixmap& theIcon,
+    const QString& theTooltip);
 
 protected:
   /// Implements ModuleBase_PagedContainer
index bf1b2974927d7595a073afdb930786db1534e4ff..11d4be0d737b207c23224c7bdb67f9315aece8c7 100644 (file)
@@ -55,9 +55,11 @@ ModuleBase_WidgetSwitch::~ModuleBase_WidgetSwitch()
 
 int ModuleBase_WidgetSwitch::addPage(ModuleBase_PageBase* thePage, const QString& theName,
                                                                    const QString& theCaseId,
-                                                                   const QPixmap& theIcon )
+                                                                   const QPixmap& theIcon,
+                                                                   const QString& theTooltip)
 {
-  int aSuperCount = ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon);
+  int aSuperCount =
+    ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon, theTooltip);
   myCombo->addItem(theName);
   int aResultCount = myCombo->count();
   if (aResultCount == 2)
index 3a5de0f9bf968687f38a54d7a42e8126849cf4dd..065df920ec9e80c51b29576c202e4989e2ab9332 100644 (file)
@@ -54,7 +54,8 @@ class MODULEBASE_EXPORT ModuleBase_WidgetSwitch : public ModuleBase_PagedContain
   virtual int addPage( ModuleBase_PageBase* theWidget,
                        const QString& theName,
                        const QString& theCaseId,
-                       const QPixmap& theIcon );
+                       const QPixmap& theIcon,
+                       const QString& theTooltip);
 
  protected:
    /// Returns index of the current page
index 3a9666b5599d5dbae7f6932403b998ea91c2d1bc..0827a699fa0b36acdb7b6dc91b9d977a4ea1bc27 100644 (file)
@@ -67,9 +67,10 @@ ModuleBase_WidgetToolbox::~ModuleBase_WidgetToolbox()
 int ModuleBase_WidgetToolbox::addPage(ModuleBase_PageBase* thePage,
                                       const QString& theName,
                                       const QString& theCaseId,
-                                      const QPixmap& theIcon )
+                                      const QPixmap& theIcon,
+                                      const QString& theTooltip)
 {
-  ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon);
+  ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon, theTooltip);
   QFrame* aFrame = dynamic_cast<QFrame*>(thePage);
   myToolBox->addItem(aFrame, theName, theIcon );
   return myToolBox->count();
index bac5c1f836467254596d389ccaedae79455a1def..5b8c1e6d770addfcee276d84f10845d78fe7b926 100644 (file)
@@ -53,7 +53,8 @@ class MODULEBASE_EXPORT ModuleBase_WidgetToolbox : public ModuleBase_PagedContai
   virtual int addPage( ModuleBase_PageBase* theWidget,
                        const QString& theName,
                        const QString& theCaseId,
-                       const QPixmap& theIcon );
+                       const QPixmap& theIcon,
+                       const QString& theTooltip);
 
  protected:
   /// Implements ModuleBase_PagedContainer