Results 1 to 4 of 4

Thread: enable mousetracking vs stylesheet hover

  1. #1
    Join Date
    Nov 2015
    Posts
    67

    Default enable mousetracking vs stylesheet hover

    Hello,

    i would need like two background-images on one QLabel while hover. It seems thats not possible in qt, so I need two lets say Qlabels on top of each other. Now i cannot use hover-stylesheets on the bottom QLabel. So I am thinking about to enable mousetracking. Does this eat much resources im comparison to the stylesheet-hover-effects?

    (Making one image out of the two would be bad for the workflow if there are changes to make)

    thanks
    Last edited by Ini; 15th May 2016 at 18:05.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: enable mousetracking vs stylesheet hover

    Is "button" referring to some custom component made from two labels?
    In which case wouldn't it be easier to just swap the pixmap on a single label?

    Or do you mean showing a series of images while hovering? E.g. like an animation?

    Cheers,
    _

  3. #3
    Join Date
    Nov 2015
    Posts
    67

    Default Re: enable mousetracking vs stylesheet hover

    Sry button is QLabel i did edit that. As I said it's very bad for the workflow to use one image on one QLabel, if there are changes to make. Lets's say I have like 2 QLabels on top of each other and this 10 times and every bottom-QLabel has the same image and every top-QLabel has different images. I have to change the image on every QLabel on the bottom now. Quite easy. If it would be one image on one QLabel instead of two stacked QLabels with seperate images, I would have to make 10 changes. Pretty bad. Thats why.

    No animation just hover.

    I am asking just for performance-comparision. I dont know why this information is important . Anyway I provided and example, maybe I should leave that next time at the first post.
    Last edited by Ini; 15th May 2016 at 18:17.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: enable mousetracking vs stylesheet hover

    Quote Originally Posted by Ini View Post
    As I said it's very bad for the workflow to use one image on one QLabel, if there are changes to make.
    Not sure I understand what you mean but even if a widget is displaying a single image, that image can be composed from many sources.

    Quote Originally Posted by Ini View Post
    Lets's say I have like 2 QLabels on top of each other and this 10 times and every bottom-QLabel has the same image and every top-QLabel has different images.
    Ok, 10 instances of a custom component made from two labels.

    Quote Originally Posted by Ini View Post
    I have to change the image on every QLabel on the bottom now. Quite easy.
    Indeed

    Quote Originally Posted by Ini View Post
    If it would be one image on one QLabel instead of two stacked QLabels with seperate images, I would have to make 10 changes. Pretty bad. Thats why.
    You always need to tell 10 objects to make a change, no?

    Quote Originally Posted by Ini View Post
    I am asking just for performance-comparision. I dont know why this information is important . Anyway I provided and example, maybe I should leave that next time at the first post.
    Well, mouse tracking will lead to mouse move events sent to the widget that has it enabled.
    If it doesn't do anything with the event then the overhead should be negligible.

    But I don't think you need mouse tracking for simple hover, only when you need to know where the mouse is inside the widget.
    Inside/outside should be determinable by overwriting enterEvent() and leaveEvent().

    Cheers,
    _

Similar Threads

  1. mouseTracking on QLabels with rich-text?
    By Zakum in forum Newbie
    Replies: 5
    Last Post: 26th January 2011, 01:50
  2. [MAC OSX] Mousetracking does not work in VideoWidget
    By Markus in forum Qt Programming
    Replies: 0
    Last Post: 1st October 2010, 23:23
  3. enable all Tooltips
    By clive in forum Qt Programming
    Replies: 3
    Last Post: 2nd January 2008, 11:08
  4. mouseTracking
    By mickey in forum Newbie
    Replies: 1
    Last Post: 16th April 2006, 05:49
  5. mouseTracking in two widgets at the same time?
    By SkripT in forum Qt Programming
    Replies: 6
    Last Post: 30th January 2006, 17:29

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.