LinuxQuestions.org
Review your favorite Linux distribution.
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, 03: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, 03: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, 01: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, 01: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-28-2003, 12:51 AM   #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, 07: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, 07: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 04:17 PM
KDE gui vs. Gnome GUI Curt6000 Linux - Newbie 11 11-10-2004 02: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 02:24 AM
Where's the GUI??? soundprizm Linux - Newbie 2 04-03-2003 02:25 PM
need GUI kraven Linux - Software 8 03-27-2003 12:47 AM


All times are GMT -5. The time now is 12:26 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration