Results 1 to 8 of 8

Thread: Flickable and mouse signal propagation

  1. #1
    Join Date
    Feb 2014
    Location
    Paris
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Flickable and mouse signal propagation

    Hi,

    In a Qml file, I have a Flickable area containing a custom QPushButton (registered thanks to qmlRegisterType()).

    When I click on the button (without releasing the mouse button), the QPushButton changes its decoration as if it would be pressed, but if I move the mouse (mouse button still pressed), this initiates the flick movement. The release of the mouse button is then not transmitted to QPushButton so the QPushButton still has its almost pressed decoration.

    The pressed event seems to be unsderstood by QPushButton and Flickable area, but once the flik move has started, the released event is get by the Flickable area only.

    How can I get the release event for the QPushButton.

    Thanks for your help.

  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: Flickable and mouse signal propagation

    Try putting an Item inbetween the push button and the flickable. If it doesn't work, try putting a MouseArea instead, setting its preventStealing property to true.
    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. #3
    Join Date
    Feb 2014
    Location
    Paris
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Flickable and mouse signal propagation

    Unfortunately none of your suggestions work for me.

    There are already many Item elements between the Flickable and my QPushButton. What did you intend with this suggestion, I can't get the point ? Does the Item element have any interaction with mouse event that would be propagated to the QPushButton ?

    The second is not working.

    I finally get a workaround. I used the answer of this thread: http://qt-project.org/forums/viewthread/30007/
    When my button is pressed, I send a signal to the Flickable to set its interactive attribute to false, this allows the button to get the release event. And in the onReleased() of my button, I send another signal to the Flickable to set its interactive attribute to true.

    Thanks for your time

  4. #4
    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: Flickable and mouse signal propagation

    Quote Originally Posted by clousque View Post
    What did you intend with this suggestion, I can't get the point ?
    Flickable sets an event filter on its children. I was hoping that putting an additional item to separate Flickable and the other item events would not be stolen from that other item through that filter. The problem is probably that the pushbutton does not handle mouse move events and Flickable kicks in then grabbing all future events.

    The second is not working.

    I finally get a workaround. I used the answer of this thread: http://qt-project.org/forums/viewthread/30007/
    When my button is pressed, I send a signal to the Flickable to set its interactive attribute to false, this allows the button to get the release event. And in the onReleased() of my button, I send another signal to the Flickable to set its interactive attribute to true.
    That's very... crude And breaks a number of functionalities (e.g. scrolling the flickable with mouse wheel). I'd try either subclassing QGraphicsProxyWidget or QPushButton and in there prevent Flickable for gettng its hands on the widget's events.
    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.


  5. #5
    Join Date
    Feb 2014
    Location
    Paris
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Flickable and mouse signal propagation

    That's very... crude And breaks a number of functionalities (e.g. scrolling the flickable with mouse wheel)
    Only when the button is pressed. In my case, rolling the wheel during this time is unlikely.

    I'd try either subclassing QGraphicsProxyWidget or QPushButton and in there prevent Flickable for gettng its hands on the widget's events.
    How can I disable Flickabel to filter its children event?
    Do you mean connecting a slot to QPushButton pressed() signal and then disable Flickable to filter its children?
    In my case, I have many QPushButton used in many Flickable. How can I manage that globally?

    These questions might seem trivial. Sorry for that.

  6. #6
    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: Flickable and mouse signal propagation

    Quote Originally Posted by clousque View Post
    How can I disable Flickabel to filter its children event?
    First you'd need to see what it does to get those events.

    Do you mean connecting a slot to QPushButton pressed() signal and then disable Flickable to filter its children?
    No, the button itself would have to make sure its mouse move events are not intercepted/propagated to the Flickable. It is possible that providing an empty mouseMoveEvent() handler could be enough to do that however I'd have to look what Flickable does that breaks your program.

    In my case, I have many QPushButton used in many Flickable. How can I manage that globally?
    By C++ mechanism called "subclassing"
    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.


  7. #7
    Join Date
    Feb 2014
    Location
    Paris
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Smile Re: Flickable and mouse signal propagation

    First you'd need to see what it does to get those events.
    That is the kind of interrogation I'm having, but I don't know where to find the answer. I mean the Qt documentation is great for interface, but I find it hard to get explanations on the underlying mechanisms.
    AFAIK the signals goes from child to parent, and if a child accepts it, the signal is not propagated to the parent. (Don't hesitate to correct me, I'm not totally confident on that). In my situtation, the signal is captured by Flickable before reaching the QPushButton (released signal while flick move started).

    By C++ mechanism called "subclassing"
    No comment

  8. #8
    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: Flickable and mouse signal propagation

    Quote Originally Posted by clousque View Post
    That is the kind of interrogation I'm having, but I don't know where to find the answer.
    In the source code.
    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.


Similar Threads

  1. Replies: 1
    Last Post: 18th July 2013, 13:31
  2. Replies: 0
    Last Post: 7th July 2013, 02:43
  3. Replies: 0
    Last Post: 16th September 2012, 10:28
  4. Propagation of mouse events in QMainWindow
    By fredheigl in forum Newbie
    Replies: 0
    Last Post: 19th April 2012, 08:41
  5. Stacked widget mouse propagation
    By bunjee in forum Qt Programming
    Replies: 3
    Last Post: 14th November 2008, 17:54

Tags for this Thread

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.