You are not logged in.

1

Sunday, February 4th 2007, 4:02pm

Qtdesigner and generate cpp code

Hi,

1 - I'm newbie with qt designer, and i want to know the following:

I've built a form in qt designer, and saved has Image.ui. This form, is a widget that shows an image.
Now, i want to write a main.cpp class that access the Image.ui. How it's possible?

2 - I'm asking this, because, the examples (cpp files) that i saw in qt website, they build the gui by the code, and not generate the code by the ui file. What i'm i missing, when i think that it's possible to generate cpp code with a ui file? I thought that, this was one of the main advantage of using qt designer.



Can you help me?
Thanks,

Pedro Sá da Costa

2

Sunday, February 4th 2007, 6:33pm

RE: Qtdesigner and generate cpp code

I found the problem. The problem is that i'm using qtdesigner 4.2.4. But this application, since it's not the commercial, can't generate the cpp code has qtdesigner 3.3.7.

1 - Is it true that qtdesigner 4.2.4 for linux can't create cpp code, because i've installed the free version, and not the commercial?

2 - If so, personally, i don't understand why. If the qtdesigner 3.3.7 can generate cpp code, and 4.2.4 can't, probably, few people that use qtdesign at home (like me) will stick to the version 3.3.7. That's toobad. :(
Thanks,

Pedro Sá da Costa

3

Monday, February 5th 2007, 7:45am

RE: Qtdesigner and generate cpp code

AFAIK the latest version of Qt 4.2 is 4.2.2. The next version that is the snapshots should be 4.2.3. anyway, The Qt Designer has never generated C++ code. what exactly do you mean by this statement ?

If you wnat to get the cpp code for the corresponding ui file. Run uic on it . that is it.

4

Monday, February 5th 2007, 2:55pm

RE: Qtdesigner and generate cpp code

Quoted



The Qt Designer has never generated C++ code. what exactly do you mean by this statement ?



I didn't found the option to generate a main.cpp for the corresponding ui file in QTDesigner 4.2, only in 3.3.7. The options was removed, or there is a new different way to generate the main.cpp?
Thanks,

Pedro Sá da Costa

5

Tuesday, February 6th 2007, 6:39am

RE: Qtdesigner and generate cpp code

I agree. main.cpp was generated by Designer. But designer's sole purpose is to design forms and nothing else. Generating a main.cpp is a pretty easy task. In my case. I use KDevelop on Linux and I have created a code snippet for that. Now the task of creating the main.cpp is reduced to just specifying what my MainWidget is.

6

Thursday, February 8th 2007, 5:06pm

You're right sunil.thaha. But, since i'm a newbie in Qt designer, there are simple things that i haven't understand it. Sorry!!!

Thanks,
Thanks,

Pedro Sá da Costa

sincnarf

Beginner

  • "sincnarf" is male

Posts: 5

Location: Philippines

Occupation: Programmer

  • Send private message

7

Wednesday, May 2nd 2007, 2:18pm

don't know how to write a main.cpp for the ui

I am also having difficulty using my .ui file. Suppose I already have the ui, but want it called by a main.cpp, how do we do that? I don't see examples in the Qt Tutorials.
-Qt, teach me-

8

Thursday, May 3rd 2007, 6:47am

RE: don't know how to write a main.cpp for the ui

Which version of Qt are you using ?
And Assistant does provide a Qt Designer Reference documentation. And the various methods are well explained there