Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Restoring previous session of an application
Qt 6.11 is out! See what's new in the release blog

Restoring previous session of an application

Scheduled Pinned Locked Moved General and Desktop
41 Posts 7 Posters 36.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    goetz
    wrote on last edited by
    #16

    Posting in this timeline:

    • 2 hours, 36 minutes ago
    • 2 hours, 19 minutes ago
    • 22 minutes ago

    Do you really expect being taken serious when crying like a childish kiddie? Come on, get serious!

    -And look at your code if it is ever able to do what you expect it to do!-

    -Or better: Use a debugger, set breakpoints and step through the code. You will find the error yourself then within seconds.-

    -Hopefully nobody will tell you the solution here, as it has no learning effect.-

    EDIT: wrong read of code, sorry

    http://www.catb.org/~esr/faqs/smart-questions.html

    1 Reply Last reply
    0
    • I Offline
      I Offline
      imrrk
      wrote on last edited by
      #17

      hello leon
      when i call it in constructor,then also it wont work..

      regards
      imrrk

      1 Reply Last reply
      0
      • I Offline
        I Offline
        imrrk
        wrote on last edited by
        #18

        Volker,I have tried so far and also i have pasted the code ,but according to you it might be very little as your r a qt geek..I just need a direction to proceed.

        Regards
        imrrk

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #19

          I personally would do something with the color read from the settings....

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • I Offline
            I Offline
            imrrk
            wrote on last edited by
            #20

            Hi volker thanks for your reply,you mean to say that

            @QColor r("red");
            r.name();
            settings.setValue("color",r.name());@

            I should check these lines..?

            regards
            imrrk

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #21

              no.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • I Offline
                I Offline
                imrrk
                wrote on last edited by
                #22

                Then?which lines i have to check.

                regards
                imrrk

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #23

                  Think yourself. It's obvious....

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • I Offline
                    I Offline
                    imrrk
                    wrote on last edited by
                    #24

                    ok.I think these lines then...
                    QColor r(settings.value("color").toString());

                    am I right?

                    regards
                    imrrk

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      goetz
                      wrote on last edited by
                      #25

                      You're heading towards one of the hotspots...

                      http://www.catb.org/~esr/faqs/smart-questions.html

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        giesbert
                        wrote on last edited by
                        #26

                        Hi imrrk,

                        one suggestion:

                        look at the docs of QColor and QSettings.
                        Then you should find it.

                        Regards

                        Gerolf

                        Nokia Certified Qt Specialist.
                        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                        1 Reply Last reply
                        0
                        • I Offline
                          I Offline
                          imrrk
                          wrote on last edited by
                          #27

                          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

                          1 Reply Last reply
                          0
                          • I Offline
                            I Offline
                            imrrk
                            wrote on last edited by
                            #28

                            Hello Volker and gerolf,
                            whether it should be done this way..

                            QColor r(settings.value(“color”).toString(),ui->pushbutton->setcolor(r));

                            regards
                            imrrk

                            1 Reply Last reply
                            0
                            • V Offline
                              V Offline
                              vinb
                              wrote on last edited by
                              #29

                              Hi imrrk,
                              You get a lot of help here, so please dont email me for something like this.

                              1 Reply Last reply
                              0
                              • I Offline
                                I Offline
                                imrrk
                                wrote on last edited by
                                #30

                                ok ,Whether I am heading the correct way..?

                                regards
                                imrrk

                                1 Reply Last reply
                                0
                                • Z Offline
                                  Z Offline
                                  ZapB
                                  wrote on last edited by
                                  #31

                                  immrk, is all this work for a school assignment or an actual job?

                                  Nokia Certified Qt Specialist
                                  Interested in hearing about Qt related work

                                  1 Reply Last reply
                                  0
                                  • G Offline
                                    G Offline
                                    goetz
                                    wrote on last edited by
                                    #32

                                    [quote author="imrrk" date="1306333461"]ok ,Whether I am heading the correct way..?
                                    [/quote]

                                    no.

                                    http://www.catb.org/~esr/faqs/smart-questions.html

                                    1 Reply Last reply
                                    0
                                    • I Offline
                                      I Offline
                                      imrrk
                                      wrote on last edited by
                                      #33

                                      hello Volker,Can u give me some hints then..

                                      regards
                                      imrrk

                                      1 Reply Last reply
                                      0
                                      • G Offline
                                        G Offline
                                        goetz
                                        wrote on last edited by
                                        #34

                                        [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....

                                        http://www.catb.org/~esr/faqs/smart-questions.html

                                        1 Reply Last reply
                                        0
                                        • I Offline
                                          I Offline
                                          imrrk
                                          wrote on last edited by
                                          #35

                                          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

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved