kconfig: qconf: fix signal connection to invalid slots
PATCH 1/3 kconfig: qconf: fix signal connection to invalid slots
If you right-click in the ConfigList window, you will see the following messages in the console:
QObject::connect: No such slot QAction::setOn(bool) in scripts/kconfig/qconf.cc:888QObject::connect: (sender name: 'config')QObject::connect: No such slot QAction::setOn(bool) in scripts/kconfig/qconf.cc:897QObject::connect: (sender name: 'config')QObject::connect: No such slot QAction::setOn(bool) in scripts/kconfig/qconf.cc:906QObject::connect: (sender name: 'config')
Right, there is no such slot in QAction. I think this is a typo of setChecked.
Due to this bug, when you toggled the menu "Option->Show Name/Range/Data" the state of the context menu was not previously updated. Fix this.
---
scripts/kconfig/qconf.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/kconfig/qconf.cc +4 -4
@@ -885,7 +885,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) connect(action, SIGNAL(toggled(bool)), parent(), SLOT(setShowName(bool))); connect(parent(), SIGNAL(showNameChanged(bool)), - action, SLOT(setOn(bool))); + action, SLOT(setChecked(bool))); action->setChecked(showName); headerPopup->addAction(action);
@@ -894,7 +894,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) connect(action, SIGNAL(toggled(bool)), parent(), SLOT(setShowRange(bool))); connect(parent(), SIGNAL(showRangeChanged(bool)), - action, SLOT(setOn(bool))); + action, SLOT(setChecked(bool))); action->setChecked(showRange); headerPopup->addAction(action);
@@ -903,7 +903,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) connect(action, SIGNAL(toggled(bool)), parent(), SLOT(setShowData(bool))); connect(parent(), SIGNAL(showDataChanged(bool)), - action, SLOT(setOn(bool))); + action, SLOT(setChecked(bool))); action->setChecked(showData); headerPopup->addAction(action); }
@@ -1275,7 +1275,7 @@ QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos) action->setCheckable(true); connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); - connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); + connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setChecked(bool))); action->setChecked(showDebug()); popup->addSeparator(); popup->addAction(action);
Signature · 1 line
2.25.1
PATCH 2/3 kconfig: qconf: fix the popup menu in the ConfigInfoView window
I do not know when ConfigInfoView::createStandardContextMenu() is called.
Because QTextEdit::createStandardContextMenu() is not virtual, ConfigInfoView::createStandardContextMenu() cannot override it. Even if right-click the ConfigInfoView window, the "Show Debug Info" menu does not show up.
Build up the menu in the constructor, and invoke it from the contextMenuEvent().
---
scripts/kconfig/qconf.cc | 29 +++++++++++++---------------- scripts/kconfig/qconf.h | 4 ++-- 2 files changed, 15 insertions(+), 18 deletions(-)
scripts/kconfig/qconf.cc +13 -16
@@ -1012,6 +1012,16 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) configSettings->endGroup(); connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); } + + contextMenu = createStandardContextMenu(); + QAction *action = new QAction("Show Debug Info", contextMenu); + + action->setCheckable(true); + connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); + connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setChecked(bool))); + action->setChecked(showDebug()); + contextMenu->addSeparator(); + contextMenu->addAction(action); } void ConfigInfoView::saveSettings(void)
@@ -1268,23 +1278,10 @@ void ConfigInfoView::clicked(const QUrl &url) delete data; } -QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos) -{ - QMenu* popup = Parent::createStandardContextMenu(pos); - QAction* action = new QAction("Show Debug Info", popup); - - action->setCheckable(true); - connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); - connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setChecked(bool))); - action->setChecked(showDebug()); - popup->addSeparator(); - popup->addAction(action); - return popup; -} - -void ConfigInfoView::contextMenuEvent(QContextMenuEvent *e) +void ConfigInfoView::contextMenuEvent(QContextMenuEvent *event) { - Parent::contextMenuEvent(e); + contextMenu->popup(event->globalPos()); + event->accept(); } ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent)
scripts/kconfig/qconf.h +2 -2
@@ -215,6 +215,7 @@ public slots: class ConfigInfoView : public QTextBrowser {Q_OBJECT typedef class QTextBrowser Parent; +QMenu *contextMenu; public: ConfigInfoView(QWidget* parent, const char *name = 0);bool showDebug (void ) const {return _showDebug; }
@@ -235,8 +236,7 @@ public slots:QString debug_info (struct symbol *sym); static QString print_filter(const QString &str);static void expr_print_help (void *data,struct symbol *sym,const char *str); - QMenu *createStandardContextMenu(const QPoint & pos); -void contextMenuEvent (QContextMenuEvent *e); +void contextMenuEvent (QContextMenuEvent *event);struct symbol *sym;struct menu *_menu;
Signature · 1 line
2.25.1
PATCH 3/3 kconfig: qconf: remove unused colNr
In reply to Masahiro YamadaThis is not used at all.
---
scripts/kconfig/qconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/qconf.h +1 -1
@@ -30,7 +30,7 @@ class ConfigSettings : public QSettings { };enum colIdx { - promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr + promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx };enum listMode { singleMode, menuMode, symbolMode, fullMode, listMode
Signature · 1 line
2.25.1