Solved Positioning Qt Widgets on the screen
-
I am a complete newbie in Qt. I am bringing up a mobile development platform so my software developers can write custom Qt applications. I have successfully brought up Qt-Wayland "minimal-qml" compositor. I can launch widgets from the Qt 5 demo directories. Now I want to be able to place these widgets at a specific location on the screen. Where or how do I go about to do this?
For example, classwizard demo widget has these files:
# ls classwizard classwizard.cpp classwizard.h classwizard.pro classwizard.qrc images main.cpp
I have an inkling that main.cpp is the one to make the necessary changes:
#include <QApplication> #include <QTranslator> #include <QLocale> #include <QLibraryInfo> #include "classwizard.h" int main(int argc, char *argv[]) { Q_INIT_RESOURCE(classwizard); QApplication app(argc, argv); #ifndef QT_NO_TRANSLATION QString translatorFileName = QLatin1String("qt_"); translatorFileName += QLocale::system().name(); QTranslator *translator = new QTranslator(&app); if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) app.installTranslator(translator); #endif ClassWizard wizard; wizard.show(); return app.exec(); }
However, my road ends here. I have no idea where to go from here. Help will be definitely appreciated.
-
@adam.yh.lee
where do you want to position the window? I mean on a specific coordinate or in a corner/centered on the screen? -
Specific location on the screen would do the job.
-
@adam.yh.lee
then simply callmove()
on the top-level widget -
@raven-worx great thank you. That's all I needed.