介绍
在QMainWindow最下方有状态栏QStatusBar,相关API:帮助
Qt主要将状态栏的信息分为五大类:
- 右下角的窗口尺寸调整符号,右下角的小黑三角。提供两个方法isSizeGripEnabled()、setSizeGripEnabled(bool)设置其是否显示。
- 每个单元之间的小竖线,分割不同的控件,仔细看了看感觉也不是状态栏提供的分割控件更像是插入到其中的控件的边框线。。。这也算他一大类吧,隐藏方法:statusBar()->setStyleSheet(“QStatusBar::item{border: 0px}”);,将状态栏的所有item边框宽度设置为0
- 永久信息显示,永久信息在状态栏最右侧。通过addPermanentWidget、insertPermanentWidget,这种信息会一直显示,一般是不改变的,比如版权、作者等,特殊功能的按钮等等,本质还是widget。Permanently means that the widget may not be obscured by temporary messages. It is is located at the far right of the status bar.
- 非永久信息显示、一般信息显示,在最左侧,通过addWidget、insertWidget进行插入。同理说是信息实际是widget,可以是按钮等。
- 临时信息,临时信息封装的很简单,不需要自己newwidget了,只需要直接传入信息内容和信息显示时间即可。currentMessage、s