Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] QFrame not showing up
QtWS25 Last Chance

[Solved] QFrame not showing up

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 7.2k 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.
  • E Offline
    E Offline
    Endless
    wrote on last edited by
    #1

    I have a UI form called MonitorWindow. In its constructor, I instantiate a QWidget class called StatusBar. See the constructor code below:
    @
    MonitorWindow::MonitorWindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MonitorWindow)
    {
    ui->setupUi(this);

    StatusBar *statusBar = new StatusBar(this);
    

    }
    @
    Then, in the constructor for StatusBar, I set up the QFrame as folows:
    @
    StatusBar::StatusBar(QWidget *parent) :
    QWidget(parent)
    {
    QFrame *statusFrame = new QFrame(this);
    statusFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
    statusFrame->setLineWidth(1);
    statusFrame->resize(300, 42);
    statusFrame->move(0, 20);
    }
    @
    My MainWindow UI shows up with the other objects on it, but StatusBar doesn't show up at all. What am I doing wrong?

    1 Reply Last reply
    1
    • V Offline
      V Offline
      vsorokin
      wrote on last edited by
      #2

      Try
      @
      ...
      StatusBar *statusBar = new StatusBar(this);
      statusBar->show();
      @

      --
      Vasiliy

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Endless
        wrote on last edited by
        #3

        Unfortunately that doesn't make any difference.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          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.

          http://www.catb.org/~esr/faqs/smart-questions.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