Results 1 to 4 of 4

Thread: Context menu works slowly on QTableWidget

  1. #1
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Context menu works slowly on QTableWidget

    Hi everyone

    I have a problem with context menu on QTableWidget. It works pretty slow. My QTableWidget's cells are painted with delegates nad I wonder if this could cause such behavior... Here is some code

    Qt Code:
    1. void QDnDtableWidget::contextMenuEvent( QContextMenuEvent* pe)
    2. {
    3. QMenu context(this);
    4. context.addAction("&Open Containing Folder...");
    5. context.addSeparator();
    6. context.addAction("&Download");
    7. context.addAction("&Stop");
    8. context.exec(pe->globalPos());
    9. }
    To copy to clipboard, switch view to plain text mode 
    C++ & AMD forever

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Context menu works slowly on QTableWidget

    QTableWidget's cells are always painted with delegates. I suggest using a profiler to find a bottle neck. There is a good chance it's in the delegate. Convenience classes such as QTableWidget are slower than their model oriented counterparts, so if you have many items this is a possible reason of the slowdown as well.

  3. #3
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Context menu works slowly on QTableWidget

    Quote Originally Posted by wysota View Post
    QTableWidget's cells are always painted with delegates
    What about index Widgets ?

    Quote Originally Posted by wysota View Post
    I suggest using a profiler to find a bottle neck
    What's that ?
    C++ & AMD forever

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Context menu works slowly on QTableWidget

    Quote Originally Posted by THRESHE View Post
    What about index Widgets ?
    They are separate widgets so essentially they don't count. Even then the delegate is used. Try setting a transparent index widget and you'll see for yourself.

    What's that ?
    http://en.wikipedia.org/wiki/Performance_analysis

Similar Threads

  1. Context Menu on QTableWidget
    By ankurjain in forum Qt Programming
    Replies: 9
    Last Post: 17th December 2009, 09:52
  2. Replies: 4
    Last Post: 25th June 2007, 20:40

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.