Friday, July 25th 2008, 2:44am UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

break

Beginner

Posts: 2

Location: Russia

1

Saturday, December 29th 2007, 11:41pm

background in QT4 Designer

How i can set background image just in Designer. I wan't to create my form over image in background. It need for my work.

I can set background in code, but a want to set it in Designer!!!

May be "Still Sheets"?? How?? I tried, but not successfull.

Sorry for my English.
  • Go to the top of the page

break

Beginner

Posts: 2

Location: Russia

2

Sunday, December 30th 2007, 9:38pm

RE: background in QT4 Designer

I found 1 solution:

use in StyleSheets Absolute name of my picture (QT Designer show picture), but before end link project use normal names from resource (:/images/...)

it work with QFrame,

QFrame
{
/* background-image: url(:/images/Saut_1280x1024.jpg);*/ /* comment normal image name */
background-image: url(/home/bboy/Projects/C++/Progs/TrainDevices/MansSautPanel/images/Saut_1280x1024.jpg);
}


and others QFrame (in my QFrame) - i set to empty StyleSheet, becouse i want only one background

QFrame
{
background-image: url();
}

I use one Frame on VBoxLayout for Background, and other Widgets put on it.


There are other ways?
  • Go to the top of the page

3

Thursday, January 3rd 2008, 3:38pm

I have the same problem.
  • Go to the top of the page

4

Monday, January 21st 2008, 1:35am

no way

probably the same issue,

I tried to set a background for any object which is supported by this attribute, but failed, it works with solid colors only.

I even explored Style Sheet example and tried to apply any part of the code taken from Style Editor window, no luck.

At first I thought that I messed up with resources and a path for the image file, but I'm sure doing right.

It looks that Qt Designer just doesn't display the style, until it would be put into an external binary application.
  • Go to the top of the page

ramandeep

Trainee

Posts: 102

Location: India

Occupation: embedded software

5

Friday, March 7th 2008, 7:20am

RE: background in QT4 Designer

Hi ,
I am trying to set background image in code.I tried the following code:
int main(int argc, char *argv[])
{
QString styleSheet = "QWidget {background-image: url(:image/image.png) }";
QApplication app(argc, argv);
app.setStyleSheet(styleSheet);
return app.exec();
}

But I get a blank background when I execute this.I have created a folder named image in my project folder and placed image.png in it.

Can you please help?
  • Go to the top of the page

Rate this thread