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

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

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