Salazaar, are you using Qt Assistant? It has nice indexing and searching functions...
Salazaar, are you using Qt Assistant? It has nice indexing and searching functions...
Oh allrgiht...
Salazar - I had a typo when in the code, and thought it might be a good lesson for you...
It should be QApplication::setMainWidget ()
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Actually you shouldn't need that line at all.
True.
But it doesn't hurt.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Yes, I'm using assistant. I would check it in docs, but I just written that I don't know what's the problem about
I made this changes you post, but when i launch application, only dialog window appear. I mean, no gui elements are displayed, only empty window. is that a 'typo'?
Yes, but this time its yours:I mean, no gui elements are displayed, only empty window. is that a 'typo'?
Qt Code:
int main(int argc, char *argv[]) { //QDialog *window = new QDialog; Dialog *window = new Dialog; window->show(); return app.exec(); }To copy to clipboard, switch view to plain text mode
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Salazaar, please read and at least try to understand the code you write. I think you should be able to distinguish between "QDialog" and "Dialog".
It should be new Dialog. Right?
Debugging an application that crashes on startup is more difficult with designer ui modules than when you make the forms yourself. The designer generates a lot of MOC able code that gets compiled.
When you are just starting to learn Qt (or C++ for that matter) you may be better off learning how to manually construct the form first (using the examples and tutorials in Qt). Make the smallest runnable code changes that compile clean. For instance, just make a form that has a group box or frame on it. When you get that small amount of code to work, then add other controls to the working code one at a time.
In this way you narrow the search for the bugs to just the code you added. It is much easier to debug a few lines of code than several hundred generated by the designer. Especially when you don't understand what it all does.
Hope this helps.
Sure, but one can safely assume that the code generated by the Designer is OK (which in fact means that you have less code to debug, if you use Designer). Although one shouldn't use a code generator, if he doesn't understand the generated code, so you are right, that it's better to start with learning how to create GUI in code.
Bookmarks