Update SDK Templates to wrap MainView in a Window item

Bug #1584061 reported by Michael Zanetti
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Client Developer Experience
New
Undecided
Zoltan Balogh
qtcreator-plugin-ubuntu (Ubuntu)
New
Undecided
Unassigned

Bug Description

Currently, like 99% of the apps don't work well on windowed environments in a sense that they neither set preferred/minimum/maximum sizes, or window titles etc. Currently MainView does not support those things (and it'll be hard to add since we're talking about everything a "window", so the currently best thing we can do is to wrap the MainView in a Window item.

The new templates should be something like

import QtQuick 2.4
import QtQuick.Window 2.2
import Ubuntu.Components 1.3

Window {
    width: units.gu(70)
    height: units.gu(70)
    visible: true
    title: i18n.tr("My cool app's name")

    minimumWidth: units.gu(40)
    minimumHeight: units.gu(40)

    MainView {
        anchors.fill: parent
        applicationName: "foo.bar"
        AdaptivePageLayout {
            ...
        }
    }
}

This should "just work" in qmlscene based templates. In templates that are based on a main.cpp, the cpp code needs to be changed into something like:

int main(int argc, char* argv[]) {
    QGuiApplication app(argc, argv);
    QQmlApplicationEngine engine;
    engine.load(Qurl("qrc://Main.qml"));
}

description: updated
Changed in canonical-developer-experience:
assignee: nobody → Zoltan Balogh (bzoltan)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.