现在的位置: 首页 > 综合 > 正文

Qt mainWindow添加状态栏,菜单栏,工具栏的Action方法

2013年09月09日 ⁄ 综合 ⁄ 共 1578字 ⁄ 字号 评论关闭

Qt mainWindow添加状态栏,菜单栏,工具栏的Action方法

 

 

 

我们可以用

QStatusBar * QMainWindow::statusBar()
const

这个函数替代上面

          msgLabel=
newQLabel;

    msgLabel->setMaximumSize(msgLabel->sizeHint());
    msgLabel->setAlignment(Qt::AlignHCenter);
    statusBar()->addWidget(msgLabel);
    statusBar()->setStyleSheet(QString("QStatusBar::item{border: 0px}"));

 (这些代码是在状态栏上加上一个label)

这些代码。在最后toolBar->addAction(openAction);后加上statusBar();

这个函数的意义就是:Returns the status bar for the main window. This function creates and returns an empty status bar if the status bar does not exist.

抱歉!评论已关闭.