Skip to content

Commit

Permalink
fix: build failed on Qt 5.6.x
Browse files Browse the repository at this point in the history
Change-Id: Ie13713d748853e4b7a0829e1200e1ceedbe405a5
  • Loading branch information
zccrs committed Feb 19, 2019
1 parent c6d65f0 commit 1ca4591
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/widgets/dtitlebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,13 @@ void DTitlebarPrivate::_q_showMinimized()
targetWindow()->showMinimized();
}

#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
static Qt::WindowFlags &setWindowFlag(Qt::WindowFlags &flags, Qt::WindowType type, bool on)
{
return on ? (flags |= type) : (flags &= ~int(type));
}
#endif

void DTitlebarPrivate::_q_onTopWindowMotifHintsChanged(quint32 winId)
{
D_QC(DTitlebar);
Expand Down Expand Up @@ -426,9 +433,15 @@ void DTitlebarPrivate::_q_onTopWindowMotifHintsChanged(quint32 winId)
&& functions_hints.testFlag(DWindowManagerHelper::FUNC_RESIZE));
closeButton->setEnabled(functions_hints.testFlag(DWindowManagerHelper::FUNC_CLOSE));
// sync button state
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
disableFlags.setFlag(Qt::WindowMinimizeButtonHint, !minButton->isEnabled());
disableFlags.setFlag(Qt::WindowMaximizeButtonHint, !maxButton->isEnabled());
disableFlags.setFlag(Qt::WindowCloseButtonHint, !closeButton->isEnabled());
#else
setWindowFlag(disableFlags, Qt::WindowMinimizeButtonHint, !minButton->isEnabled());
setWindowFlag(disableFlags, Qt::WindowMaximizeButtonHint, !maxButton->isEnabled());
setWindowFlag(disableFlags, Qt::WindowCloseButtonHint, !closeButton->isEnabled());
#endif

if (titlePadding) {
titlePadding->setFixedSize(buttonArea->size());
Expand Down

0 comments on commit 1ca4591

Please sign in to comment.