Merge branch 'release/2.6.2' into develop
This commit is contained in:
@@ -54,6 +54,8 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "gui/Icons.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
Q_GUI_EXPORT int qt_defaultDpiX();
|
||||
QT_END_NAMESPACE
|
||||
@@ -282,6 +284,17 @@ namespace Phantom
|
||||
? highlightedOutlineOf(pal)
|
||||
: Grad(pal.color(QPalette::WindowText), pal.color(QPalette::Window)).sample(0.5);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
QColor tabBarBase(const QPalette& pal)
|
||||
{
|
||||
return hack_isLightPalette(pal) ? QRgb(0xD1D1D1) : QRgb(0x252525);
|
||||
}
|
||||
QColor tabBarBaseInactive(const QPalette& pal)
|
||||
{
|
||||
return hack_isLightPalette(pal) ? QRgb(0xF4F4F4) : QRgb(0x282828);
|
||||
}
|
||||
#endif
|
||||
} // namespace DeriveColors
|
||||
|
||||
namespace SwatchColors
|
||||
@@ -328,6 +341,9 @@ namespace Phantom
|
||||
S_itemView_headerOnLine,
|
||||
S_scrollbarGutter_disabled,
|
||||
|
||||
S_tabBarBase,
|
||||
S_tabBarBase_inactive,
|
||||
|
||||
// Aliases
|
||||
S_progressBar = S_highlight,
|
||||
S_progressBar_specular = S_highlight_specular,
|
||||
@@ -340,7 +356,7 @@ namespace Phantom
|
||||
|
||||
enum
|
||||
{
|
||||
Num_SwatchColors = SwatchColors::S_scrollbarGutter_disabled + 1,
|
||||
Num_SwatchColors = SwatchColors::S_tabBarBase_inactive + 1,
|
||||
Num_ShadowSteps = 3,
|
||||
};
|
||||
|
||||
@@ -443,6 +459,14 @@ namespace Phantom
|
||||
colors[S_itemView_headerOnLine] = Dc::itemViewHeaderOnLineColorOf(pal);
|
||||
colors[S_scrollbarGutter_disabled] = colors[S_window];
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
colors[S_tabBarBase] = Dc::tabBarBase(pal);
|
||||
colors[S_tabBarBase_inactive] = Dc::tabBarBaseInactive(pal);
|
||||
#else
|
||||
colors[S_tabBarBase] = pal.color(QPalette::Active, QPalette::Window);
|
||||
colors[S_tabBarBase_inactive] = pal.color(QPalette::Inactive, QPalette::Window);
|
||||
#endif
|
||||
|
||||
brushes[S_none] = Qt::NoBrush;
|
||||
for (int i = S_none + 1; i < Num_SwatchColors; ++i) {
|
||||
// todo try to reuse
|
||||
@@ -1551,6 +1575,12 @@ void BaseStyle::drawPrimitive(PrimitiveElement elem,
|
||||
auto tbb = qstyleoption_cast<const QStyleOptionTabBarBase*>(option);
|
||||
if (!tbb)
|
||||
break;
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
painter->fillRect(widget->rect(),
|
||||
swatch.color(option->state & QStyle::State_Active ? S_tabBarBase : S_tabBarBase_inactive));
|
||||
#endif
|
||||
|
||||
Qt::Edge edge = Qt::TopEdge;
|
||||
switch (tbb->shape) {
|
||||
case QTabBar::RoundedNorth:
|
||||
@@ -2253,6 +2283,21 @@ void BaseStyle::drawControl(ControlElement element,
|
||||
auto toolBar = qstyleoption_cast<const QStyleOptionToolBar*>(option);
|
||||
if (!toolBar)
|
||||
break;
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
if (auto* mainWindow = qobject_cast<QMainWindow*>(widget->window())) {
|
||||
// Fill toolbar background with transparent pixels to reveal the
|
||||
// gradient background drawn by the Cocoa platform plugin.
|
||||
// Inspired by qmacstyle_mac.mm.
|
||||
if (m_drawNativeMacOsToolBar && toolBar && toolBar->toolBarArea == Qt::TopToolBarArea
|
||||
&& mainWindow->unifiedTitleAndToolBarOnMac()) {
|
||||
painter->setCompositionMode(QPainter::CompositionMode_Source);
|
||||
painter->fillRect(option->rect, Qt::transparent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
painter->fillRect(option->rect, option->palette.window().color());
|
||||
bool isFloating = false;
|
||||
if (auto tb = qobject_cast<const QToolBar*>(widget)) {
|
||||
@@ -3036,6 +3081,21 @@ QPalette BaseStyle::standardPalette() const
|
||||
return QCommonStyle::standardPalette();
|
||||
}
|
||||
|
||||
QIcon BaseStyle::standardIcon(StandardPixmap sp, const QStyleOption* opt, const QWidget* widget) const
|
||||
{
|
||||
switch (sp) {
|
||||
case SP_ToolBarHorizontalExtensionButton:
|
||||
return icons()->icon("chevron-double-down");
|
||||
case SP_ToolBarVerticalExtensionButton:
|
||||
return icons()->icon("chevron-double-right");
|
||||
case SP_LineEditClearButton:
|
||||
return icons()->icon(
|
||||
QString("edit-clear-locationbar-").append((opt->direction == Qt::LeftToRight) ? "rtl" : "ltr"));
|
||||
default:
|
||||
return QCommonStyle::standardIcon(sp, opt, widget);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseStyle::drawComplexControl(ComplexControl control,
|
||||
const QStyleOptionComplex* option,
|
||||
QPainter* painter,
|
||||
|
||||
Reference in New Issue
Block a user