Commit 5f68261d authored by Hans-Christian Ebke's avatar Hans-Christian Ebke

Added customizable widget into whitespace in side pane elements.

parent 9555d035
......@@ -98,7 +98,13 @@ SideElement::SideElement (SideArea *_parent, QWidget *_w, QString _name, QIcon*
detachButton_->setAutoRaise(true);
hl->addWidget (iconHolder_);
hl->addWidget (label_);
hl->addStretch (1);
QWidget *stretcher_wdgt = new QWidget(this);
stretcher_wdgt->setObjectName("ChildControlArea");
connect(this, SIGNAL(toggleActive(bool)), stretcher_wdgt, SLOT(setVisible(bool)));
stretcher_wdgt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
stretcher_wdgt->setVisible(false);
hl->addWidget (stretcher_wdgt);
hl->addStretch(1);
hl->addWidget (detachButton_);
......@@ -161,6 +167,8 @@ void SideElement::labelPress ()
QFont font;
font.setBold (active_);
label_->setFont (font);
emit toggleActive(active_);
}
}
......@@ -175,6 +183,7 @@ void SideElement::setActive(bool _active)
}
else
{
const bool doEmit = (active_ != _active);
active_ = _active;
if (active_)
widget_->show ();
......@@ -184,6 +193,8 @@ void SideElement::setActive(bool _active)
QFont font;
font.setBold (active_);
label_->setFont (font);
if (doEmit) emit toggleActive(active_);
}
}
......@@ -261,7 +272,9 @@ void SideElement::restoreState (QSettings &_settings)
{
_settings.beginGroup (name_);
active_ = _settings.value ("Active", active_).toBool ();
bool active = _settings.value ("Active", active_).toBool ();
const bool doEmit = (active_ != active);
active_ = active;
if (active_)
widget_->show ();
......@@ -272,6 +285,8 @@ void SideElement::restoreState (QSettings &_settings)
font.setBold (active_);
label_->setFont (font);
if (doEmit) emit toggleActive(active_);
if (_settings.value ("Detached", false).toBool () && !dialog_)
detachPressed (true);
......
......@@ -117,6 +117,9 @@ class SideElement : public QWidget
/// returns the pointer to the plugin tool widget
QWidget const * widget();
signals:
void toggleActive(bool);
private:
/// Clickable area inside of the side element.
......
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