34 #include <QHBoxLayout>
35 #include <QToolButton>
47 QVBoxLayout* layout =
new QVBoxLayout(
this);
49 this->setLayout(layout);
53 mShowHeaderButton = expandButton;
54 this->setFixedSize(expandButton->sizeHint());
56 QAction* action =
new QAction(QIcon(
":icons/open_icon_library/layer-lower-3.png"),
"Controls",
this);
57 QString tip =
"Show Controls";
58 action->setStatusTip(tip);
59 action->setWhatsThis(tip);
60 action->setToolTip(tip);
61 connect(action, SIGNAL(triggered()),
this, SLOT(onTriggered()));
64 mShowHeaderButton->setDefaultAction(action);
65 layout->addWidget(mShowHeaderButton);
67 action->setCheckable(
true);
72 return mShowHeaderButton->isChecked();
77 mShowHeaderButton->setChecked(val);
80 void PopupButton::onTriggered()
83 mAction->setIcon(QIcon(
":icons/open_icon_library/layer-raise-3.png"));
85 mAction->setIcon(QIcon(
":icons/open_icon_library/layer-lower-3.png"));
97 mControlLayout =
new QHBoxLayout(
this);
98 mControlLayout->setMargin(0);
100 mShowControlsButton =
new PopupButton(this->parentWidget());
101 mControlLayout->addWidget(mShowControlsButton);
102 connect(mShowControlsButton, &
PopupButton::popup,
this, &PopupToolbarWidget::onPopup);
104 mButtonWidget =
new QWidget(
this);
105 mControlLayout->addWidget(mButtonWidget);
112 return mButtonWidget;
117 return mButtonWidget->isVisible();
126 void PopupToolbarWidget::onPopup()
130 mButtonWidget->setVisible(show);
134 mControlLayout->insertWidget(0, mShowControlsButton);
139 mControlLayout->removeWidget(mShowControlsButton);
140 mShowControlsButton->setParent(NULL);
141 mShowControlsButton->setParent(this->parentWidget());
142 mShowControlsButton->setVisible(
true);