pineapple-pictures/app/framelesswindow.cpp
2021-01-04 13:50:09 +08:00

26 lines
675 B
C++

#include "framelesswindow.h"
#include "framelesshandler.h"
#include <QVBoxLayout>
FramelessWindow::FramelessWindow(QWidget *parent)
: QWidget(parent)
, m_centralLayout(new QVBoxLayout(this))
, m_framelessHandler(new FramelessHandler(this))
{
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);
m_centralLayout->setMargin(0);
}
void FramelessWindow::setCentralWidget(QWidget *widget)
{
if (m_centralWidget) {
m_centralLayout->removeWidget(m_centralWidget);
m_centralWidget->deleteLater();
}
m_centralLayout->addWidget(widget);
m_centralWidget = widget;
}