LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   QT GUI Programmming (https://www.linuxquestions.org/questions/programming-9/qt-gui-programmming-66889/)

shibdas 06-20-2003 02:06 PM

QT GUI Programmming
 
Hi everybody,
I am just starting QT GUI programming in Linux. I am stuck at a point where there are two forms and I have to relate them as follows:- One form has a next button when the button is clicked current form will disappear and another form will be displayed. Although this should be very simple I will be glad to have a code snippent from you.

Thanks
Shibdas;)

Langly 06-20-2003 02:34 PM

why not make your own slot on the class that you try to hide..


//written in langly++
//currentwindow.code
public slot:
void nextWindow(){
this->hide();
nextwindow->show();
}

//where the button is
currentwindow *a;
connect(button,SIGNAL(clicked()),a,SLOT(nextWindow()));

Hmm.. This is the best you can get from me at the moment, hope you figure out what I meant.. :)

or you could simply do this:

connect(button,SIGNAL(clicked()),windowopen,SLOT(hide()));
connect(button,SIGNAL(clicked()),windownext,SLOT(show()));

all offcouse written in langlycode<tm> so don't expect it to work :D


Greets Langly.. and send me an mail if you need more help.. Maybe I'm better earlier at the day :)

shibdas 06-22-2003 12:33 PM

Thanks langly for your cute code. I have done it but I think you are missing something or it may be obvious to you. The thing is simply hide and show seems to have some problem you have to set the main widget of the application to the next window as follows:-

//meta-code
//in the slot of the buttob of current window
currentwindow->accept();
nextwindows next;
//qApp is a global variable set by QT for the application
qApp->setMainWidget(next);
next.show();

I am cuurently coding in qt2.3. Maybe in qt 3.0 or latter your code will not need any modification.

Thanks again for the code.

Shibdas

Langly 06-22-2003 12:45 PM

hmmm..
Do you need to set the mainWidget, just try to hide the old one and show the new without the setMainWidget(this)..

Hopes it will work.. :)

juby 06-27-2003 11:51 PM

arent there any good books on Qt ?????

Langly 06-28-2003 06:56 AM

Sams theach yourself QT in 24 Hours is a good one

foomonkey 07-02-2003 06:50 AM

Qt Programming by O'Reilly publishing is good. However, the online docs are just about as helpful.


All times are GMT -5. The time now is 05:27 AM.