2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2016-01-15 14:58:39 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2016-01-15 14:58:39 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2016-01-15 14:58:39 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
** 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-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 15:08:31 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-07-15 12:38:45 +02:00
|
|
|
#include "utils_global.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QStyle>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-10-01 16:38:08 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QPalette;
|
|
|
|
class QPainter;
|
|
|
|
class QRect;
|
2010-03-15 17:09:57 +01:00
|
|
|
// Note, this is exported but in a private header as qtopengl depends on it.
|
|
|
|
// We should consider adding this as a public helper function.
|
2010-03-16 12:08:17 +01:00
|
|
|
void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed = 0);
|
|
|
|
QT_END_NAMESPACE
|
2010-03-15 17:09:57 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
// Helper class holding all custom color values
|
|
|
|
|
2009-10-05 11:06:05 +02:00
|
|
|
namespace Utils {
|
2009-07-15 12:38:45 +02:00
|
|
|
class QTCREATOR_UTILS_EXPORT StyleHelper
|
2008-12-02 15:08:31 +01:00
|
|
|
{
|
2008-12-02 12:01:29 +01:00
|
|
|
public:
|
2010-05-27 16:07:52 +02:00
|
|
|
static const unsigned int DEFAULT_BASE_COLOR = 0x666666;
|
2013-03-22 14:14:21 +01:00
|
|
|
static const int progressFadeAnimationDuration = 600;
|
2010-05-27 16:07:52 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
// Height of the project explorer navigation bar
|
|
|
|
static int navigationWidgetHeight() { return 24; }
|
|
|
|
static qreal sidebarFontSize();
|
|
|
|
static QPalette sidebarFontPalette(const QPalette &original);
|
|
|
|
|
|
|
|
// This is our color table, all colors derive from baseColor
|
2010-03-03 11:02:13 +01:00
|
|
|
static QColor requestedBaseColor() { return m_requestedBaseColor; }
|
2010-02-19 09:54:29 +01:00
|
|
|
static QColor baseColor(bool lightColored = false);
|
|
|
|
static QColor panelTextColor(bool lightColored = false);
|
|
|
|
static QColor highlightColor(bool lightColored = false);
|
|
|
|
static QColor shadowColor(bool lightColored = false);
|
|
|
|
static QColor borderColor(bool lightColored = false);
|
2008-12-02 12:01:29 +01:00
|
|
|
static QColor buttonTextColor() { return QColor(0x4c4c4c); }
|
2009-06-05 13:59:10 +02:00
|
|
|
static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-02-18 11:41:58 +01:00
|
|
|
static QColor sidebarHighlight() { return QColor(255, 255, 255, 40); }
|
|
|
|
static QColor sidebarShadow() { return QColor(0, 0, 0, 40); }
|
|
|
|
|
2016-03-29 17:36:49 +02:00
|
|
|
static QColor toolBarDropShadowColor() { return QColor(0, 0, 0, 70); }
|
|
|
|
|
2014-06-06 16:06:32 +02:00
|
|
|
static QColor notTooBrightHighlightColor();
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
// Sets the base color and makes sure all top level widgets are updated
|
|
|
|
static void setBaseColor(const QColor &color);
|
|
|
|
|
2010-02-17 17:09:00 +01:00
|
|
|
// Draws a shaded anti-aliased arrow
|
|
|
|
static void drawArrow(QStyle::PrimitiveElement element, QPainter *painter, const QStyleOption *option);
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
// Gradients used for panels
|
2010-02-19 09:54:29 +01:00
|
|
|
static void horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored = false);
|
|
|
|
static void verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored = false);
|
2008-12-02 12:01:29 +01:00
|
|
|
static void menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect);
|
2009-01-26 15:27:04 +01:00
|
|
|
static bool usePixmapCache() { return true; }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2015-11-11 19:26:58 +01:00
|
|
|
static QPixmap disabledSideBarIcon(const QPixmap &enabledicon);
|
2010-03-23 15:47:43 +01:00
|
|
|
static void drawIconWithShadow(const QIcon &icon, const QRect &rect, QPainter *p, QIcon::Mode iconMode,
|
2013-01-16 22:06:59 +01:00
|
|
|
int dipRadius = 3, const QColor &color = QColor(0, 0, 0, 130),
|
|
|
|
const QPoint &dipOffset = QPoint(1, -2));
|
2014-05-19 18:26:28 +03:00
|
|
|
static void drawCornerImage(const QImage &img, QPainter *painter, const QRect &rect,
|
2010-02-24 19:23:40 +01:00
|
|
|
int left = 0, int top = 0, int right = 0, int bottom = 0);
|
|
|
|
|
2010-08-02 17:02:53 +02:00
|
|
|
static void tintImage(QImage &img, const QColor &tintColor);
|
2013-03-22 14:06:42 +01:00
|
|
|
static QLinearGradient statusBarGradient(const QRect &statusBarRect);
|
2010-08-02 17:02:53 +02:00
|
|
|
|
2014-07-24 15:24:58 +02:00
|
|
|
static QString dpiSpecificImageFile(const QString &fileName);
|
2015-10-15 16:34:54 +02:00
|
|
|
static QString imageFileWithResolution(const QString &fileName, int dpr);
|
|
|
|
static QList<int> availableImageResolutions(const QString &fileName);
|
2014-07-09 13:20:53 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
private:
|
|
|
|
static QColor m_baseColor;
|
2010-03-03 11:02:13 +01:00
|
|
|
static QColor m_requestedBaseColor;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
2009-10-05 11:06:05 +02:00
|
|
|
} // namespace Utils
|