Results 1 to 3 of 3

Thread: QListWidget::itemActivated and single click

  1. #1
    Join Date
    Jun 2006
    Posts
    76
    Thanks
    6
    Thanked 4 Times in 3 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Question QListWidget::itemActivated and single click

    Hi all,

    How do I emit a particular object's QListWidget::itemActivated signal on single click always? (Qt 5.9.8 btw)

    Normally this follows system settings. Thus e.g. on Windows the emit happens on double click by default.

    I found QStyle::SH_ItemView_ActivateItemOnSingleClick. However I have no idea how to apply this to said object. Do I need to overload QStyle::styleHint and set this style on the object? If so, what would the implementation have to look like?

    Thank you for your consideration.

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    530
    Thanked 81 Times in 76 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QListWidget::itemActivated and single click

    Why not use QListWidget::itemClicked ?

  3. #3
    Join Date
    Jun 2006
    Posts
    76
    Thanks
    6
    Thanked 4 Times in 3 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QListWidget::itemActivated and single click

    Quote Originally Posted by ChristianEhrlicher View Post
    Why not use QListWidget::itemClicked ?
    Because
    • itemActivated is already being used,
    • itemActivated is a nice abstraction on top of both click and activation key (which would have to be implemented on top of itemClicked) and
    • I want to learn something new.

    Of course it would be straightforward, albeit inelegant, and I may resort to that way if the other should prove not feasible.

Similar Threads

  1. Replies: 2
    Last Post: 19th May 2014, 18:25
  2. Telling apart single click and double click in QTableView
    By jgirlich in forum Qt Programming
    Replies: 1
    Last Post: 5th March 2013, 14:27
  3. Replies: 2
    Last Post: 16th July 2012, 12:40
  4. Replies: 7
    Last Post: 26th April 2012, 14:45
  5. Replies: 6
    Last Post: 5th June 2009, 09:38

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.