Thanks Ando_skoa for your reply.
Is MyWindow a QTableWidget subclass?
Yes, MyWindow is a QtableWidget subclass.
How are you calling showContextMenu()?
Please have a look at the line 5 of .cpp
MyWindow is a widget having a QWidget as parent.
.h
{
Q_OBJECT
public:
public slots:
void showContextMenu
(const QPoint &pos
);
private:
};
class AWindow: public QDialog
{
Q_OBJECT
public:
MyWindow(QWidget *parent = 0)
public slots:
void showContextMenu(const QPoint &pos);
private:
QTableWidget *m_MyWindow;
};
To copy to clipboard, switch view to plain text mode
.cpp
{
connect(m_myWindow,
SIGNAL(customContextMenuRequested
(const QPoint)),
this,
SLOT(showContextMenu
(const QPoint)));
}
void MyWindow
::showContextMenu(const QPoint &pos
) {
m_insererRow = menu->addAction("Inser row here");
// Some actions...
}
MyWindow::MyWindow(QWidget *parent): QDialog(parent)
{
m_mywindow = new QTableWidget(this);
connect(m_myWindow, SIGNAL(customContextMenuRequested(const QPoint)), this, SLOT(showContextMenu(const QPoint)));
}
void MyWindow::showContextMenu(const QPoint &pos)
{
QMenu *menu = new QMenu(this);
m_insererRow = menu->addAction("Inser row here");
QAction *selectedItem = menu->exec(QCursor::pos());
// Some actions...
}
To copy to clipboard, switch view to plain text mode
Many thanks in advance!
Added after 54 minutes:
Any help? Do you required more information please?
Bookmarks