Update to 1.1.1

This commit is contained in:
Jan Grulich 2019-11-20 09:02:23 +01:00
parent 3b56b66edb
commit bf33952edf
4 changed files with 7 additions and 149 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@
/adwaita-qt-1.0.90.tar.gz
/adwaita-qt-1.0.91.tar.gz
/adwaita-qt-1.1.0.tar.gz
/adwaita-qt-1.1.1.tar.gz

View File

@ -1,144 +0,0 @@
diff --git a/style/adwaita.h b/style/adwaita.h
index b7c830a..09b970a 100644
--- a/style/adwaita.h
+++ b/style/adwaita.h
@@ -136,7 +136,7 @@ namespace Adwaita
// line editors
LineEdit_FrameWidth = 3,
- LineEdit_MarginHeight = 4,
+ LineEdit_MarginHeight = 2,
LineEdit_MarginWidth = 8,
LineEdit_MinHeight = 36,
LineEdit_MinWidth = 80,
diff --git a/style/adwaitahelper.cpp b/style/adwaitahelper.cpp
index 9c9e905..604b9e3 100644
--- a/style/adwaitahelper.cpp
+++ b/style/adwaitahelper.cpp
@@ -182,7 +182,7 @@ QColor Helper::buttonBackgroundColor(const QPalette &palette, bool mouseOver, bo
// Hovered button for normal mode is bg_color
return mix(buttonBackground, background, opacity);
}
- } else if(mouseOver) {
+ } else if (mouseOver) {
if (darkMode) {
// Hovered button for dark mode is darken(bg_color, 0.01)
return darken(background, 0.01);
@@ -575,10 +575,10 @@ void Helper::renderMenuFrame(QPainter *painter, const QRect &rect, const QColor
painter->setBrush(Qt::NoBrush);
painter->setRenderHint(QPainter::Antialiasing, false);
- QRect frameRect(rect);
+ QRectF frameRect(rect);
if (outline.isValid()) {
painter->setPen(outline);
- frameRect.adjust(0, 0, -1, -1);
+ frameRect.adjust(0.5, 0.5, -0.5, -0.5);
} else
painter->setPen(Qt::NoPen);
diff --git a/style/adwaitastyle.cpp b/style/adwaitastyle.cpp
index aeeb8ae..224fa7f 100644
--- a/style/adwaitastyle.cpp
+++ b/style/adwaitastyle.cpp
@@ -392,7 +392,12 @@ void Style::polish(QWidget *widget)
} else if (widget->inherits("QTipLabel")) {
setTranslucentBackground(widget);
} else if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget)) {
- lineEdit->setTextMargins(Metrics::LineEdit_MarginWidth, Metrics::LineEdit_MarginHeight, Metrics::LineEdit_MarginWidth, Metrics::LineEdit_MarginHeight);
+ // Do not use additional margin if the QLineEdit is really small
+ const bool useMarginWidth = lineEdit->width() > lineEdit->fontMetrics().width("#####");
+ const bool useMarginHeight = lineEdit->height() > lineEdit->fontMetrics().height() + (2 * Metrics::LineEdit_MarginHeight);
+ const int marginHeight = useMarginHeight ? Metrics::LineEdit_MarginHeight : 0;
+ const int marginWidth = useMarginWidth ? Metrics::LineEdit_MarginWidth : 0;
+ lineEdit->setTextMargins(marginWidth, marginHeight, marginWidth, marginHeight);
} else if (QSpinBox *spinBox = qobject_cast<QSpinBox *>(widget)) {
if (!spinBox->isEnabled()) {
QPalette pal = spinBox->palette();
@@ -1266,9 +1271,6 @@ void Style::drawControl(ControlElement element, const QStyleOption *option, QPai
case CE_MenuBarItem:
fcn = &Style::drawMenuBarItemControl;
break;
- case CE_MenuEmptyArea:
- fcn = &Style::drawMenuEmptyAreaControl;
- break;
case CE_MenuItem:
fcn = &Style::drawMenuItemControl;
break;
@@ -3391,7 +3393,6 @@ bool Style::drawFrameLineEditPrimitive(const QStyleOption *option, QPainter *pai
// focus takes precedence over mouse over
_animations->inputWidgetEngine().updateState(widget, AnimationFocus, hasFocus);
- _animations->inputWidgetEngine().updateState(widget, AnimationHover, mouseOver && !hasFocus);
// retrieve animation mode and opacity
AnimationMode mode(_animations->inputWidgetEngine().frameAnimationMode(widget));
@@ -4844,27 +4845,12 @@ bool Style::drawMenuBarItemControl(const QStyleOption *option, QPainter *painter
QRect textRect = option->fontMetrics.boundingRect(rect, textFlags, menuItemOption->text);
// render text
- const QPalette::ColorRole role = (useStrongFocus && sunken) ? QPalette::Highlight : QPalette::WindowText;
+ const QPalette::ColorRole role = (useStrongFocus && sunken) ? QPalette::Link : QPalette::WindowText;
drawItemText(painter, textRect, textFlags, palette, enabled, menuItemOption->text, role);
return true;
}
-bool Style::drawMenuEmptyAreaControl(const QStyleOption *option, QPainter *painter, const QWidget *widget) const
-{
- if (_isGNOME)
- painter->setPen(Qt::transparent);
- else
- painter->setPen(option->palette.window().color().darker(150));
-
- painter->setBrush(option->palette.base().color());
- if (_isGNOME)
- painter->drawRect(option->rect);
- else
- painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
- return true;
-}
-
//___________________________________________________________________________________
bool Style::drawMenuItemControl(const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
@@ -4878,11 +4864,6 @@ bool Style::drawMenuItemControl(const QStyleOption *option, QPainter *painter, c
// copy rect and palette
const QRect &rect(option->rect);
const QPalette &palette(option->palette);
- const QColor &background(palette.color(QPalette::Active, QPalette::Base));
-
- painter->setPen(Qt::NoPen);
- painter->setBrush(background);
- painter->drawRect(rect);
// deal with separators
if (menuItemOption->menuItemType == QStyleOptionMenuItem::Separator) {
@@ -6273,11 +6254,13 @@ bool Style::drawComboBoxComplexControl(const QStyleOptionComplex *option, QPaint
AnimationMode mode(_animations->inputWidgetEngine().buttonAnimationMode(widget));
qreal opacity(_animations->inputWidgetEngine().buttonOpacity(widget));
- QColor shadow(palette.color(QPalette::Shadow));
+ // define colors
+ QColor shadow(_helper->shadowColor(palette));
QColor outline(_helper->buttonOutlineColor(palette, mouseOver, hasFocus, opacity, mode, _dark));
QColor background(_helper->buttonBackgroundColor(palette, mouseOver, hasFocus, sunken, opacity, mode, _dark));
- _helper->renderFlatButtonFrame(painter, subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget), background, outline, shadow, hasFocus, sunken, mouseOver, enabled && windowActive);
+ // render
+ _helper->renderButtonFrame(painter, rect, background, outline, shadow, hasFocus, sunken, mouseOver, enabled && windowActive, _dark);
QStyleOptionComplex tmpOpt(*option);
tmpOpt.rect.setWidth(tmpOpt.rect.width() - subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget).width() + 3);
diff --git a/style/adwaitastyle.h b/style/adwaitastyle.h
index 2809286..ae6b13e 100644
--- a/style/adwaitastyle.h
+++ b/style/adwaitastyle.h
@@ -312,7 +312,6 @@ protected:
virtual bool drawItemViewItemControl(const QStyleOption *option, QPainter *painter, const QWidget *widget) const;
virtual bool drawMenuBarEmptyArea(const QStyleOption *option, QPainter *painter, const QWidget *widget) const;
virtual bool drawMenuBarItemControl(const QStyleOption *option, QPainter *painter, const QWidget *widget) const;
- virtual bool drawMenuEmptyAreaControl(const QStyleOption *option, QPainter *painter, const QWidget *widget) const;
virtual bool drawMenuItemControl(const QStyleOption *option, QPainter *painter, const QWidget *widget) const;
virtual bool drawProgressBarControl(const QStyleOption *option, QPainter *painter, const QWidget *widget) const;
virtual bool drawProgressBarContentsControl(const QStyleOption *option, QPainter *painter, const QWidget *widget) const;

View File

@ -1,14 +1,12 @@
Name: adwaita-qt
Version: 1.1.0
Release: 5%{?dist}
Version: 1.1.1
Release: 1%{?dist}
License: LGPLv2+
Summary: Adwaita theme for Qt-based applications
Url: https://github.com/FedoraQt/adwaita-qt
Source0: https://github.com/FedoraQt/adwaita-qt/archive/%{version}/adwaita-qt-%{version}.tar.gz
Patch0: adwaita-qt-upstream-fixes.patch
BuildRequires: cmake
BuildRequires: qt4-devel
@ -76,6 +74,9 @@ make install/fast DESTDIR=%{buildroot} -C "%{_target_platform}-qt5"
%files
%changelog
* Wed Nov 20 2019 Jan Grulich <jgrulich@redhat.com> - 1.1.1-1
- Update to 1.1.1
* Mon Oct 21 2019 Jan Grulich <jgrulich@redhat.com> - 1.1.0-5
- Actually apply all the fixes

View File

@ -1 +1 @@
SHA512 (adwaita-qt-1.1.0.tar.gz) = 5203b64cb9e4038579c68ae8f52bc8c2fcdaf0ab46ce134f2a92b318493cc69718ce4d69968f1da20fcdf5f5492c38a6a225475f74f75390ada1337d35504a01
SHA512 (adwaita-qt-1.1.1.tar.gz) = 6d11fc8eecc94da4f2e3798ee5147258f277032b23a82d5bf8d3414943ac89c5ebd056d519338959c72a8a45d1638ab8cfeac01b3f3fd1118b4c89eb0c8b5608