forked from qt-creator/qt-creator
Some tuning of the fancy action bar
Done-with: jbache
This commit is contained in:
@@ -57,10 +57,17 @@ using namespace Internal;
|
||||
FancyToolButton::FancyToolButton(QWidget *parent)
|
||||
: QToolButton(parent), m_fader(0)
|
||||
{
|
||||
m_hasForceVisible = false;
|
||||
setAttribute(Qt::WA_Hover, true);
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
}
|
||||
|
||||
void FancyToolButton::forceVisible(bool visible)
|
||||
{
|
||||
m_hasForceVisible = true;
|
||||
setVisible(visible);
|
||||
}
|
||||
|
||||
bool FancyToolButton::event(QEvent *e)
|
||||
{
|
||||
switch(e->type()) {
|
||||
@@ -220,8 +227,10 @@ 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());
|
||||
if (!m_hasForceVisible) {
|
||||
if (QAction* action = defaultAction())
|
||||
setVisible(action->isVisible());
|
||||
}
|
||||
}
|
||||
|
||||
FancyActionBar::FancyActionBar(QWidget *parent)
|
||||
@@ -270,8 +279,8 @@ void FancyActionBar::modeChanged(Core::IMode *mode)
|
||||
if (m_runButton && m_debugButton) {
|
||||
bool inDebugMode = (mode->id() == QLatin1String("Debugger.Mode.Debug"));
|
||||
layout()->setEnabled(false);
|
||||
m_runButton->setVisible(!inDebugMode);
|
||||
m_debugButton->setVisible(inDebugMode);
|
||||
m_runButton->forceVisible(!inDebugMode);
|
||||
m_debugButton->forceVisible(inDebugMode);
|
||||
layout()->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user