Make mode hiding and style available from mode selector

Add the View > Modes menu as a context menu to the mode selector in the
emtpy areas. Add a context menu with "Hide" and the mode style to the
modes that don't have a menu, and extend existing mode menus (Debug
mode) with these items too.

Change-Id: I28106d9b6c4f0d69b2d06c4ec9664eb67e2b1216
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2024-07-09 15:57:48 +02:00
parent d386421998
commit e1560a3c7c
9 changed files with 105 additions and 47 deletions

View File

@@ -79,6 +79,7 @@
#include <QDebug>
#include <QDialogButtonBox>
#include <QLibraryInfo>
#include <QLoggingCategory>
#include <QMenu>
#include <QMenuBar>
#include <QMessageBox>
@@ -96,6 +97,8 @@
#include <malloc.h>
#endif
Q_LOGGING_CATEGORY(coreLog, "qtc.core", QtWarningMsg)
/*!
\namespace Core
\inmodule QtCreator
@@ -1373,8 +1376,8 @@ void ICorePrivate::init()
QApplication::setStyle(new ManhattanStyle(baseName));
m_modeManager = new ModeManager(m_modeStack);
connect(m_modeStack, &FancyTabWidget::topAreaClicked, this, [](Qt::MouseButton, Qt::KeyboardModifiers modifiers) {
if (modifiers & Qt::ShiftModifier) {
connect(m_modeStack, &FancyTabWidget::topAreaClicked, this, [](QMouseEvent *event) {
if (event->modifiers() & Qt::ShiftModifier) {
QColor color = QColorDialog::getColor(StyleHelper::requestedBaseColor(), ICore::dialogParent());
if (color.isValid())
StyleHelper::setBaseColor(color);
@@ -2412,6 +2415,10 @@ void ICorePrivate::updateContext()
uniquecontexts.add(id);
}
if (coreLog().isDebugEnabled()) {
qCDebug(coreLog) << "context changed:"
<< Utils::transform<QList<QString>>(uniquecontexts, &Id::toString);
}
ActionManager::setContext(uniquecontexts);
emit m_core->contextChanged(uniquecontexts);
}