forked from qt-creator/qt-creator
When we hide the action, also hide its toolbutton.
Originally-By: kh1
This commit is contained in:
@@ -136,6 +136,14 @@ QSize FancyToolButton::minimumSizeHint() const
|
||||
return QSize(8, 8);
|
||||
}
|
||||
|
||||
void FancyToolButton::actionChanged()
|
||||
{
|
||||
// the default action changed in some way, e.g. it might got hidden
|
||||
// since we inherit a tool button we won't get invisible, so do this here
|
||||
if (QAction* action = defaultAction())
|
||||
setVisible(action->isVisible());
|
||||
}
|
||||
|
||||
FancyActionBar::FancyActionBar(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
@@ -152,6 +160,8 @@ void FancyActionBar::insertAction(int index, QAction *action, QMenu *menu)
|
||||
{
|
||||
FancyToolButton *toolButton = new FancyToolButton(this);
|
||||
toolButton->setDefaultAction(action);
|
||||
connect(action, SIGNAL(changed()), toolButton, SLOT(actionChanged()));
|
||||
|
||||
if (menu) {
|
||||
toolButton->setMenu(menu);
|
||||
toolButton->setPopupMode(QToolButton::DelayedPopup);
|
||||
|
@@ -43,6 +43,8 @@ namespace Internal {
|
||||
|
||||
class FancyToolButton : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FancyToolButton(QWidget *parent = 0);
|
||||
|
||||
@@ -50,6 +52,9 @@ public:
|
||||
QSize sizeHint() const;
|
||||
QSize minimumSizeHint() const;
|
||||
|
||||
private slots:
|
||||
void actionChanged();
|
||||
|
||||
private:
|
||||
const QMap<QString, QPicture> &m_buttonElements;
|
||||
};
|
||||
|
Reference in New Issue
Block a user