PDA

View Full Version : Strange QPrintDialog behavior on my machine



kkk777kkk
20th September 2011, 14:20
Hi, help me please with my problem: listed code from main.cpp work in strange case, if line "splash.show();" commented it work right, but if it is not commented QPringDialog window can't be closed it any way: all buttons responding on my clicks but nothing more not happened. Mac OS X 10.6.6 Qt 4.7.4



#include <QApplication>
#include <QPrintDialog>
#include <QPrinter>
#include <QSplashScreen>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QSplashScreen splash;
splash.show();

QPrinter printer(QPrinter::HighResolution);QPrintDialog dialog(&printer);dialog.exec();
return app.exec();
}

slqh
21st September 2011, 11:09
i'm using the splash screen too, but I use it like this.



int main(int argc, char** argv) {
QApplication app(argc, argv);

QPixmap pixmap("./images/splash.png");
QSplashScreen splash(pixmap);
splash.show();
app.processEvents(); // this is to allow the procesing of mouse clicks over the splash to close it

// some more code

MainWindow win;
win.resize(1024, 768);
win.show();
splash.finish(&win); // this finishes the splash when the program finished loading.



Check the way i'm using the splash, I'm inclined to think that the app.processEvents(); is key to your problem.

kkk777kkk
21st September 2011, 13:52
after some more investigation i understand that it is something wrong in my environment because it works at other developer machine. that is not Qt problem but i cant understand why cocoa dialog works wrong way...