QT 增加最小化按钮
2021-09-17 本文已影响0人
c之气三段
默认对话框
Qt::WindowFlags flags=Qt::Dialog;
flags|=Qt::WindowMinimizeButtonHint;
flags|=Qt::WindowMaximizeButtonHint;
flags|= Qt::WindowCloseButtonHint;
setWindowFlags(ture);
自定义
QToolButton* closeButton = new QToolButton(this);//构建关闭按钮
QIcon closeIcon(":/titleCoin/Resources/close.png");//获取关闭按钮图标"
connect(addTitleBar(closeButton, closeIcon,"关闭"), &QToolButton::clicked, this, &PWindow::close);
QToolButton* minimizeButton = new QToolButton(this);
QIcon minimizeIcon(":/titleCoin/Resources/min.png");
connect(addTitleBar(minimizeButton, minimizeIcon,"最小化"), &QToolButton::clicked, this, &PWindow::showMinimized);
QToolButton* setButton = new QToolButton(this);
QIcon setIcon(":/titleCoin/Resources/set.png");
connect(addTitleBar(setButton, setIcon,"设置"), &QToolButton::clicked, this, &PWindow::showMinimized);//需要实现这个方法