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. QtDesktop & Qt components for desktop with Qt 5
Forum Updated to NodeBB v4.3 + New Features

QtDesktop & Qt components for desktop with Qt 5

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 4.1k 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.
  • T Offline
    T Offline
    tedmiddleton
    wrote on 15 Apr 2013, 07:51 last edited by
    #1

    I'm trying to get the QtDesktop components working and I'm having a heck of a time. I read "this blog post":http://blog.qt.digia.com/blog/2011/03/10/qml-components-for-desktop/ and figured this satisfied a need I have with a project I'm working on right now.

    First, I went to gitorious, and saw this:

    !http://i.imgur.com/vM0v3AD.png(QtDesktop is defunct...)!

    Clicking on the recommended link brings me to this page:

    !http://i.imgur.com/9XIayYB.png(It's all broken!)!

    Is this project still 'active'? The last check-in seems to be pretty old - April of last year? Is there a newer repository?

    Anyways, the existing QtDesktop doesn't build for Qt 5. Aside from some header inclusion differences, the 'plugin' architecture is very different between qt 4 and qt 5. I have qt 5 installed on my computer (OSX 10.8). Without knowing what I was getting into, I figured I would take a stab at porting QtDesktop to Qt 5. I have it all compiling and building and installing to imports/QtDesktop, but...

    it just doesn't work. I try to import something:

    @import QtQuick 1.1
    import QtDesktop.Button 0.1

    Rectangle {
    width: 360
    height: 360
    Text {
    id: text_box
    text: qsTr("Hello World")
    anchors.centerIn: parent
    }
    MouseArea {
    anchors.fill: parent
    onClicked: {
    Qt.quit();
    }
    }

    Button {
        id: button
        anchors.top: text_box.bottom
        anchors.horizontalCenter: text_box.horizontalCenter
        text: "Push me"
        onClicked: button.text = "Pressed"
    }
    

    }
    @

    ...and at runtime Qt complains:

    @QDeclarativeDebugServer: Waiting for connection on port 3768...
    QDeclarativeDebugServer: Connection established
    file:///Users/ted/Documents/Projects/qtcreatorworkspace/build-testcomponents-OSXDesktop-Debug/testcomponents.app/Contents/Resources/qml/testcomponents/main.qml:2:1: module "QtDesktop.Button" is not installed
    import QtDesktop.Button 0.1
    ^
    Debugging has finished@

    And yet, when I look in my Qt directory, this is what I see:

    !http://i.imgur.com/He4Nd4U.png(Yup, it's all there.)!

    I'm thinking maybe I've done something wrong on the Qt 5 conversion front. Here are the files that I modified:

    src/qdeclarativefolderlistmodel.cpp
    src/qdeclarativefolderlistmodel.h
    src/qrangemodel.h
    src/qstyleitem.cpp
    src/qstyleitem.h
    src/qstyleplugin.cpp
    src/qstyleplugin.h
    src/qtmenu.h
    src/qtmenubar.cpp
    src/qtmenubar.h
    src/qtmenuitem.h
    src/qwheelarea.h
    src/qwindowitem.h
    src/src.pro

    Most of these are just fixing Qt 5 header issues. qdeclarativefolderlistmodel had to be changed because I guess in Qt 5 classes deriving from QAbstractListModel are supposed to override QAbstractListModel::roleNames() rather than call QAbstractListModel::setRoleNames().

    I suspect where I've gone wrong, perhaps, is qstyleplugin? I had to make some modifications to update it to the Qt 5 plugin model, but I really didn't have any idea at all what I was doing. In qstyleplugin.h I added a call to the new Q_PLUGIN_METADATA() macro:

    @class StylePlugin : public QDeclarativeExtensionPlugin
    {
    Q_OBJECT
    Q_PLUGIN_METADATA(IID "QtDesktop" FILE "components.json" )
    public:
    void registerTypes(const char *uri);
    void initializeEngine(QDeclarativeEngine *engine, const char *uri);
    @

    I have no idea what I should be putting in that IID field. Does it have to correspond to something? I've tried 'QtDesktop', 'org.qt-project.QtDesktop', and a few other things. Also, I have no idea what's supposed to go in the json file. The plug and paint example leaves the json file empty, so that's what I did. None of this seems to be documented very well, and the documentation that does exists either seems to apply to writing general Qt plugins (see the Plug and Paint plugin example), or Qml examples, but no Qt 5 Qml Qt plugin examples.

    Should I just revert to Qt 4.8.2?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 15 Apr 2013, 08:53 last edited by
      #2

      This project is now integrated into Qt5.1 and renamed to Qt Quick Controls.

      (Z(:^

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Jens
        wrote on 15 Apr 2013, 20:34 last edited by
        #3

        You are looking at an outdated and old repo and that code has never touched Qt 5. The new repository depends on new functionality added in Qt 5.1 so prepare to get on the bleeding edge.

        You can find the links to the current repo which compiles against Qt 5.1 here: http://qt-project.org/wiki/QtDesktopComponents

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tedmiddleton
          wrote on 22 Apr 2013, 18:20 last edited by
          #4

          Thanks guys - I can't update to a prerelease version of Qt for this project (in fact, one of the platforms that I'm developing for is actually on Qt 4.6 and will require special qwidget-based forms rather than the spiffy new qml forms I'm building). I guess if this doesn't work easily with 5.0, then I'm pretty solidly on 4.8. I'll try building what's in the public repository on gitorious for 4.8.

          1 Reply Last reply
          0

          1/4

          15 Apr 2013, 07:51

          • Login

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