Results 1 to 4 of 4

Thread: About popup menu on a QTableWidget with headers, incorrect popup position

  1. #1
    Join Date
    Apr 2009
    Posts
    132
    Thanks
    67
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default About popup menu on a QTableWidget with headers, incorrect popup position

    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?

    Qt Code:
    1. void CSequencesDialog::popupSequences(const QPoint &pos) {
    2. QWidget* widget=qobject_cast<QWidget *>(QObject::sender());
    3. if (widget!=NULL)
    4. m_popupSequences->popup(widget->mapToGlobal(pos));
    5. }
    To copy to clipboard, switch view to plain text mode 

    Thanks for help.

  2. #2
    Join Date
    Apr 2009
    Posts
    132
    Thanks
    67
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: About popup menu on a QTableWidget with headers, incorrect popup position

    Any idea? Should I extract width and height from my header, or there is another way?

    Thanks in advance.

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: About popup menu on a QTableWidget with headers, incorrect popup position

    Where do u wanna show the menu, and on what condition ?
    You can always override contextMenuEvent I guess ?

  4. #4
    Join Date
    Apr 2009
    Posts
    132
    Thanks
    67
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: About popup menu on a QTableWidget with headers, incorrect popup position

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.