Falkon Develop
Cross-platform Qt-based web browser
stylehelper.h
Go to the documentation of this file.
1/**************************************************************************
2**
3** This file is part of Qt Creator
4**
5** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
6**
7** Contact: Nokia Corporation (qt-info@nokia.com)
8**
9** Commercial Usage
10**
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17**
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 2.1 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 2.1 requirements
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24**
25** If you are unsure which license is appropriate for your use, please
26** contact the sales department at http://qt.nokia.com/contact.
27**
28**************************************************************************/
29
30#ifndef STYLEHELPER_H
31#define STYLEHELPER_H
32
33#include "qzcommon.h"
34
35#include <QColor>
36#include <QStyle>
37
38QT_BEGIN_NAMESPACE
39class QPalette;
40class QPainter;
41class QRect;
42// Note, this is exported but in a private header as qtopengl depends on it.
43// We should consider adding this as a public helper function.
44void qt_blurImage(QPainter* p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed = 0);
45QT_END_NAMESPACE
46
47// Helper class holding all custom color values
48
49namespace Utils
50{
52{
53public:
54 static const unsigned int DEFAULT_BASE_COLOR = 0x666666;
55
56 // Height of the project explorer navigation bar
57 static qreal sidebarFontSize();
58
59 // This is our color table, all colors derive from baseColor
60 static QColor requestedBaseColor() { return m_requestedBaseColor; }
61 static QColor baseColor(bool lightColored = false);
62 static QColor panelTextColor(bool lightColored = false);
63 static QColor highlightColor(bool lightColored = false);
64 static QColor shadowColor(bool lightColored = false);
65 static QColor borderColor(bool lightColored = false);
66
67 static QColor sidebarHighlight() { return {255, 255, 255, 40}; }
68 static QColor sidebarShadow() { return {0, 0, 0, 40}; }
69
70 // Sets the base color and makes sure all top level widgets are updated
71 static void setBaseColor(const QColor &color);
72
73 // Gradients used for panels
74 static void verticalGradient(QPainter* painter, const QRect &spanRect, const QRect &clipRect, bool lightColored = false);
75 static bool usePixmapCache() { return true; }
76
77 static void drawIconWithShadow(const QIcon &icon, const QRect &rect, QPainter* p, QIcon::Mode iconMode,
78 int radius = 3, const QColor &color = QColor(0, 0, 0, 130),
79 const QPoint &offset = QPoint(1, -2));
80
81private:
82 static QColor m_baseColor;
83 static QColor m_requestedBaseColor;
84};
85
86} // namespace Utils
87
89#endif // STYLEHELPER_H
static void verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored=false)
static qreal sidebarFontSize()
Definition: stylehelper.cpp:51
static QColor baseColor(bool lightColored=false)
Definition: stylehelper.cpp:74
static QColor highlightColor(bool lightColored=false)
Definition: stylehelper.cpp:84
static QColor borderColor(bool lightColored=false)
static QColor requestedBaseColor()
Definition: stylehelper.h:60
static const unsigned int DEFAULT_BASE_COLOR
Definition: stylehelper.h:54
static QColor shadowColor(bool lightColored=false)
Definition: stylehelper.cpp:98
static void setBaseColor(const QColor &color)
static bool usePixmapCache()
Definition: stylehelper.h:75
static QColor sidebarShadow()
Definition: stylehelper.h:68
static QColor panelTextColor(bool lightColored=false)
Definition: stylehelper.cpp:60
static QColor sidebarHighlight()
Definition: stylehelper.h:67
static void drawIconWithShadow(const QIcon &icon, const QRect &rect, QPainter *p, QIcon::Mode iconMode, int radius=3, const QColor &color=QColor(0, 0, 0, 130), const QPoint &offset=QPoint(1, -2))
void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed=0)