Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Import failure(bug?)
Forum Updated to NodeBB v4.3 + New Features

Import failure(bug?)

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    onek24
    wrote on last edited by
    #1

    Hello,

    i've created a brand new qtquick2applicationviewer application, but i also tested it with a QQuickView. I've got a QML-file loaded including this code:
    @import QtQuick 2.2
    import QtQuick.Controls 1.1
    import QtQuick.Layouts 1.1

    ApplicationWindow {
    width: 200
    height: 200
    title: qsTr("Sample");
    color: "black"
    }@
    This message displays in my console:

    bq. QQuickView only supports loading of root objects that derive from QQuickItem.
    If your example is using QML 2, (such as qmlscene) and the .qml file you
    loaded has 'import QtQuick 1.0' or 'import Qt 4.7', this error will occur.
    To load files with 'import QtQuick 1.0' or 'import Qt 4.7', use the
    QDeclarativeView class in the Qt Quick 1 module.

    It does not occur when i am using a Rectangle as my top-level component.

    @import QtQuick 2.2
    import QtQuick.Controls 1.1
    import QtQuick.Layouts 1.1

    Rectangle {
    width: 200
    height: 200
    color: "black"
    }@

    All the other files in my project are unchanged.

    Am i using ApplicationWindow wrong or is this maybe a bug?

    1 Reply Last reply
    0
    • O Offline
      O Offline
      osfesa
      wrote on last edited by
      #2

      Try creating a new project with qtquick controls. Check if this Hello World doesn't run, must be your installation problem.

      1 Reply Last reply
      0
      • O Offline
        O Offline
        onek24
        wrote on last edited by
        #3

        Thanks for your reply, i've tried it with a generated QtQuickControls 1.0 project and it worked fine.

        1 Reply Last reply
        0
        • O Offline
          O Offline
          onek24
          wrote on last edited by
          #4

          My QtQuick initializing code:
          @MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
          {
          ui->setupUi(this);
          QQuickView *view = new QQuickView(QUrl("qrc:/qml/main.qml"));
          QWidget::createWindowContainer(view, this);
          }@

          I would guess that the problem is this line:
          @QWidget::createWindowContainer(view, this);@

          Currently i am using a qtquick2controlsapplicationviewer and it works fine so far.

          Provisionally solved

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved