Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Show widget or label above all widget
Forum Updated to NodeBB v4.3 + New Features

Show widget or label above all widget

Scheduled Pinned Locked Moved Solved Qt for Python
9 Posts 3 Posters 2.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.
  • F Offline
    F Offline
    Flanagan
    wrote on last edited by
    #1

    I want to display a loading screen every time a user presses a button (a process that takes a few seconds runs).

    1a38095c-9d8f-42aa-836c-0247941e38be-image.png

    QSplashScreen does not help me because that is only used before opening the application and a QDialog is not useful for me because I want that by dragging the window the application will move along with the message Loading...

    JonBJ 1 Reply Last reply
    0
    • F Flanagan

      I want to display a loading screen every time a user presses a button (a process that takes a few seconds runs).

      1a38095c-9d8f-42aa-836c-0247941e38be-image.png

      QSplashScreen does not help me because that is only used before opening the application and a QDialog is not useful for me because I want that by dragging the window the application will move along with the message Loading...

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by JonB
      #2

      @Flanagan

      QSplashScreen does not help me because that is only used before opening the application

      Although I'm not saying it will do what you want, you can use QSplashScreen at any point in an application.

      You should look at QProgressDialog, and try to use that as it's ready-made for you. You may have to set it modal to get your drag behaviour. At least under Linux/GNOME, dragging a modal dialog drags it's parent window with it.

      F 1 Reply Last reply
      2
      • JonBJ JonB

        @Flanagan

        QSplashScreen does not help me because that is only used before opening the application

        Although I'm not saying it will do what you want, you can use QSplashScreen at any point in an application.

        You should look at QProgressDialog, and try to use that as it's ready-made for you. You may have to set it modal to get your drag behaviour. At least under Linux/GNOME, dragging a modal dialog drags it's parent window with it.

        F Offline
        F Offline
        Flanagan
        wrote on last edited by
        #3

        @JonB Ah, I did not know that about modal, I will try it

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

          Nope, on Windows 10, i set the QProcessDIalog to WindowModal or ApplicationModal and the dialog forbids me to even touch and move the MainWindow. If I set NonModal, I can move the window but the dialog stays there floating.

          JonBJ 1 Reply Last reply
          0
          • F Flanagan

            Nope, on Windows 10, i set the QProcessDIalog to WindowModal or ApplicationModal and the dialog forbids me to even touch and move the MainWindow. If I set NonModal, I can move the window but the dialog stays there floating.

            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by
            #5

            @Flanagan
            I think you will have no choice about this under Windows then. Either you won't be able to move the back (main) window at all, or you will be able to move it but it won't take the fore dialog with it (like it does under GNOME). I don't know why you want to be able to drag the back window while something is happening and have it take the dialog with it, but if you do I would look at have the dialog modeless and write your own code so that if the main window is moved you respond by moving the dialog yourself.

            1 Reply Last reply
            1
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi
              As an alternative, you can also use a custom overlay widget
              https://stackoverflow.com/questions/19362455/dark-transparent-layer-over-a-qmainwindow-in-qt/19367454#19367454

              You can disable setAttribute(Qt::WA_TransparentForMouseEvents);
              and user cannot click on MainWin while its up.
              Its inside MainWin so it follows on move.
              It uses event filter to resize it self to parent automatically.

              You can alter paint event, to only darken a sub rect if you want only part of the main looking covered.

              F 1 Reply Last reply
              1
              • mrjjM mrjj

                Hi
                As an alternative, you can also use a custom overlay widget
                https://stackoverflow.com/questions/19362455/dark-transparent-layer-over-a-qmainwindow-in-qt/19367454#19367454

                You can disable setAttribute(Qt::WA_TransparentForMouseEvents);
                and user cannot click on MainWin while its up.
                Its inside MainWin so it follows on move.
                It uses event filter to resize it self to parent automatically.

                You can alter paint event, to only darken a sub rect if you want only part of the main looking covered.

                F Offline
                F Offline
                Flanagan
                wrote on last edited by
                #7

                @mrjj I was trying to do something similar, use a QWidget above as a screen but it didn't come out on top.

                I've seen that person use raise(), which was what I needed, thanks!

                mrjjM 1 Reply Last reply
                1
                • F Flanagan

                  @mrjj I was trying to do something similar, use a QWidget above as a screen but it didn't come out on top.

                  I've seen that person use raise(), which was what I needed, thanks!

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Flanagan
                  Hi. good to hear.
                  The thing he does with the event filter is also pretty handy as the overlay then auto resize
                  if user resize the main window.

                  F 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @Flanagan
                    Hi. good to hear.
                    The thing he does with the event filter is also pretty handy as the overlay then auto resize
                    if user resize the main window.

                    F Offline
                    F Offline
                    Flanagan
                    wrote on last edited by
                    #9

                    @mrjj Yeah, im using resizeEvent() of the parent widget to resize the overlay.

                    1 Reply Last reply
                    1

                    • Login

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