LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-22-2005, 02:14 PM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Blog Entries: 1

Rep: Reputation: 90
Question .ui.h / kdevelop question


I think I got the concept right. I have to use a .ui.h file to make (and code) my own slots. That's OK. But where do I have to code, say a Dialog's constructor? because the .cpp file, and .h and moc.h files are re-created everytime I build the project, so it doesn't make sense to write any code there.

What do you think?
 
Old 12-22-2005, 02:31 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
The method most people use (including me) is to write the new class (that inherites the one created in Designer) in a new set of .h and .cpp files (header and implementation). Then you can just #include the orginal header and it can be overwritten by uic without any problems. The rule is: don't modify the files build by automatic tools.
 
Old 12-26-2005, 10:14 AM   #3
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
OK.... I'm starting to work on that.

I had a UI called "Principal", and I was able to compile it without a problem. I changed its name to PrincipalBase, created a file called principal.h that I will use to extend PrincipalBase, the problem is that I can't build now. :'(

This is the content of principal.h (in case I made a mistake on the extension):

Code:
#include "principalbase.h"

class Principal : public PrincipalBase
{

public:
	Principal();
};
When I build there are a number of messages... saying (among others):
Code:
attention: commands are imposed for the target "principalbase.h"
attention: old instructions are ignored for target "principalbase.h"
circular dependency eliminated principalbase.h <- principalbase.h (3 times in a row)
uic: Failed to parse formas/principal/principalbase.h: unexpected end of file in line 1
After "building" principalbase.h is completely empty.

Any idea of what I'm doing wrong?
 
Old 12-26-2005, 01:44 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
You need to run 'uic' on the .ui file (clear the project, then build again). Also, make sure that the whole class is renamed, not only the header file.
 
Old 12-28-2005, 08:49 AM   #5
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
When I start kdevelop, it gets stuck switching between two of the file tabs that I had opened before I closed kdevelop the last time and I can't do anything at all. How can I keep it from happening?
 
Old 12-28-2005, 02:53 PM   #6
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Your KDevelop config is kept in ~/.kde/share/config/kdevelop3rc. If you delete it, you get the default config.

In your case it may be easier to edit last session. If probect is someproject/ and has someproject/someproject.kdevelop, you need to edit/remove someproject/someproject.kdevses
 
Old 12-29-2005, 08:14 AM   #7
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
I did something a little less radical. I removed the last doc in the project's .kdevses file. That did the trick.

Will keep you posted about my advances... and Thanks, Mara!
 
Old 12-30-2005, 10:27 AM   #8
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
I managed (somehow, don't ask :-) ) to extend my original class and make the two QDateEdit fields to have today's date as their date. However, I am starting to miss code completion, and I also had to manually add the .h filed needed as includes (qdatetime.h, qdatetimeedit.h), and that's certainly not the kind of work I want to do (I-m thinking about coing java in eclipse, right now). Is it possible to make kdevelop code-complete as I write? and also that it automagically adds/removes header files as needed?
 
Old 12-30-2005, 03:14 PM   #9
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
I'm wondering how you're adding the new classes. Do as much as possible in Designer, the include its' files, they have all the needed includes (usually).

Also, if you have't already, look into Project Options->C++ specific->Code completion You can add your own code completion databases.
 
Old 12-30-2005, 07:20 PM   #10
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
I extended the hard way. Created two new files: form.h and form.cpp and wrote all the code there. What's the "lazy" way?
 
Old 01-01-2006, 03:32 PM   #11
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
'Generate new class' button on on the right side (below 'Open project') or Project->New class
 
Old 01-02-2006, 02:10 PM   #12
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
Mara, you have been very helpful! I appreciate that! :-)

Do you know how I can build (or maybe install through apt) QT's MySQL Plugin? I'm on a kubuntu breezy box... boxes, as a matter of fact. ;-)
 
Old 01-03-2006, 12:19 AM   #13
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
Quote:
Originally Posted by eantoranz
Mara, you have been very helpful! I appreciate that! :-)

Do you know how I can build (or maybe install through apt) QT's MySQL Plugin? I'm on a kubuntu breezy box... boxes, as a matter of fact. ;-)
im not completely sure.. but i think you would have to recompile qt after a configure with
Code:
./configure -plugin-sql-mysql
there may be a way to update the current install.. i dont know of it though..

Last edited by xhi; 01-03-2006 at 12:23 AM.
 
Old 01-03-2006, 12:22 AM   #14
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
oops REMOVED same as above..

page not refreshing or even *reacting* when hitting submit.. ??

@moderator.. delete me ???

Last edited by xhi; 01-03-2006 at 12:25 AM.
 
Old 01-04-2006, 09:32 AM   #15
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
It was a lot simpler than compiling something. There's a package for each driver.

from apt-cache search libqt3:
Code:
libqt3-mt-ibase - InterBase/FireBird database driver for Qt3 (Threaded)
libqt3-mt-mysql - MySQL database driver for Qt3 (Threaded)
libqt3-mt-odbc - ODBC database driver for Qt3 (Threaded)
libqt3-mt-psql - PostgreSQL database driver for Qt3 (Threaded)
libqt3-mt-sqlite - SQLite database driver for Qt3 (Threaded)
In this case:
Code:
apt-get install libqt3-mt-mysql

Last edited by eantoranz; 01-04-2006 at 09:35 AM.
 
  


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
Kdevelop/IDE Question stealth0707 Programming 10 02-21-2005 07:53 AM
simple kdevelop question laclac01 Linux - Software 0 07-23-2004 10:44 AM
Kdevelop question nny0000 Slackware 3 01-11-2004 12:46 AM
Kdevelop Question BajaNick Programming 1 10-10-2003 12:40 AM
kdevelop question skibud2 Programming 4 09-04-2003 07:07 PM

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

All times are GMT -5. The time now is 11:32 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
Open Source Consulting | Domain Registration