Results 1 to 3 of 3

Thread: Unsetting transparency

  1. #1
    Join Date
    Dec 2008
    Posts
    18
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Unsetting transparency

    Hello.

    The application I am trying to develop is required to have the window as the main output of the information. This window needs to be resizable and have an ability to be transparent.

    With resizing there is no problem. But the second feature has an issue.

    I am setting the window next way:
    Qt Code:
    1. MainOutput:: MainOutput(QWidget *parent)
    2. : QWidget(parent, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint)
    3. {
    4. setWindowTitle("title");
    5. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void MainOutput::configureWindow()
    2. {
    3. if(myConfig.IsFullScrn()){
    4. showFullScreen();
    5. }
    6. else{
    7. showNormal();
    8. resize(myConfig.wCoordinate(),myConfig.hCoordinate());
    9. move(myConfig.xCoordinate(),myConfig.yCoordinate());
    10. }
    11. setAttribute(Qt::WA_TranslucentBackground, myConfig.IsTransparent());
    12. }
    To copy to clipboard, switch view to plain text mode 

    The problem is that if initially window was not transparent – the setting it to be such works as I am passing
    Qt Code:
    1. setAttribute(Qt::WA_TranslucentBackground, true);
    To copy to clipboard, switch view to plain text mode 

    But when I am trying to unset transparency with
    Qt Code:
    1. setAttribute(Qt::WA_TranslucentBackground, false);
    To copy to clipboard, switch view to plain text mode 

    it doesn’t make any change.

    I am using QT 4.5 under Ms Windows XP with MiGW.

    Is there anything I am doing wrong?

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Unsetting transparency

    You can also use:
    Qt Code:
    1. void setWindowOpacity ( qreal level );
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Dec 2008
    Posts
    18
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Unsetting transparency

    Thank you. I will try.

    Qt Code:
    1. setWindowOpacity(qreal num);
    To copy to clipboard, switch view to plain text mode 
    makes the window AND what is inside to be transparent.
    A apologize I didn't mention that the window has text on it. And text required to be visible all the time. It is just the window containing it needs to be transparent or not.
    Last edited by Pavel Abrosimov; 8th October 2009 at 12:29.

Similar Threads

  1. Tree selection - icon transparency (lack of)
    By MrGarbage in forum Qt Programming
    Replies: 1
    Last Post: 8th January 2008, 21:48
  2. Transparency ... Again
    By EricF in forum Qt Programming
    Replies: 4
    Last Post: 1st December 2007, 19:52
  3. Speed, transparency, and drop issues with QGraphicsView
    By jefferai in forum Qt Programming
    Replies: 16
    Last Post: 30th June 2007, 16:14
  4. background transparency
    By hma in forum Qt Programming
    Replies: 2
    Last Post: 4th April 2007, 07:22
  5. transparency
    By roms18 in forum Qt Programming
    Replies: 2
    Last Post: 16th February 2006, 19:38

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.