Do you have a simple example of the problem that you have? Post some of your code. It's hard to suggest anything when no-one can see how you're using things...
ravenous
Practically a Master Poster
681 posts since Jul 2005
Reputation Points: 286
Solved Threads: 111
Skill Endorsements: 9
@Ravenous Bro its just a drag and drop program in which i gave names to buttons but when i try to use those buttons using code in the program .cpp file, i can't use them as pointers or objects.
It's the "use those buttons using code in the program" part that I was asking to see.
Why do we use ui->widget->required function syntax in Class cpp file in order to access a widget function. why isn't this syntax allowed widget->required function
The behaviour of Qt Designer is to produce a class in a namespace called Ui that contains all the stuff that you made in the designer. The class that you're editing the cpp file for will have a private member of this automatically generated type, called ui . To do things with the widgets that you made in Designer, you have to access them through the ui member of your class.
There is another way to use Qt that uses inheritance, and then you can do the things that you mentioned. I don't know if designer can be adjusted to use this pattern though, I just use the default one.
If you post the code that you're trying to write, then people might be able to offer some advice...
ravenous
Practically a Master Poster
681 posts since Jul 2005
Reputation Points: 286
Solved Threads: 111
Skill Endorsements: 9
So my question is this true and if this definition also goes for a function's local pointers.
No, you still have to call delete on anything that you choose to new in a function. In fact, I think that Qt only deletes certain pointers and only if you have the right flags specified, for instance by calling setAttribute( Qt::WA_DeleteOnClose ) in the constructor of your Q_OBJECT
I can't understand why primaryColumnCombo setting its minimum size by the ideal size of the secondaryColumnCombo
I think that this is an example of how to make an expanding sort dialog from the book "C++ GUI Programming with QT 4" or one of its predecessors. Correct? If so, it explains in the text that the secondary and tertiary combos have the default text "none" in them, which is the widest entry of any of the three combos on the dialog. To prevent the primary combo from resizing in an ugly way when the "More" button is clicked, the primary combo takes its hint from the (wider) secondary combo.
And how does "ch" will become equal to "last"?
If this is indeed the example that I mentioned, then last is passed in as an argument to the setColumnRange function.
And in QString(ch) is "ch" is type getting typecasted!
Yes, it is. The addItem member of QComboBox takes a reference to a QString as its argument, not a QChar . However, QString has a constructor that takes a QChar so you can do a kind of typecast by making a temporary QString like you see here.
This seems to be drifting away from your original question. If you have solved that issue, you should mark this thread as "solved" and start a new thread for additional questions :)
ravenous
Practically a Master Poster
681 posts since Jul 2005
Reputation Points: 286
Solved Threads: 111
Skill Endorsements: 9
Can i do like this
QString ch=first; // where first is also QString
I don't think so, since the ch=ch.unicode()+1 line probably won't work as expected for a QString , compared to a QChar . It's also possible that your ch could be changed later in the code to be something random. It's not likely in this code because it's a very small chunk of code and you can see everything that's going on. However, it's not a pattern that I would recommend that you get into. It's safer to keep the variable as a QChar and only convert to a QString when required, as the original code does.
ravenous
Practically a Master Poster
681 posts since Jul 2005
Reputation Points: 286
Solved Threads: 111
Skill Endorsements: 9
Question Answered as of 1 Year Ago by
ravenous
and
Eagletalon