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. [SOLVED]How to set the position of progress bar at right corner of statusbar
QtWS25 Last Chance

[SOLVED]How to set the position of progress bar at right corner of statusbar

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 15.3k 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.
  • A Offline
    A Offline
    adnan
    wrote on last edited by
    #1

    @progressBar=new QProgressBar(ui->statusBar);
    progressBar->setMaximumSize(170,19);
    // position of progress bar should be extreme right
    ui->statusBar->addWidget(progressBar); @

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      I don't know your specific use case but you could use "a permanent widget":http://qt-project.org/doc/qt-4.8/qstatusbar.html#addPermanentWidget
      Which is situated at the right.

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      1
      • A Offline
        A Offline
        adnan
        wrote on last edited by
        #3

        Thanks a lot! It did the job.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          astodolski
          wrote on last edited by
          #4

          [quote author="adnan" date="1345363580"]@progressBar=new QProgressBar(ui->statusBar);
          progressBar->setMaximumSize(170,19);
          // position of progress bar should be extreme right
          ui->statusBar->addWidget(progressBar);@ [/quote]

          For some reason mine is at the extreme left:

          @
          MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
          {
          ui->setupUi(this);
          progressBar = new QProgressBar(ui->statusBar);
          progressBar->setAlignment(Qt::AlignRight);
          progressBar->setMaximumSize(180, 19);
          ui->statusBar->addWidget(progressBar);
          progressBar->setValue(50);
          }

          @

          I Guess addPermanentWidget is the ticket.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            adnan
            wrote on last edited by
            #5

            Instead of using
            @ ui->statusBar->addWidget(progressBar);@

            Use
            @ ui->statusBar->addPermanentWidget(progressBar);@

            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