LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-20-2003, 02:06 PM   #1
shibdas
Member
 
Registered: Jun 2003
Posts: 32

Rep: Reputation: 15
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
 
Old 06-20-2003, 02:34 PM   #2
Langly
LQ Newbie
 
Registered: Jan 2003
Distribution: RH8.0; FreeBSD;
Posts: 17

Rep: Reputation: 0
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


Greets Langly.. and send me an mail if you need more help.. Maybe I'm better earlier at the day
 
Old 06-22-2003, 12:33 PM   #3
shibdas
Member
 
Registered: Jun 2003
Posts: 32

Original Poster
Rep: Reputation: 15
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
 
Old 06-22-2003, 12:45 PM   #4
Langly
LQ Newbie
 
Registered: Jan 2003
Distribution: RH8.0; FreeBSD;
Posts: 17

Rep: Reputation: 0
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..
 
Old 06-27-2003, 11:51 PM   #5
juby
Member
 
Registered: Dec 2002
Location: Bangalore, India
Distribution: Ubuntu 5.*
Posts: 241

Rep: Reputation: 30
arent there any good books on Qt ?????
 
Old 06-28-2003, 06:56 AM   #6
Langly
LQ Newbie
 
Registered: Jan 2003
Distribution: RH8.0; FreeBSD;
Posts: 17

Rep: Reputation: 0
Sams theach yourself QT in 24 Hours is a good one
 
Old 07-02-2003, 06:50 AM   #7
foomonkey
LQ Newbie
 
Registered: Jun 2003
Location: Cleveland, TN, USA
Distribution: RedHat
Posts: 1

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


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ubuntu GUI] Changing GUI from Gnome to wmaker MangaManiac Linux - Laptop and Netbook 8 05-08-2005 03:17 PM
KDE gui vs. Gnome GUI Curt6000 Linux - Newbie 11 11-10-2004 01:37 PM
Isn't Windows 95 or 98 a better GUI solution for old machines than an old Linux GUI lynchmob09 General 10 04-20-2004 01:24 AM
Where's the GUI??? soundprizm Linux - Newbie 2 04-03-2003 01:25 PM
need GUI kraven Linux - Software 8 03-26-2003 11:47 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration