×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    101

    use setStyleSheet set qwidget background image

    hi, all

    i use code set background - image , but nothing in screen

    QString styleSheet("QWidget { background-image: url(:/pics/bg.jpg); } ");
    QApplication a(argc, argv);
    a.setStyleSheet(styleSheet);

    what's wrong??

  2. #2
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: use setStyleSheet set qwidget background image

    I guess that setting is overridden from some other setting since it's too general. Have you tried to apply it directly to the widget?

  3. #3
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    101

    Re: use setStyleSheet set qwidget background image

    yes i try, apply it directly to the widget

    QString styleSheet(" { background-image: url(:/pics/bg.jpg) } ");
    setStyleSheet(styleSheet);

    but is nothing.

  4. #4
    Registered User
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998

    Re: use setStyleSheet set qwidget background image

    Have you checked the path and resource?

  5. #5
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    101

    Re: use setStyleSheet set qwidget background image

    i use code

    QPalette palette;
    QImage bg;
    bg.load( ":/pics/bg.jpg" );
    palette.setBrush(backgroundRole(), QBrush(bg));
    setPalette(palette);

    the backgroup is show ok, so i think the resource is right

    but , I really did not know how to check

    Use such like RFile::isExist function in Qt

Similar Threads

  1. Replies: 17
    Last Post: 2010-11-21, 04:42
  2. Replies: 47
    Last Post: 2009-07-21, 11:08
  3. How to set a background image
    By anup007star in forum Symbian User Interface
    Replies: 4
    Last Post: 2009-06-02, 08:37
  4. Background Image Set
    By mit@indianic.com in forum Symbian User Interface
    Replies: 2
    Last Post: 2009-03-18, 19:12
  5. help for set a background image
    By 1symbian1 in forum Symbian
    Replies: 7
    Last Post: 2008-12-30, 21:42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×