[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
Hi,
mainwindow.h
- #ifndef MAINWINDOW_H
- #define MAINWINDOW_H
- #include <QMainWindow>
- #include "mainwindow1.h" //adding second window
- namespace Ui {
- class MainWindow;
- }
- {
- Q_OBJECT
- public:
- MainWindow1 *objmain1; // creating object for the second window
- ~MainWindow();
- private slots:
- void btnaction(); // creating slots
- private:
- Ui::MainWindow *ui;
- };
- #endif // MAINWINDOW_H
mainwindow.cpp
- #include "mainwindow.h"
- #include "ui_mainwindow.h"
- ui(new Ui::MainWindow)
- {
- ui->setupUi(this);
- connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(btnaction())); // creating connections
- }
- void MainWindow::btnaction()
- {
- objmain1 = new MainWindow1;
- objmain1->show(); //opening second form
- }
- MainWindow::~MainWindow()
- {
- delete ui;
- }
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
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.
You must log in to post a reply. Not a member yet? Register here!

