Restoring previous session of an application
-
no.
-
Then?which lines i have to check.
regards
imrrk -
Think yourself. It's obvious....
-
ok.I think these lines then...
QColor r(settings.value("color").toString());am I right?
regards
imrrk -
You're heading towards one of the hotspots...
-
Hi imrrk,
one suggestion:
look at the docs of QColor and QSettings.
Then you should find it.Regards
Gerolf
-
hello Volker,I am sorry,I didnt get your meaning..
Hello gerolf, from yesterday i am reading the docs..
this has been given@QSettings settings("MySoft", "Star Runner");
QColor color = palette().background().color();
settings.setValue("DataPump/bgcolor", color);@
//here i didnt understand "DataPump/bgcolor"..regards
imrrk -
Hello Volker and gerolf,
whether it should be done this way..QColor r(settings.value(“color”).toString(),ui->pushbutton->setcolor(r));
regards
imrrk -
Hi imrrk,
You get a lot of help here, so please dont email me for something like this. -
ok ,Whether I am heading the correct way..?
regards
imrrk -
immrk, is all this work for a school assignment or an actual job?
-
[quote author="imrrk" date="1306333461"]ok ,Whether I am heading the correct way..?
[/quote]no.
-
hello Volker,Can u give me some hints then..
regards
imrrk -
[quote author="imrrk" date="1306387710"]hello Volker,Can u give me some hints then..[/quote]
To quote myself:
[quote author="Volker" date="1306322983"]I personally would do something with the color read from the settings....[/quote]
Oh, and that debugger thingie likes breakpoints, you know...
I would be alarmed if it did not stop at a certain point....
-
hello volker problem solved..now i m able to set colors..and save it in .ini file
@void MainWindow::writeSettings()
{
QSettings settings;//("company name", "project");settings.beginGroup("pushbutton");
settings.setValue("size", size());
settings.setValue("pos", pos());
settings.setValue("mytext",ui->pushButton->styleSheet());
settings.setValue("mytext1",ui->pushButton_2->styleSheet());
settings.setValue("mytext2",ui->pushButton_3->styleSheet());
//QColor r("red");
//r.name();//settings.setValue("color",r.name());
settings.setValue("state", saveState());
qDebug()<<r.name();
settings.endGroup();
}void MainWindow::readSettings()
{
QSettings settings;//("Plackal", "restoreproject");settings.beginGroup("pushbutton");
resize(settings.value("size", QSize(400, 400)).toSize());
move(settings.value("pos", QPoint(200, 200)).toPoint());
a=settings.value("mytext").toString();
b=settings.value("mytext1").toString();
c=settings.value("mytext2").toString();
//ui->pushButton->setText(a);
//QColor r=settings.value("color").toString();
ui->pushButton->setStyleSheet(a);
ui->pushButton_2->setStyleSheet(b);
ui->pushButton_3->setStyleSheet(c);
//ui->pushButton->autoFillBackground(r);
QByteArray state = settings.value("state", QByteArray()).toByteArray();
restoreState(state);
//resize(size);
//move(pos);
qDebug("set");
settings.endGroup();}@
regards
imrrk -
Hi All,
Although this thread is generating too much spam I think the topic about QSettings is interesting. I was unable to find a simple QSettings example here in our wiki nor in Forum Nokia so I decided to create a new article:
"How to Use QSettings":http://developer.qt.nokia.com/wiki/How_to_Use_QSettings I have tested the example on my Nokia E7 and I will improve the article in the coming days :)Best regards,
LeonP.S.
Please note that the example contains very basic GUI without any layouts. My idea was just to focus on the basic usage of QSettings.
-
I found the API docs on "QSettings":http://doc.qt.nokia.com/4.7/qsettings.html with the example snippets to be sufficient.
-
Thanks Leon for you support..:)
Regards
imrrk -
[quote author="Volker" date="1306406061"]I found the API docs on "QSettings":http://doc.qt.nokia.com/4.7/qsettings.html with the example snippets to be sufficient.[/quote]
Please excuse me if you find the article useless. Qt documentation is very good and there are examples for almost everything but I think it is always good to have another example application at Qt Dev Net wiki.
10x,
Leon -
Oh, no insult intended. Every wiki article with a working snippet adds value to DevNet, IMHO.