What code should I write in line-edit subclass and I didn't understand how qsetting can help me with this problem.
QSettings allow you to store some data and load it back next time the application is started. I don't know what you should write in QLineEdit subclass (I don't know if you even need to subclass QLineEdit), it depends what you want to do. Programming is something more than just taking ready components and connecting them together.
I just need a method to make the lineedit save that text for every start up.
You tell me how to do this.![]()
Read the QSettings documentation, everything is explained there (pay attention to setValue() / value() methods).You tell me how to do this.
As far as I remember we've done that using QCompleter and QSettings and a bit of smart code that looked for all line edits in the form and tried to retrieve previous values for them from settings.
Nah..completer doesn't help me with this.
And although I read the qsetting doc. I can't really understand how I attach it to the lineedit..:/
Any example code for my problem?
Thanks
You don't attach QSettings to a line edit. I already told you, it's not always as easy as calling one method on an object passing it the other object. You need to implement everything you need on your own. I don't even know what you want to do since you said completer is not what you want.
EDIT:- late
you dont have to attach anything. Its just a simple transfer of data (QString) to and fro (QSettings to LineEdit).
something like
settings->setValue(lineEdit.text())
lineEdit.setText(settings.value()).
Why?
Someone help me please....
Because you'll start bombarding him with requests to fix things for you. Currently it looks like you have totally no idea how to solve your problem. Moreover it looks like you are not willing to do any thinking yourself, you just want a ready solution.
Bookmarks