PDA

View Full Version : how to apply stylesheet to qtopia application using qss file



namita
28th March 2008, 05:58
Hi,

I want to know how can I apply stylesheet to atopia application using qss file.
I want to run this application on green phone emulator. Where should I save .qss file?
I tried to run one of my developed qt stylesheet application on emulator, but the images are missing.

Pls help me.

Thanks in advance,
Namita

jpn
31st March 2008, 07:24
Please, do not double post. Do not post the same question again and again but ask for help in the thread where you did not get a solution in the first place.

You might want to embed the stylesheet and images as resources. Read: The Qt Resource System (http://doc.trolltech.com/latest/resources.html)

namita
31st March 2008, 08:04
Hi,

Sorry for posting same question again. Actually I did it because there was a spelling mistake in the subject line of earlier post.

I want to apply external stylesheet to qtopia application using .qss file. I tried doing it using setStyleSheet function. Following is my code. If I use Qapplication instead of QtopiaApplication, it works. It seems external style sheet can't be set to qtopia application using setStyleSheet function. Is it true?




#include <QFile>
#include <QtopiaApplication>
#include "dialogimpl.h"
//
QSXE_APP_KEY
int main(int argc, char ** argv)
{
QSXE_SET_APP_KEY(argv[0]);
QtopiaApplication app( argc, argv );

QFile qss("/home/stylesheet.qss");
qss.open(QFile::ReadOnly);
app.setStyleSheet(qss.readAll());
qss.close();

DialogImpl win;
win.show();
app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) );
return app.exec();
}