[Qt-interest] QTreeWidget

Yixun Liu enjoywm at cs.wm.edu
Fri Jul 31 00:16:04 CEST 2009


Thank you very much. It's very helpful.
I can pop up a slider at the position where I right click mouse. Now I
want to hide the slide when I click anywhere except on the slider.

How to do it?



David Boosalis wrote:
> YOu can Inherit from QTreeWidget and then implement you own
> mousePressEvent().  For instance.
>
> /********************************************************************/
> void MyTreeWidget::mousePressEvent(QMouseEvent *event)
> {
>   QTreeWidgetItem *pressedItem = 0;
>
>   if (event->button() == Qt::RightButton) {
>     pressedItem = itemAt(event->pos());
>     if (pressedItem)
>       emit showPopup(event->globalPos(),pressedItem);
>   }
>   else
>     QTreeWidget::mousePressEvent(event);
>  
>
> On Thu, Jul 30, 2009 at 7:15 AM, Yixun Liu <enjoywm at cs.wm.edu
> <mailto:enjoywm at cs.wm.edu>> wrote:
>
>     Hi,
>     I want to right click one item in QTreeWidget and then pop up a
>     slider.
>     I cannot find the signal related right click event for
>     QTreeWidget. How
>     to solve this?
>
>     Thanks.
>
>     Yixun
>     _______________________________________________
>     Qt-interest mailing list
>     Qt-interest at trolltech.com <mailto:Qt-interest at trolltech.com>
>     http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>




More information about the Qt-interest-old mailing list