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. New to GUI
Qt 6.11 is out! See what's new in the release blog

New to GUI

Scheduled Pinned Locked Moved General and Desktop
11 Posts 4 Posters 4.2k Views 1 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.
  • CoreyWhiteC Offline
    CoreyWhiteC Offline
    CoreyWhite
    wrote on last edited by
    #1

    This stuff is awesome. I have been coding C++ for years without any GUIs. Now that I found Qt everything makes so much more sense. Still, I need a little help.

    I want to take a number from the entry tool, and when I click a button. I want to print something to a text area as many times as the number in the entry tool designates.

    Please any help, I'm new!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #2

      Welcome to DevNet,

      I suggest to start from the "examples and tutorial":http://doc.qt.io/qt-5/qtexamplesandtutorials.html

      Try to create a "Qt Widget based":http://doc.qt.io/qtcreator/creator-writing-program.html application

      Then try Qml application.

      1 Reply Last reply
      0
      • CoreyWhiteC Offline
        CoreyWhiteC Offline
        CoreyWhite
        wrote on last edited by
        #3

        I have been reading examples, following tutorials, and watching youtube. None of them have helped me with this specific problem. Could you at least direct me to something more specific?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SysTech
          wrote on last edited by
          #4

          As posted above try Widget first. You can use the form designer to put the following things on the form:

          line edit (input)
          button

          Then for showing the output you could use

          List widget

          For your first approach use code-behind. This means you put your logic to do things right in the connections for the thing that raised the signal.

          Example:

          For the button create clicked connection. In that connection (C++ code) you get whatever is entered in the line edit, then you have a loop that prints it out tot he list widget.

          Pretty much all of your code is in the one method that is called when clicked() happens.

          After you put the objects on the form (buttons, line edit, list) each will be usable in your code. Each gets an automatically generated name. You can change the names but for a simple test you can just leave them.

          For example the button becomes:

          pushButton

          When you are in the form editor you change to signals mode on the edit menu. Then you click on your pushButton in the form view, drag to the form. This will open a dialog where you can create a new function that will be called when the button is clicked.

          in that function you'd write your code to get what is in the line edit (using its object name) and loop and print it out to the list.

          1 Reply Last reply
          0
          • CoreyWhiteC Offline
            CoreyWhiteC Offline
            CoreyWhite
            wrote on last edited by
            #5

            Thanks, I think. I mean it makes sense, but I still need to visualize it. Is it possible you could code me a test case that I could then compile?

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andreyc
              wrote on last edited by
              #6

              "Here":http://qt-project.org/wiki/Qt_for_beginners_Hello_World is very small example.

              And "here":https://www.youtube.com/watch?v=XauEGKUh5Xs&index=16&list=PL2D1942A4688E9D63 is QLineEdit example

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SysTech
                wrote on last edited by
                #7

                Ok this is real crude:

                http://www.systemstechllc.com/filechute/Sites/filechute/untitled5.zip

                1 Reply Last reply
                0
                • CoreyWhiteC Offline
                  CoreyWhiteC Offline
                  CoreyWhite
                  wrote on last edited by
                  #8

                  OKAY! SysTech, your program runs like a dream. The only problem I am having now is with the Qt IDE. Your program compiles and runs, but I'm not able to view it inside the Qt IDE. In fact the button labeled layout isn't even active no matter what I do. So I can't see your work outside of a text editor.

                  Any help or advice?

                  1 Reply Last reply
                  0
                  • CoreyWhiteC Offline
                    CoreyWhiteC Offline
                    CoreyWhite
                    wrote on last edited by
                    #9

                    Found the problem, sorry everybody. Ha!

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      Homer JS
                      wrote on last edited by
                      #10

                      Hi CoreyWhite,
                      I'm also new to Qt GUI just like you. Nice that you solved this little button problem. I just wanted to point out that if you're planning on creating some more advanced UI or hoping to extend QML apps with C++ code (since you're experienced in C++), be prepared for a lot and I mean a lot of frustration (especially if you're using recent versions of Qt like 5.3 or 5.4). Practically there's NULL learning resources around for a beginner.

                      Good luck.

                      1 Reply Last reply
                      0
                      • CoreyWhiteC Offline
                        CoreyWhiteC Offline
                        CoreyWhite
                        wrote on last edited by
                        #11

                        Thanks for the reply. Maybe we could try to help each other. My e-mail address it adventmagic@gmail.com , if you want to write me. I think this is actually pretty straighforward, when you compare it to other IDE's like Microsoft Visual C++. I'm actually just happy to have found this stuff. I've never buiult a GUI before.

                        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