Results 1 to 3 of 3

Thread: Problem with background

  1. #1
    Join Date
    Jul 2010
    Posts
    16
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Problem with background

    Hi,
    I have a strange problem with an application, I set a background in this way:

    Qt Code:
    1. QPalette palette;
    2. palette.setBrush(QPalette::Window, QBrush(QImage("image.jpg")));
    3. this->setPalette(palette);
    To copy to clipboard, switch view to plain text mode 

    I compiled on my pc and all work good.
    Then I compiled on another pc and I get a black background.
    If I set only a color as background in this way:
    Qt Code:
    1. palette.setBrush(QPalette::Window, QBrush(Qt::cyan, Qt::SolidPattern));
    To copy to clipboard, switch view to plain text mode 
    all work good on both pc.
    I thought a problem with path, but i try with absolute and I have the same result.
    Both are linux system.
    The first pc uses Qt version 4.6.2, GNOME and it's a 32 bit, the second uses Qt 4.6.3, KDE4 and it's a 64bit.
    I really can't understand, help me.
    Thanks.
    Last edited by ale6111; 2nd August 2010 at 16:41.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Problem with background

    The first thing I notice is this: jpg

    Are you sure Qt can read jpg files on both pc's?

  3. #3
    Join Date
    Jul 2010
    Posts
    16
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem with background

    Honestly I don't know what libraries I need to look for...
    I try to convert the image to .png and it doesn't work again, and in that application I have other .png for icon so I don't think is that the problem.


    EDIT:
    The problem seems to be this (http://www.qtcentre.org/threads/2056...-custom-widget) but it's old, in fact if I resize the widget for a short time I can see the image. I try the solution with stylesheet but since I have other widgets (ex. QTextEdit) the background is applied also on it, and I don't want.
    And in any case why it works on first pc and not on second one.
    Last edited by ale6111; 2nd August 2010 at 18:11.

Similar Threads

  1. Problem with OpenGL support (transparent background)
    By developer-nsk in forum Qt Programming
    Replies: 0
    Last Post: 2nd November 2009, 19:31
  2. QTabWidget transparent background problem
    By destroyar0 in forum Qt Programming
    Replies: 10
    Last Post: 25th June 2009, 12:19
  3. Widget background problem.
    By zgulser in forum Qt Tools
    Replies: 2
    Last Post: 6th January 2009, 06:34
  4. Scrolling problem with background using View/Scene
    By nileshsince1980 in forum Qt Programming
    Replies: 5
    Last Post: 22nd October 2007, 08:19
  5. Replies: 10
    Last Post: 17th August 2006, 15:12

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.