PDA

View Full Version : Some QSetting Questions and some more...



aguayro
13th March 2012, 12:30
hi, i have a question:
there is any problem if i use QSettigns to write settings "on the fly"?
i'd like to save a setting value whe the user change the text of a QLineEdit
is this a bad practice or something?

Question 2:
What is better FOR PERFOMANCE, a lot of QWidget->setValue("Secction/Sub").toInt(); ( for example )
or an "intelligent coded based/dynamic engine" like:
( with pseudocode )
for (int x=0; x<MaxWidgets; x++) {
QWidget->setValue( "Function that assigns section name using Widget name" ).toInt();
}
(same question for saving settings)

another question, so i have not to open another thread:
there is any way of making make a checkbox uncheckable, via QT Designer, if a radiobutton is not checked? ( its easy to do with code, but maybe there is a fastest way with QT Designer )

Thanks for your time :)

high_flyer
14th March 2012, 10:36
there is any problem if i use QSettigns to write settings "on the fly"?
i'd like to save a setting value whe the user change the text of a QLineEdit
is this a bad practice or something?
In general QSettings is there to save persistent data - so its not a bad practice.
However, if you need to save it very often, you might want to cache it first, and save only the last change before closing.


Question 2:
What is better FOR PERFOMANCE, a lot of QWidget->setValue("Secction/Sub").toInt(); ( for example )
or an "intelligent coded based/dynamic engine" like:
( with pseudocode )
for (int x=0; x<MaxWidgets; x++) {
QWidget->setValue( "Function that assigns section name using Widget name" ).toInt();
}
(same question for saving settings)
There is no measurable difference between the two approaches in terms of performance.
Specially since you wont have thousands of lines setting the value.
And if you need many such lines you can't avoid using a loop.


another question, so i have not to open another thread:
there is any way of making make a checkbox uncheckable, via QT Designer, if a radiobutton is not checked? ( its easy to do with code, but maybe there is a fastest way with QT Designer )
You can connected the toggled() signal of the radio button to the setEnabled() slot of the check box in designer.
For me personally however, in this case writing the code would be faster then doing it in designer.

aguayro
14th March 2012, 13:43
thanks for the answers!!!, very helpful :)