自制标题栏
this->setWindowFlags(Qt::FramelessWindowHint);//去除Qt自带的标题栏
去除标题栏后为了实现窗体的窗口最大化、最小化、关闭以及移动事件,需要自定义以下操作:
1.窗口最大化事件
自制QPushButton按钮,连接到showMax()事件上
void QiXin_companyItemClass::showMax()
{
int deskWidth = QApplication::desktop()->availableGeometry().width();
int deskHeight = QApplication::desktop()->availableGeometry().height();//除去任务栏后高度
this->move(QApplication::desktop()->availableGeometry().x(), QApplication::desktop()->availableGeometry().y());
this->resize(deskWidth, deskHeight);
ui->pushButton_2->disconnect();
connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(showNorma()));
}
void showNorma()
{
QDesktopWidget* desktopWidget = QApplication::desktop();
int deskWidth = QApplication::desktop()->