February 14, 2012

yola-yoli yola-yoli
Lab Rat
18 posts

[SOLVED] how to link a form(.ui) to another form using push button

Page  
1

Hey all,
I am new at Qt creator.
I have a problem, how to link a form(.ui) to another form using push button?
Can you give some example for me?
Because I still don’t understand even after reading the tutorial…
Thank you…

23 replies

February 14, 2012

Deleted Member # 1d173 Deleted Member # 1d173
Lab Rat
41 posts

Hi, mainwindow.h

  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QMainWindow>
  5. #include "mainwindow1.h"  //adding second window
  6. namespace Ui {
  7.     class MainWindow;
  8. }
  9.  
  10. class MainWindow : public QMainWindow
  11. {
  12.     Q_OBJECT
  13.  
  14. public:
  15.     explicit MainWindow(QWidget *parent = 0);
  16.     MainWindow1 *objmain1; // creating object for the second window
  17.     ~MainWindow();
  18. private slots:
  19.     void btnaction();  // creating slots
  20. private:
  21.     Ui::MainWindow *ui;
  22. };
  23.  
  24. #endif // MAINWINDOW_H

mainwindow.cpp

  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3.  
  4. MainWindow::MainWindow(QWidget *parent) :
  5.     QMainWindow(parent),
  6.     ui(new Ui::MainWindow)
  7. {
  8.     ui->setupUi(this);
  9.     connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(btnaction()));  // creating connections
  10. }
  11.  
  12. void MainWindow::btnaction()
  13. {
  14.  objmain1 = new MainWindow1;  
  15.  objmain1->show(); //opening second form
  16. }
  17. MainWindow::~MainWindow()
  18. {
  19.     delete ui;
  20. }

this will open the new window seperately. if you want to open the new window inside the first window means you have go for the parent child concept

February 14, 2012

yola-yoli yola-yoli
Lab Rat
18 posts

thanks for reply,
i will try now….

February 14, 2012

Deleted Member # 1d173 Deleted Member # 1d173
Lab Rat
41 posts

ok all the best

February 14, 2012

yola-yoli yola-yoli
Lab Rat
18 posts

thanks a lot…
it really help me so much…

February 14, 2012

Deleted Member # 1d173 Deleted Member # 1d173
Lab Rat
41 posts

ok carry on

February 14, 2012

yola-yoli yola-yoli
Lab Rat
18 posts

@cdeepak : can i ask again?
how about child have child?
i use the same way but is not correct..
thanks

February 14, 2012

yola-yoli yola-yoli
Lab Rat
18 posts

i try again, and correct…
hehe,
thanks

February 14, 2012

yola-yoli yola-yoli
Lab Rat
18 posts

How about dialing?

February 14, 2012

luisvaldes88 luisvaldes88
Lab Rat
31 posts

what do you mean with dialing ?

 Signature 

Muchos quieren, pocos pueden, algunos consiguen.

February 15, 2012

yola-yoli yola-yoli
Lab Rat
18 posts

i mean, when use a push button we can send short message service….
can you help me?

February 15, 2012

yola-yoli yola-yoli
Lab Rat
18 posts

maybe you can give me an example about how to send sms using Qt…
thanks luisvaldes88

February 15, 2012

Deleted Member # 1d173 Deleted Member # 1d173
Lab Rat
41 posts

i think this will help for u Try this link “http://www.developer.nokia.com/Community/Wiki/CS001616_-_Send_SMS_using_Qt_Mobility”. and let me know what happens.

February 15, 2012

Deleted Member # 1d173 Deleted Member # 1d173
Lab Rat
41 posts

Try this

http://www.qtcentre.org/archive/index.php/t-8380.html

http://www.developer.nokia.com/Community/Wiki/Creating_database_driven_applications_using_Qt

February 15, 2012

yola-yoli yola-yoli
Lab Rat
18 posts

okey, thanks all…
i will learn it…

February 16, 2012

yola-yoli yola-yoli
Lab Rat
18 posts

@cdeepak : i want ask about parent child concept…
i have two form,
form 1 is main menu and form 2 is sub menu…
i want create a button in form 2, the button used to back in form1,
i use the ame way but failed…
can you help me?

Page  
1

  ‹‹ Qt Creator/MinGW: Add some function to the static .lib part of a DLL      A question about the auto compleation of Qt creator ››

You must log in to post a reply. Not a member yet? Register here!