Results 1 to 2 of 2

Thread: QtQuick can not display the component item

  1. #1
    Join Date
    Jan 2011
    Posts
    127
    Thanks
    42
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QtQuick can not display the component item

    Qt version : Qt4.8.1
    Qt quick verision : 1.1
    Compiler : mingw4.4
    OS : win7(qt quick for desktop)

    I create a qt quick application project to do some experiment.When I try to
    compose the other qml as the example show at http://doc.qt.nokia.com/4.7/gettingstartedqml.html
    it always give me a blank view.

    //button.qml
    Qt Code:
    1. import QtQuick 1.1
    2.  
    3. Rectangle {
    4. id: simplebutton
    5. color: "grey"
    6. width: 150; height: 75
    7. }
    To copy to clipboard, switch view to plain text mode 

    this could display normally with the default code generated by the qtCreator(except of the file name)
    Qt Code:
    1. Q_DECL_EXPORT int main(int argc, char *argv[])
    2. {
    3. QScopedPointer<QApplication> app(createApplication(argc, argv));
    4.  
    5. QmlApplicationViewer viewer;
    6. viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    7. viewer.setMainQmlFile(QLatin1String("qml/Qt_quick_example_00/button.qml"));
    8. viewer.showExpanded();
    9.  
    10. return app->exec();
    11. }
    To copy to clipboard, switch view to plain text mode 

    When I want to compose the qml, the widget show nothing but blank screen
    //fileMenu.qml
    Qt Code:
    1. // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
    2. import QtQuick 1.1
    3.  
    4. Rectangle {
    5. id: fileMenu
    6. color: "blue"
    7. height: 480; width:1000
    8.  
    9. Row{
    10. anchors.centerIn: parent
    11. spacing: parent.width / 2
    12.  
    13. button {
    14. id: loadButton
    15. }
    16. }
    17. }
    To copy to clipboard, switch view to plain text mode 

    Only change one line on main.cpp
    Qt Code:
    1. viewer.setMainQmlFile(QLatin1String("qml/Qt_quick_example_00/fileMenu.qml"));
    To copy to clipboard, switch view to plain text mode 

    I place both of the qml in the same folder,yet the compiler always complain
    "Cannot assign to non-existent property "button"
    button {
    "
    How could I solve it?Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtQuick can not display the component item

    Name the file "Button.qml" and not "button.qml" and name the type "Button" and not "button". QML is case-sensitive, types have to start with capital letters.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. integrating openCv with QtQuick
    By nitish in forum Qt Quick
    Replies: 1
    Last Post: 24th September 2011, 13:16
  2. Designer or QtQuick?
    By Jeffb in forum Qt Quick
    Replies: 5
    Last Post: 9th August 2011, 06:38
  3. visualize qtQuick project
    By amadanes in forum Newbie
    Replies: 1
    Last Post: 8th May 2011, 23:15
  4. Linking Sql Database in QtQuick
    By chronoski in forum Newbie
    Replies: 1
    Last Post: 17th March 2011, 03:46
  5. In which component can I display video?
    By punkypogo in forum Qt Programming
    Replies: 4
    Last Post: 16th July 2010, 16:40

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.