PDA

View Full Version : Help me to load one form over another form PushButton



wagmare
5th September 2008, 12:43
Hi Friends,
I am new to this Qt enviroiment and my first assign task is to create a application in Qt as when i click one PushButton a new form with series of pushButton has to be opened so i dont know how to connect the form 1 pushButton to form 2 ....
Please help me

janus
5th September 2008, 12:54
hi,

you should use the designer to add signal/slot connections (if the new form is within the same widget). It's pretty easy that way.
If it is a new, own window you can crate a slot with the name:


void on_myPushButton_clicked()

and in the on_myPushButton_clicked() function you can open a new form/window/dialog.

lyuts
5th September 2008, 13:29
Take a look at Qt's examples, standard dialogs in particular.

wagmare
12th September 2008, 09:44
hi,

you should use the designer to add signal/slot connections (if the new form is within the same widget). It's pretty easy that way.
If it is a new, own window you can crate a slot with the name:


void on_myPushButton_clicked()

and in the on_myPushButton_clicked() function you can open a new form/window/dialog.

thanks but i cant understand because i am new .... can u explain with small example please.....

wagmare
12th September 2008, 09:47
hi.
I went through the dialog examples but i still cant learn about how to connect a new dialog
along with the parent and inside that dialog i should open pushbutton and labels...
please help me...

janus
12th September 2008, 11:01
hi,

Take a look at the QDialog Class Reference. There is some example code:


void MyFirstDialog::on_myPushButton_clicked()
{
MySecondDialog dialog(this);
dialog.exec(); //opens the second Dialog
}

windsword
26th November 2008, 14:51
Janus:

What about when you wan to launch a new window?, hide the parent window, but keep track of it to recall it later. I have an intro window with buttons and one of these should launch the "main window" that I call the admin window:



void introWindow::adminstart() {
hide();
adminwin = new AdminWindow(this);
}

my header file has the following:


#ifndef INTROWINDOW_H
#define INTROWINDOW_H

#include <QWidget>
#include <QtGui>
#include <QPushButton>
#include <QtGui/QGraphicsView>
#include <QtGui/QPushButton>
#include <QtGui/QVBoxLayout>
#include <QtGui/QHBoxLayout>
//#include "adminWindow.h"
class QAction;
class QMenu;
class AdminWindow;
class introWindow : public QWidget
{
Q_OBJECT
public:
introWindow(QWidget *parent = 0);
//introWindow();
~introWindow();

QGraphicsView *graphicsView;
QPushButton *adminButton;
QPushButton *measureButton;
QPushButton *viewButton;
QPushButton *quitButton;
QVBoxLayout *vboxLayout;
QHBoxLayout *hboxLayout;
private slots:
void adminstart();
private:
AdminWindow *adminwin;
};
#endif


when I compile I get the following error msg:
Undefined symbols:
"AdminWindow::AdminWindow(QWidget*)", referenced from:
introWindow::adminstart() in introwindow.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

maverick_pol
26th November 2008, 16:11
Hi,

1)If you paste the code we will surely help you( whole app or a reasonable example/minimm compilable )
2)If you explain in detail what you want exactly I will help you as well.
3)If you show the adminWindow implementation we can look for problems.

The code you need is rather simple so if you provide your code or explanation surely someone will help you within a short period of time.

Kacper