Results 1 to 8 of 8

Thread: Can a QML element be displayed inside a QT C++ GUI?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Can a QML element be displayed inside a QT C++ GUI?

    Quote Originally Posted by StealthCentroid View Post
    That is exactly what I want to do , but I don't see a QDeclarativeView in "Display Widgets". I only see a "Graphics View" and "QWebView", unless you are meaning it can be done with a Graphics View.
    No, I mean what I said. I just checked that I wasn't imagining the QDeclarativeView in Designer (Qt 4.7.4 on Linux) but in my recent Windows Qt SDK it is not present.

  2. #2
    Join Date
    Apr 2012
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can a QML element be displayed inside a QT C++ GUI?

    Quote Originally Posted by ChrisW67 View Post
    No, I mean what I said. I just checked that I wasn't imagining the QDeclarativeView in Designer (Qt 4.7.4 on Linux) but in my recent Windows Qt SDK it is not present.
    Perfect then. I'll check it on Linux. The program I want to do is on Linux, but before moving I was testing in Windows because the only code that uses other libraries that are not from QT are available in Linux and Windows. Now that I think about it, it doesn't make much sense to do it that way, but I'm a noob after all and felt more comfortable working with QT Creator in a system I'm more familiar with (you know, until I get the hang of it). Thanks for lining that out, I'll tell you how it goes when I check it.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Can a QML element be displayed inside a QT C++ GUI?

    I am surprised it is missing in the Windows Qt SDK given the headlong rush to QML everything. There are QML components for Designer in the SDK but they seem to be only Symbian.

  4. #4
    Join Date
    Apr 2012
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can a QML element be displayed inside a QT C++ GUI?

    Quote Originally Posted by ChrisW67 View Post
    I am surprised it is missing in the Windows Qt SDK given the headlong rush to QML everything. There are QML components for Designer in the SDK but they seem to be only Symbian.
    Yeah, there are others too that are on Linux, but not in Widnows.

    It works on Linux perfectly, look at the attachment. You choose File->New File or Project->Qt Widget Project->QT Gui Application

    Once its created you must edit the .pro file and add under SOURCES:
    QT += declarative

    This step is important, if you don't do it, you won't be able to compile the application.

    Something to note is that QDeclarativeView is not available in Windows by default. In Windows you can insert a Graphics View (under Display Widgets) and after adding the above to the .pro file you can right click it and promote it to QDeclarativeView. However, there won't be a way to specify its source on the designer and from what I've tried it doesn't work either through code.

    Only way I found around this is to make the project on linux and then open it in Windows and even though, you won't see the QDeclarativeView preview on the designer. You will just see a white component in the screen. Anyway, this time you will be able to set its source on the designer on the property segment of the screen all the way to the end. It says source in bold.
    Attached Images Attached Images
    Last edited by StealthCentroid; 15th May 2012 at 04:42.

Similar Threads

  1. Replies: 9
    Last Post: 23rd April 2012, 13:53
  2. Get element in Qgridlayout
    By dieter in forum Newbie
    Replies: 1
    Last Post: 12th February 2012, 09:51
  3. Remove element of xml
    By VitaliBR in forum Newbie
    Replies: 17
    Last Post: 16th February 2011, 13:28
  4. Help with QML Pathview element
    By chetu1984 in forum Newbie
    Replies: 0
    Last Post: 7th February 2011, 04:49
  5. Replies: 1
    Last Post: 23rd January 2010, 13:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.