PDA

View Full Version : About popup menu on a QTableWidget with headers, incorrect popup position



ricardo
15th May 2009, 00:17
Hi mates!

I added a popup menu to a QTableWidget, but position seems wrong, I guess is because I have a vertical and/or horizontal header. I think if I add header lenght, would be enoungh, but is there any other more generic solution?



void CSequencesDialog::popupSequences(const QPoint &pos) {
QWidget* widget=qobject_cast<QWidget *>(QObject::sender());
if (widget!=NULL)
m_popupSequences->popup(widget->mapToGlobal(pos));
}


Thanks for help.

ricardo
17th May 2009, 17:24
Any idea? Should I extract width and height from my header, or there is another way?

Thanks in advance.

aamer4yu
17th May 2009, 17:47
Where do u wanna show the menu, and on what condition ?
You can always override contextMenuEvent I guess ?

ricardo
17th May 2009, 20:17
I have a listWidget compenet, I modified
contextMenuPolicy to CuistomContextMenu
and added this signal/slot
connect(ui.listWidgetSequences, SIGNAL(customContextMenuRequested(QPoint)),this,SL OT(popupSequences(QPoint)));

My problem is that if the list has a headr, position is a bit wrong.

Thanks in advance.