the PopMenu is a class derived the QMenu. In the contextMenuEvent of the DisplayWindow, the code is called . The menu is not immediately shown. After moved the mouse, then the menu will show. It's seem like a problem of render because the cpu is used for decoding the multi-channel
realtime stream & the gpu is used for rendering the YUV on the DisplayWindow at the same time. I find that if I reduce the channels from 8 to 6,the popmenu is immediately shown.
{
PopMenu *menu = new PopMenu(this);
QAction* activeAction
= menu
->exec
(cur.
pos());
}
void DisplayWindow::contextMenuEvent (QContextMenuEvent *event)
{
QCursor cur = this->cursor();
PopMenu *menu = new PopMenu(this);
QAction* activeAction = menu->exec(cur.pos());
}
To copy to clipboard, switch view to plain text mode
.h file
{
Q_OBJECT
public:
virtual int pixelMetric
(PixelMetric metric,
const QStyleOption * option,
const QWidget * widget
) const;
};
class MyMenu
: public QMenu{
Q_OBJECT
public:
protected:
MyIconStyle *m_pMyStyle;
};
class PopMenu : public MyMenu
{
Q_OBJECT
public:
protected:
//sub_menus
public slots:
void triggeredDeal
(QAction *action
);
};
class MyIconStyle : public QPlastiqueStyle
{
Q_OBJECT
public:
virtual int pixelMetric(PixelMetric metric, const QStyleOption * option, const QWidget * widget) const;
};
class MyMenu : public QMenu
{
Q_OBJECT
public:
explicit MyMenu(QWidget *parent);
protected:
MyIconStyle *m_pMyStyle;
};
class PopMenu : public MyMenu
{
Q_OBJECT
public:
explicit PopMenu(QWidget *parent);
protected:
QAction *action1;
QAction *action2;
//sub_menus
QAction *sub_action_16[2];
QAction *sub_action_24[2];
QLabel *label_title;
bool eventFilter(QObject *obj, QEvent *event);
public slots:
void triggeredDeal(QAction *action);
};
To copy to clipboard, switch view to plain text mode
Bookmarks