Results 1 to 4 of 4

Thread: Why so few slots?

  1. #1
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Why so few slots?

    Hello all!
    I was wondering why there are so few slots connected to widgets.
    For example the pushbutton has on_released, on_clicked, on_pressed etc, but it's missing so many slots (that I personally don't use but...) like on_mouse_over, while_is_clicked etc...
    This came to my mind while trying to create a small program that while you have pressed a button, the value of a slider changes and when you release the pushbutton then the slider stops. So, I searched for a slot something like while_it_is_clicked() but there wasn't any, and, finally I created a QTimer that was starting at pressed() and stopped at released().

    So, the conclusion maybe, is that there aren't these slots because are easily developed by the user, using the already existing?
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Why so few slots?

    I don't see a problem here, the framework provide the basic and the programmer can build on top of that if needed.

    Anyway think about the documentation for all the stuff, i bet you don't want the documentation page for QPushButton to be as long as Stroustrup's book about The C++ programming language, we usually want just a simple button, and the ways to add functionality on top of it when we need that and Qt is very good with that.

  3. #3
    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: Why so few slots?

    Quote Originally Posted by hakermania View Post
    For example the pushbutton has on_released, on_clicked, on_pressed etc, but it's missing so many slots (that I personally don't use but...) like on_mouse_over, while_is_clicked etc...
    Signals and slots are a high-level semantic mechanism. What you're after is a low-level syntactic mechanism which is implemented by events. "Mouse being over me" is not in a regular interest of a button. Buttons are objects that "can be clicked", not those that "mice can hover over" and thus you have a "clicked" signal but not a "mouseOver" signal. You do however get a enterEvent().

    This came to my mind while trying to create a small program that while you have pressed a button, the value of a slider changes and when you release the pushbutton then the slider stops. So, I searched for a slot something like while_it_is_clicked() but there wasn't any, and, finally I created a QTimer that was starting at pressed() and stopped at released().
    Maybe you were searching in a wrong place then? There is a QAbstractButton::autoRepeat property which will cause the clicked() signal to be repeated when the QAbstractButton::autoRepeatInterval passes.
    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.


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

    hakermania (8th April 2011)

  5. #4
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Why so few slots?

    Hey, wysota thx
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

Similar Threads

  1. DLL Injection with slots... ?!?!?
    By gilamran in forum Qt Programming
    Replies: 62
    Last Post: 27th October 2010, 12:00
  2. How do you add slots?
    By rakkar in forum Newbie
    Replies: 10
    Last Post: 26th August 2009, 23:11
  3. Signals and Slots
    By 83.manish in forum Qt Programming
    Replies: 3
    Last Post: 30th June 2008, 10:31
  4. Slots or new slots
    By Colx007 in forum Qt Programming
    Replies: 3
    Last Post: 21st January 2008, 17:38
  5. Signals and slots
    By sylvarant in forum Newbie
    Replies: 4
    Last Post: 11th September 2007, 15:48

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.