Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
Public Member Functions | Private Member Functions | Private Attributes | List of all members
geometrize::dialog::GeometrizeSplashScreen Class Reference
Inheritance diagram for geometrize::dialog::GeometrizeSplashScreen:
Inheritance graph
[legend]
Collaboration diagram for geometrize::dialog::GeometrizeSplashScreen:
Collaboration graph
[legend]

Public Member Functions

 GeometrizeSplashScreen ()
 
virtual ~GeometrizeSplashScreen ()=default
 
void setState (const SplashState state)
 

Private Member Functions

void setProgress (const int value)
 
virtual void drawContents (QPainter *painter) override
 
void processEvents ()
 

Private Attributes

int m_progress
 

Constructor & Destructor Documentation

geometrize::dialog::GeometrizeSplashScreen::GeometrizeSplashScreen ( )
inline
25  : QSplashScreen{nullptr}, m_progress{0}
26  {
27  setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
28  setPixmap(QPixmap(":/logos/splashscreen.png"));
29  setCursor(Qt::BusyCursor);
31  if(const auto mouseScreen = geometrize::common::ui::getFirstScreenContainingCursor()) {
33  }
34  }
void centerWidgetOnScreen(QWidget &widget, const QScreen &screen)
Definition: uiactions.cpp:37
void setState(const SplashState state)
Definition: appsplashscreen.cpp:37
int m_progress
Definition: appsplashscreen.cpp:97
const QScreen * getFirstScreenContainingCursor()
Definition: uiactions.cpp:30
virtual geometrize::dialog::GeometrizeSplashScreen::~GeometrizeSplashScreen ( )
virtualdefault

Member Function Documentation

virtual void geometrize::dialog::GeometrizeSplashScreen::drawContents ( QPainter *  painter)
inlineoverrideprivatevirtual
64  {
65  QSplashScreen::drawContents(painter);
66 
67  // Set style for progressbar
68  const int barHeight = 24;
69  const int border = 0;
70  QProgressBar renderer;
71 
72  const QString style = "QProgressBar { border: 0px; background-color: #FFFFFF; } QProgressBar::chunk { background-color: #505050; width: 20px; }";
73 
74  renderer.resize(width() - border * 2, barHeight);
75  renderer.setMinimum(0);
76  renderer.setMaximum(100);
77  renderer.setValue(m_progress);
78  renderer.setTextVisible(false);
79 
80  renderer.setStyleSheet(style);
81  painter->save();
82  painter->translate(border, height() - barHeight);
83  renderer.render(painter);
84  painter->restore();
85  }
int m_progress
Definition: appsplashscreen.cpp:97
void geometrize::dialog::GeometrizeSplashScreen::processEvents ( )
inlineprivate
88  {
89  QCoreApplication* instance = QCoreApplication::instance();
90  if(!instance) {
91  assert(0 && "Failed to get app instance, app needs to exist before showing splash screen");
92  return;
93  }
94  instance->processEvents();
95  }

Here is the caller graph for this function:

void geometrize::dialog::GeometrizeSplashScreen::setProgress ( const int  value)
inlineprivate
59  {
60  m_progress = geometrize::util::clamp(value, 0, 100);
61  }
int m_progress
Definition: appsplashscreen.cpp:97
T clamp(T value, T lower, T upper)
clamp Clamps a value within a range.
Definition: util.h:220

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::dialog::GeometrizeSplashScreen::setState ( const SplashState  state)
inline
38  {
39  switch(state) {
41  setProgress(0);
42  show();
43  break;
45  setProgress(50);
46  break;
48  setProgress(100);
49  hide();
50  break;
51  }
52 
53  update();
54  processEvents();
55  }
void setProgress(const int value)
Definition: appsplashscreen.cpp:58
void processEvents()
Definition: appsplashscreen.cpp:87

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

int geometrize::dialog::GeometrizeSplashScreen::m_progress
private

The documentation for this class was generated from the following file: