PDA

View Full Version : Context menu works slowly on QTableWidget



THRESHE
13th March 2008, 14:56
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



void QDnDtableWidget::contextMenuEvent( QContextMenuEvent* pe)
{
QMenu context(this);
context.addAction("&Open Containing Folder...");
context.addSeparator();
context.addAction("&Download");
context.addAction("&Stop");
context.exec(pe->globalPos());
}

wysota
13th March 2008, 15:48
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.

THRESHE
13th March 2008, 17:54
QTableWidget's cells are always painted with delegates
What about index Widgets ? :o


I suggest using a profiler to find a bottle neck
What's that ?

wysota
13th March 2008, 19:54
What about index Widgets ? :o
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