Public bug reported:

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"));
}

** Affects: canonical-developer-experience
     Importance: Undecided
         Status: New

** Affects: qtcreator-plugin-ubuntu (Ubuntu)
     Importance: Undecided
         Status: New

** Also affects: qtcreator-plugin-ubuntu (Ubuntu)
   Importance: Undecided
       Status: New

** Description changed:

  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
+     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)
+     minimumWidth: units.gu(40)
+     minimumHeight: units.gu(40)
  
-     MainView {
-         anchors.fill: parent
-         applicationName: "foo.bar"
-         AdaptivePageLayout {
-             ...
-         }
-     }
+     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:
+ 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"));
+     QGuiApplication app(argc, argv);
+     QQmlApplicationEngine engine;
+     engine.load(Qurl("qrc://Main.qml"));
  }

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1584061

Title:
  Update SDK Templates to wrap MainView in a Window item

To manage notifications about this bug go to:
https://bugs.launchpad.net/canonical-developer-experience/+bug/1584061/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to