[Qt-interest] mousePress Eveent disabling QTreeWidgetItem andchildIndicator

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Tue Mar 22 06:50:36 CET 2011


Hi Sujan, 
 
Whenever you override a virtual method, you must ask yourself "Do I need to
call the base method?" 
 
In this case, the base code is never gets the mouse press, so functions that
rely on it don't work.  
 
Tony.
 
 
 

-----Original Message-----
From: qt-interest-bounces+tony.rietwyk=rightsoft.com.au at qt.nokia.com
[mailto:qt-interest-bounces+tony.rietwyk=rightsoft.com.au at qt.nokia.com] On
Behalf Of Sujan Dasmahapatra
Sent: Tuesday, 22 March 2011 16:03
To: qt-interest at trolltech.com
Subject: [Qt-interest] mousePress Eveent disabling QTreeWidgetItem
andchildIndicator



Dear Friends

I have just implemented  drag and drop for  QTreeWidgetItems. But as I
reimplemented mousePressEvent() then I am not able to select an item and
childIndicator is not expanding. The item is disabled from mouseAction. I
implemented drag and drop for right mouse button.

 

////////////////////////////////////////////////////////////////////////////
///////////////////////////////

void Tree::mousePressEvent(QMouseEvent *event)

{

 

       if(event->button()==Qt::RightButton)

       {

       draggingItem = this->itemAt(event->pos());

       QDrag *drag = new QDrag(this);

       drag->exec(Qt::MoveAction | Qt::CopyAction, Qt::CopyAction);

       event->accept();

       }

}

////////////////////////////////////////////////////////////////////////////
///////////////////////

 

Thanks in advance for any help.

 

Kind Regards,

 

 

Sujan Dasmahapatra
Project Leader, Aero Group
Aero Group

Tel    +91 80 66470248
Mob  

 <mailto:%25EMAIL%25> sdh at lmwindpower.com

 

LM Wind Power Blades

lmwindpower.com

 

Together we capture the wind to power a cleaner world


  _____  


 

This e-mail and any attachments are confidential. If you are not the named
or intended recipient, please notify the sender immediately and do not
disclose the contents to any other person, use it for any purpose, or store
or copy the information in any medium. Any unauthorized disclosure, use or
storage is prohibited and might be unlawful.


-----

No virus found in this message.

Checked by AVG - www.avg.com

Version: 10.0.1204 / Virus Database: 1498/3521 - Release Date: 03/21/11

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110322/81211f7a/attachment.html 


More information about the Qt-interest-old mailing list