在下面的代码中,我创建一个窗口,调用window.show()
,但该窗口不会显示,直到调用window->iterateSolution()
之后。几乎就好像,app.exec()
是显示窗口的函数。我对Qt非常陌生,所以我不知道发生了什么。Qt:mainWindow-> show();不显示主窗口
#include <QtGui/QApplication>
#include <mainWindow.h>
#include <Cube.h>
mainWindow * newWindow;
int main(int argc, char *argv[]) {
// initialize resources, if needed
// Q_INIT_RESOURCE(resfile);
QApplication app(argc, argv);
newWindow = new mainWindow;
newWindow->show();
QString initialState = "YWOBYYBYYGRRGRRBWWYOOYGGRGGBBGYOOYOOWRRBBRBBWGOOGWWRWW";
/* Construct cube, set state, and solve */
Cube * cube = new Cube(initialState);
QString solution = cube->solve();
delete cube;
newWindow->iterateSolution(solution);
// create and show your widgets here
return app.exec();
}
好的,但我想在哪里执行我的功能? – dfetter88 2010-12-03 23:07:50