QtBase  v6.3.1
topbar.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the examples of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28 
29 #ifndef __TOPBAR_H__
30 #define __TOPBAR_H__
31 
32 #include <QObject>
33 #include <QHash>
34 
35 #include "gvbwidget.h"
36 
37 class QPixmap;
38 class QPoint;
39 class QGraphicsView;
40 class QFont;
41 
42 class TopBar : public GvbWidget
43 {
44  Q_OBJECT
45 
46 public:
48  {
51  None
52  };
53 
54 public:
56  ~TopBar();
57 
58 public:
60  QRectF boundingRect() const;
63  {
64  return m_topBarStatusBarMiddlePoint + m_topBarStatusBarMiddle.rect().bottomLeft();
65  }
66 
67 public slots:
68  void themeChange();
69 
70 protected:
72 
73 signals:
74  void clicked(bool checked = false);
75 
76 private:
77  QSizeF sizeHint(Qt::SizeHint which,
78  const QSizeF &constraint = QSizeF()) const;
79  void setDefaultSizes();
80 
81 private:
83 
84  QGraphicsView* m_mainView;
85  bool m_isLimeTheme;
86  Orientation m_orientation;
87 
88  //Fonts
89  QFont m_titleFont;
90  QFont m_statusFont;
91 
92  //Pixmaps
93  QPixmap m_topBarPixmap;
94  QPixmap m_topBarUserIcon;
95  QPixmap m_topBarUserStatus;
96  QPixmap m_topBarStatusBarLeft;
97  QPixmap m_topBarStatusBarRight;
98  QPixmap m_topBarStatusBarMiddle;
99 
100  //Drawing points
101  QPoint m_topBarUserIconPoint;
102  QPoint m_topBarUserStatusPoint;
103  QPoint m_topBarStatusBarLeftPoint;
104  QPoint m_topBarStatusBarRightPoint;
105  QPoint m_topBarStatusBarMiddlePoint;
106  QPoint m_topBarStatusBarTextPoint;
107  QPoint m_topBarTitlePoint;
108 
109  //Sizes
110  QHash<QString, QSize> m_sizesBlue;
111  QHash<QString, QSize> m_sizesLime;
112 };
113 
114 #endif // __TOPBAR_H__
The QFont class specifies a query for a font used for drawing text.
Definition: qfont.h:56
QGraphicsObject * parent
the parent of the item
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
The QGraphicsSceneResizeEvent class provides events for widget resizing in the graphics view framewor...
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
Definition: qgraphicsview.h:60
The QGraphicsWidget class is the base class for all widget items in a QGraphicsScene.
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:82
The QPixmap class is an off-screen image representation that can be used as a paint device.
Definition: qpixmap.h:63
QRect rect() const
Definition: qpixmap.cpp:540
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:52
The QRectF class defines a finite rectangle in the plane using floating point precision.
Definition: qrect.h:511
constexpr QPoint bottomLeft() const noexcept
Definition: qrect.h:257
The QSizeF class defines the size of a two-dimensional object using floating point precision.
Definition: qsize.h:235
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem.
Definition: qstyleoption.h:684
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:133
Definition: topbar.h:43
~TopBar()
Definition: topbar.cpp:52
QRectF boundingRect() const
Definition: topbar.cpp:198
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: topbar.cpp:169
Orientation
Definition: topbar.h:48
@ None
Definition: topbar.h:51
@ Landscape
Definition: topbar.h:50
@ Portrait
Definition: topbar.h:49
void resizeEvent(QGraphicsSceneResizeEvent *event)
Definition: topbar.cpp:56
void themeChange()
Definition: topbar.cpp:211
void mousePressEvent(QGraphicsSceneMouseEvent *event)
Definition: topbar.cpp:338
QPoint getStatusBarLocation()
Definition: topbar.h:62
void clicked(bool checked=false)
TopBar(QGraphicsView *mainView, QGraphicsWidget *parent)
Definition: topbar.cpp:40
QOpenGLWidget * widget
[1]
SizeHint
Definition: qnamespace.h:1589
#define Q_DISABLE_COPY(Class)
Definition: qglobal.h:515
struct _cl_event * event
Definition: qopenglext.h:2998
GLuint GLenum option
Definition: qopenglext.h:5929
#define Q_OBJECT
Definition: qtmetamacros.h:158
#define slots
Definition: qtmetamacros.h:76
#define signals
Definition: qtmetamacros.h:77
QPainter painter(this)
[7]