Port to QT6 on MacOs (#3977)

This commit is contained in:
borgmanJeremy
2025-06-04 18:41:55 -05:00
committed by GitHub
parent 533c811016
commit 2732eb375c
4 changed files with 14 additions and 18 deletions

View File

@@ -21,8 +21,7 @@ public:
private:
void initInfoTable();
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if (defined(Q_OS_MAC) || defined(Q_OS_MACOS))
const QString& nativeOSHotKeyText(const QString& text);
#endif
@@ -31,8 +30,7 @@ private slots:
void onShortcutCellClicked(int, int);
private:
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if (defined(Q_OS_MAC) || defined(Q_OS_MACOS))
QString m_res;
#endif
ConfigHandler m_config;

View File

@@ -13,8 +13,7 @@ class ConfigWindow;
class InfoWindow;
class CaptureLauncher;
class UploadHistory;
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if (defined(Q_OS_MAC) || defined(Q_OS_MACOS))
class QHotkey;
#endif
@@ -75,8 +74,7 @@ private:
QPointer<CaptureLauncher> m_launcherWindow;
QPointer<ConfigWindow> m_configWindow;
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#if (defined(Q_OS_MAC) || defined(Q_OS_MACOS))
QHotkey* m_HotkeyScreenshotCapture;
QHotkey* m_HotkeyScreenshotHistory;
#endif

View File

@@ -421,7 +421,7 @@ void CaptureWidget::showxywh()
void CaptureWidget::initHelpMessage()
{
QList<QPair<QString, QString>> keyMap;
keyMap << QPair(tr("Mouse"), tr("Select screenshot area"));
keyMap << std::pair(tr("Mouse"), tr("Select screenshot area"));
using CT = CaptureTool;
for (auto toolType : { CT::TYPE_ACCEPT, CT::TYPE_SAVE, CT::TYPE_COPY }) {
if (!m_tools.contains(toolType)) {
@@ -432,14 +432,14 @@ void CaptureWidget::initHelpMessage()
ConfigHandler().shortcut(QVariant::fromValue(toolType).toString());
shortcut.replace("Return", "Enter");
if (!shortcut.isEmpty()) {
keyMap << QPair(shortcut, tool->description());
keyMap << std::pair(shortcut, tool->description());
}
}
keyMap << QPair(tr("Mouse Wheel"), tr("Change tool size"));
keyMap << QPair(tr("Right Click"), tr("Show color picker"));
keyMap << QPair(ConfigHandler().shortcut("TYPE_TOGGLE_PANEL"),
keyMap << std::pair(tr("Mouse Wheel"), tr("Change tool size"));
keyMap << std::pair(tr("Right Click"), tr("Show color picker"));
keyMap << std::pair(ConfigHandler().shortcut("TYPE_TOGGLE_PANEL"),
tr("Open side panel"));
keyMap << QPair(tr("Esc"), tr("Exit"));
keyMap << std::pair(tr("Esc"), tr("Exit"));
m_helpMessage = OverlayMessage::compileFromKeyMap(keyMap);
}

View File

@@ -26,7 +26,7 @@ TrayIcon::TrayIcon(QObject* parent)
// https://bugreports.qt.io/browse/QTBUG-86393
// https://developer.apple.com/forums/thread/126072
auto currentMacOsVersion = QOperatingSystemVersion::current();
if (currentMacOsVersion >= currentMacOsVersion.MacOSBigSur) {
if (currentMacOsVersion >= QOperatingSystemVersion::MacOSBigSur) {
setContextMenu(m_menu);
}
#else
@@ -37,7 +37,7 @@ TrayIcon::TrayIcon(QObject* parent)
setIcon(icon);
#if defined(Q_OS_MACOS)
if (currentMacOsVersion < currentMacOsVersion.MacOSBigSur) {
if (currentMacOsVersion < QOperatingSystemVersion::MacOSBigSur) {
// Because of the following issues on MacOS "Catalina":
// https://bugreports.qt.io/browse/QTBUG-86393
// https://developer.apple.com/forums/thread/126072
@@ -101,7 +101,7 @@ void TrayIcon::initMenu()
connect(captureAction, &QAction::triggered, this, [this]() {
#if defined(Q_OS_MACOS)
auto currentMacOsVersion = QOperatingSystemVersion::current();
if (currentMacOsVersion >= currentMacOsVersion.MacOSBigSur) {
if (currentMacOsVersion >= QOperatingSystemVersion::MacOSBigSur) {
startGuiCapture();
} else {
// It seems it is not relevant for MacOS BigSur (Wait 400 ms to hide