Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How to link push button to another form
QtWS25 Last Chance

How to link push button to another form

Scheduled Pinned Locked Moved Qt Creator and other tools
23 Posts 12 Posters 32.5k 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.
  • I Offline
    I Offline
    infoctopus
    wrote on last edited by
    #8

    I strongly suggest reading basics on Qt, at least topics in Assistant. Qt Creator is tool for making things easier if you know what really happens. It shouldn't be a black box.

    Also Qt Framework encourage a good programming style (unlike RADs, point-and-click and the program is ready)

    Qt rulez

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #9

      [quote author="husban" date="1291662926"]That's great except for the fact that I have not got a clue about your help. Having mentioned that I am new at this I am looking for the easiest method to link a push button to a form using the design mood, drag and drop thing, u know simple form with an action button that's all. Please help.[/quote]

      Sorry my tips were not helpful for you. Qt won't allow you to do what you want without writing some actual code. If you want to do this with nothing but drag and drop, perhaps Qt is not for you. Designer can be a handy tool to help you get some things done, but it won't write your applications for you. What you want is not possible in only Designer.

      1 Reply Last reply
      0
      • I Offline
        I Offline
        infoctopus
        wrote on last edited by
        #10

        As for me, I prefer creating UI by hands. It's easier to make changes, if needed.

        Qt rulez

        1 Reply Last reply
        0
        • H Offline
          H Offline
          husban
          wrote on last edited by
          #11

          Thanks for the hint, so where to start then and where the code should be added. And it seems i can use this-> pointer to assign an action to the push button, I am very familiar with c++ but I am having a difficult time finding how and where to add the code, thanks again

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #12

            The Getting Started Programming with Qt I mentioned earlier is a good starting point. Also the docs on "Designer":http://doc.qt.nokia.com/latest/designer-manual.html and in particular the chapter "Using a Designer UI File in Your Application".

            Try things with small sample applications and adapt to your actual project later on.

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • F Offline
              F Offline
              fcrochik
              wrote on last edited by
              #13

              Make sure to check:

              http://developer.qt.nokia.com/wiki/Books_and_Links_for_learning_C_and_advanced_topics

              Certified Specialist & Qt Ambassador <a href="http://www.crochik.com">Maemo, Meego, Symbian, Playbook, RaspberryPi, Desktop... Qt everywhere!</a>

              1 Reply Last reply
              0
              • D Offline
                D Offline
                disperso
                wrote on last edited by
                #14

                [quote author="husban" date="1291675289"]Thanks for the hint, so where to start then and where the code should be added. And it seems i can use this-> pointer to assign an action to the push button, I am very familiar with c++ but I am having a difficult time finding how and where to add the code, thanks again[/quote]

                Husban, unfortunately there is no quick answer that gives a solution to your problem. Qt is very easy to learn, really, but you have to learn a little bit first about signals and slots. It might seem a bummer a first, but are pretty simple, as slots are regular functions, but ones that can be executed when a signal is emitted. You probably have to write a slot that instantiates the second form and raises it, and connect() it to the clicked() signal from the push button.

                As Andre explained you, the Qt Designer is not enough for doing what you want. Is helpful for creating individual dialogs or layouts, but not that much for linking different dialogs.

                I would start with the documents mentioned. Good luck!

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  kamalakshantv
                  wrote on last edited by
                  #15

                  A reference most of the Qt books is available "here":http://qt.nokia.com/developer/books.

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    gerasalus
                    wrote on last edited by
                    #16

                    I'm reading all the replies and wondering... are these all nerds and geeks there? Coming from java and Android world, i find development for Nokia pretty painful. Even developing for iPhones objective c is much easier that getting information around here. Arguments "qt is not for you", "encourages good programming style". Are you reading what you are writing? It encourages me to spend my time for learning new stuff, when all i want is to deliver some kind of business value. No wonder Nokia lags soooo behind, and with attitudes around here, it wont get any closer.

                    nice holidays for you all :)

                    1 Reply Last reply
                    0
                    • V Offline
                      V Offline
                      vcsala
                      wrote on last edited by
                      #17

                      [quote author="gerasalus" date="1293199489"]I'm reading all the replies and wondering... are these all nerds and geeks there? Coming from java and Android world, i find development for Nokia pretty painful. Even developing for iPhones objective c is much easier that getting information around here. Arguments "qt is not for you", "encourages good programming style". Are you reading what you are writing? It encourages me to spend my time for learning new stuff, when all i want is to deliver some kind of business value. No wonder Nokia lags soooo behind, and with attitudes around here, it wont get any closer. [/quote]

                      You have joined a few hours ago and already made a verdict on people here... and based on half sentences by dragging them out of context. It is not so nice, but you are new therefore: welcome on the forum and we hope your opinion will be much better after you spent some more time here.

                      1 Reply Last reply
                      0
                      • Q Offline
                        Q Offline
                        qtrahul
                        wrote on last edited by
                        #18

                        [quote author="husban" date="1291675289"]Thanks for the hint, so where to start then and where the code should be added. And it seems i can use this-> pointer to assign an action to the push button, I am very familiar with c++ but I am having a difficult time finding how and where to add the code, thanks again[/quote]

                        You are familiar with C++, then Qt is fun and very easy for you.
                        In C++ ,you have to develop class of your own choice during programming, while in Qt you can have class library , from where you should use them and make code.

                        Check the Qt class library.

                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          disperso
                          wrote on last edited by
                          #19

                          [quote author="gerasalus" date="1293199489"]I'm reading all the replies and wondering... are these all nerds and geeks there? Coming from java and Android world, i find development for Nokia pretty painful. Even developing for iPhones objective c is much easier that getting information around here. Arguments "qt is not for you", "encourages good programming style". Are you reading what you are writing? It encourages me to spend my time for learning new stuff, when all i want is to deliver some kind of business value. No wonder Nokia lags soooo behind, and with attitudes around here, it wont get any closer.
                          [/quote]

                          I can add a "citation needed" to almost all sentences in this paragraph, plus a huge "off-topic" label. Please, don't feed the obvious troll.

                          Gerasalus, if you really want to discuss things, use a proper thread. Leave this open in case husban needs a follow up.

                          1 Reply Last reply
                          0
                          • K Offline
                            K Offline
                            kamalakshantv
                            wrote on last edited by
                            #20

                            [quote author="disperso" date="1293207826"][quote author="gerasalus" date="1293199489"]I'm reading all the replies and wondering... are these all nerds and geeks there? Coming from java and Android world, i find development for Nokia pretty painful. Even developing for iPhones objective c is much easier that getting information around here. Arguments "qt is not for you", "encourages good programming style". Are you reading what you are writing? It encourages me to spend my time for learning new stuff, when all i want is to deliver some kind of business value. No wonder Nokia lags soooo behind, and with attitudes around here, it wont get any closer.
                            [/quote]

                            I can add a "citation needed" to almost all sentences in this paragraph, plus a huge "off-topic" label. Please, don't feed the obvious troll.

                            Gerasalus, if you really want to discuss things, use a proper thread. Leave this open in case husban needs a follow up.[/quote]

                            I had actually thought of replying to Gerasalus post, but then I strongly felt its a waste of time.

                            1 Reply Last reply
                            0
                            • G Offline
                              G Offline
                              gerasalus
                              wrote on last edited by
                              #21

                              Don't feed the troll? Are you serious ? There were at least three people with "Certified developer" badges there were so ignorant and could not write few lines of code? As i'm trying to enter Nokia development world for almost two weeks in after-work evening, i'll try to help husban:

                              1. Lets say you have created two Main windows. One is called HelloWorld (you have a file HelloWorld.ui) and the other is called IgnorantForumMembers (you have a file IgnorantForumMembers.ui)
                              2. You add a button to HelloWorld and name it myButton
                              3. Locate file HelloWorld.h under Headers folder, and add a line like this inside HelloWorld declaration:

                              @private slots:

                              void myButton_clicked();@
                              
                              1. Locate file HelloWorld.cpp under Sources directory, and add code like this:

                              In HellowWorld constructor:

                              @ connect(ui->myButton, SIGNAL(clicked()), this, SLOT(myButton_clicked()));@

                              And in the file, define myButton_clicked action:

                              @void HelloWorld::myButton_clicked()
                              {
                              IgnorantForumMembers * t = new IgnorantForumMembers();
                              t->activateWindow();
                              t->raise();
                              t->repaint();
                              t->show();
                              }@

                              and vuolia - it works. This code might have a couple of bugs, especially related to memory management, as i'm pretty new to c++ world, so maybe those smart people with nice badges can help out, and correct my mistakes.

                              And usability of QT creator strikes once again... It does work on Simulator, but it does not launch on Nokia X6 providing a meaningful " undefined reference to `IgnorantForumMembers::IgnorantForumMembers(QWidget*)"

                              1 Reply Last reply
                              0
                              • K Offline
                                K Offline
                                klrkt
                                wrote on last edited by
                                #22

                                I am very new here - just created an account.
                                Some quick observations.
                                If you want to help someone please help.

                                Pretend that you are helping a tourist who is lost.
                                Giving directions is a lot more helpful than saying "Have you looked at a map?" ("have you read documentation?"

                                FWIW my suggestion is this link:
                                http://doc.qt.nokia.com/latest/designer-using-a-ui-file.html
                                It describes several methods of mixing cpp code and designer "ui" files.
                                I found it helpful, since it shows and explains how to use the header files "ui_xxxx.h" with the cpp files.
                                Additionally when you add the #include "ui_xxxx.h" line, RIGHT CLICKING the line will bring you to the CREATED "ui_xxxx.h" so that you know exact syntax of the AUTOMAGICALLY created form.

                                While the above does not explicitly answer "husban"
                                "husban" did say "I am very familiar with c++ "
                                therefore knowing how to access the "automagically" created code, should be a huge help

                                my two cents worth

                                1 Reply Last reply
                                0
                                • G Offline
                                  G Offline
                                  goetz
                                  wrote on last edited by
                                  #23

                                  Please, no necroposting - this topic is more than 4 months old. Meta stuff like this should be discussed in "The Lounge":http://developer.qt.nokia.com/forums/viewforum/7/.

                                  If you think there is need for discussion of this stuff, feel free to open a new thread there.

                                  Closing this one for now.

                                  http://www.catb.org/~esr/faqs/smart-questions.html

                                  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