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. showMessage and updating progress bar, emitting signals even after splash screen is gone when using connect().
Forum Updated to NodeBB v4.3 + New Features

showMessage and updating progress bar, emitting signals even after splash screen is gone when using connect().

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 906 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.
  • M Offline
    M Offline
    Madhavi
    wrote on last edited by Madhavi
    #1

    Re: How to update progress bar?

    I am updating the progress bar using connect(senderInstance, &SenderClass::signalMethod,
    receiverInstance, &ReceiverClass::slotMethod) method only.
    But this is some how disturbing the way of loading SEQENCE of other start up dll's.
    When I put logs I am seeing the slotMethod is still invoked by QT after the splash screen is hidden and out of focus..

    I am using below code for updating progress bar
    if (_progressBar != nullptr)
    { _progressBar->setValue(_progressBar->value() + progress);
    _progressBarLabel->repaint();
    repaint();
    }
    After replacing the repaint() with update(), the issue is gone. And I reduced some signal emits also.
    What can be the cause of this issue?

    jsulmJ 1 Reply Last reply
    0
    • M Madhavi

      Re: How to update progress bar?

      I am updating the progress bar using connect(senderInstance, &SenderClass::signalMethod,
      receiverInstance, &ReceiverClass::slotMethod) method only.
      But this is some how disturbing the way of loading SEQENCE of other start up dll's.
      When I put logs I am seeing the slotMethod is still invoked by QT after the splash screen is hidden and out of focus..

      I am using below code for updating progress bar
      if (_progressBar != nullptr)
      { _progressBar->setValue(_progressBar->value() + progress);
      _progressBarLabel->repaint();
      repaint();
      }
      After replacing the repaint() with update(), the issue is gone. And I reduced some signal emits also.
      What can be the cause of this issue?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Madhavi said in showMessage and updating progress bar, emitting signals even after splash screen is gone when using connect().:

      What can be the cause of this issue?

      Of which issue actually? Please explain better.
      Why do you call repaint at all?
      This should not be needed if implemented properly.

      If the issue is "When I put logs I am seeing the slotMethod is still invoked by QT after the splash screen is gone" then disconnect the connection you did before or delete the progressBar...

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • M Offline
        M Offline
        Madhavi
        wrote on last edited by
        #3

        I have QSplashsceen class, where I need to update progress bar(With Message) to indicate the progress of dll's which are loading and running.

        So I am connecting in main.cpp like below
        connect(senderInstance, &SenderClass::signalMethod,
        receiverInstance, &ReceiverClass::slotMethod)

        And emitting signals while loading binaries. In the slot I have the below code
        if (_progressBar != nullptr)
        { _progressBar->setValue(_progressBar->value() + progress);
        _progressBarLabel->repaint();
        repaint();
        }

        With this the startup dll's loading sequence is modified. And getting sync up issues .
        By replacing repaint() with update(), the issues are gone. But why is this difference?

        How updating splash screen progress bar with repaint() effecting the sequence of dll loading, which ultimately causing the sync up issues.

        load_dlls()
        while(list of dll's) //loops through the list of dll's
        {
        runDlls();
        emit updateprogress();
        emit showMessage();
        }
        }

        M JonBJ 2 Replies Last reply
        0
        • M Madhavi

          I have QSplashsceen class, where I need to update progress bar(With Message) to indicate the progress of dll's which are loading and running.

          So I am connecting in main.cpp like below
          connect(senderInstance, &SenderClass::signalMethod,
          receiverInstance, &ReceiverClass::slotMethod)

          And emitting signals while loading binaries. In the slot I have the below code
          if (_progressBar != nullptr)
          { _progressBar->setValue(_progressBar->value() + progress);
          _progressBarLabel->repaint();
          repaint();
          }

          With this the startup dll's loading sequence is modified. And getting sync up issues .
          By replacing repaint() with update(), the issues are gone. But why is this difference?

          How updating splash screen progress bar with repaint() effecting the sequence of dll loading, which ultimately causing the sync up issues.

          load_dlls()
          while(list of dll's) //loops through the list of dll's
          {
          runDlls();
          emit updateprogress();
          emit showMessage();
          }
          }

          M Offline
          M Offline
          mpergand
          wrote on last edited by mpergand
          #4

          @Madhavi said in showMessage and updating progress bar, emitting signals even after splash screen is gone when using connect().:

          load_dlls()
          while(list of dll's) //loops through the list of dll's
          {
          runDlls();
          emit updateprogress();
          emit showMessage();
          }

          You're blocking the event loop !
          Your design is wrong, you should do something like that instead:

          void loadNextDll()  // must be a slot
          {
              if(list not empty)
              {
              load top dll in the list
              emit what ever ...
              QTimer::singleShoot(loadNextDll)
              }
          }
          
          1 Reply Last reply
          1
          • M Offline
            M Offline
            Madhavi
            wrote on last edited by
            #5

            If you don't mind will you please explain which part of the code is blocking the event loop?

            1 Reply Last reply
            0
            • M Madhavi

              I have QSplashsceen class, where I need to update progress bar(With Message) to indicate the progress of dll's which are loading and running.

              So I am connecting in main.cpp like below
              connect(senderInstance, &SenderClass::signalMethod,
              receiverInstance, &ReceiverClass::slotMethod)

              And emitting signals while loading binaries. In the slot I have the below code
              if (_progressBar != nullptr)
              { _progressBar->setValue(_progressBar->value() + progress);
              _progressBarLabel->repaint();
              repaint();
              }

              With this the startup dll's loading sequence is modified. And getting sync up issues .
              By replacing repaint() with update(), the issues are gone. But why is this difference?

              How updating splash screen progress bar with repaint() effecting the sequence of dll loading, which ultimately causing the sync up issues.

              load_dlls()
              while(list of dll's) //loops through the list of dll's
              {
              runDlls();
              emit updateprogress();
              emit showMessage();
              }
              }

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @Madhavi said in showMessage and updating progress bar, emitting signals even after splash screen is gone when using connect().:

              while(list of dll's)

              Any loop like this will block. You emit messages but do not allow the Qt event loop to run. Hence @mpergand's suggestion.

              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