LinuxQuestions.org
Visit Jeremy's Blog.
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 11-29-2005, 08:25 AM   #1
Gnarg
Member
 
Registered: Feb 2004
Location: Canada
Distribution: Gentoo Linux
Posts: 44

Rep: Reputation: 15
Do I need something else when displaying a new dialog?


When my main dialog opens another dialog, do I need additional code to let the new dialog that is displayed to talk with the implementation class? Here is what I do to display a new dialog:
Code:
Form1 *frmMain;

frmMain = new Form1();
frmMain->show();

When the new dialog is shown I can't seem to have the dialog to use the implementation class. It still uses the class that QT generated.


My implementation class goes as follows:

Header File
Code:
class frmMainImpl : public Form1
{
       //more code here
}

Source File
Code:
frmMainImpl::frmMainImpl(QWidget *parent, const char *name) : Form1(parent, name)
{

}


Thanks...

Gnarg
 
Old 11-30-2005, 02:54 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
You create an instance of Form1 type, not frmMainImpl. I thin you should use rather the second class.
Code:
frmMainImpl *frmMain;

frmMain = new frmMainImpl();
frmMain->show();
This is a better idea, especially when you use Qt Designer to draw your widgets. When you use classes that inherit from the generated ones, you can edit in Qt Designer and make no modifications in your code (and not touch the generated classes at all).
 
Old 12-01-2005, 06:34 AM   #3
Gnarg
Member
 
Registered: Feb 2004
Location: Canada
Distribution: Gentoo Linux
Posts: 44

Original Poster
Rep: Reputation: 15
Thanks Mara,

I looked over my code and done as you suggested and now it all works!


Thanks for your help on my misunderstanding....


Gnarg
 
  


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
GTK 2.0 problems in displaying dialog boxes stephenwalter Programming 1 01-20-2006 01:21 AM
Dialog cookie_ie Programming 5 04-11-2005 01:48 AM
dialog ziox Programming 1 03-16-2005 01:09 PM
Dialog phatbastard Linux - Security 3 12-13-2004 09:48 PM
Java: wait until first dialog is closed before displaying the other one? gundelgauk Programming 2 08-13-2004 06:57 AM

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

All times are GMT -5. The time now is 04:40 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