October 4, 2011

Endless Endless
Lab Rat
83 posts

[Solved] QFrame not showing up

 

I have a UI form called MonitorWindow. In its constructor, I instantiate a QWidget class called StatusBar. See the constructor code below:

  1. MonitorWindow::MonitorWindow(QWidget *parent) :
  2.     QWidget(parent),
  3.     ui(new Ui::MonitorWindow)
  4. {
  5.     ui->setupUi(this);
  6.  
  7.     StatusBar *statusBar = new StatusBar(this);
  8. }

Then, in the constructor for StatusBar, I set up the QFrame as folows:
  1. StatusBar::StatusBar(QWidget *parent) :
  2.     QWidget(parent)
  3. {
  4.     QFrame *statusFrame = new QFrame(this);
  5.     statusFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
  6.     statusFrame->setLineWidth(1);
  7.     statusFrame->resize(300, 42);
  8.     statusFrame->move(0, 20);
  9. }

My MainWindow UI shows up with the other objects on it, but StatusBar doesn’t show up at all. What am I doing wrong?

3 replies

October 4, 2011

Vass Vass
Ant Farmer
743 posts

Try

  1.  
  2. ...
  3. StatusBar *statusBar = new StatusBar(this);
  4. statusBar->show();

 Signature 


Vasiliy

October 4, 2011

Endless Endless
Lab Rat
83 posts

Unfortunately that doesn’t make any difference.

October 4, 2011

Volker Volker
Ant Farmer
5428 posts

You set a parent in the StatusBar widget. It’s likely that it is hidden by the other widgets of your MainWindow. You should put it into a layout.

 
  ‹‹ QML Map elements in QtMobility 1.2: binary break?      [Solved] ListElements (ListModel) defined in other qml files? ››

You must log in to post a reply. Not a member yet? Register here!