forked from qt-creator/qt-creator
Debugger: Enabled state of "Threads:" label depends on thread combobox
...and making sure that items of a disabled combobox are visibly disabled. This prevents users from clicking on the Threads label before debugging even started. Change-Id: I59cc9b7e875fe8c126a9ee4221ff9d8322e4b1a8 Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
@@ -245,7 +245,10 @@ QPalette panelPalette(const QPalette &oldPalette, bool lightColored = false)
|
|||||||
pal.setBrush(QPalette::All, QPalette::WindowText, color);
|
pal.setBrush(QPalette::All, QPalette::WindowText, color);
|
||||||
pal.setBrush(QPalette::All, QPalette::ButtonText, color);
|
pal.setBrush(QPalette::All, QPalette::ButtonText, color);
|
||||||
pal.setBrush(QPalette::All, QPalette::Foreground, color);
|
pal.setBrush(QPalette::All, QPalette::Foreground, color);
|
||||||
color.setAlpha(100);
|
if (lightColored)
|
||||||
|
color.setAlpha(100);
|
||||||
|
else
|
||||||
|
color = creatorTheme()->color(Theme::IconsDisabledColor);
|
||||||
pal.setBrush(QPalette::Disabled, QPalette::WindowText, color);
|
pal.setBrush(QPalette::Disabled, QPalette::WindowText, color);
|
||||||
pal.setBrush(QPalette::Disabled, QPalette::ButtonText, color);
|
pal.setBrush(QPalette::Disabled, QPalette::ButtonText, color);
|
||||||
pal.setBrush(QPalette::Disabled, QPalette::Foreground, color);
|
pal.setBrush(QPalette::Disabled, QPalette::Foreground, color);
|
||||||
@@ -740,9 +743,9 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
|
|||||||
painter->setPen(StyleHelper::toolBarDropShadowColor());
|
painter->setPen(StyleHelper::toolBarDropShadowColor());
|
||||||
painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, text);
|
painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, text);
|
||||||
}
|
}
|
||||||
if (!(option->state & State_Enabled))
|
painter->setPen(creatorTheme()->color((option->state & State_Enabled)
|
||||||
painter->setOpacity(0.8);
|
? Theme::ComboBoxTextColor
|
||||||
painter->setPen(creatorTheme()->color(Theme::ComboBoxTextColor));
|
: Theme::IconsDisabledColor));
|
||||||
painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, text);
|
painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, text);
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
@@ -966,6 +966,7 @@ public:
|
|||||||
|
|
||||||
QIcon m_locationMarkIcon;
|
QIcon m_locationMarkIcon;
|
||||||
|
|
||||||
|
QLabel *m_threadLabel = 0;
|
||||||
QComboBox *m_threadBox = 0;
|
QComboBox *m_threadBox = 0;
|
||||||
|
|
||||||
BaseTreeView *m_breakView = 0;
|
BaseTreeView *m_breakView = 0;
|
||||||
@@ -1788,7 +1789,9 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
|
|||||||
}
|
}
|
||||||
|
|
||||||
toolbar.addWidget(new StyledSeparator);
|
toolbar.addWidget(new StyledSeparator);
|
||||||
toolbar.addWidget(new QLabel(tr("Threads:")));
|
|
||||||
|
m_threadLabel = new QLabel(tr("Threads:"));
|
||||||
|
toolbar.addWidget(m_threadLabel);
|
||||||
|
|
||||||
m_threadBox = new QComboBox;
|
m_threadBox = new QComboBox;
|
||||||
m_threadBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
m_threadBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
@@ -2489,6 +2492,8 @@ void DebuggerPluginPrivate::setInitialState()
|
|||||||
|
|
||||||
action(AutoDerefPointers)->setEnabled(true);
|
action(AutoDerefPointers)->setEnabled(true);
|
||||||
action(ExpandStack)->setEnabled(false);
|
action(ExpandStack)->setEnabled(false);
|
||||||
|
|
||||||
|
m_threadLabel->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
|
void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
|
||||||
@@ -2586,6 +2591,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
|
|||||||
m_attachToUnstartedApplication->setEnabled(true);
|
m_attachToUnstartedApplication->setEnabled(true);
|
||||||
|
|
||||||
m_threadBox->setEnabled(state == InferiorStopOk || state == InferiorUnrunnable);
|
m_threadBox->setEnabled(state == InferiorStopOk || state == InferiorUnrunnable);
|
||||||
|
m_threadLabel->setEnabled(m_threadBox->isEnabled());
|
||||||
|
|
||||||
const bool isCore = engine->runParameters().startMode == AttachCore;
|
const bool isCore = engine->runParameters().startMode == AttachCore;
|
||||||
const bool stopped = state == InferiorStopOk;
|
const bool stopped = state == InferiorStopOk;
|
||||||
|
Reference in New Issue
Block a user