PDA

View Full Version : Mouse Drag selction Issue in QListWidget



vishal.chauhan
15th February 2007, 08:15
Hi All,

I m using Qt 4.2.2 on my Intel Mac.

I m using QListWidget in IconView Mode.
I am setting the Selection Mode to MultiSelction that is i can selct multiple Item by clicking on them.

But If i click and drag the mouse then It selcted many Items but I want that The multiselction would work only on mouse click not by Dragging mouse.

If anybody know how can I do it then plz help me.

Thanks.

drhex
15th February 2007, 09:29
Reimplement QListWidget::mouseMoveEvent()

vishal.chauhan
16th February 2007, 06:21
Thanks for reply.

Actually I can Implement the MouseMoveEvent in the form but I donot know how to implement it in the ListWidget.

and what I have to do with in mousemoveevent to avoid drag selection of mouse.

Thanks

jpn
16th February 2007, 13:46
Actually I can Implement the MouseMoveEvent in the form but I donot know how to implement it in the ListWidget.

and what I have to do with in mousemoveevent to avoid drag selection of mouse.
The default implementation of QListWidget::mouseMoveEvent() does what you want to avoid. Therefore you must either subclass QListWidget and override mouseMoveEvent() with an empty implementation (just to avoid the base class from doing what it does by default) or alternatively install an event filter and filter the corresponding event out so that QListView implementation never receives the event.

vishal.chauhan
21st February 2007, 07:59
Thanks for reply.

But Actually I donot know how to subclass QListWidget from MainWindow class or some other class.

plz give some sample code for that if you can.

Thanks.

patrik08
21st February 2007, 08:55
Thanks for reply.

But Actually I donot know how to subclass QListWidget from MainWindow class or some other class.

plz give some sample code for that if you can.

Thanks.

Have a look on dir chap09 Choise Projekt on code sample from QT4 German Book.... from Mister Blanchette.... get tar on http://ppk.ciz.ch/qt_c++/qt4Book_german.tar.gz .... other sample here on this forum search a link from developer day 2006 ....