Commit cfcd9c6e authored by Hans-Christian Ebke's avatar Hans-Christian Ebke
Browse files

Changed the header area widget installation mechanism to something more robust.

parent b15b2b91
...@@ -218,33 +218,27 @@ void DataControlPlugin::initializePlugin() ...@@ -218,33 +218,27 @@ void DataControlPlugin::initializePlugin()
toolIcon_ = new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-toolbox.png"); toolIcon_ = new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-toolbox.png");
emit addToolbox("Data Control", tool_, toolIcon_); QWidget *headerAreaWidget = new QWidget();
advancedSettingsBtn_ = new QToolButton();
QWidget *childControlArea = tool_->parent()->findChild<QWidget*>( advancedSettingsBtn_->setAutoRaise(true);
"ChildControlArea"); advancedSettingsBtn_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"preferences.png"));
if (childControlArea) { advancedSettingsBtn_->setIconSize(QSize(16, 16));
std::cout << "Child Control Area found." << std::endl; advancedSettingsBtn_->setPopupMode(QToolButton::InstantPopup);
advancedSettingsBtn_ = new QToolButton(); advancedSettingsBtn_->setToolTip(tr("Advanced Settings"));
advancedSettingsBtn_->setAutoRaise(true); QHBoxLayout *hl = new QHBoxLayout;
advancedSettingsBtn_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"preferences.png")); hl->addWidget(advancedSettingsBtn_);
advancedSettingsBtn_->setIconSize(QSize(16, 16)); hl->addStretch(1);
advancedSettingsBtn_->setPopupMode(QToolButton::InstantPopup); hl->setContentsMargins(8, 0, 0, 0);
advancedSettingsBtn_->setToolTip(tr("Advanced Settings")); headerAreaWidget->setLayout(hl);
QHBoxLayout *hl = new QHBoxLayout;
hl->addWidget(advancedSettingsBtn_); QMenu *menu = new QMenu();
hl->addStretch(1); menu->addAction(tool_->lightSources);
hl->setContentsMargins(8, 0, 0, 0); menu->addAction(tool_->notSelected);
childControlArea->setLayout(hl); menu->addAction(tool_->sourceSelected);
menu->addAction(tool_->targetSelected);
QMenu *menu = new QMenu(); advancedSettingsBtn_->setMenu(menu);
menu->addAction(tool_->lightSources);
menu->addAction(tool_->notSelected); emit addToolbox("Data Control", tool_, toolIcon_, headerAreaWidget);
menu->addAction(tool_->sourceSelected);
menu->addAction(tool_->targetSelected);
advancedSettingsBtn_->setMenu(menu);
} else {
std::cout << "Child Control Area NOT found." << std::endl;
}
} }
...@@ -903,7 +897,8 @@ void DataControlPlugin::saveOnExit(INIFile& _ini){ ...@@ -903,7 +897,8 @@ void DataControlPlugin::saveOnExit(INIFile& _ini){
} }
void DataControlPlugin::showReducedUi(bool reduced) { void DataControlPlugin::showReducedUi(bool reduced) {
advancedSettingsBtn_->setVisible(reduced); if (advancedSettingsBtn_)
advancedSettingsBtn_->setVisible(reduced);
} }
void DataControlPlugin::slotObjectUpdated( int _identifier, const UpdateType& _type ) void DataControlPlugin::slotObjectUpdated( int _identifier, const UpdateType& _type )
......
...@@ -110,7 +110,7 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, KeyIn ...@@ -110,7 +110,7 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, KeyIn
void copyObject( int _oldId, int& _newId); void copyObject( int _oldId, int& _newId);
// ToolboxInterface // ToolboxInterface
void addToolbox( QString _name , QWidget* _widget, QIcon* _icon ); void addToolbox( QString _name , QWidget* _widget, QIcon* _icon, QWidget *_headerAreaWidget);
private slots : private slots :
// BaseInterface // BaseInterface
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment