"Very New to QTquick" ..Hit a snag with label: ?



  • Hi,

    I'm a complete newcomer to Qt Quick and I hit a snag following the "Getting Started Programing with Qt Quick" from QTDoc 5.2
    I've installed the complete online down load options for qt, and qtcreator 5.2.0.

    In the section "Creating a Menu Page"
    label: in the Button {...} throws a "Invalid property name 'label' (M16)

    Other then that it runs, just the label on the buttons continue on from the Button.qml file Text{}

    Don't know what I've missed gone over my code, Hope some one can point me in the write direction.

    Thanks


  • Moderators

    Hi,

    -It looks like the documentation has some errors in it. The Button QML type was updated in Qt 5, but they forgot to update that example. Replace "label" with "text", and you should be fine :)-

    -Thanks for bringing this up; I'll have it fixed.-

    -You can see the latest Button documentation at http://qt-project.org/doc/qt-5/qml-qtquick-controls-button.html-

    EDIT: Whoops, I misunderstood that example. It DOESN'T refer to the built-in "Button":http://qt-project.org/doc/qt-5/qml-qtquick-controls-button.html provided by Qt, but instead it asks readers to implement their own Button. Please ignore what I wrote above.

    Anyway, that page does not show all the code used to create the example, it only discusses the important parts of the code. The code is in your Qt installation for you to study -- somewhere like C:\Qt\5.2.0\msvc2012_64_opengl\examples\quick\tutorials\gettingStartedQml\core\Button.qml. You can find the full Button code here, which declares the "label" property.

    May I ask how you are running the example?

    IMHO, this example is rather complicated for a "getting started" tutorial. I'd start with http://qt-project.org/doc/qt-5/qml-tutorial.html instead.



  • Yes I found The examples/... /Button.qml
    Thank you very much :)

    Desktop QT 5.2.0 GCC 64 bit on SuseLinux
    I've gone through the qml-tutorials, but this was the first thing that I ran into that popped up and gave me any trouble. As for running the example I just followed along adding in the code. Each example is an addition to the file being worked on. Have to fill in the rest. And ya I missed some of the code. :)

    The code runs but if you comment the label: out it uses the default from the button , each button was named the same .

    I'm interested In qml/c++ and qtquick seems fun!
    Again thanks for the path nice to see the whole concept.


  • Moderators

    You're welcome. :)

    Happy coding!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.