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. insert basic code source and run it
Forum Updated to NodeBB v4.3 + New Features

insert basic code source and run it

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 3 Posters 1.1k Views
  • 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.
  • S Offline
    S Offline
    signalK
    wrote on 11 Jun 2018, 02:25 last edited by
    #1

    Hi,

    My goal is to copy / paste source code of basic functions in order to understand, to study their single effect
    So,how (type of project) then insert, compile run basic source code in a new project?

    thanks

    1 Reply Last reply
    0
    • K Offline
      K Offline
      KillerSmath
      wrote on 11 Jun 2018, 02:51 last edited by KillerSmath 6 Nov 2018, 02:55
      #2

      @signalK
      Hi there.
      If you are interested in learn QML, i can suggest you a good eBook to start your learning.

      https://qmlbook.github.io/ <- Qt5 Cadaques eBook
      http://doc.qt.io/qt-5/qmlfirststeps.html <- First Step in QML Documentation

      @Computer Science Student - Brazil
      Web Developer and Researcher
      “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

      1 Reply Last reply
      0
      • S Offline
        S Offline
        signalK
        wrote on 12 Jun 2018, 23:23 last edited by signalK 6 Dec 2018, 23:24
        #3

        Ok !
        after creating a new project "try":
        file> new file or project> projects: Application> Qt quick application-Empty> choose build sydtem: qmake> etc ...> close
        I, in the editor, clicked on essai.pro to show the source code that I totally delete and replace it with basic like this:

        import QtQuick 2.3

        Rectangle {
        width: 200
        height: 100
        color: "red"

        Text {
            anchors.centerIn: parent
            text: "Hello, World!"
        }
        

        }
        it has compiled and executed well but by changing some values, nothing has changed!
        Why?

        thanks

        K 1 Reply Last reply 13 Jun 2018, 04:53
        0
        • D Offline
          D Offline
          dheerendra
          Qt Champions 2022
          wrote on 13 Jun 2018, 04:12 last edited by
          #4

          which values you changed ? Did the program work when u created the "try" application ? Did it show window ?

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          0
          • S signalK
            12 Jun 2018, 23:23

            Ok !
            after creating a new project "try":
            file> new file or project> projects: Application> Qt quick application-Empty> choose build sydtem: qmake> etc ...> close
            I, in the editor, clicked on essai.pro to show the source code that I totally delete and replace it with basic like this:

            import QtQuick 2.3

            Rectangle {
            width: 200
            height: 100
            color: "red"

            Text {
                anchors.centerIn: parent
                text: "Hello, World!"
            }
            

            }
            it has compiled and executed well but by changing some values, nothing has changed!
            Why?

            thanks

            K Offline
            K Offline
            KillerSmath
            wrote on 13 Jun 2018, 04:53 last edited by KillerSmath
            #5

            @signalK

            after creating a new project "try":
            file> new file or project> projects: Application> Qt quick application-Empty> choose build sydtem: qmake> etc ...> close
            I, in the editor, clicked on essai.pro to show the source code that I totally delete and replace it with basic like this:

            .pro files will say how you project must be built. -> Read more: http://doc.qt.io/qt-5/qmake-project-files.html

            myproject.pro file

            TEMPLATE = app # what type of project is it.
            
            QT += qml quick # what modules are necessary in this project
            
            SOURCES += main.cpp # what sources files are necessary to compile
            
            RESOURCES += qml.qrc # "index file"
            
            # Default rules for deployment.
            qnx: target.path = /tmp/$${TARGET}/bin
            else: unix:!android: target.path = /opt/$${TARGET}/bin
            !isEmpty(target.path): INSTALLS += target
            

            If you want to customize your window, you should to change the main.qml because this file is loaded by QmlEngine (in main.cpp or main.py) to create a window.

            Example of a customized main.qml file

            import QtQuick 2.3
            import QtQuick.Window 2.3
            
            Window {
                visible: true
                width: 600
                height: 450
                minimumWidth: 210
                minimumHeight: 110
                title: "My First Application"
                // change color of background
                color: "steelblue"
            
                Rectangle{
                    width: 200
                    height: 100
                    // change color of rectangle
                    color: "darkslateblue"
                    // anchors in center of father (window)
                    anchors.centerIn: parent
                    // border settings
                    border.color: "black"
                    border.width: 2
            
                    Text{
                        text: "Hello World!"
                        // anchors in center of father (rectangle)
                        anchors.centerIn: parent
                        // Font Settings
                        color: "white"
                        font.family: "Arial"
                        font.pixelSize: 11
                    }
                }
            }
            

            > Where is the main.qml file ?

            0_1528865501039_qt_project.png

            @Computer Science Student - Brazil
            Web Developer and Researcher
            “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

            1 Reply Last reply
            0
            • S Offline
              S Offline
              signalK
              wrote on 14 Jun 2018, 01:30 last edited by
              #6

              sorry
              my problem is solved

              1 Reply Last reply
              0

              1/6

              11 Jun 2018, 02:25

              • Login

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