Results 1 to 3 of 3

Thread: "pressed" and "released" signals for buttons

  1. #1
    Join Date
    Jun 2015
    Posts
    2
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Android Maemo/MeeGo

    Default "pressed" and "released" signals for buttons

    Hello! Question from a QML newbie here. I'm trying to port a Qt Widgets-based app I wrote a while ago to QML, using the Qt Quick controls. One of the UI features the app heavily relies upon is the ability to tell when the user starts pressing a button, and when they finally release that button. Unfortunately, it appears that Qt Quick's "Button" type only has a "clicked()" signal.

    So far as I have been able to tell, there aren't any alternative button-like controls which provide press and release signals. Only the raw "MouseArea" seems to have this level of detail. So, my question is,

    a) Am I missing a more full-featured button control?

    b) Can I subclass the Button control somehow to add pressed() and released() signals?

    or, what I'm really afraid of:
    c) Do I need to create my own customized MouseArea-based QML button object just to get access to pressed() and released() signals?

    Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: "pressed" and "released" signals for buttons

    Use onPressedChanged handler.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    jpietrzak8 (11th June 2015)

  4. #3
    Join Date
    Jun 2015
    Posts
    2
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Android Maemo/MeeGo

    Default Re: "pressed" and "released" signals for buttons

    Quote Originally Posted by wysota View Post
    Use onPressedChanged handler.
    Aha, thank you! I didn't notice that QML properties had implicit signals available.

Similar Threads

  1. Replies: 3
    Last Post: 16th March 2015, 08:31
  2. Replies: 1
    Last Post: 3rd December 2013, 03:19
  3. Replies: 2
    Last Post: 21st August 2011, 08:57
  4. Replies: 3
    Last Post: 8th July 2008, 20:37
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 20:05

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.