Results 1 to 3 of 3

Thread: Set the transperancy for an image

  1. #1
    Join Date
    Oct 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Set the transperancy for an image

    From mainwindow i'm opening a dialog writing:
    SplashScreenDialog *splScrDlg = new SplashScreenDialog(this);
    splScrDlg->show();

    I'm opening and showing an image [for splash screen] writing
    QPalette palette;
    QPixmap pixMap("army.jpg");
    QSize size(this->height(), this->width());
    QPixmap pixMapScaled(pixMap.scaled(size));
    palette.setBrush(QPalette::Background, pixMapScaled);
    this->setPalette(palette);

    Now i want to control the opacity[or transparency] of this image, i wan to make it transparent as time goes by[an splash screen behaviour].

    How to do it ?

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

    Default Re: Set the transperancy for an image

    Call this function:
    Qt Code:
    1. splScrDlg->setWindowOpacity (0.5);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Set the transperancy for an image

    Quote Originally Posted by yogeshgokul View Post
    Call this function:
    Qt Code:
    1. splScrDlg->setWindowOpacity (0.5);
    To copy to clipboard, switch view to plain text mode 
    In a loop probably...
    something like -
    Qt Code:
    1. // on timer event...
    2. splScrDlg->setWindowOpacity( 1 - (time / duration) );
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Image Commander v.1.2
    By piotrek in forum Qt-based Software
    Replies: 0
    Last Post: 20th April 2009, 10:59
  2. can Qlabel display a series of image one by one ?
    By jirach_gag in forum Qt Tools
    Replies: 3
    Last Post: 11th August 2008, 15:36
  3. Finding marks on scanned image for alignment
    By caduel in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2007, 02:10
  4. how i can add image in my toolbar
    By jyoti in forum Qt Tools
    Replies: 7
    Last Post: 19th December 2006, 14:39
  5. How and when to repaint a widget ?
    By yellowmat in forum Newbie
    Replies: 7
    Last Post: 3rd April 2006, 16:36

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.