PDA

View Full Version : TreeWidget mousePressEvent not being captured



sujan.dasmahapatra
10th December 2009, 06:55
Friends
I have a claas TreeWidget which is derived from QTreeWidget I am overriding mousePressEvent() but when I am clicking in the region of TreeWidget the event is not getting captured. Please tell what to do . see the codes below

class TreeWidget:public QTreeWidget
{
Q_OBJECT
public:
TreeWidget();
~TreeWidget();
void mousePressEvent(QMouseEvent *me);
};

void TreeWdiget::mousePressEvent(QMouseEvent *me)
{
qDebug() << "Testing " << "\n";
}

//but this event is not being captured in the mainwindow where I am setting this widget on the mainwindow.
// then i am clicking on the treewidget. but no response.

whats wrong pls tell me someone.
Thanks sujan

spirit
10th December 2009, 07:08
did you set QWidget::setMouseTracking for QTreeWidget in true?