chore: no longer based on QMainWindow
Since most of the features that QMainWindow offered will never be used in this program. We don't need a statusbar, a menubar, etc.
This commit is contained in:
23
app/framelesswindow.cpp
Normal file
23
app/framelesswindow.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include "framelesswindow.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
||||
FramelessWindow::FramelessWindow(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_centralLayout(new QVBoxLayout(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;
|
||||
}
|
Reference in New Issue
Block a user