Microsoft is accessing the field of WPF platform independence with Xamarin Forms. However, there has for a long time been an existing framework that runs on Windows, MacOS, Linux and starting with version 5 on iOS, Android, Sailfish OS and other operating systems – without re-implementation: Qt.
#include „maincontroller.h“ #include #include #include #include #include int main(int argc, char *argv[]) { QApplication app(argc, argv); QQmlApplicationEngine engine; QQmlContext* context = engine.rootContext(); QString currPath = QDir::currentPath(); context->setContextProperty(„currentPath“, currPath); QScreen *screen = QApplication::screens().at(0); int width = screen->availableSize().width(); context->setContextProperty(„availableWidth“, width); int height = screen->availableSize().height(); context->setContextProperty(„availableHeight“, height); MainController* mainController = new MainController(); context->setContextProperty(„mainController“, mainController); engine.load(QUrl(QStringLiteral(„qrc:/main.qml“))); return app.exec(); }
Qt has been around since 1992. For a long time, the company Trolltech distributed the framework commercially. There was a free version for the Linux desktop KDE that later was licensed under GPL. The two versions differed in the availability of certain modules. Starting with version 4.5 in 2009, the LGPL (GNU Lesser General Public License) was added. The current version 5.x is available in commercial and free versions as well. The rights are currently owned by The Qt Company.
Qt development was distinguished by the signal/slot principle. While other frameworks still used events, this already was an implementation of the publish-subscribe pattern. A button provides the clicked() signal, which view components can bind to a slot onClicked().
Version 4.7 introduced the Qt Markup Language, QML. While designers previously generated the completed source code, now the interface could be described in a JSON-like language. On-screen elements can be manipulated with JavaScript, values and lists can be bound. The framework achieved an architecture called model-view-delegate. Version 5.6 was used for this article. read more…