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. The ProgressBar doesnt close Properly

The ProgressBar doesnt close Properly

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 224 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.
  • sankarapandiyanS Offline
    sankarapandiyanS Offline
    sankarapandiyan
    wrote on last edited by
    #1

    Tried to close the ProgressBar , by giving the condition , But it doesnt hide

    void Timer::SetValueProgress()
    {
    // QMessageBox::information(this,"Progressbar");
    popup_progress->setValue(popup_progress->value()+1);
    int value = popup_progress->value() + 1;
    popup_progress->setValue(value);
    if ( value == 100 )
    {
    popup_progress->hide();
    }
    }
    Is there is any Mistake in this Code

    J.HilkJ jsulmJ 2 Replies Last reply
    0
    • sankarapandiyanS sankarapandiyan

      Tried to close the ProgressBar , by giving the condition , But it doesnt hide

      void Timer::SetValueProgress()
      {
      // QMessageBox::information(this,"Progressbar");
      popup_progress->setValue(popup_progress->value()+1);
      int value = popup_progress->value() + 1;
      popup_progress->setValue(value);
      if ( value == 100 )
      {
      popup_progress->hide();
      }
      }
      Is there is any Mistake in this Code

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @sankarapandiyan
      I would say, that totally depends on how often you call setValueProgress()
      and what the initial value of the progress bar is.

      Hard to tell, but an obvious trip fall is if ( value == 100 ) is your value 99 and you call setValueProgress, it becomes 101 and will never hide itself


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      2
      • sankarapandiyanS sankarapandiyan

        Tried to close the ProgressBar , by giving the condition , But it doesnt hide

        void Timer::SetValueProgress()
        {
        // QMessageBox::information(this,"Progressbar");
        popup_progress->setValue(popup_progress->value()+1);
        int value = popup_progress->value() + 1;
        popup_progress->setValue(value);
        if ( value == 100 )
        {
        popup_progress->hide();
        }
        }
        Is there is any Mistake in this Code

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

        @sankarapandiyan said in The ProgressBar doesnt close Properly:

        popup_progress->setValue(popup_progress->value()+1);
        int value = popup_progress->value() + 1;
        popup_progress->setValue(value);

        Why do you set the value twice?!
        Lets say popup_progress->value() is 99, then:

        popup_progress->setValue(popup_progress->value()+1); // here you set it to 100
        int value = popup_progress->value() + 1; // value is 101 now
        popup_progress->setValue(value); // you set 101 here
        

        So, value is never 100 in my example!

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

        1 Reply Last reply
        2

        • Login

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