Results 1 to 11 of 11

Thread: leaveEvent on transparent area issue

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2007
    Posts
    53
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: leaveEvent on transparent area issue

    Quote Originally Posted by high_flyer View Post
    I don't know if this will work, but you can try see if you can use QDesktopWidget for taping to these event.
    But my guess is that it will not work, since probably QDesktopWidget will be in global (not your application) scope.
    But its worth a try.
    Yes, it was my idea cause QDesktopWidget inherits from QWidget so there is the mouse events.

    But as it is written in the Qt doc : Instead of using QDesktopWidget directly, use QApplication::desktop(). I don't think I can inherits my own DesktopWidget from QDesktopWidget, reimplement events and then construct it in my code without calling QApplication::desktop()...

    But perhaps by digging with events filter and tryin' to intercept the QDesktopWidget events...

    But I think I will stick with QRgba(0, 0, 0, 1) as I don't notice a difference between the overlayed areas and the pure areas of the desktop.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: leaveEvent on transparent area issue

    use QApplication::desktop()
    That's what I meant.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Nov 2007
    Posts
    53
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question Re: leaveEvent on transparent area issue

    Ok, Rgba(0,0,0, 1) or whatever color with an alpha value of 1 is definitively a bad idea !

    It could be noticed a little depending of the screen color and the viewing angle for a LCD screen.

    Moreover, my co-worker who is the infographic artist told me that it could be far more noticeable on CRT screen with a particular contrast.

    I will have to dig and I'll try with the QDesktopWidget

  4. #4
    Join Date
    Nov 2007
    Posts
    53
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: leaveEvent on transparent area issue

    Just for information, events filtering on the QDesktopWidget doesn't work so much :

    In my constructor :

    Qt Code:
    1. desktop = QApplication::desktop();
    2. desktop->installEventFilter(this);
    3. desktop->setMouseTracking(true);
    To copy to clipboard, switch view to plain text mode 

    And in the event :

    Qt Code:
    1. bool MyWidget::eventFilter(QObject *target, QEvent *event)
    2. {
    3. int tmp = -1;
    4. if(target == desktop)
    5. {
    6. tmp = event->type();
    7.  
    8. switch(tmp)
    9. {
    10. case 109: // Mouse tracking state change
    11. case 74: // Should be Polished
    12. case 75: // Is Polished
    13. break;
    14.  
    15. default:
    16. tmp = tmp;
    17. break;
    18. }
    19. }
    20.  
    21. return false;
    22. }
    To copy to clipboard, switch view to plain text mode 

    I've set a breakpoint on the tmp = tmp line in the default case.

    I can only seen the third events from the switch / case (perhaps some others, I haven't tried everything but mouse moves and keypress didn't falled in the events filter.

    But I've told you that QColor(0, 0, 0, 1) could be visible on a screen, even on an LCD depending of the way you look at it.

    It seems that QColor(255, 255, 255, 1) is less visible, I can't see the semi-transparency, it appears really transparent.

    The infographic artist told me that a 50% grey QColor(127, 127, 127, 1) is even more neutral.

    Hope it could help. If someone has a CRT screen with a crazy contrast rate, just tell me if you see something on a single color desktop background ;o)
    Last edited by nooky59; 8th January 2008 at 13:27.

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
  •  
Qt is a trademark of The Qt Company.