Getting QWidget::windowIcon to work
Hi,
I'm not certain if this should be a design or a programming question however...
I want to add an icon to the window of my application. I have used the designer (4.1.0) and added a .png as my icon the image was a 16x16 (although I have tried 24x24 & 32x32 with the same sad result) The designer accepts the image and displays how it will look in the window.
I save, compile and run. But when I run it I get the following problem:
ASSERT: "i>=0 && i< height()" in file image/qimage.cpp, line1311
The code in qimage is as follows:
Code:
uchar
*QImage::scanLine(int i
){
detach();
Q_ASSERT(i >= 0 && i < height());
return d->data + i * d->bytes_per_line;
}
Any help would be gratefully received.
graeme.
Re: Getting QWidget::windowIcon to work
Re: Getting QWidget::windowIcon to work
Thanks,
But if that is the problem then it indicates that the designer is using a different path. But which one?
I just tried by putting the file in the same folder as the window no joy, and the same folder as the binary again no joy.
Re: Getting QWidget::windowIcon to work
Open the .ui file in a text editor and check what path is there. The safest way is to store icons as resources.
Re: Getting QWidget::windowIcon to work
Okay thanks,
I've managed to get it working. For anyone else facing this problem, the ui is created with just the file name, the path is lost, and so it looks for the file from the folder from where you execute the command. This means if you are in the directory where the binary is then the image must be in that directory, however if the command is issued from another directory such as ./../bin/myProg (which was being done for me by my set up in Kdevelop) then the icon needs to be in the pwd (for me the root of my source directory).
The long and the short of it, wait for 4.1.1 to fix the problem.
Once again thank you jacek for providing me with the necessary pointers.
graeme.
Re: Getting QWidget::windowIcon to work
Quote:
Originally Posted by graeme
wait for 4.1.1 to fix the problem.
Actually, Qt 4.1.2 was released two days ago ;)
Re: Getting QWidget::windowIcon to work
Alas it doesn't appear to be fixed in 4.1.2 :(
Re: Getting QWidget::windowIcon to work
Quote:
Originally Posted by graeme
Alas it doesn't appear to be fixed in 4.1.2 :(
It's strange, both entries in the task tracker seem to describe the same bug, but one is marked as fixed in 4.1.1, while second --- in 4.1.3. You can always try the latest snapshot.