Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. QStackedWidget as 'window management' for embedded eglfs device?
Forum Updated to NodeBB v4.3 + New Features

QStackedWidget as 'window management' for embedded eglfs device?

Scheduled Pinned Locked Moved Solved Language Bindings
17 Posts 2 Posters 6.1k 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.
  • J Offline
    J Offline
    jars121
    wrote on last edited by jars121
    #7

    Never mind me, it looks like I had accidentally 'returned' the underlying function; I must have changed some code when converting from the multi-window to single-window approach.

    EDIT: I spoke too soon. I just ran an archived version of the multi-window application, which executes perfectly. The setting of the flags hasn't changed, but it looks like calling the .setCurrentIndex() function is stopping the execution of the background function.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #8

      It looks like you are trying to create something similar to QWizard::setField, isn't it ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jars121
        wrote on last edited by
        #9

        Not quite @SGaist, but not too dissimilar.

        In short, I have a background function which runs multiple times a second to update the GUI elements on the screen (QWidgets, QLabels, QPixmaps, etc.). On the old version of the application, I could open a new window (Window.show()) and this function would continue to operate. Now that I've changed to QStackedLayout, this background function ceases when I call .setCurrentIndex(x) to change the window shown. I'm going through the code step-by-step at the moment, but I've set some print() commands at the key points in the application and it certainly appears that the .setCurrentIndex() is stopping the function.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jars121
          wrote on last edited by
          #10

          I think I've found the culprit. On my multi-window version of the application, the updating of all GUI elements was driven by a paintEvent on the main QWidget, which is only on the main window. When I .show() a new window on top of the main window, calling .update() on this QWidget worked, and allowed for the updating of all QWidget, QLabels, etc., even if they were on a different window.

          On the QStackedLayout application however, calling .update() doesn't work if the .currentIndex of the QStackedLayout doesn't have this main QWidget! So I'm calling .update() when changing between pages of the application, but the paintEvent() is only run when the .currentIndex() is on the main page.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jars121
            wrote on last edited by
            #11

            I've separated the .painEvent() from the updating of the GUI elements on the other pages, and used a custom signal to paint the elements on the non-main page when .setCurrentIndex() is called. It's a bit of a workaround, but I'm much more comfortable now that I can tailor the updating of the separate page's GUI elements independent of the main page's main QWidget.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #12

              The paint event is not meant to trigger updates somewhere else.

              What kind of update were you triggering and why in the paint event ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jars121
                wrote on last edited by
                #13

                I have 10+ QWidgets on the main page, and I only want to paint the main page once, so when the paintEvent of the main widget is called, I paint all the other widgets as well.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #14

                  Widget painting can happen for several reasons. For example because you are moving it, because you are moving something else on top of your application etc. Usually it won't happen only once.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    jars121
                    wrote on last edited by
                    #15

                    I understand and agree, I was using the .update() call to force the paintEvent() and then change the colour/text of the other QWidgets/QLabels at the same time. It's all working nicely now that I've separated the paintEvent() from the GUI updating of the non-Main page QWidgets and QLabels :)

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #16

                      Great !

                      In that case, since you have everything working, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        jars121
                        wrote on last edited by
                        #17

                        Done, thanks as always @SGaist!

                        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