Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Widget Applications
Qt 6.11 is out! See what's new in the release blog

Widget Applications

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 7 Posters 4.3k Views 5 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.
  • tomyT tomy

    I think I do not have an option to create such a project using my Qt Creator!

    A Offline
    A Offline
    ambershark
    wrote on last edited by
    #4

    @tomy Well you can modify the project file it creates for you to include that stuff.

    But in Creator I'm sure there's an option for a QtQuick/QML project. That is the one you want.

    But you could literally create any project and add those things.

    You could even go into your terminal (linux/osx) and do this:

    mkdir mynewproject
    cd mynewproject
    touch main.cpp
    qmake -project
    

    That would make your project for you, then just edit the mynewproject.pro file and add the QT line from my post above.

    But again I'm sure there are projects in Creator that will match what you want.

    My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

    1 Reply Last reply
    1
    • tomyT Offline
      tomyT Offline
      tomy
      wrote on last edited by tomy
      #5

      Unfortunately I don't use a Linux! (But I will chat with you :-))
      And I think I should create a project like this in the Qt Creator IDE:
      File ‣ New File or Project ‣ Qt Quick Project ‣ Qt Quick UI
      and then modify the .qml file and paste that snipped-code.
      (But I also have doubts on that way!!)

      A JKSHJ 2 Replies Last reply
      0
      • tomyT tomy

        Unfortunately I don't use a Linux! (But I will chat with you :-))
        And I think I should create a project like this in the Qt Creator IDE:
        File ‣ New File or Project ‣ Qt Quick Project ‣ Qt Quick UI
        and then modify the .qml file and paste that snipped-code.
        (But I also have doubts on that way!!)

        A Offline
        A Offline
        ambershark
        wrote on last edited by
        #6

        @tomy No worries, you can do this in windows as well with this in a command shell:

        mkdir project
        cd project
        echo "" > main.cpp
        qmake -project
        

        This requires you have your qt bin dir in your path though. And like above it will generate the project file in this case project.pro that you can edit and add the QT += line from above.

        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

        1 Reply Last reply
        2
        • tomyT tomy

          Unfortunately I don't use a Linux! (But I will chat with you :-))
          And I think I should create a project like this in the Qt Creator IDE:
          File ‣ New File or Project ‣ Qt Quick Project ‣ Qt Quick UI
          and then modify the .qml file and paste that snipped-code.
          (But I also have doubts on that way!!)

          JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #7

          @tomy said in Widget Applications:

          I think I should create a project like this in the Qt Creator IDE:
          File ‣ New File or Project ‣ Qt Quick Project ‣ Qt Quick UI
          and then modify the .qml file and paste that snipped-code.

          If you want to follow the "Widget Application" part of the tutorial (sections 2.3.2 to 2.3.3), then the most suitable option for you is File -> New File or Project... -> Application -> Qt Widgets Application. You don't need anything related to Qt Quick or QML.

          Note: This tutorial looks old, from Qt 4. You will need to replace #include <QtGui> with #include <QtWidgets> for Qt 5.

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          3
          • tomyT Offline
            tomyT Offline
            tomy
            wrote on last edited by tomy
            #8

            @JKSH

            If you want to follow the "Widget Application" part of the tutorial (sections 2.3.2 to 2.3.3), then the most suitable option for you is File -> New File or Project... -> Application -> Qt Widgets Application.

            Hi,
            Thanks for addressing all the part not only that only one. And I created one like you said named "widget_1" and changed nothing but the main.cpp like below:
            alt text
            An error!

            You don't need anything related to Qt Quick or QML.

            I, too, think that this part of the book is recalling the reader the basics of Qt yet.

            Note: This tutorial looks old, from Qt 4. You will need to replace #include <QtGui> with #include <QtWidgets> for Qt 5.

            It, as says,is of 2013!

            JKSHJ 1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #9

              Hi,

              Where's CustomWidget declared ?

              It usually means that you are missing #include "customwidget.h".

              However from your screen shot, it looks like you have no sources matching that widget i.e. no header nor cpp file.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              2
              • tomyT Offline
                tomyT Offline
                tomy
                wrote on last edited by
                #10

                Hi,

                A simple answer that solves all issues: How do you run the code written in section 2.3.2. Widget Application? (I was trying to run that example).

                jsulmJ FlotisableF J.HilkJ 3 Replies Last reply
                0
                • tomyT tomy

                  Hi,

                  A simple answer that solves all issues: How do you run the code written in section 2.3.2. Widget Application? (I was trying to run that example).

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by jsulm
                  #11

                  @tomy Simple answer: yes, Widget Appplication, press CTRL-R.
                  But as @SGaist said: you do not have CustomWidget sources (header and cpp) which you are trying to use in main.cpp. How is it going to work? So, where is CustomWidget?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • tomyT tomy

                    Hi,

                    A simple answer that solves all issues: How do you run the code written in section 2.3.2. Widget Application? (I was trying to run that example).

                    FlotisableF Offline
                    FlotisableF Offline
                    Flotisable
                    wrote on last edited by
                    #12

                    @tomy
                    in the tutorial, it write a CustomWidget in another file, so you have to write all the files it provide and then run the program.

                    so you need a main.cpp, customwidget.h, customwidget.cpp. in main.cpp and customwidget.cpp, you need to include customwidget.h.

                    1 Reply Last reply
                    1
                    • tomyT tomy

                      Hi,

                      A simple answer that solves all issues: How do you run the code written in section 2.3.2. Widget Application? (I was trying to run that example).

                      J.HilkJ Offline
                      J.HilkJ Offline
                      J.Hilk
                      Moderators
                      wrote on last edited by
                      #13

                      @tomy

                      I think we had this before :-P

                      StefenStrange: Warnings come after the instructions

                      In your case the following paragraphs describe the CustomWidget class refered to in the main cpp.

                      You'll have to add a new cpp+ class in the Creator and include it in the main.cpp with #include "customwidget.h" then the compiler should find the type specifier


                      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                      Q: What's that?
                      A: It's blue light.
                      Q: What does it do?
                      A: It turns blue.

                      1 Reply Last reply
                      1
                      • tomyT tomy

                        @JKSH

                        If you want to follow the "Widget Application" part of the tutorial (sections 2.3.2 to 2.3.3), then the most suitable option for you is File -> New File or Project... -> Application -> Qt Widgets Application.

                        Hi,
                        Thanks for addressing all the part not only that only one. And I created one like you said named "widget_1" and changed nothing but the main.cpp like below:
                        alt text
                        An error!

                        You don't need anything related to Qt Quick or QML.

                        I, too, think that this part of the book is recalling the reader the basics of Qt yet.

                        Note: This tutorial looks old, from Qt 4. You will need to replace #include <QtGui> with #include <QtWidgets> for Qt 5.

                        It, as says,is of 2013!

                        JKSHJ Offline
                        JKSHJ Offline
                        JKSH
                        Moderators
                        wrote on last edited by
                        #14

                        @tomy said in Widget Applications:

                        It, as says,is of 2013!

                        @tomy said in Widget Applications:

                        A simple answer that solves all issues: How do you run the code written in section 2.3.2. Widget Application? (I was trying to run that example).

                        Actually... now that I look more closely at Section 2.3.2, I realized that it is a poorly-written tutorial. It has missing parts and it doesn't explain the code in detail. I don't recommend it for beginners.

                        Follow this tutorial instead: http://doc.qt.io/qt-5/gettingstartedqt.html

                        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                        tomyT 1 Reply Last reply
                        1
                        • JKSHJ JKSH

                          @tomy said in Widget Applications:

                          It, as says,is of 2013!

                          @tomy said in Widget Applications:

                          A simple answer that solves all issues: How do you run the code written in section 2.3.2. Widget Application? (I was trying to run that example).

                          Actually... now that I look more closely at Section 2.3.2, I realized that it is a poorly-written tutorial. It has missing parts and it doesn't explain the code in detail. I don't recommend it for beginners.

                          Follow this tutorial instead: http://doc.qt.io/qt-5/gettingstartedqt.html

                          tomyT Offline
                          tomyT Offline
                          tomy
                          wrote on last edited by JKSH
                          #15

                          @JKSH

                          Actually... now that I look more closely at Section 2.3.2, I realized that it is a poorly-written tutorial. It has missing parts and it doesn't explain the code in detail. I don't recommend it for beginners.

                          Ow, Thank God, finally someone believed me. Thank you so much. Again and again.

                          Follow this tutorial instead: http://doc.qt.io/qt-5/gettingstartedqt.html

                          I can't do that! That is, for Qt, I've decided to learn and follow a book, sorry.
                          And for QML, again a book, that one. But as you, too, agree, it's not well written (especially for a learner of QML) and I may face difficulties that I hope cope with them by both my hard-working plus your help.
                          Thanks.

                          1 Reply Last reply
                          0

                          • Login

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