Skip to content

Commit

Permalink
feat: use native window on mac
Browse files Browse the repository at this point in the history
Change-Id: I63493ab44b4a20f705e2fd3e798ad47f2eb9e9f8
  • Loading branch information
Iceyer authored and deepin-gerrit committed Nov 28, 2017
1 parent 290fbae commit b940476
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/app/app.pro
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ SOURCES += \
bmwindow.cpp \
main.cpp

linux {

unix {
INCLUDEPATH += $$PWD/linux
HEADERS += $$PWD/linux/bmwindow.h
}

linux {


binary.path = $${PREFIX}/bin
binary.files = $${OUT_PWD}/deepin-boot-maker
Expand All @@ -57,7 +60,7 @@ INSTALLS += binary desktop hicolor dman

}

!linux {
win {
INCLUDEPATH += $$PWD/other
HEADERS += $$PWD/other/bmwindow.h
}
Expand Down
13 changes: 11 additions & 2 deletions src/app/bmwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,20 @@ BMWindow::BMWindow(QWidget *parent)
qApp->setApplicationDescription(descriptionText);

auto title = titlebar();
auto flags = title->windowFlags() & ~Qt::WindowMaximizeButtonHint;
auto flags = windowFlags() & ~Qt::WindowMaximizeButtonHint;
#ifndef Q_OS_LINUX
flags = flags & ~Qt::WindowSystemMenuHint;
#endif
setWindowFlags(flags);
// TODO: read it from parent
#ifdef Q_OS_MAC
titlebar()->setWindowFlags(flags);

QPalette pal(palette());
pal.setColor(QPalette::Background, Qt::white);
setAutoFillBackground(true);
setPalette(pal);
#endif

title->setTitle("");
title->setIcon(QIcon(":/theme/light/image/deepin-boot-maker.svg"));
Expand All @@ -135,7 +144,7 @@ BMWindow::BMWindow(QWidget *parent)
mainLayout->setMargin(0);
mainLayout->setSpacing(0);

#ifdef Q_OS_LINUX
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
auto centralWidget = new QWidget;
centralWidget->setLayout(mainLayout);
setCentralWidget(centralWidget);
Expand Down

0 comments on commit b940476

Please sign in to comment.