Version: 9.16.0
QtxSplash.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5//
6// This library is free software; you can redistribute it and/or
7// modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation; either
9// version 2.1 of the License, or (at your option) any later version.
10//
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public
17// License along with this library; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22
23// File : QtxSplash.h
24// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
25//
26#ifndef QTXSPLASH_H
27#define QTXSPLASH_H
28
29#include "Qtx.h"
30
31#include <QWidget>
32#include <QPixmap>
33#include <QGradient>
34#include <QMap>
35
36#ifdef WIN32
37#pragma warning( disable:4251 )
38#endif
39
40class QtxResourceMgr;
41
43{
44 Q_OBJECT
45
46private:
47 QtxSplash( const QPixmap& );
48
49public:
51 typedef enum {
52 LeftSide = 0x0001,
53 RightSide = 0x0002,
54 TopSide = 0x0004,
55 BottomSide = 0x0008,
56 LeftToRight = 0x0010,
57 RightToLeft = 0x0020
58 } ProgressBarFlags;
59
60 virtual ~QtxSplash();
61
62 static QtxSplash* splash( const QPixmap& = QPixmap() );
63
64 static void setStatus( const QString&, const int = -1 );
65 static void setError( const QString&, const QString& = QString(), const int = -1 );
66
67 void setSize( const QSize& );
68 void setSize( int, int );
69 QSize fixedSize() const;
70
71 void setPixmap( const QPixmap& );
72 QPixmap pixmap() const;
73
74 void setHideOnClick( const bool );
75 bool hideOnClick() const;
76
77 void setProgressVisible( const bool );
78 bool progressVisible() const;
79
80 void setMessageVisible( const bool );
81 bool messageVisible() const;
82
83 void setPercentageVisible( const bool );
84 bool percentageVisible() const;
85
86 void setTotalSteps( const int );
87 int totalSteps() const;
88
89 void setProgress( const int );
90 void setProgress( const int, const int );
91 int progress() const;
92
93 void setMargin( const int );
94 int margin() const;
95
96 void setProgressWidth( const int );
97 int progressWidth() const;
98
99 void setProgressFlags( const int );
100 int progressFlags() const;
101
102 void setProgressColors( const QColor&,
103 const QColor& = QColor(),
105 void setProgressColors( const QGradient& );
106 const QGradient* progressColors() const;
107
108 void setOpacity( const double );
109 double opacity() const;
110
111 void setTextAlignment( const int );
112 int textAlignment() const;
113
114 void setTextColors( const QColor&, const QColor& = QColor() );
115 void textColors( QColor&, QColor& ) const;
116
117 void setConstantInfo( const QString& info );
118 QString constantInfo() const;
119
120 void setOption( const QString&, const QString& );
121 QString option( const QString& ) const;
122
123 QString message() const;
124
125 int error() const;
126
127 void finish( QWidget* );
128 void repaint();
129
130 void readSettings( QtxResourceMgr*, const QString& = QString() );
131
132public slots:
133 void setMessage( const QString&,
134 const int,
135 const QColor& = QColor() );
136 void setMessage( const QString& );
137 void clear();
138
139protected:
140 virtual void mousePressEvent( QMouseEvent* );
141 virtual void customEvent( QEvent* );
142 virtual void paintEvent( QPaintEvent* );
143
144 virtual void drawContents( QPainter* );
145
146 virtual void drawProgressBar( QPainter* );
147 virtual void drawMessage( QPainter* );
148
149private:
150 void drawContents();
151 void setError( const int );
152 QString fullMessage() const;
153
154private:
155 typedef QMap<QString, QString> OptMap;
156
157private:
159
160 QSize mySize;
161 QPixmap myPixmap;
162 QString myInfo;
163 QString myMessage;
165 QColor myColor;
170 QGradient myGradient;
174 double myOpacity;
180};
181
182#endif
#define QTX_EXPORT
Definition: Qtx.h:36
Orientation
Orientation.
Definition: SalomePyQt.h:147
@ Vertical
Vertical orientation.
Definition: SalomePyQt.h:149
Application resources manager.
Definition: QtxResourceMgr.h:53
The QtxSplash widget provides a splash screen that can be shown during application startup.
Definition: QtxSplash.h:43
bool myShowProgress
'show progress bar' flag
Definition: QtxSplash.h:177
int myProgressFlags
progress bar flags (QtxSplash::ProgressBarFlags)
Definition: QtxSplash.h:172
bool myShowMessage
'show status message' flag
Definition: QtxSplash.h:178
int myMargin
margin (for progress bar and status message)
Definition: QtxSplash.h:173
OptMap myOptions
constant info options
Definition: QtxSplash.h:176
int myProgress
current progress
Definition: QtxSplash.h:168
QGradient myGradient
progress bar custom gradient
Definition: QtxSplash.h:170
bool myHideOnClick
'hide on click' flag
Definition: QtxSplash.h:167
QSize mySize
splash size
Definition: QtxSplash.h:160
int myTotal
total progress steps
Definition: QtxSplash.h:169
int myAlignment
text alignment flags (Qt::Alignment)
Definition: QtxSplash.h:164
QColor myShadowColor
text shadow color
Definition: QtxSplash.h:166
QString myMessage
current status message
Definition: QtxSplash.h:163
int myError
error code
Definition: QtxSplash.h:175
static QtxSplash * mySplash
The only one instance of splash screen.
Definition: QtxSplash.h:158
bool myShowPercent
'show percentage' flag
Definition: QtxSplash.h:179
double myOpacity
progress bar / status message opacity
Definition: QtxSplash.h:174
QPixmap myPixmap
splash pixmap
Definition: QtxSplash.h:161
int myProgressWidth
progress bar width
Definition: QtxSplash.h:171
QColor myColor
text color
Definition: QtxSplash.h:165
QString myInfo
constant info
Definition: QtxSplash.h:162
QMap< QString, QString > OptMap
Definition: QtxSplash.h:155