screen is two 1920*1080;
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
setWindowFlags(Qt::FramelessWindowHint );
InitWidget();
QTimer* ptime = new QTimer(this);
ptime->start(1000);
connect(ptime, &QTimer::timeout, this, [&]()
{ qDebug() << "max:" << m_bMainWndMax << " - " << this->size() << "- pos:" << this->geometry(); }
);
}
void Widget::slotMaxWindow()
{ m_bMainWndMax = true; QWidget::showMaximized(); }
void Widget::slotShowNormalWindow()
{ m_bMainWndMax = false; QWidget::showNormal(); }
void Widget::InitWidget()
{
this->setMinimumSize(500, 400);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(2, 2, 2, 2);
QPushButton* pMaxBtn = new QPushButton(this);
pMaxBtn->setText("max");
layout->addWidget(pMaxBtn);
QPushButton* pNormalBtn = new QPushButton(this);
pNormalBtn->setText("normal");
layout->addWidget(pNormalBtn);
connect(pMaxBtn, &QPushButton::clicked, this, &Widget::slotMaxWindow);
connect(pNormalBtn, &QPushButton::clicked, this, &Widget::slotShowNormalWindow);
}
int main(int argc, char *argv[])
{ QApplication a(argc, argv); Widget win; win.show(); return a.exec(); }