Did you try to compile it? Variable pixmap is not a pointer so it would be pixmap.isNull(). Check the return value with a debugger or print it to debug output.
Did you try to compile it? Variable pixmap is not a pointer so it would be pixmap.isNull(). Check the return value with a debugger or print it to debug output.
J-P Nurmi
I placed this in main.cpp, and reached in console window:
QObject::connect: No such signal QTimer::timeout()
But even if there's no timeout() signal, it should show splash
Sure it's something wrong with pixmap.
Make sure you added the qrc to the project file and that you rebuild the project.
Regards
You have in your code timeOut not timeout.
I'm sure console said the same.
Regards
Call QApplication::processEvents() after the splash.show()... and read the docs next time... a QWidget can't appear before the application event loop starts running unless :
- It has an event loop of its own, just like QMessageBox
- You manually force events processing
If you want to display messages (or change the content of the splash in any way...) you'll have to call the same function after each change to allow propagation of show/hide/reisze/paint events...
Current Qt projects : QCodeEdit, RotiDeCode
Actually, processing pending events does not solve the problem. QCoreApplication::exec() is already called and the splash screen is shown by then, same time with the main window. It's just that the pixmap is not loaded correctly so no splash screen is shown either.
J-P Nurmi
This seems to be a double thread. Please don't start new threads on exactly the same subject.
J-P Nurmi
Yes, it seemed kind of familiar... The suggestions just came out, no thinking at all.
Anyway, Sal, loose the resource file and put the png somewhere accessible, like "c:\\image.png" ( this is to make sure you don't mess up the path ), and load the pixmap like this:
Qt Code:
To copy to clipboard, switch view to plain text mode
There is no room for mistakes here. If it still doesn't show, then try changing the window flags for the splash. But only if that doesn't work.
Regards
This is it. Now splash is displayed. So I have a wrong adress of image in resource file. Of course I have resource file included in my .pro file. But what's the correct adress of this image...hmm...
This is what I was trying to help you to realize yourself. It would be great help for you to learn, if not how to use debugger for now, but at least how to print informative messages to debug output.
J-P Nurmi
D' you mean to use qDebug to see if pixmap.isNull() ?
I added line
and reached in console:Qt Code:
qDebug() << "Is pixmap null:" << pixmap.isNull();To copy to clipboard, switch view to plain text mode
QObject::connect: No such signal QTimer::timeout()
Is pixmap null: true
So there's a problem with loading image.
Could you paste the contents of .qrc file and the output of "tree -f" executed in the project directory from command line? About the signal, you have already been advised more than once how to fix that.![]()
J-P Nurmi
Sure. Images.qrc:
And If I try tree -f I reach that there's no such command<RCC>
<qresource prefix="/new/prefix1" >
<file>File.jpg</file>
<file>Poker.JPG</file>
<file>Poker.PNG</file>
<file>Tools.jpg</file>
<file>about.jpg</file>
<file>copy.jpg</file>
<file>cut.jpg</file>
<file>delete.jpg</file>
<file>delfile.jpg</file>
<file>exit.jpg</file>
<file>favicon.ico</file>
<file>find.jpg</file>
<file>font.jpg</file>
<file>help.jpg</file>
<file>mainlogo.jpg</file>
<file>new.jpg</file>
<file>paste.jpg</file>
<file>print.jpg</file>
<file>save.jpg</file>
<file>settings.jpg</file>
<file>sort.jpg</file>
</qresource>
</RCC>
Bookmarks