Qt状态栏

QStatusBar

    QStatusBar* stBar = statusBar();

    QLabel* lb1 = new QLabel("标签1");       //
    lb1->setAlignment(Qt::AlignLeft);       //左对齐
    QLabel* lb2 = new QLabel("标签2");
    QLineEdit* edit = new QLineEdit("edit");
    QPushButton* btnOpen = new QPushButton("打开");

    stBar->addWidget(lb1);
    stBar->addWidget(lb2);
    stBar->addPermanentWidget(edit);
    stBar->addPermanentWidget(btnOpen);
    //stBar->showMessage("显示");

    lb1->setText("显示1");
    edit->setText("空内容");

Qt状态栏_第1张图片

(1)addPermanentWidget:在状态栏的右半部分添加组件。It is is located at the far right of the status bar

(2)addWidget:在状态栏的左半部分添加组件。The widget is located to the far left of the first permanent widget and may be obscured by temporary messages.

(3)showMessage:Hides the normal status indications and displays the given message for the specified number of milli-seconds

你可能感兴趣的:(QT,qt,开发语言)