forked from PrismLauncher/PrismLauncher
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request PrismLauncher#2360 from PrismLauncher/backport-234…
…8-to-release-8.x [Backport release-8.x] Use proxy style to force ActivateItemOnSingleClick off
- Loading branch information
Showing
5 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
/* | ||
* Prism Launcher - Minecraft Launcher | ||
* Copyright (C) 2024 TheKodeToad <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "HintOverrideProxyStyle.h" | ||
|
||
int HintOverrideProxyStyle::styleHint(QStyle::StyleHint hint, | ||
const QStyleOption* option, | ||
const QWidget* widget, | ||
QStyleHintReturn* returnData) const | ||
{ | ||
if (hint == QStyle::SH_ItemView_ActivateItemOnSingleClick) | ||
return 0; | ||
|
||
return QProxyStyle::styleHint(hint, option, widget, returnData); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
/* | ||
* Prism Launcher - Minecraft Launcher | ||
* Copyright (C) 2024 TheKodeToad <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <QProxyStyle> | ||
#include <iostream> | ||
|
||
/// Used to override platform-specific behaviours which the launcher does work well with. | ||
class HintOverrideProxyStyle : public QProxyStyle { | ||
Q_OBJECT | ||
public: | ||
HintOverrideProxyStyle(QStyle* style) : QProxyStyle(style) {} | ||
|
||
int styleHint(QStyle::StyleHint hint, | ||
const QStyleOption* option = nullptr, | ||
const QWidget* widget = nullptr, | ||
QStyleHintReturn* returnData = nullptr) const override; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
/* | ||
* Prism Launcher - Minecraft Launcher | ||
* Copyright (C) 2022 Tayou <[email protected]> | ||
* Copyright (C) 2024 TheKodeToad <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -36,12 +37,13 @@ | |
#include <QDir> | ||
#include <QStyleFactory> | ||
#include "Application.h" | ||
#include "HintOverrideProxyStyle.h" | ||
#include "rainbow.h" | ||
|
||
void ITheme::apply(bool) | ||
{ | ||
APPLICATION->setStyleSheet(QString()); | ||
QApplication::setStyle(QStyleFactory::create(qtTheme())); | ||
QApplication::setStyle(new HintOverrideProxyStyle(QStyleFactory::create(qtTheme()))); | ||
if (hasColorScheme()) { | ||
QApplication::setPalette(colorScheme()); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
/* | ||
* Prism Launcher - Minecraft Launcher | ||
* Copyright (C) 2022 Tayou <[email protected]> | ||
* Copyright (C) 2024 TheKodeToad <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -37,6 +38,7 @@ | |
#include <QDebug> | ||
#include <QStyle> | ||
#include <QStyleFactory> | ||
#include "HintOverrideProxyStyle.h" | ||
#include "ThemeManager.h" | ||
|
||
SystemTheme::SystemTheme() | ||
|
@@ -64,8 +66,11 @@ void SystemTheme::apply(bool initial) | |
{ | ||
// See https://github.com/MultiMC/Launcher/issues/1790 | ||
// or https://github.com/PrismLauncher/PrismLauncher/issues/490 | ||
if (initial) | ||
if (initial) { | ||
QApplication::setStyle(new HintOverrideProxyStyle(QStyleFactory::create(qtTheme()))); | ||
return; | ||
} | ||
|
||
ITheme::apply(initial); | ||
} | ||
|
||
|