triggered signal
This commit is contained in:
parent
f3edf32cb7
commit
1a4a4b8f45
@ -31,6 +31,8 @@ QMenuProxy::QMenuProxy (QObject *parent)
|
||||
m_status(DialogStatus::Closed)
|
||||
{
|
||||
m_menu = new QMenu(0);
|
||||
connect(m_menu, SIGNAL(triggered(QAction *)),
|
||||
this, SLOT(itemTriggered(QAction *)));
|
||||
}
|
||||
|
||||
QMenuProxy::~QMenuProxy()
|
||||
@ -86,6 +88,14 @@ void QMenuProxy::addMenuItem(const QString &text)
|
||||
m_items << item;
|
||||
}
|
||||
|
||||
void QMenuProxy::itemTriggered(QAction *action)
|
||||
{
|
||||
QMenuItem *item = qobject_cast<QMenuItem *>(action);
|
||||
if (item) {
|
||||
emit triggered(item);
|
||||
}
|
||||
}
|
||||
|
||||
void QMenuProxy::showMenu(int x, int y)
|
||||
{
|
||||
m_menu->clear();
|
||||
|
@ -58,6 +58,10 @@ public:
|
||||
Q_SIGNALS:
|
||||
void statusChanged();
|
||||
void visualParentChanged();
|
||||
void triggered(QMenuItem*);
|
||||
|
||||
private Q_SLOTS:
|
||||
void itemTriggered(QAction *item);
|
||||
|
||||
private:
|
||||
QList<QMenuItem*> m_items;
|
||||
|
Loading…
Reference in New Issue
Block a user