From 0cf5dc87cc8e10cd15f2f8e6fc414bee192084a5 Mon Sep 17 00:00:00 2001 From: "craig.p.drummond" Date: Thu, 18 Sep 2014 16:29:58 +0000 Subject: [PATCH] Better retina support. --- cantata.qrc | 4 --- gui/application_mac.cpp | 7 ++++- gui/interfacesettings.cpp | 17 ++++++++++++ gui/interfacesettings.h | 1 + gui/interfacesettings.ui | 18 ++++++++++-- gui/settings.cpp | 10 +++++++ gui/settings.h | 2 ++ support/fancytabwidget.cpp | 7 ++++- support/lineedit.cpp | 12 ++++---- support/lineedit.h | 18 ++++++------ support/pagewidget.cpp | 33 ++++++++++++---------- widgets/actionitemdelegate.cpp | 12 ++++++-- widgets/groupedview.cpp | 21 +++++++++++--- widgets/icons.cpp | 9 +++--- widgets/itemview.cpp | 17 ++++++++---- widgets/ratingwidget.cpp | 50 ++++++++++++++++++++++++++++------ widgets/ratingwidget.h | 3 ++ 17 files changed, 180 insertions(+), 61 deletions(-) diff --git a/cantata.qrc b/cantata.qrc index db0b1b5e6..34d76c127 100644 --- a/cantata.qrc +++ b/cantata.qrc @@ -7,14 +7,10 @@ icons/view-media-repeat22.png icons/view-media-repeat24.png icons/view-media-repeat32.png -icons/view-media-repeat48.png - icons/view-media-shuffle16.png icons/view-media-shuffle22.png icons/view-media-shuffle24.png icons/view-media-shuffle32.png -icons/view-media-shuffle48.png - icons/sidebar-albums-dark.svg icons/sidebar-artists-dark.svg diff --git a/gui/application_mac.cpp b/gui/application_mac.cpp index 8aa7dfbda..4ae2e68f4 100644 --- a/gui/application_mac.cpp +++ b/gui/application_mac.cpp @@ -22,6 +22,7 @@ */ #include "application_mac.h" +#include "settings.h" #include "support/utils.h" #include @@ -29,7 +30,11 @@ Application::Application(int &argc, char **argv) : SingleApplication(argc, argv) { setAttribute(Qt::AA_DontShowIconsInMenus, true); -// setAttribute(Qt::AA_UseHighDpiPixmaps); + #if QT_VERSION >= 0x050100 + if (Settings::self()->retinaSupport()) { + setAttribute(Qt::AA_UseHighDpiPixmaps); + } + #endif // Setup icon path... QStringList paths=QIcon::themeSearchPaths(); diff --git a/gui/interfacesettings.cpp b/gui/interfacesettings.cpp index 05fc7206c..2366b0f29 100644 --- a/gui/interfacesettings.cpp +++ b/gui/interfacesettings.cpp @@ -228,6 +228,12 @@ InterfaceSettings::InterfaceSettings(QWidget *p) connect(systemTrayPopup, SIGNAL(toggled(bool)), SLOT(systemTrayPopupToggled())); } #endif + #if defined Q_OS_MAC && QT_VERSION >= 0x050100 + connect(retinaSupport, SIGNAL(toggled(bool)), SLOT(retinaSupportChanged())); + #else + REMOVE(retinaSupport) + REMOVE(retinaSupportNoteLabel) + #endif // If we are on a display less than 800 pixels tall (e.g. a netbook), then re-arrange // the view settings to allow dialog to shrink more... @@ -291,6 +297,9 @@ void InterfaceSettings::load() playQueueViewChanged(); forceSingleClick->setChecked(Settings::self()->forceSingleClick()); infoTooltips->setChecked(Settings::self()->infoTooltips()); + if (retinaSupport) { + retinaSupport->setChecked(Settings::self()->retinaSupport()); + } touchFriendly->setChecked(Settings::self()->touchFriendly()); showStopButton->setChecked(Settings::self()->showStopButton()); showCoverWidget->setChecked(Settings::self()->showCoverWidget()); @@ -377,6 +386,9 @@ void InterfaceSettings::save() Settings::self()->savePlayQueueSearch(playQueueSearch->isChecked()); Settings::self()->saveForceSingleClick(forceSingleClick->isChecked()); Settings::self()->saveInfoTooltips(infoTooltips->isChecked()); + if (retinaSupport) { + Settings::self()->saveRetinaSupport(retinaSupport->isChecked()); + } Settings::self()->saveTouchFriendly(touchFriendly->isChecked()); Settings::self()->saveShowStopButton(showStopButton->isChecked()); Settings::self()->saveShowCoverWidget(showCoverWidget->isChecked()); @@ -523,6 +535,11 @@ void InterfaceSettings::touchFriendlyChanged() touchFriendlyNoteLabel->setOn(touchFriendly->isChecked()!=Settings::self()->touchFriendly()); } +void InterfaceSettings::retinaSupportChanged() +{ + retinaSupportNoteLabel->setOn(retinaSupport->isChecked()!=Settings::self()->retinaSupport()); +} + void InterfaceSettings::enableStartupState() { if (systemTrayCheckBox && minimiseOnClose && startupState) { diff --git a/gui/interfacesettings.h b/gui/interfacesettings.h index 952a42e78..105a68492 100644 --- a/gui/interfacesettings.h +++ b/gui/interfacesettings.h @@ -52,6 +52,7 @@ private Q_SLOTS: void playQueueViewChanged(); void forceSingleClickChanged(); void touchFriendlyChanged(); + void retinaSupportChanged(); void enableStartupState(); void langChanged(); void viewItemChanged(QListWidgetItem *changedItem); diff --git a/gui/interfacesettings.ui b/gui/interfacesettings.ui index 03345ba93..a40539c46 100644 --- a/gui/interfacesettings.ui +++ b/gui/interfacesettings.ui @@ -764,7 +764,14 @@ - + + + + Support retina displays + + + + Language: @@ -774,7 +781,7 @@ - + @@ -800,6 +807,13 @@ + + + + Enabling support for retina displays will produce sharper icons on the retina display, but may produce less sharp icons on non-retina displays. Changing this setting will require a re-start of Cantata. + + + diff --git a/gui/settings.cpp b/gui/settings.cpp index e88857832..77b619b92 100644 --- a/gui/settings.cpp +++ b/gui/settings.cpp @@ -858,6 +858,11 @@ bool Settings::infoTooltips() return cfg.get("infoTooltips", true); } +bool Settings::retinaSupport() +{ + return cfg.get("retinaSupport", false); +} + void Settings::removeConnectionDetails(const QString &v) { if (v==currentConnection()) { @@ -1397,6 +1402,11 @@ void Settings::saveInfoTooltips(bool v) cfg.set("infoTooltips", v); } +void Settings::saveRetinaSupport(bool v) +{ + cfg.set("retinaSupport", v); +} + void Settings::save() { if (version()!=PACKAGE_VERSION || isFirstRun) { diff --git a/gui/settings.h b/gui/settings.h index 463890d38..1077fe6a2 100644 --- a/gui/settings.h +++ b/gui/settings.h @@ -182,6 +182,7 @@ public: bool showStopButton(); bool showRatingWidget(); bool infoTooltips(); + bool retinaSupport(); void removeConnectionDetails(const QString &v); void saveConnectionDetails(const MPDConnectionDetails &v); @@ -296,6 +297,7 @@ public: void saveShowStopButton(bool v); void saveShowRatingWidget(bool v); void saveInfoTooltips(bool v); + void saveRetinaSupport(bool v); void save(); #if defined ENABLE_KDE_SUPPORT && defined ENABLE_KWALLET bool openWallet(); diff --git a/support/fancytabwidget.cpp b/support/fancytabwidget.cpp index 93c036481..212634156 100644 --- a/support/fancytabwidget.cpp +++ b/support/fancytabwidget.cpp @@ -87,7 +87,12 @@ int FancyTabWidget::iconSize(bool large) static void drawIcon(const QIcon &icon, const QRect &r, QPainter *p, const QSize &iconSize, bool selected) { QPixmap px = icon.pixmap(iconSize, selected ? QIcon::Selected : QIcon::Normal); - p->drawPixmap(r.x()+(r.width()-px.width())/2.0, r.y()+(r.height()-px.height())/2.0, px.width(), px.height(), px); + #if QT_VERSION >= 0x050100 + QSize layoutSize = px.size() / px.devicePixelRatio(); + #else + QSize layoutSize = px.size(); + #endif + p->drawPixmap(r.x()+(r.width()-layoutSize.width())/2.0, r.y()+(r.height()-layoutSize.height())/2.0, layoutSize.width(), layoutSize.height(), px); } void FancyTabProxyStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *p, const QWidget *widget) const diff --git a/support/lineedit.cpp b/support/lineedit.cpp index 2b72fab4b..13b0243a9 100644 --- a/support/lineedit.cpp +++ b/support/lineedit.cpp @@ -41,7 +41,7 @@ void LineEdit::setReadOnly(bool e) } } -#if !defined ENABLE_KDE_SUPPORT && QT_VERSION < 0x050200 +#if !defined ENABLE_KDE_SUPPORT // && QT_VERSION < 0x050200 /**************************************************************************** ** @@ -63,12 +63,14 @@ LineEdit::LineEdit(QWidget *parent) { clearButton = new QToolButton(this); int iconSize=Icon::stdSize(fontMetrics().height()); - QPixmap pixmap(Icon(isRightToLeft() ? "edit-clear-locationbar-ltr" : "edit-clear-locationbar-rtl").pixmap(iconSize, iconSize)); + Icon icon(isRightToLeft() ? "edit-clear-locationbar-ltr" : "edit-clear-locationbar-rtl"); + QPixmap pixmap(icon.pixmap(iconSize, iconSize)); if (pixmap.isNull()) { - pixmap=(Icon("edit-clear").pixmap(iconSize, iconSize)); + icon=Icon("edit-clear"); + pixmap=icon.pixmap(iconSize, iconSize); } - clearButton->setIcon(QIcon(pixmap)); - clearButton->setIconSize(pixmap.size()); + clearButton->setIcon(icon); + //clearButton->setIconSize(pixmap.size()); clearButton->setCursor(Qt::ArrowCursor); clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); clearButton->hide(); diff --git a/support/lineedit.h b/support/lineedit.h index dde2d2ae6..2127ebb14 100644 --- a/support/lineedit.h +++ b/support/lineedit.h @@ -45,15 +45,15 @@ public: void setReadOnly(bool e); }; -#elif QT_VERSION >= 0x050200 - -class LineEdit : public QLineEdit -{ -public: - LineEdit(QWidget *parent = 0) : QLineEdit(parent) { setClearButtonEnabled(true); } - virtual ~LineEdit() { } - void setReadOnly(bool e); -}; +//#elif QT_VERSION >= 0x050200 +// +//class LineEdit : public QLineEdit +//{ +//public: +// LineEdit(QWidget *parent = 0) : QLineEdit(parent) { setClearButtonEnabled(true); } +// virtual ~LineEdit() { } +// void setReadOnly(bool e); +//}; #else diff --git a/support/pagewidget.cpp b/support/pagewidget.cpp index 9d3e0dd48..9778458be 100644 --- a/support/pagewidget.cpp +++ b/support/pagewidget.cpp @@ -149,13 +149,16 @@ public: const QPixmap pixmap = icon.pixmap(iconSize, iconSize); QFontMetrics fm = painter->fontMetrics(); - int wp = pixmap.width(); - int hp = pixmap.height(); + #if QT_VERSION >= 0x050100 + QSize layoutSize = pixmap.size() / pixmap.devicePixelRatio(); + #else + QSize layoutSize = pixmap.size(); + #endif QTextLayout iconTextLayout(text, option.font); QTextOption textOption(Qt::AlignHCenter); iconTextLayout.setTextOption(textOption); - int maxWidth = qMax(3 * wp, 8 * fm.height()); + int maxWidth = qMax(3 * layoutSize.width(), 8 * fm.height()); layoutText(&iconTextLayout, maxWidth); QPen pen = painter->pen(); @@ -183,9 +186,9 @@ public: painter->setPen(option.palette.color(cg, QPalette::Text)); } - painter->drawPixmap(option.rect.x() + (option.rect.width()/2)-(wp/2), option.rect.y() + 5, pixmap); + painter->drawPixmap(option.rect.x() + (option.rect.width()/2)-(layoutSize.width()/2), option.rect.y() + 5, pixmap); if (!text.isEmpty()) { - iconTextLayout.draw(painter, QPoint(option.rect.x() + (option.rect.width()/2)-(maxWidth/2), option.rect.y() + hp+7)); + iconTextLayout.draw(painter, QPoint(option.rect.x() + (option.rect.width()/2)-(maxWidth/2), option.rect.y() + layoutSize.height()+7)); } painter->setPen(pen); drawFocus(painter, option, option.rect); @@ -206,30 +209,32 @@ public: QFontMetrics fm = option.fontMetrics; int gap = fm.height(); - int wp = pixmap.width(); - int hp = pixmap.height(); + #if QT_VERSION >= 0x050100 + QSize layoutSize = pixmap.size() / pixmap.devicePixelRatio(); + #else + QSize layoutSize = pixmap.size(); + #endif - if (hp == 0) { + if (layoutSize.height() == 0) { /** * No pixmap loaded yet, we'll use the default icon size in this case. */ - hp = iconSize; - wp = iconSize; + layoutSize=QSize(iconSize, iconSize); } QTextLayout iconTextLayout(text, option.font); - int wt = layoutText(&iconTextLayout, qMax(3 * wp, 8 * fm.height())); + int wt = layoutText(&iconTextLayout, qMax(3 * layoutSize.width(), 8 * fm.height())); int ht = iconTextLayout.boundingRect().height(); int width, height; if (text.isEmpty()) { - height = hp; + height = layoutSize.height(); } else { - height = hp + ht + 10; + height = layoutSize.height() + ht + 10; } - width = qMax(wt, wp) + gap; + width = qMax(wt, layoutSize.width()) + gap; return QSize(width, height); } diff --git a/widgets/actionitemdelegate.cpp b/widgets/actionitemdelegate.cpp index 21641df7d..a2a7c3c96 100644 --- a/widgets/actionitemdelegate.cpp +++ b/widgets/actionitemdelegate.cpp @@ -118,9 +118,15 @@ void ActionItemDelegate::drawIcons(QPainter *painter, const QRect &r, bool mouse foreach (const QPointer &a, actions) { QPixmap pix=a->icon().pixmap(QSize(iconSize, iconSize)); - if (!pix.isNull() && actionRect.width()>=pix.width()/* && r.x()>=0 && r.y()>=0*/) { - painter->drawPixmap(actionRect.x()+(actionRect.width()-pix.width())/2, - actionRect.y()+(actionRect.height()-pix.height())/2, pix); + #if QT_VERSION >= 0x050100 + QSize pixSize = pix.isNull() ? QSize(0, 0) : (pix.size() / pix.devicePixelRatio()); + #else + QSize pixSize = pix.size(); + #endif + + if (!pix.isNull() && actionRect.width()>=pixSize.width()/* && r.x()>=0 && r.y()>=0*/) { + painter->drawPixmap(actionRect.x()+(actionRect.width()-pixSize.width())/2, + actionRect.y()+(actionRect.height()-pixSize.height())/2, pix); } if (largeIcons && 2==actions.count() && AP_VTop==actionPos) { adjustActionRect(rtl, actionPos, actionRect, iconSize>>4); diff --git a/widgets/groupedview.cpp b/widgets/groupedview.cpp index 66e9f00f6..3664cf640 100644 --- a/widgets/groupedview.cpp +++ b/widgets/groupedview.cpp @@ -373,17 +373,30 @@ public: pix=cover ? *cover : (stream && !song.isCdda() ? Icons::self()->streamIcon : Icons::self()->albumIcon).pixmap(constCoverSize, constCoverSize); } - if (pix.width()>constCoverSize) { - pix=pix.scaled(constCoverSize, constCoverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); + #if QT_VERSION >= 0x050100 + int maxSize=constCoverSize*pix.devicePixelRatio(); + #else + int maxSize=constCoverSize; + #endif + + if (pix.width()>maxSize) { + pix=pix.scaled(maxSize, maxSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); } + #if QT_VERSION >= 0x050100 + QSize pixSize = pix.isNull() ? QSize(0, 0) : (pix.size() / pix.devicePixelRatio()); + #else + QSize pixSize = pix.size(); + #endif + if (rtl) { - painter->drawPixmap(r.x()+r.width()-(pix.width()-constBorder), r.y()+((r.height()-pix.height())/2), pix.width(), pix.height(), pix); + painter->drawPixmap(r.x()+r.width()-(pixSize.width()-constBorder), r.y()+((r.height()-pixSize.height())/2), pixSize.width(), pixSize.height(), pix); r.adjust(0, 0, -(constCoverSize+constBorder), 0); } else { - painter->drawPixmap(r.x()-2, r.y()+((r.height()-pix.height())/2), pix.width(), pix.height(), pix); + painter->drawPixmap(r.x()-2, r.y()+((r.height()-pixSize.height())/2), pixSize.width(), pixSize.height(), pix); r.adjust(constCoverSize+constBorder, 0, 0, 0); } + int td=index.data(Cantata::Role_AlbumDuration).toUInt(); QString totalDuration=td>0 ? Utils::formatTime(td) : QString(); QRect duratioRect(r.x(), r.y(), r.width(), textHeight); diff --git a/widgets/icons.cpp b/widgets/icons.cpp index d337202e9..7977d00a4 100644 --- a/widgets/icons.cpp +++ b/widgets/icons.cpp @@ -43,7 +43,8 @@ GLOBAL_STATIC(Icons, instance) -static QList constStdSizes=QList() << 16 << 22 << 32 << 48; // << 64; +static QList constStdSmallSizes=QList() << 16 << 22 << 32 ; +static QList constStdSizes=QList() << constStdSmallSizes << 48; // << 64; static const int constDarkLimit=80; static const int constDarkValue=64; @@ -110,7 +111,7 @@ static QPixmap createConsumeIconPixmap(int size, const QColor &col, double opaci } /*else if (64==size) { border=6; }*/ - p.setPen(QPen(col, size/10.0)); + p.setPen(QPen(col, size/8.0)); p.setOpacity(opacity); p.setRenderHint(QPainter::Antialiasing, true); QRectF rect(border+0.5, border+0.5, size-(2*border), size-(2*border)); @@ -190,7 +191,7 @@ static QColor calcIconColor() static Icon createSingleIcon(const QColor &stdColor) { Icon icon; - foreach (int s, constStdSizes) { + foreach (int s, constStdSmallSizes) { icon.addPixmap(createSingleIconPixmap(s, stdColor)); } return icon; @@ -199,7 +200,7 @@ static Icon createSingleIcon(const QColor &stdColor) static Icon createConsumeIcon(const QColor &stdColor) { Icon icon; - foreach (int s, constStdSizes) { + foreach (int s, constStdSmallSizes) { icon.addPixmap(createConsumeIconPixmap(s, stdColor)); } return icon; diff --git a/widgets/itemview.cpp b/widgets/itemview.cpp index 43bab88d2..c2cd53091 100644 --- a/widgets/itemview.cpp +++ b/widgets/itemview.cpp @@ -252,13 +252,18 @@ public: r.adjust(constBorder, 0, -constBorder, 0); } if (!pix.isNull()) { - int adjust=qMax(pix.width(), pix.height()); + #if QT_VERSION >= 0x050100 + QSize layoutSize = pix.size() / pix.devicePixelRatio(); + #else + QSize layoutSize = pix.size(); + #endif + int adjust=qMax(layoutSize.width(), layoutSize.height()); if (AP_VTop==actionPos) { - int xpos=r.x()+((r.width()-pix.width())/2); - painter->drawPixmap(xpos, r.y(), pix.width(), pix.height(), pix); + int xpos=r.x()+((r.width()-layoutSize.width())/2); + painter->drawPixmap(xpos, r.y(), layoutSize.width(), layoutSize.height(), pix); QColor color(option.palette.color(active ? QPalette::Active : QPalette::Inactive, QPalette::Text)); double alphas[]={0.25, 0.125, 0.061}; - QRect border(xpos, r.y(), pix.width(), pix.height()); + QRect border(xpos, r.y(), layoutSize.width(), layoutSize.height()); QRect shadow(border); for (int i=0; i<3; ++i) { shadow.adjust(1, 1, 1, 1); @@ -287,10 +292,10 @@ public: r.adjust(0, adjust+3, 0, -3); } else { if (rtl) { - painter->drawPixmap(r.x()+r.width()-pix.width(), r.y()+((r.height()-pix.height())/2), pix.width(), pix.height(), pix); + painter->drawPixmap(r.x()+r.width()-layoutSize.width(), r.y()+((r.height()-layoutSize.height())/2), layoutSize.width(), layoutSize.height(), pix); r.adjust(3, 0, -(3+adjust), 0); } else { - painter->drawPixmap(r.x(), r.y()+((r.height()-pix.height())/2), pix.width(), pix.height(), pix); + painter->drawPixmap(r.x(), r.y()+((r.height()-layoutSize.height())/2), layoutSize.width(), layoutSize.height(), pix); r.adjust(adjust+3, 0, -3, 0); } } diff --git a/widgets/ratingwidget.cpp b/widgets/ratingwidget.cpp index d21257649..21cf42d7e 100644 --- a/widgets/ratingwidget.cpp +++ b/widgets/ratingwidget.cpp @@ -40,6 +40,9 @@ RatingPainter::RatingPainter(int s) , pixmapSize((starSz*constNumStars)+(constBorder*(constNumStars-1)), starSz) , col(QApplication::palette().text().color()) { + #if QT_VERSION >= 0x050100 + pixelRatio=Icon("dialog-ok").pixmap(16, 16).devicePixelRatio(); + #endif } void RatingPainter::paint(QPainter *p, const QRect &r, int rating) @@ -47,6 +50,14 @@ void RatingPainter::paint(QPainter *p, const QRect &r, int rating) if (rating<0 || rating>Song::Rating_Max) { return; } + + #if QT_VERSION >= 0x050100 + double pixelRatio=Icon("dialog-ok").pixmap(16, 16).devicePixelRatio(); + if (!isNull() && Utils::equal(pixelRatio, pixmaps[0].devicePixelRatio())) { + pixmaps[0]=QPixmap(); + } + #endif + if (isNull()) { QSvgRenderer renderer; QFile f(":stars.svg"); @@ -56,29 +67,52 @@ void RatingPainter::paint(QPainter *p, const QRect &r, int rating) } if (!bytes.isEmpty()) { bytes.replace("#000", col.name().toLatin1()); + #if QT_VERSION >= 0x050100 + if (pixelRatio>1.25) { + bytes.replace("stroke-width=\"3\"", "stroke-width=\"6\""); + } + #endif } renderer.load(bytes); + #if QT_VERSION >= 0x050100 + int pixSize=starSz*pixelRatio; + #else + int pixSize=starSz; + #endif + for (int p=0; p<2; ++p) { - pixmaps[p]=QPixmap(starSz, starSz); + pixmaps[p]=QPixmap(pixSize, pixSize); pixmaps[p].fill(Qt::transparent); QPainter painter(&(pixmaps[p])); - renderer.render(&painter, 1==p ? "on" : "off", QRectF(0, 0, starSz, starSz)); + renderer.render(&painter, 1==p ? "on" : "off", QRectF(0, 0, pixSize, pixSize)); } - pixmaps[2]=QPixmap(starSz, starSz); + pixmaps[2]=QPixmap(pixSize, pixSize); pixmaps[2].fill(Qt::transparent); QPainter painter(&(pixmaps[2])); - int halfSz=(starSz/2.0)+0.5; - painter.drawPixmap(0, 0, pixmaps[1], 0, 0, halfSz, starSz); - painter.drawPixmap(halfSz, 0, pixmaps[0], halfSz, 0, starSz-halfSz, starSz); + int halfSz=(pixSize/2.0)+0.5; + painter.drawPixmap(0, 0, pixmaps[1], 0, 0, halfSz, pixSize); + painter.drawPixmap(halfSz, 0, pixmaps[0], halfSz, 0, pixSize-halfSz, pixSize); + #if QT_VERSION >= 0x050100 + painter.end(); + for (int p=0; p<3; ++p) { + pixmaps[p].setDevicePixelRatio(pixelRatio); + } + #endif } - QRect pr(r.x(), r.y()+(r.height()-starSz)/2, starSz, starSz); int fullStars=rating/Song::Rating_Step; bool half=allowHalfStars && rating%Song::Rating_Step; + #if QT_VERSION >= 0x050100 + QSize layoutSize = pixmaps[0].size() / pixmaps[0].devicePixelRatio(); + #else + QSize layoutSize = pixmaps[0].size(); + #endif + QRect pr(r.x(), r.y()+(r.height()-layoutSize.width())/2, layoutSize.width(), layoutSize.height()); + for (int i=0; idrawPixmap(pr, pixmaps[half && i==fullStars ? 2 : i= 0x050100 + double pixelRatio; + #endif }; class RatingWidget : public QWidget