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. Adding QStatusBox to form - no show ?
Forum Updated to NodeBB v4.3 + New Features

Adding QStatusBox to form - no show ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 441 Views 2 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    Part of the attached code is to add QStatusBar to the class / form .

    statusBar->showMessage does not "show" as expected.

    The test added
    statusLabel->setText("TEST Status Label");
    statusProgressBar->setTextVisible(true);

    works as expected

    Default QStatusBox works as expected in main window .
    Like to have same - QStatusBox object added to each of derived dialog form.

    **QUESTION
    What is missing in implementing in form / dialog **
    statusBar->showMessage ??

    Partial test code

    MDiChild_Form_BT::MDiChild_Form_BT(QWidget *parent) :
        QWidget(parent),
        ui(new Ui::MDiChild_Form_BT)
    {
        ui->setupUi(this);
        // create objects for the label and progress bar
        statusLabel = new QLabel(this);   works fine , text  shows at the top of form 
        //    statusProgressBar = new QProgressBar(this); works fine with default value  in the form 
        statusBar = new QStatusBar(this);
         statusBar ->show();
        statusBar->visibleRegion();
        statusBar->showMessage("TEST status bar message ",100000); time makes  no difference 
    
        statusBar ->show();
    #ifdef  BYPASS
        statusBar = new QStatusBar(this);
        statusBar->showMessage("TEST status bar message ");
        statusBar ->show();
    #endif
    
    statusLabel->setText("TEST Status Label");
    
    #ifdef BYPASS
        // set text for the label
        statusLabel->setText("Status Label");
    
        // make progress bar text invisible
        statusProgressBar->setTextVisible(true);
    #endif
    
    
        // add the two controls to the status bar
        //    ui->statusBar->addPermanentWidget(statusLabel);
        //    ui->statusBar->addPermanentWidget(statusProgressBar,1);
    
    
        //    QStatusBar *SB = new QStatusBar(); // "Status bar text ");
        //    SB->show();
        //    SB->showMessage("TESTS status bar messge ");
    
        //    statusBar()->showMessage("TEST status bar text ");
        // showMessage(const QString & message, int timeout = 0)
        //    ui->statusBar->showMessage("Status");
    
        // When the action triggered, set the progress bar at 51%
        //    statusProgressBar->setValue(51);
    
        //   createStatusBar();
        //      statusBar()->currentMessage("Test status bar curent message ");
        //    statusBar()->showMessage(tr("Ready"));
    
    }
    
    

    MDiChild_Form_BT::MDiChild_Form_BT(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MDiChild_Form_BT)
    {
    ui->setupUi(this);
    // create objects for the label and progress bar
    // statusLabel = new QLabel(this);
    // statusProgressBar = new QProgressBar(this);
    statusBar = new QStatusBar(this);
    statusBar ->show();
    statusBar->visibleRegion();
    statusBar->showMessage("TEST status bar message ",100000);
    statusBar ->show();```

    ......................

    Will appreciate suggestion towards solution, commentary on my test code style ARE unnecessary to solve the issue.

    M 1 Reply Last reply
    0
    • A Anonymous_Banned275

      Part of the attached code is to add QStatusBar to the class / form .

      statusBar->showMessage does not "show" as expected.

      The test added
      statusLabel->setText("TEST Status Label");
      statusProgressBar->setTextVisible(true);

      works as expected

      Default QStatusBox works as expected in main window .
      Like to have same - QStatusBox object added to each of derived dialog form.

      **QUESTION
      What is missing in implementing in form / dialog **
      statusBar->showMessage ??

      Partial test code

      MDiChild_Form_BT::MDiChild_Form_BT(QWidget *parent) :
          QWidget(parent),
          ui(new Ui::MDiChild_Form_BT)
      {
          ui->setupUi(this);
          // create objects for the label and progress bar
          statusLabel = new QLabel(this);   works fine , text  shows at the top of form 
          //    statusProgressBar = new QProgressBar(this); works fine with default value  in the form 
          statusBar = new QStatusBar(this);
           statusBar ->show();
          statusBar->visibleRegion();
          statusBar->showMessage("TEST status bar message ",100000); time makes  no difference 
      
          statusBar ->show();
      #ifdef  BYPASS
          statusBar = new QStatusBar(this);
          statusBar->showMessage("TEST status bar message ");
          statusBar ->show();
      #endif
      
      statusLabel->setText("TEST Status Label");
      
      #ifdef BYPASS
          // set text for the label
          statusLabel->setText("Status Label");
      
          // make progress bar text invisible
          statusProgressBar->setTextVisible(true);
      #endif
      
      
          // add the two controls to the status bar
          //    ui->statusBar->addPermanentWidget(statusLabel);
          //    ui->statusBar->addPermanentWidget(statusProgressBar,1);
      
      
          //    QStatusBar *SB = new QStatusBar(); // "Status bar text ");
          //    SB->show();
          //    SB->showMessage("TESTS status bar messge ");
      
          //    statusBar()->showMessage("TEST status bar text ");
          // showMessage(const QString & message, int timeout = 0)
          //    ui->statusBar->showMessage("Status");
      
          // When the action triggered, set the progress bar at 51%
          //    statusProgressBar->setValue(51);
      
          //   createStatusBar();
          //      statusBar()->currentMessage("Test status bar curent message ");
          //    statusBar()->showMessage(tr("Ready"));
      
      }
      
      

      MDiChild_Form_BT::MDiChild_Form_BT(QWidget *parent) :
      QWidget(parent),
      ui(new Ui::MDiChild_Form_BT)
      {
      ui->setupUi(this);
      // create objects for the label and progress bar
      // statusLabel = new QLabel(this);
      // statusProgressBar = new QProgressBar(this);
      statusBar = new QStatusBar(this);
      statusBar ->show();
      statusBar->visibleRegion();
      statusBar->showMessage("TEST status bar message ",100000);
      statusBar ->show();```

      ......................

      Will appreciate suggestion towards solution, commentary on my test code style ARE unnecessary to solve the issue.

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

      @AnneRanch
      Usually StatusBar is part of QMainWindow.

      But you can add one to a layout:

           auto statusBar=new QStatusBar;
           auto progressBar=new QProgressBar;
           statusBar->addPermanentWidget(progressBar);
           statusBar->showMessage("Hello");
           layout->addWidget(statusBar);
      
      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