Results 1 to 6 of 6

Thread: Mouse Drag selction Issue in QListWidget

  1. #1
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Mouse Drag selction Issue in QListWidget

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Knivsta, Sweden
    Posts
    153
    Thanks
    30
    Thanked 13 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Mouse Drag selction Issue in QListWidget

    Reimplement QListWidget::mouseMoveEvent()

  3. #3
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Re: Mouse Drag selction Issue in QListWidget

    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

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Mouse Drag selction Issue in QListWidget

    Quote Originally Posted by vishal.chauhan View Post
    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.
    J-P Nurmi

  5. #5
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Re: Mouse Drag selction Issue in QListWidget

    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.

  6. #6
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Mouse Drag selction Issue in QListWidget

    Quote Originally Posted by vishal.chauhan View Post
    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 ....

Similar Threads

  1. Replies: 7
    Last Post: 8th September 2006, 16:19
  2. Replies: 2
    Last Post: 24th July 2006, 18:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.