diff options
author | hjk <[email protected]> | 2023-06-28 10:48:37 +0200 |
---|---|---|
committer | hjk <[email protected]> | 2023-06-29 06:08:25 +0000 |
commit | 5867d986a8360dcf8d9d62678b3ce61de8bc4fbd (patch) | |
tree | 2b5acc517da73b81278075c971db2a131d4e8f70 /src/plugins | |
parent | 0406f543eb584e07c3371fa4160c50d21fff397b (diff) |
Core: Drop Q_OBJECT from OptionsPopup
Not needed.
Also slim down header a bit.
Change-Id: I6ac828fdfc42173e0b5aeca5d92e920745b424c9
Reviewed-by: Eike Ziller <[email protected]>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/coreplugin/find/optionspopup.cpp | 32 | ||||
-rw-r--r-- | src/plugins/coreplugin/find/optionspopup.h | 9 |
2 files changed, 16 insertions, 25 deletions
diff --git a/src/plugins/coreplugin/find/optionspopup.cpp b/src/plugins/coreplugin/find/optionspopup.cpp index af2e306037c..9f5f11ad2d0 100644 --- a/src/plugins/coreplugin/find/optionspopup.cpp +++ b/src/plugins/coreplugin/find/optionspopup.cpp @@ -18,6 +18,21 @@ using namespace Utils; namespace Core { +static QCheckBox *createCheckboxForCommand(QObject *owner, Id id) +{ + QAction *action = ActionManager::command(id)->action(); + QCheckBox *checkbox = new QCheckBox(action->text()); + checkbox->setToolTip(action->toolTip()); + checkbox->setChecked(action->isChecked()); + checkbox->setEnabled(action->isEnabled()); + checkbox->installEventFilter(owner); // enter key handling + QObject::connect(checkbox, &QCheckBox::clicked, action, &QAction::setChecked); + QObject::connect(action, &QAction::changed, checkbox, [action, checkbox] { + checkbox->setEnabled(action->isEnabled()); + }); + return checkbox; +} + /*! \class Core::OptionsPopup \inmodule QtCreator @@ -35,7 +50,7 @@ OptionsPopup::OptionsPopup(QWidget *parent, const QVector<Id> &commands) bool first = true; for (const Id &command : commands) { - QCheckBox *checkBox = createCheckboxForCommand(command); + QCheckBox *checkBox = createCheckboxForCommand(this, command); if (first) { checkBox->setFocus(); first = false; @@ -73,19 +88,4 @@ bool OptionsPopup::eventFilter(QObject *obj, QEvent *ev) return QWidget::eventFilter(obj, ev); } -QCheckBox *OptionsPopup::createCheckboxForCommand(Id id) -{ - QAction *action = ActionManager::command(id)->action(); - QCheckBox *checkbox = new QCheckBox(action->text()); - checkbox->setToolTip(action->toolTip()); - checkbox->setChecked(action->isChecked()); - checkbox->setEnabled(action->isEnabled()); - checkbox->installEventFilter(this); // enter key handling - QObject::connect(checkbox, &QCheckBox::clicked, action, &QAction::setChecked); - QObject::connect(action, &QAction::changed, checkbox, [action, checkbox] { - checkbox->setEnabled(action->isEnabled()); - }); - return checkbox; -} - } // namespace Core diff --git a/src/plugins/coreplugin/find/optionspopup.h b/src/plugins/coreplugin/find/optionspopup.h index 6331de8914f..3356dc50556 100644 --- a/src/plugins/coreplugin/find/optionspopup.h +++ b/src/plugins/coreplugin/find/optionspopup.h @@ -9,25 +9,16 @@ #include <QWidget> -QT_BEGIN_NAMESPACE -class QCheckBox; -QT_END_NAMESPACE - namespace Core { class CORE_EXPORT OptionsPopup : public QWidget { - Q_OBJECT - public: OptionsPopup(QWidget *parent, const QVector<Utils::Id> &commands); protected: bool event(QEvent *ev) override; bool eventFilter(QObject *obj, QEvent *ev) override; - -private: - QCheckBox *createCheckboxForCommand(Utils::Id id); }; } // namespace Core |