QT状态栏(statusbar)用法

状态栏显示的信息分3种

1. 一般信息,用QLabel 代表

2. 永久信息,文本会一直显示在状态栏的最右边。

3. 临时信息,指定信息现实的时间。时间到即信息消失

//QLabel *locationLabel;

locationLabel = new QLabel(“July”);

locationLabel->setAlignment(Qt::AlignCenter);

locationLabel->setMinimumSize(locationLabel->sizeHint());

//QLabel *aixLabel;

aixLabel = new QLabel("“CTRL + H” for help");

//Optional

statusBar()->setStyleSheet(QString(“QStatusBar::item{border: 0px}”)); // 设置不显示label的边框

statusBar()->setSizeGripEnabled(false); //设置是否显示右边的大小控制点

statusBar()->addWidget(locationLabel);

statusBar()->addWidget(aixLabel, 1);

QLabel *per1 = new QLabel(“Ready1”, this);

QLabel *per2 = new QLabel(“Ready2”, this);

QLabel *per3 = new QLabel(“Ready3”, this);

statusBar()->addPermanentWidget(per1); //现实永久信息

statusBar()->addPermanentWidget(per2);

statusBar()->insertPermanentWidget(2, per3);

statusBar()->showMessage(“Status is here…”, 3000); // 显示临时信息,时间3秒钟.

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值