LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   .ui.h / kdevelop question (https://www.linuxquestions.org/questions/programming-9/ui-h-kdevelop-question-395714/)

eantoranz 12-22-2005 02:14 PM

.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?

Mara 12-22-2005 02:31 PM

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.

eantoranz 12-26-2005 10:14 AM

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? :scratch:

Mara 12-26-2005 01:44 PM

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.

eantoranz 12-28-2005 08:49 AM

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? :mad:

Mara 12-28-2005 02:53 PM

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

eantoranz 12-29-2005 08:14 AM

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!

eantoranz 12-30-2005 10:27 AM

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?

Mara 12-30-2005 03:14 PM

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.

eantoranz 12-30-2005 07:20 PM

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?

Mara 01-01-2006 03:32 PM

'Generate new class' button on on the right side (below 'Open project') or Project->New class

eantoranz 01-02-2006 02:10 PM

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. ;-)

xhi 01-03-2006 12:19 AM

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..

xhi 01-03-2006 12:22 AM

oops REMOVED same as above..

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

@moderator.. delete me ???

eantoranz 01-04-2006 09:32 AM

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


All times are GMT -5. The time now is 07:17 PM.