[SOLVED] Qt crashing on windows when loading an image file
-
hello,
This is my first topic here, so I apologize beforehand if I'm using the wrong forum.
I'm having an issue with loading an image file into a QWidget object. Basically what I'm trying to do is set the background of a widget to a certain gif file.
This is my code:
@
#include "loginwindow.h"
#include "ui_loginwindow.h"
#include <QImage>
#include <QLabel>LoginWindow::LoginWindow(QWidget *parent) :
QWidget(parent),
ui(new Ui::LoginWindow)
{ui->logo->setStyleSheet("QWidget {background-image: url(C:\\Users\\Dell1\\Desktop\\QtProjects\\test\\pic.jpg) }"); ui->setupUi(this);
}
LoginWindow::~LoginWindow()
{delete ui;
}
@The above code compiles but when trying to run it, I get a windows error (untitled.exe has stopped working).
Untitled being the bane of my project. The project runs fine when I comment out the "ui->logo->setStyleSheet...." line.I tried using QPixmap with a QLabel and it gave me the same runtime error.
I'm using Qt 2.0.1 on a Windows 7 OS (32 bit). I checked all the Qt plugins and they seem intact.
Is there something wrong with the code ? Am I missing something ?
Any help or hints would be appreciated.
Thanks.
[edit : next time please use @ tags for your code, thanks, Eddy]