Results 1 to 5 of 5

Thread: translucent background - no mouse event

  1. #1
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default translucent background - no mouse event

    Hello,
    I have translucent window set like:
    Qt Code:
    1. setAttribute( Qt::WA_TranslucentBackground, true);
    To copy to clipboard, switch view to plain text mode 
    and the problem is that when I do press on transparent part event is not received by MainWindow.

    Question how do I receive a mouse press event in that situation?

    EDIT: OS Win8 - Qt 5.2
    Last edited by Talei; 8th April 2014 at 12:07.
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

  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: translucent background - no mouse event

    Did you try setting Qt::WA_NoSystemBackground on the widget instead of Qt::WA_TranslucentBackground?
    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
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: translucent background - no mouse event

    Yes I did, and what I got is either white (auto fill false) or back screen.

    I must add that widget is QGraphicsView with scene.

    PS. Its top level widget with Frameless etc.
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

  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: translucent background - no mouse event

    What do you mean by "back screen"?
    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. The following user says thank you to wysota for this useful post:

    Talei (8th April 2014)

  6. #5
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: translucent background - no mouse event

    Sorry for not detailed description, I display QGraphicsView in full screen mode so screen has black colour. In window mode its black window.

    Basically I do display QGraphicsView in full screen mode and show items on scene, scene default color is white and base on QGraphicsView ->viewport()->setAutoFillBackground( true/false); I do get white or black screen not transparent one (in conjunction with WA_NoSystemBackground). Same for QWidget wth no Qt::WA_NoSystemBackground flag.

    Solution that I look for is to get transparent / translucent window (QGraphicsView + scene in it) that will receive mouse press events. From search that I done it seams like without Win hook I cant do that. And my app also runs on Mac. That's why I'm looking for Qt specific solution.

    PS. Ideal solution would be that I can receive mouse vent (press, move, release) and decide if I want to consume that event or pass it to OS (to underlying applications / windows). But I think that without OS specific code this cant be accomplished - with I hope I'm wrong . Although just copy is enough.
    Last edited by Talei; 8th April 2014 at 13:51.
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

Similar Threads

  1. Ogre+qt mouse event (add object with mouse problem)
    By rimie23 in forum Qt Programming
    Replies: 7
    Last Post: 24th April 2012, 10:49
  2. Replies: 3
    Last Post: 7th January 2012, 08:38
  3. translucent background (on Gnome)
    By drus in forum Qt Programming
    Replies: 0
    Last Post: 31st May 2010, 08:23
  4. Have translucent window follow mouse
    By mike_am_i in forum Qt Programming
    Replies: 2
    Last Post: 27th October 2009, 10:18
  5. Translucent window background in 4.3.2 - possible?
    By dpimka in forum Qt Programming
    Replies: 2
    Last Post: 15th July 2009, 08:53

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.