2 Attachment(s)
QT program start without proper main window
I'm porting one example in Mark Summerfield's book: Advanced Qt Programming to QT5. I'm using QT 5.3.1&vs2013. I made some change in .pro and the source code so that the project can be build.
but when the exe runs, it shows another window(textitem dialog of the project), not the main window(an graphical editor) of the program.
the main.cpp is as following:
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow window;
window.show();
app.setApplicationName(app.translate("main", "Page Designer"));
app.setOrganizationName("Qtrac Ltd.");
app.setOrganizationDomain("qtrac.eu");
app.setWindowIcon(QIcon(":/icon.png"));
#ifdef Q_WS_MAC
app.setCursorFlashTime(0);
#endif
qsrand(static_cast<uint>(time(0)));
return app.exec();
}
due the upload limit, I can't attach the source(The source should be build with QT greater than 5.0). but I can send it by mail .
I think this problem doesn't belong to QT5 only.
does anyone knows why? thank you in andvance.
Attachment 10492
Attachment 10493
Re: QT program start without proper main window
You should be able to attach a ZIP file with the program's sources without hitting any limit.
Make sure the folder does not contain any build artifacts before you zip it.
Cheers,
_
2 Attachment(s)
Re: QT program start without proper main window
thank you!
I've uploaded the source and EXE of the project(QT DLLs are needed to be in the path variable to run the EXE demo)
Re: QT program start without proper main window
Those are the sources of three applications.
Which one is the one you are building/running?
Cheers,
_
Re: QT program start without proper main window
the .pro file is in the directory: pagedesigner1.
the directory is as the demo was provided in the book: advanced qt programming, by Mark Summerfield.
thank you.
Quote:
Originally Posted by
anda_skoa
Those are the sources of three applications.
Which one is the one you are building/running?
Cheers,
_
Re: QT program start without proper main window
Well, the screenshot you have posted is from the textedit example.
Check that you have only the pagedesigner1 project loaded or that it is the active project.
Cheers,
_
Re: QT program start without proper main window
Quote:
Originally Posted by
anda_skoa
Well, the screenshot you have posted is from the textedit example.
Check that you have only the pagedesigner1 project loaded or that it is the active project.
Cheers,
_
thank you for your help! the problem is solved(after I renamed the main.cpp in directory textedit). I've always open the pagedesigner1.pro(not textedit.pro).
following is part of the .pro file:
HEADERS += ../textedit/textedit.hpp
SOURCES += ../textedit/textedit.cpp
RESOURCES += ../textedit/textedit.qrc
INCLUDEPATH += ../textedit
HEADERS += mainwindow.hpp
SOURCES += mainwindow.cpp
SOURCES += main.cpp
RESOURCES += pagedesigner.qrc
so, what should be used is the main.cpp in dir pagedesigner1, but there is also a main.cpp in dir textedit, note that the latter isn't mentioned in .pro file.
however, during the build process, the latter main.cpp was taken as the main file, and improper window was showen.
I wonder if it is a bug of Qt.