Philip_Anselmo
28th April 2006, 15:04
Hello, N00B here :D
I'm as new to C++ as to Qt so I'm having problems all the time and wel some of them I could resolved my self with the documentation and reading some posts here and in qtforum..
Well straight to the point:
I've made an app (inb Qt Designer) that has 2 forms the first one (form1, wich is a MainWindow) has a LineEdit called LE1, a QTextLabel called TL1 and 2 pushbuttons... I think you can guess how did I called them (PB1,PB2)
The second form.. (form2) a Dialog has only a QTextLabel TL2 and 2 PushButtons PBCaptura and PBSalir (I worked my head to the bone thinking on those names XD)
The thing is that I've included the forms on each other, like
Form1
#include <form2.h>
on the slots of the form1 clicking on the PB1 makes the text from LE1 appear on TL1, and on a QMessageBox, then if you click on PB2 it calls the form2...
void Form1::muestraform2()
{
static Form2 *form2 = new Form2(this);
static Form1 *form1 = new Form1;
fprima->close();
form2->show();
form2->setActiveWindow();
form2->raise();
}
but doesn't close the form1... <=the first question is.. how do I close or better yet.. just hide.. the form1?
the other problem is that I made an object of the class form1 on form2 ( Form1 *form1 = new Form1(); ), the I tryied to fill the TL2 with this:
TL2->setText("en el form1 escribiste: " + form1->LE1->text());
It doesn't gives me any errors at all, but the text is empty :confused: <= 2º question
So I tryied another way...
on form1 I'm trying to capture the LE1->text() on a QString called texto
QString texto = LE1->text(); (it's declared and filled inside a slot wich I use to pass the text from LE1 to TL1) <= 3º question.. how do I capture on a QString the text inputed on the LE1?
I'm not shure about managing a QString... to be honest I don't think is that way but I just can't find any examples anywhere.
after that I want to pass that QString to form2 to fill the TL2 <= 4º question
It should be like: form1->texto right?
With these I'm pretending to learn how to capture input from lineedits to fill variables on main.cpp, and other forms, so I can make an app that connects to a Database wich I set on runtime... and well to learn that and to avoid my boss to kick me out of the job
Please helpme :crying:
PD: I'm working on a Linux Fedora Core 1 with Qt 3.1.2
... I miss my deb sarge
I must leave Deby Ann at home :(
I'm as new to C++ as to Qt so I'm having problems all the time and wel some of them I could resolved my self with the documentation and reading some posts here and in qtforum..
Well straight to the point:
I've made an app (inb Qt Designer) that has 2 forms the first one (form1, wich is a MainWindow) has a LineEdit called LE1, a QTextLabel called TL1 and 2 pushbuttons... I think you can guess how did I called them (PB1,PB2)
The second form.. (form2) a Dialog has only a QTextLabel TL2 and 2 PushButtons PBCaptura and PBSalir (I worked my head to the bone thinking on those names XD)
The thing is that I've included the forms on each other, like
Form1
#include <form2.h>
on the slots of the form1 clicking on the PB1 makes the text from LE1 appear on TL1, and on a QMessageBox, then if you click on PB2 it calls the form2...
void Form1::muestraform2()
{
static Form2 *form2 = new Form2(this);
static Form1 *form1 = new Form1;
fprima->close();
form2->show();
form2->setActiveWindow();
form2->raise();
}
but doesn't close the form1... <=the first question is.. how do I close or better yet.. just hide.. the form1?
the other problem is that I made an object of the class form1 on form2 ( Form1 *form1 = new Form1(); ), the I tryied to fill the TL2 with this:
TL2->setText("en el form1 escribiste: " + form1->LE1->text());
It doesn't gives me any errors at all, but the text is empty :confused: <= 2º question
So I tryied another way...
on form1 I'm trying to capture the LE1->text() on a QString called texto
QString texto = LE1->text(); (it's declared and filled inside a slot wich I use to pass the text from LE1 to TL1) <= 3º question.. how do I capture on a QString the text inputed on the LE1?
I'm not shure about managing a QString... to be honest I don't think is that way but I just can't find any examples anywhere.
after that I want to pass that QString to form2 to fill the TL2 <= 4º question
It should be like: form1->texto right?
With these I'm pretending to learn how to capture input from lineedits to fill variables on main.cpp, and other forms, so I can make an app that connects to a Database wich I set on runtime... and well to learn that and to avoid my boss to kick me out of the job
Please helpme :crying:
PD: I'm working on a Linux Fedora Core 1 with Qt 3.1.2
... I miss my deb sarge
I must leave Deby Ann at home :(