Utils: Rework aspect implementation

This avoids some repetition and could be a step towards
having type storage in (or rather accessible from) the base,
so we can have aspects for more complex data (treemodels...)
that are not easily converted to QVariant.

Change-Id: I9797b3d5646195705212db1830d2b415291ac651
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-06-26 11:02:42 +02:00
parent 900ea82fd1
commit 379e7f906e
30 changed files with 463 additions and 643 deletions

View File

@@ -87,8 +87,8 @@ Console::Console()
m_showDebug.setToolTip(Tr::tr("Show debug, log, and info messages."));
m_showDebug.setValue(true);
m_showDebug.action()->setIcon(Utils::Icons::INFO_TOOLBAR.icon());
connect(&m_showDebug, &Utils::BoolAspect::valueChanged,
proxyModel, &ConsoleProxyModel::setShowLogs);
connect(&m_showDebug, &Utils::BoolAspect::changed,
proxyModel, [this, proxyModel] { proxyModel->setShowLogs(m_showDebug()); });
m_showDebugButton->setDefaultAction(m_showDebug.action());
m_showWarningButton = new QToolButton(m_consoleWidget);
@@ -100,7 +100,7 @@ Console::Console()
m_showWarning.setValue(true);
m_showWarning.action()->setIcon(Utils::Icons::WARNING_TOOLBAR.icon());
connect(m_showWarning.action(), &QAction::toggled,
proxyModel, &ConsoleProxyModel::setShowWarnings);
proxyModel, [this, proxyModel] { proxyModel->setShowWarnings(m_showWarning()); });
m_showWarningButton->setDefaultAction(m_showWarning.action());
m_showErrorButton = new QToolButton(m_consoleWidget);
@@ -112,7 +112,7 @@ Console::Console()
m_showError.setValue(true);
m_showError.action()->setIcon(Utils::Icons::CRITICAL_TOOLBAR.icon());
connect(m_showError.action(), &QAction::toggled,
proxyModel, &ConsoleProxyModel::setShowErrors);
proxyModel, [this, proxyModel] { proxyModel->setShowErrors(m_showError()); });
m_showErrorButton->setDefaultAction(m_showError.action());
m_spacer = new QWidget(m_consoleWidget);