Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Show UI Design not in main metod is possible?
Qt 6.11 is out! See what's new in the release blog

Show UI Design not in main metod is possible?

Scheduled Pinned Locked Moved C++ Gurus
17 Posts 3 Posters 7.9k 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.
  • F Offline
    F Offline
    Franzk
    wrote on last edited by
    #2

    [quote author="Vetryaspa" date="1307640421"]@void RootViewer::lanciaSplash(){

    qDebug()<<"SPLASH"<<endl;
    
    Splash showSplash;
    showSplash.showFullScreen();
    

    }@
    [/quote]

    The showFullScreen() function is probably non-blocking. The splash screen will be destroyed immediately after you showed it, because it is created on the stack. This means the screen will not be showed at all. A better solution would most likely be:

    @
    void RootViewer::lanciaSplash(){

    qDebug()<<"SPLASH"<<endl;
    
    Splash *showSplash = new Splash;
    showSplash->setWindowAttributes(WA_DeleteOnClose, true); // delete the thing when we're done showing
    showSplash->showFullScreen();
    

    }@

    The widget is created on the heap and it stays in existence until it is explicitly deleted.

    "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

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

    1 Reply Last reply
    0
    • V Offline
      V Offline
      Vetryaspa
      wrote on last edited by
      #3

      Tnx for reply but I have an error: 'class Splash' has no member named 'setWindowAttributes'

      I have to import somthing?

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Franzk
        wrote on last edited by
        #4

        Oh, it's
        @showSplash->setAttribute(Qt::WA_DeleteOnClose, true);@

        "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

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

        1 Reply Last reply
        0
        • V Offline
          V Offline
          Vetryaspa
          wrote on last edited by
          #5

          I have just make but..... error: 'class Splash' has no member named 'setWindowAttributes'

          :S no change

          1 Reply Last reply
          0
          • F Offline
            F Offline
            Franzk
            wrote on last edited by
            #6

            Don't use setWindowAttributes, use setAttribute as I stated in my previous post.

            "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

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

            1 Reply Last reply
            0
            • V Offline
              V Offline
              Vetryaspa
              wrote on last edited by
              #7

              ok now build but not show the screen... :(

              1. but I have read something about GUI Thread, you know something about this?

              2. I try to do the same metod to show Root?

              1 Reply Last reply
              0
              • F Offline
                F Offline
                Franzk
                wrote on last edited by
                #8

                [quote author="Vetryaspa" date="1307691735"]1. but I have read something about GUI Thread, you know something about this?[/quote]I know something about the GUI thread, but I don't know enough about your code to see where this question becomes relevant.

                [quote]2. I try to do the same metod to show Root?[/quote]Not necessary, since rootView stays in scope during the run of the application.

                "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

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

                1 Reply Last reply
                0
                • V Offline
                  V Offline
                  Vetryaspa
                  wrote on last edited by
                  #9

                  but the method to show the view is currect?

                  You have sample that I can See?

                  1 Reply Last reply
                  0
                  • V Offline
                    V Offline
                    Vetryaspa
                    wrote on last edited by
                    #10

                    An idea: you have said that the splash are quickly destroyed, tha exist a metod where i can intercept the event of closing of the splash?

                    so I can control if it will be created or not....
                    whit destructor method [ ~Splash() ] I can see this

                    [Edit:] I have try and the destructor will not call

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      Franzk
                      wrote on last edited by
                      #11

                      I don't know the contents of your showFullScreen() function, so I don't have any further suggestions.

                      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

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

                      1 Reply Last reply
                      0
                      • V Offline
                        V Offline
                        Vetryaspa
                        wrote on last edited by
                        #12

                        some sample?

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

                          Use the debugger and look when your classes are constructed, methods called and destroyed.

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

                          1 Reply Last reply
                          0
                          • V Offline
                            V Offline
                            Vetryaspa
                            wrote on last edited by
                            #14

                            Volker I see when the constructor al call but if I put

                            @qDebug() << "Destruct"<<endl;@

                            in the ~Splash() distructor it was not show in the Application Output. then in theory it was not destroied?

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

                              If you use the pointer, then it's only destroyed when you call delete on it.

                              Problem could be caused by the not yet running event loop. You might want to try

                              @
                              app.processEvents();
                              // or
                              qApp->processEvents();
                              @

                              to work around this.

                              Did you try "QSplashScreen":http://doc.qt.nokia.com/4.7/qsplashscreen.html?

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

                              1 Reply Last reply
                              0
                              • V Offline
                                V Offline
                                Vetryaspa
                                wrote on last edited by
                                #16

                                where I have to put your code? and what a have to write inside the processEvents(); metod?

                                then I control Qsplash

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

                                  The sample is in QSplashScreen's documentation... have a look over there.

                                  You are not required to write a processEvents() method, but to use the provided one...

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

                                  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