| | |
| | | winStyleGroup->addAction(acrylicAction); |
| | | winStyleGroup->addAction(micaAction); |
| | | winStyleGroup->addAction(micaAltAction); |
| | | connect(winStyleGroup, &QActionGroup::triggered, this, [this, winStyleGroup](QAction *action) { |
| | | // Unset all custom style attributes first, otherwise the style will not display correctly |
| | | for (const QAction* _act : winStyleGroup->actions()) { |
| | | const QString data = _act->data().toString(); |
| | | if (data.isEmpty() || data == QStringLiteral("none")) { |
| | | continue; |
| | | } |
| | | windowAgent->setWindowAttribute(data, false); |
| | | } |
| | | const QString data = action->data().toString(); |
| | | if (data == QStringLiteral("none")) { |
| | | setProperty("custom-style", false); |
| | | } else if (!data.isEmpty()) { |
| | | windowAgent->setWindowAttribute(data, true); |
| | | setProperty("custom-style", true); |
| | | } |
| | | style()->polish(this); |
| | | }); |
| | | connect(winStyleGroup, &QActionGroup::triggered, this, |
| | | [this, winStyleGroup](QAction *action) { |
| | | // Unset all custom style attributes first, otherwise the style will not display |
| | | // correctly |
| | | for (const QAction *_act : winStyleGroup->actions()) { |
| | | const QString data = _act->data().toString(); |
| | | if (data.isEmpty() || data == QStringLiteral("none")) { |
| | | continue; |
| | | } |
| | | windowAgent->setWindowAttribute(data, false); |
| | | } |
| | | const QString data = action->data().toString(); |
| | | if (data == QStringLiteral("none")) { |
| | | setProperty("custom-style", false); |
| | | } else if (!data.isEmpty()) { |
| | | windowAgent->setWindowAttribute(data, true); |
| | | setProperty("custom-style", true); |
| | | } |
| | | style()->polish(this); |
| | | }); |
| | | |
| | | #elif defined(Q_OS_MAC) |
| | | auto darkBlurAction = new QAction(tr("Dark blur"), menuBar); |
| | |
| | | iconButton->setObjectName(QStringLiteral("icon-button")); |
| | | iconButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); |
| | | |
| | | auto pinButton = new QWK::WindowButton(); |
| | | pinButton->setCheckable(true); |
| | | pinButton->setObjectName(QStringLiteral("pin-button")); |
| | | pinButton->setProperty("system-button", true); |
| | | pinButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); |
| | | |
| | | auto minButton = new QWK::WindowButton(); |
| | | minButton->setObjectName(QStringLiteral("min-button")); |
| | | minButton->setProperty("system-button", true); |
| | |
| | | auto windowBar = new QWK::WindowBar(); |
| | | #ifndef Q_OS_MAC |
| | | windowBar->setIconButton(iconButton); |
| | | windowBar->setPinButton(pinButton); |
| | | windowBar->setMinButton(minButton); |
| | | windowBar->setMaxButton(maxButton); |
| | | windowBar->setCloseButton(closeButton); |
| | |
| | | |
| | | windowAgent->setTitleBar(windowBar); |
| | | #ifndef Q_OS_MAC |
| | | windowAgent->setHitTestVisible(pinButton, true); |
| | | windowAgent->setSystemButton(QWK::WindowAgentBase::WindowIcon, iconButton); |
| | | windowAgent->setSystemButton(QWK::WindowAgentBase::Minimize, minButton); |
| | | windowAgent->setSystemButton(QWK::WindowAgentBase::Maximize, maxButton); |
| | |
| | | |
| | | |
| | | #ifndef Q_OS_MAC |
| | | connect(windowBar, &QWK::WindowBar::pinRequested, this, [this, pinButton](bool pin){ |
| | | if (isHidden() || isMinimized() || isMaximized() || isFullScreen()) { |
| | | return; |
| | | } |
| | | setWindowFlag(Qt::WindowStaysOnTopHint, pin); |
| | | show(); |
| | | pinButton->setChecked(pin); |
| | | }); |
| | | connect(windowBar, &QWK::WindowBar::minimizeRequested, this, &QWidget::showMinimized); |
| | | connect(windowBar, &QWK::WindowBar::maximizeRequested, this, [this, maxButton](bool max) { |
| | | if (max) { |