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. QScrollBar values changes when a modeless dialog is created
QtWS25 Last Chance

QScrollBar values changes when a modeless dialog is created

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 281 Views
  • 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.
  • S Offline
    S Offline
    Sangeetha24
    wrote on last edited by
    #1

    In my application, I am creating a QListWidget with customized QScrollBar. If I select a list item, then I have made a modeless dialog box (to display msgs like "Processing.....") before loading another GUI screen.

    To make the modeless dialog visible immediately, QCoreApplication::processEvents() is called.
    When this line gets executed, my modeless dialog starts visible and my scrollbar goes to the state like it is disabled.(Image attached for reference)

    After the modeless dialog is gone, then the QScrollBar is normal again.

    1.Why during the execution of modeless dialog, scrollbar changes its value?
    2.How to make the scrollbar normally visible during the execution of modeless dialog box?

    ScrollBar.PNG

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      I'm guessing you're doing something like this:

      • show dialog
      • call processEvents()
      • do some lengthy processing
      • hide dialog

      Is that true? If yes then that's the wrong way to do it. Your window probably freezes and scrollbar just stops repainting.

      The better way to do it is:

      • show dialog
      • start lengthy operation on another thread
      • when the operation is done signal main thread and close dialog in a slot

      This way your main thread will keep processing events, window won't freeze and scrollbar should be fine.

      S 1 Reply Last reply
      4
      • Chris KawaC Chris Kawa

        I'm guessing you're doing something like this:

        • show dialog
        • call processEvents()
        • do some lengthy processing
        • hide dialog

        Is that true? If yes then that's the wrong way to do it. Your window probably freezes and scrollbar just stops repainting.

        The better way to do it is:

        • show dialog
        • start lengthy operation on another thread
        • when the operation is done signal main thread and close dialog in a slot

        This way your main thread will keep processing events, window won't freeze and scrollbar should be fine.

        S Offline
        S Offline
        Sangeetha24
        wrote on last edited by
        #3

        @Chris-Kawa Thanks.. Will try the same..

        mrjjM 1 Reply Last reply
        0
        • S Sangeetha24

          @Chris-Kawa Thanks.. Will try the same..

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

          @Sangeetha24
          Hi
          Depepending on what the operation is, you might be able to use
          https://doc.qt.io/qt-5/qtconcurrent-index.html

          This sample sounds like what you are trying.

          https://doc.qt.io/qt-5/qtconcurrent-progressdialog-example.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