|
|||||||
| Newbie Newbie to Qt? Ask your questions here. |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
From the FAQ I read:
Quote:
1) The 2 Forms have to be in the same file? 2) Where I add the code? Into the .cpp or .ui or wherelse? 3) Could the 2nd Form be derived from QWindow or not? |
|
#2
|
|||
|
|||
|
Ad 1. - No
Ad 2. - Never touch the .ui, you add all code in a cpp file, as usual Ad 3. - I don't know a class called QWindow, but the other form can be derived from any widget. |
|
#3
|
|||
|
|||
|
Thank you wysota.
|
|
#4
|
|||
|
|||
|
How do the cpp file "knows" in which files are contained the 2 forms?
|
|
#5
|
|||
|
|||
|
Quote:
![]()
__________________
J-P Nurmi |
|
#6
|
|||
|
|||
|
The problem is that i never used headers with classes when coding c++ at school. I know cpp, but I found almost nowhere how qt (and other libraries with classes) actually works..
I'm realizing now that: - Qt designers produces an xml - qmake get infos from xml and produces c++ code that put into header files - the headers' code contains just classes definitions So it's - now - obvious that in order to use Qt designer's code one have to: - include the headers, #include "ui_header.h" - edit default Qt Designer's objects' names in order to be able to distinguish classes (if one uses more than 1 form) |
|
#7
|
|||
|
|||
|
You had a course on C++ at school and you didn't write a single class during that course?
Quote:
Quote:
Quote:
|
|
#8
|
|||||
|
|||||
|
Quote:
![]() Quote:
Quote:
Quote:
Quote:
Does it work an application if I have 2 forms (classes) differents, that do different things, that behave in a different way, composed by different objects, that are incorporated in the same .cpp? I'm pretty sure it doesn't. If it does, how do you distinguish them? If it does, is it safe coding in this way? |
|
#9
|
|||
|
|||
|
The "Black Box" OOP metaphor doesn't refer or apply to to a programmer's understanding of his tools, that's the funniest thing I've read in awhile. Thanks! :-)
|
|
#10
|
|||
|
|||
|
no comment
|
|
#11
|
||||||
|
||||||
|
Quote:
Quote:
![]() Quote:
See the previous paragraph for an explanation or dig into the ui_xx.h file and see for yourself.Quote:
Quote:
Quote:
A general remark - don't think of Qt as a separate language or some other special entity - it is just a set of classes written in standard C++, so all C++ rules apply to it. It's files are not in any way special apart from the fact that Qt introduces three new keywords to C++ but at the same time hides them from the C++ compiler, so that the only tool to see and understand them is moc (another part of the "qmake black box" that does most of Qt's "magic"). |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|