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
Forum Updated to NodeBB v4.3 + New Features

How to link push button to another form

Scheduled Pinned Locked Moved Qt Creator and other tools
23 Posts 12 Posters 32.7k 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.
  • G Offline
    G Offline
    gerasalus
    wrote on 24 Dec 2010, 19:28 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 3 May 2011, 18:18 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 3 May 2011, 18:36 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