Sure, I'll read classes chapter in C++ Symphony (Symfonia C++)
Sure, I'll read classes chapter in C++ Symphony (Symfonia C++)
But there still is a problem. I added .ui prefix in every reference to gui element e.g. ui.convertButton->hide(); instead of convertButton->hide(); But it still doesn't have functionality. Did I miss something?
Which is exactlxy what I said in my last post:But there still is a problem.
yes - but then you will stumble on the next error, and you wont understand why.
This is no way to learn C++.
Do it properly from the start.
==========================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.
Of course, you're right
![]()
Now I understand why do we have to use .ui prefix. Because in main cpp before creating dialog we define Ui:ialog ui; where ui is a variable of the class in which is setupUi so that we have to call ui prefix to refer content of setupUi class. Is that right?
Well, yes and no.
Yes - but its not a "prefix".
Its an object, which has elements, and that is the way you reference elements of objects in C++.
But as you see, once you started reading a bit, things get much clearer.
Continue so.
You don't have to post here each time you learn a new C++ concept, we know them already
You are welcome to ask specific question in the General Programming sections any time though.
==========================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.
I read classes chapter of my book and I think that there's something wrong with calling just e.g. hide(): But I don't know what.
edit:
or maybe no. In docs it was something like this:
Could you tell me, what's wrong? I understand classes, but don't know why application doesn't have any functionality (the only working thing is exit button which closes dialog. But connection was made in designer)Qt Code:
ui.colorDepthCombo->addItem(tr("2 colors (1 bit per pixel)"));To copy to clipboard, switch view to plain text mode
Last edited by Salazaar; 12th June 2007 at 19:42.
provided that 'ui' is a valid member variable, that has accessible member pointer 'convertButton' that has an accessible member function 'hide()' - your code is correct.
With correct syntax your code will compile.
But correct systax is not enough for correct functionality.
Why your program does not function the way you expect it is another question, which has to do with your programs design.
But that is another story, which I suggest you leave at the moment.
Concentrate on C++ first.
Do some simple example programs and learn the concept.
Just readin one chapter in the book, does not make you REALLY know object oriented programming.
==========================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.
Do you really think that all I know about C++ is how to access class member?? I know C++ quite well, but I didn't use classes in my problem, that's the reason why I didn't understand "accessing GUI elements", and it doesn't mean that I don't know C++. What is wrong in my code? I really don't know... Regards
I used combination of functions. No, the code isn't availible because as I said once my console programs are histroy. I'll ask you once more, why my application doesn't have functionality? Regards
So where was C++ in that? Maybe it was C then?
That's a pitty... Were they some school projects or something you did for fun?No, the code isn't availible because as I said once my console programs are histroy.
Define "functionality". Does it contain widgets? Are they connected using signals and slots? Give us more details (be warned though, we'll still be assuming you know what you're doing regarding C++ syntax and semantics).I'll ask you once more, why my application doesn't have functionality?
You are being very forceful and expecting the good people on here just to fix your problem.
You have been told to read more on C++ and I believe you should do. The best way to learn and fix your problems is by sitting down and trying to do it yourself first.
I'm sorry to sound hard, but having read lots of your posts, it seems you are just expecting to post your code on here and expect it to be fixed for you.
Bookmarks