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(). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
@@ -1012,6 +1012,16 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
|
|||||||
configSettings->endGroup();
|
configSettings->endGroup();
|
||||||
connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
|
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)
|
void ConfigInfoView::saveSettings(void)
|
||||||
@@ -1268,23 +1278,10 @@ void ConfigInfoView::clicked(const QUrl &url)
|
|||||||
delete data;
|
delete data;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos)
|
void ConfigInfoView::contextMenuEvent(QContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
QMenu* popup = Parent::createStandardContextMenu(pos);
|
contextMenu->popup(event->globalPos());
|
||||||
QAction* action = new QAction("Show Debug Info", popup);
|
event->accept();
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
Parent::contextMenuEvent(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent)
|
ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent)
|
||||||
|
@@ -215,6 +215,7 @@ public:
|
|||||||
class ConfigInfoView : public QTextBrowser {
|
class ConfigInfoView : public QTextBrowser {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
typedef class QTextBrowser Parent;
|
typedef class QTextBrowser Parent;
|
||||||
|
QMenu *contextMenu;
|
||||||
public:
|
public:
|
||||||
ConfigInfoView(QWidget* parent, const char *name = 0);
|
ConfigInfoView(QWidget* parent, const char *name = 0);
|
||||||
bool showDebug(void) const { return _showDebug; }
|
bool showDebug(void) const { return _showDebug; }
|
||||||
@@ -235,8 +236,7 @@ protected:
|
|||||||
QString debug_info(struct symbol *sym);
|
QString debug_info(struct symbol *sym);
|
||||||
static QString print_filter(const QString &str);
|
static QString print_filter(const QString &str);
|
||||||
static void expr_print_help(void *data, struct symbol *sym, const char *str);
|
static void expr_print_help(void *data, struct symbol *sym, const char *str);
|
||||||
QMenu *createStandardContextMenu(const QPoint & pos);
|
void contextMenuEvent(QContextMenuEvent *event);
|
||||||
void contextMenuEvent(QContextMenuEvent *e);
|
|
||||||
|
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
struct menu *_menu;
|
struct menu *_menu;
|
||||||
|
Reference in New Issue
Block a user