forked from qt-creator/qt-creator
ManhattanStyle: Draw round rectangles in "Relaxed toolbar style"
Task-number: QTCREATORBUG-29054 Change-Id: Ic06ddfec87fd9b43c88b3a7dfb9946c3a8b22c60 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <QFileInfo>
|
||||
#include <QFontDatabase>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include <QPixmapCache>
|
||||
#include <QStyleOption>
|
||||
#include <QWindow>
|
||||
@@ -455,6 +456,22 @@ void StyleHelper::drawMinimalArrow(QStyle::PrimitiveElement element, QPainter *p
|
||||
painter->drawPixmap(xOffset, yOffset, pixmap);
|
||||
}
|
||||
|
||||
void StyleHelper::drawPanelBgRect(QPainter *painter, const QRectF &rect, const QBrush &brush)
|
||||
{
|
||||
if (toolbarStyle() == ToolbarStyleCompact) {
|
||||
painter->fillRect(rect.toRect(), brush);
|
||||
} else {
|
||||
constexpr int margin = 2;
|
||||
constexpr int radius = 5;
|
||||
QPainterPath path;
|
||||
path.addRoundedRect(rect.adjusted(margin, margin, -margin, -margin), radius, radius);
|
||||
painter->save();
|
||||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
painter->fillPath(path, brush);
|
||||
painter->restore();
|
||||
}
|
||||
}
|
||||
|
||||
void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect)
|
||||
{
|
||||
if (StyleHelper::usePixmapCache()) {
|
||||
|
||||
Reference in New Issue
Block a user