I have a treeWidget which displays the items as buttons when hover over them. I use a custom class derived from QStyledItemDelegate to do that.
The problem is that I also need the functionality of doubleClick on an item. SlotItemPressed() never gets called the way it is now. Is there a possibility to do both?

Qt Code:
  1. class MyTreeWidget : public QTreeWidget
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. MyTreeWidget(QWidget *parent = NULL);
  7. ~MyTreeWidget() {}
  8.  
  9. void mouseMoveEvent(QMouseEvent *event);
  10.  
  11. public slots:
  12. void SlotItemPressed(QTreeWidgetItem *item, int index)
  13. {
  14. qDebug() << "slotItemPressed\n";
  15. }
  16.  
  17. };
To copy to clipboard, switch view to plain text mode 

Here is the implementation MyTreeWidget.cpp
Qt Code:
  1. MyTreeWidget::MyTreeWidget(QWidget *parent) : QTreeWidget(parent)
  2. {
  3. connect( this, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ),
  4. this, SLOT( SlotItemPressed( QTreeWidgetItem*, int ) ) );
  5.  
  6.  
  7. setMouseTracking(true);
  8. setEditTriggers(QAbstractItemView::CurrentChanged);
  9. }
  10.  
  11. void MyTreeWidget::mouseMoveEvent(QMouseEvent *event)
  12. {
  13. QTreeWidget::mouseMoveEvent(event);
  14. setCurrentIndex( indexAt(event->pos()));
  15. }
To copy to clipboard, switch view to plain text mode