Results 1 to 4 of 4

Thread: How do I get a pixmap to respond from being double clicked

  1. #1
    Join Date
    Jul 2012
    Posts
    201
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default How do I get a pixmap to respond from being double clicked

    Hi there, I have a list of Pixmap in a QListView. My problem is that I want something to happen when I double click on a pixmap in the View. Please not that I did set the flags so that the pixmaps are selectable but I couldn't find anything about double clicking on them. Basically what I want is that when I double click on a pixmap, a signal gets sent. how can I implement that? NB: I created a custom model to hold the pixmaps in the QListView.

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How do I get a pixmap to respond from being double clicked

    I'm not an expert in the model/view stuff (so maybe there is a better solution), but I think you can simply connect to "QAbstractItemView::doubleClicked(const QModelIndex &)" signal to get notified about double click events on your view.

  3. #3
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: How do I get a pixmap to respond from being double clicked

    If the QPixmap is in a QLabel, then implement the QLabel::mouseDoubleClickEvent. If not in a QLabel, add it to a QLabel and see the first sentence.

    Edit: missed the part about it being in a QListView. Do as @stampede suggested.

  4. #4
    Join Date
    Jul 2012
    Posts
    201
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How do I get a pixmap to respond from being double clicked

    thank you guys, works like a charm.

Similar Threads

  1. Replies: 3
    Last Post: 13th February 2012, 00:00
  2. double clicked on an item QTreeWidget
    By milli in forum Newbie
    Replies: 3
    Last Post: 7th May 2011, 22:49
  3. Getting the Id of a double clicked item
    By thefatladysingsopera in forum Qt Programming
    Replies: 1
    Last Post: 30th April 2011, 15:18
  4. Replies: 12
    Last Post: 24th July 2009, 11:38
  5. Replies: 1
    Last Post: 17th July 2008, 15:42

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.