diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoasystemsettings.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoasystemsettings.mm | 63 |
1 files changed, 36 insertions, 27 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm index 48f2f72b7e..be5fa61b8b 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -42,13 +48,13 @@ QT_BEGIN_NAMESPACE -QColor qt_mac_colorForTheme(ThemeBrush brush) +QBrush qt_mac_brushForTheme(ThemeBrush brush) { QMacAutoReleasePool pool; QCFType<CGColorRef> cgClr = 0; HIThemeBrushCreateCGColor(brush, &cgClr); - return qt_mac_toQColor(cgClr); + return qt_mac_toQBrush(cgClr); } QColor qt_mac_colorForThemeTextColor(ThemeTextColor themeColor) @@ -86,25 +92,29 @@ QPalette * qt_mac_createSystemPalette() QColor qc; // Standard palette initialization (copied from Qt 4 styles) - QColor background = QColor(237, 237, 237); + QBrush backgroundBrush = qt_mac_toQBrush([NSColor windowBackgroundColor]); + QColor background = backgroundBrush.color(); QColor light(background.lighter(110)); QColor dark(background.darker(160)); QColor mid(background.darker(140)); QPalette *palette = new QPalette(Qt::black, background, light, dark, mid, Qt::black, Qt::white); + palette->setBrush(QPalette::Window, backgroundBrush); + palette->setBrush(QPalette::Disabled, QPalette::WindowText, dark); palette->setBrush(QPalette::Disabled, QPalette::Text, dark); palette->setBrush(QPalette::Disabled, QPalette::ButtonText, dark); - palette->setBrush(QPalette::Disabled, QPalette::Base, background); + palette->setBrush(QPalette::Disabled, QPalette::Base, backgroundBrush); palette->setColor(QPalette::Disabled, QPalette::Dark, QColor(191, 191, 191)); palette->setColor(QPalette::Active, QPalette::Dark, QColor(191, 191, 191)); palette->setColor(QPalette::Inactive, QPalette::Dark, QColor(191, 191, 191)); // System palette initialization: - palette->setBrush(QPalette::Active, QPalette::Highlight, qt_mac_colorForTheme(kThemeBrushPrimaryHighlightColor)); - qc = qt_mac_colorForTheme(kThemeBrushSecondaryHighlightColor); - palette->setBrush(QPalette::Inactive, QPalette::Highlight, qc); - palette->setBrush(QPalette::Disabled, QPalette::Highlight, qc); + palette->setBrush(QPalette::Active, QPalette::Highlight, + qt_mac_toQBrush([NSColor selectedControlColor])); + QBrush br = qt_mac_toQBrush([NSColor secondarySelectedControlColor]); + palette->setBrush(QPalette::Inactive, QPalette::Highlight, br); + palette->setBrush(QPalette::Disabled, QPalette::Highlight, br); palette->setBrush(QPalette::Shadow, background.darker(170)); @@ -170,8 +180,7 @@ QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes() } if (mac_widget_colors[i].paletteRole == QPlatformTheme::MenuPalette || mac_widget_colors[i].paletteRole == QPlatformTheme::MenuBarPalette) { - qc = qt_mac_colorForTheme(kThemeBrushMenuBackground); - pal.setBrush(QPalette::Background, qc); + pal.setBrush(QPalette::Background, qt_mac_brushForTheme(kThemeBrushMenuBackground)); qc = qt_mac_colorForThemeTextColor(kThemeTextColorMenuItemActive); pal.setBrush(QPalette::ButtonText, qc); qc = qt_mac_colorForThemeTextColor(kThemeTextColorMenuItemSelected); @@ -188,9 +197,9 @@ QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes() pal.color(QPalette::Active, QPalette::Text)); } else if (mac_widget_colors[i].paletteRole == QPlatformTheme::ItemViewPalette) { pal.setBrush(QPalette::Active, QPalette::Highlight, - qt_mac_colorForTheme(kThemeBrushAlternatePrimaryHighlightColor)); - qc = qt_mac_colorForThemeTextColor(kThemeTextColorMenuItemSelected); - pal.setBrush(QPalette::Active, QPalette::HighlightedText, qc); + qt_mac_toQBrush([NSColor alternateSelectedControlColor])); + pal.setBrush(QPalette::Active, QPalette::HighlightedText, + qt_mac_toQBrush([NSColor alternateSelectedControlTextColor])); pal.setBrush(QPalette::Inactive, QPalette::Text, pal.brush(QPalette::Active, QPalette::Text)); pal.setBrush(QPalette::Inactive, QPalette::HighlightedText, |