add showMacWindowButton
This commit is contained in:
parent
ce69d1a4c5
commit
de1d6abaf0
|
@ -1,5 +1,6 @@
|
|||
#include "flwindow.h"
|
||||
#include "../../framelesshelper.h"
|
||||
#include "../../utilities.h"
|
||||
|
||||
#include <QScreen>
|
||||
#include <QVBoxLayout>
|
||||
|
@ -30,6 +31,13 @@ void FLWindow::initFramelessWindow()
|
|||
helper->setHitTestVisible(m_maximizeButton);
|
||||
helper->setHitTestVisible(m_closeButton);
|
||||
helper->install();
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
m_minimizeButton->hide();
|
||||
m_maximizeButton->hide();
|
||||
m_closeButton->hide();
|
||||
Utilities::showMacWindowButton(windowHandle());
|
||||
#endif
|
||||
}
|
||||
|
||||
void FLWindow::showEvent(QShowEvent *event)
|
||||
|
|
|
@ -74,6 +74,7 @@ FRAMELESSHELPER_API bool unsetMacWindowHook(QWindow* w);
|
|||
FRAMELESSHELPER_API bool setMacWindowFrameless(QWindow* w);
|
||||
FRAMELESSHELPER_API bool startMacDrag(QWindow* w, const QPoint& pos);
|
||||
FRAMELESSHELPER_API Qt::MouseButtons getMacMouseButtons();
|
||||
FRAMELESSHELPER_API bool showMacWindowButton(QWindow *w);
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
}
|
||||
|
|
|
@ -223,16 +223,36 @@ bool setMacWindowFrameless(QWindow* w)
|
|||
nswindow.titlebarAppearsTransparent = true;
|
||||
nswindow.titleVisibility = NSWindowTitleHidden;
|
||||
nswindow.hasShadow = true;
|
||||
nswindow.showsToolbarButton = false;
|
||||
|
||||
nswindow.movableByWindowBackground = false;
|
||||
nswindow.movable = false;
|
||||
[nswindow standardWindowButton:NSWindowCloseButton].hidden = true;
|
||||
[nswindow standardWindowButton:NSWindowMiniaturizeButton].hidden = true;
|
||||
[nswindow standardWindowButton:NSWindowZoomButton].hidden = true;
|
||||
|
||||
nswindow.showsToolbarButton = false;
|
||||
[nswindow standardWindowButton:NSWindowCloseButton].hidden = true;
|
||||
[nswindow standardWindowButton:NSWindowMiniaturizeButton].hidden = true;
|
||||
[nswindow standardWindowButton:NSWindowZoomButton].hidden = true;
|
||||
|
||||
[nswindow makeKeyWindow];
|
||||
return true;
|
||||
}
|
||||
|
||||
bool showMacWindowButton(QWindow *w)
|
||||
{
|
||||
NSView* view = reinterpret_cast<NSView *>(w->winId());
|
||||
if (view == nullptr)
|
||||
return false;
|
||||
NSWindow* nswindow = [view window];
|
||||
if (nswindow == nullptr)
|
||||
return false;
|
||||
|
||||
nswindow.showsToolbarButton = true;
|
||||
[nswindow standardWindowButton:NSWindowCloseButton].hidden = false;
|
||||
[nswindow standardWindowButton:NSWindowMiniaturizeButton].hidden = false;
|
||||
[nswindow standardWindowButton:NSWindowZoomButton].hidden = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool startMacDrag(QWindow* w, const QPoint& pos)
|
||||
{
|
||||
NSView* view = reinterpret_cast<NSView *>(w->winId());
|
||||
|
|
Loading…
Reference in New Issue