[solved] porting Nokia apps to Qt5: Qt Quick Components and PageStack?



  • Now that Qt5 is almost ready, I want to port my Nokia N9 meego(Harmattan) app to run under Qt5.

    Nokia and Digia taught us to create QML apps for the N9 (and Symbian) using PageStack and other QML components, in the com.nokia.meego namespace. These were known as "Components" for QML Quick. I haven't yet found them in Qt5 beta 2.

    Is Digia planning to add them as an Add-On module? Or are there new equivalent components that we should be using instead?



  • Component sets are "per-platform" since they basically provide "platform look and feel" QML elements.
    As far as I know, official MeeGo QML components for Qt5 haven't yet been written. I'd be surprised if Symbian ones have been written or are being planned, as I don't think Qt5 works on Symbian.

    Digia are continuing to develop the "Desktop QML Components" which have native look-and-feel on Windows, MacOSX, and Linux. See "QtDesktopComponents":http://qt-project.org/wiki/QtDesktopComponents for information on that.

    Cheers,
    Chris.



  • I don't think that the Qt official team will port Qt 5 for Harmattan/Symbian. Though there is port of Qt 5 for Harmattan (and MeeGo Qt Quick Component) by community, so hopefully will be merge upstream.



  • Thanks Chris. That separation of components doesn't entirely make sense. I mean the idea makes sense, that specific visual elements should be handled separately. But the main one I'm looking for is the PageStack, which is a question of functionality, not appearance. Don't other platforms use pages to organise the way a QML app works? How are pages supposed to be handled in QML if there is no PageStack?

    The QtDesktopComponents link says it's now superseded by "Qt Quick Components":https://qt-project.org/wiki/Qt_Quick_Components. The "first link":https://bugreports.qt-project.org/browse/QTCOMPONENTS-72 in the references says Window and Pages are in and have been implemented, but they seem to have gotten lost in the current Qt Quick Components.

    Thanks Dickson. Building Qt5 apps for the N9 is a separate question, I'm sure it'll be made possible!



  • This is outdated but might leave this here anyway. I am planning to add a pageStack to the desktop components and make them a bit more general purpose. For the time being you can actually copy the PageStack component directly from meego components (and port it to QtQuick 2.0). They are BSD licensed so it should not really be an issue.



  • Thanks Jens. It'll be handy to have these components in. Sounds like copying the old versions will be an adequate workaround, if not too many code changes are needed.

    I do however get the impression that there is something more fundamental here that I'm missing. At the Nokia/Digia Qt workshop I attended, we were taught that the PageStack is the way to construct an app (one which is sufficiently complex to be made of several different pages). But if the PageStack component does not generally exist, then how are everyone else constructing their QML apps without it? Surely they're not all single screen apps with no need for separate pages?



  • PageStack itself is constructed from more basic QtQuick primitives so making your own pagestack is certainly feasible. (You get half way just having a container with multiple listviews in them). Including it in the core components might also have been premature since for instance, we dont yet if it scales to IOS and Android. That said it was included in both the Symbian components and Meego components so I would expect it to be built into core Qt in some shape or form soon. Also keep in mind that on Desktop, Window and Dialog is a more common way of splitting up your application.



  • Thanks again. I'll take a closer look at Window and Dialog at the same time that I look at copying across PageStack for my app.



  • I am also porting my Harmattan apps to Qt5 and to Android. I see lot of traditional Android apps having the same kind of page view logic as in Harmattan and Symbian. Seems that Qt 5.1 still lacks PageStack that my apps were using, which would be perfect also for these android/Qt5 versions.

    I would love to hear how people have handle the porting without PageStack?


  • Moderators

    PageStack still exists; it has just been renamed to "StackView":http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-stackview.html for consistency with other views (namely TabView, TableView, ScrollView, and SplitView)



  • I see it, Qt 5.1 now has what we want (ApplicationWindow, StackView etc) in QtQuick.Controls 1.0 (module qtquickcontrols). My port is now underway.



  • p.s. Might be worth mentioning, in Qt4 (Qt Quick 1) QtCreator added qmlapplicationviewer to start up the gui, with
    @QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());@
    put into main.cpp.

    QtQuick.Controls 1.0 needs QtQuick 2, which in turn needs qtquick2applicationviewer rather than qmlapplicationviewer, e.g.
    @QScopedPointer<QtQuick2ApplicationViewer> viewer(new QtQuick2ApplicationViewer());@

    But this actually conflicts with ApplicationWindow. Both ApplicationWindow and QtQuick2ApplicationViewer create a root window, so there is conflict over which window is to be used. Instead, to use ApplicationWindow, in main.cpp we should use QQmlApplicationEngine instead of QtQuick2ApplicationViewer, e.g.
    @QScopedPointer<QQmlApplicationEngine> engine(new QQmlApplicationEngine());@
    followed by
    @ engine->load(QUrl("qrc:/qml/main.qml"));
    QObject *topLevel = engine->rootObjects().value(0);
    QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
    window->show();@
    instead of
    @viewer->setSource(QUrl("qrc:/qml/main.qml"));
    viewer->show();@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.