Qt状态栏(statusbar)的使用
1. 新建项目
2.ui不添加
3.显示效果
![(https://img-blog.csdnimg.cn/20201112182315159.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM5NjAyNzYy,size_16,color_FFFFFF,t_70#pic_center)
4.附代码(.cpp)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) {<!-- --> ui->setupUi(this); QLabel *titleLabel = new QLabel;//定义一个label titleLabel->setText("Qt状态栏(statusbar)的使用!");//label显示内容 statusBar()->addWidget(titleLabel);//将label加到状态栏上 } MainWindow::~MainWindow() {<!-- --> delete ui; } |