MyToolBar::MyToolBar(QWidget *parent) :
QToolBar(parent)
{
setWindowFlags(Qt::FramelessWindowHint);
createToolBar();
}
void MyToolBar::createToolBar()
{
QAction *actSave = addAction("另存为");
actSave->setIcon(QIcon(":/images/savebtn.png"));
addSeparator();
QAction *actExit = addAction("退出");
actExit->setIcon(QIcon(":/images/closebtn.png"));
QToolButton *toolButton = new QToolButton(this);
toolButton->setIcon(QIcon(":/images/okbtn.png"));
// toolButton->setIconSize(QSize(15,15));//useless
toolButton->setText("完成");
toolButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
addWidget(toolButton);
setIconSize(QSize(18,18));//useful
}
窗体部件之QToolBar
最新推荐文章于 2024-10-10 14:53:15 发布