VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtQtUtil.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2016 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCoreQt/vrvCoreQt.h>
13 #include <QtWidgets/QMessageBox>
14 #include <QtCore/QEvent>
15 #include <QtCore/QString>
16 
17 namespace makVrv
18 {
19 
23  {
24  public:
25  // We check the Virtual Keys to differentiate between some of the
26  // keys that are mapped to the same QT enum.
27 
28  // Widows virtual key codes
29  // Only get the first 10 if numlock is on
30  static const unsigned int DtVK_NUMPAD0 = 0x60;
31  static const unsigned int DtVK_NUMPAD1 = 0x61;
32  static const unsigned int DtVK_NUMPAD2 = 0x62;
33  static const unsigned int DtVK_NUMPAD3 = 0x63;
34  static const unsigned int DtVK_NUMPAD4 = 0x64;
35  static const unsigned int DtVK_NUMPAD5 = 0x65;
36  static const unsigned int DtVK_NUMPAD6 = 0x66;
37  static const unsigned int DtVK_NUMPAD7 = 0x67;
38  static const unsigned int DtVK_NUMPAD8 = 0x68;
39  static const unsigned int DtVK_NUMPAD9 = 0x69;
40 
41  // Get these regardless of numlock state
42  static const unsigned int DtVK_MULTIPLY = 0x6A;
43  static const unsigned int DtVK_ADD = 0x6B;
44  static const unsigned int DtVK_SUBTRACT = 0x6D;
45  static const unsigned int DtVK_DECIMAL = 0x6E;
46  static const unsigned int DtVK_DIVIDE = 0x6F;
47 
48  // Linux virtual key codes
49  // Only get the first 10 if numlock is on
50  static const unsigned int DtVK_NUMPAD0_LINUX = 0xFFB0;
51  static const unsigned int DtVK_NUMPAD1_LINUX = 0xFFB1;
52  static const unsigned int DtVK_NUMPAD2_LINUX = 0xFFB2;
53  static const unsigned int DtVK_NUMPAD3_LINUX = 0xFFB3;
54  static const unsigned int DtVK_NUMPAD4_LINUX = 0xFFB4;
55  static const unsigned int DtVK_NUMPAD5_LINUX = 0xFFB5;
56  static const unsigned int DtVK_NUMPAD6_LINUX = 0xFFB6;
57  static const unsigned int DtVK_NUMPAD7_LINUX = 0xFFB7;
58  static const unsigned int DtVK_NUMPAD8_LINUX = 0xFFB8;
59  static const unsigned int DtVK_NUMPAD9_LINUX = 0xFFB9;
60 
61  // Get these regardless of numlock state
62  static const unsigned int DtVK_MULTIPLY_LINUX = 0xFFAA;
63  static const unsigned int DtVK_ADD_LINUX = 0xFFAB;
64  static const unsigned int DtVK_SUBTRACT_LINUX = 0xFFAD;
65  static const unsigned int DtVK_DECIMAL_LINUX = 0xFFAE;
66  static const unsigned int DtVK_DIVIDE_LINUX = 0xFFAF;
67 
68  public:
72  static QString eventTypeName(QEvent::Type eventType);
73 
77  static QString eventTypeName(QEvent const * event);
78 
81  static QMessageBox::StandardButton critical(
82  QWidget * parent, const QString & title, const QString & text,
83  QMessageBox::StandardButtons buttons = QMessageBox::Ok,
84  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
85  Qt::WindowFlags f = Qt::Tool | Qt::MSWindowsFixedSizeDialogHint);
86 
89  static QMessageBox::StandardButton critical(
90  QWidget * parent, const QString & title, const QString & text,
91  bool & checkBoxChecked, const QString& checkBoxText = QString::fromStdString("Do not show this dialog again"),
92  QMessageBox::StandardButtons buttons = QMessageBox::Ok,
93  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
94  Qt::WindowFlags f = Qt::Tool | Qt::MSWindowsFixedSizeDialogHint);
95 
98  static QMessageBox::StandardButton information (
99  QWidget * parent, const QString & title, const QString & text,
100  const QString& checkBoxText = QString(),
101  QMessageBox::StandardButtons buttons = QMessageBox::Ok,
102  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
103  Qt::WindowFlags f = Qt::Tool | Qt::MSWindowsFixedSizeDialogHint );
104 
107  static QMessageBox::StandardButton information(
108  QWidget * parent, const QString & title, const QString & text,
109  bool & checkBoxChecked, const QString& checkBoxText = QString::fromStdString("Do not show this dialog again"),
110  QMessageBox::StandardButtons buttons = QMessageBox::Ok,
111  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
112  Qt::WindowFlags f = Qt::Tool | Qt::MSWindowsFixedSizeDialogHint);
113 
116  static QMessageBox::StandardButton question (
117  QWidget * parent, const QString & title, const QString & text,
118  QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No,
119  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
120  Qt::WindowFlags f = Qt::MSWindowsFixedSizeDialogHint | Qt::Tool);
121 
124  static QMessageBox::StandardButton question(
125  QWidget * parent, const QString & title, const QString & text,
126  bool & checkBoxChecked, const QString& checkBoxText = QString::fromStdString("Do not show this dialog again"),
127  QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No,
128  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
129  Qt::WindowFlags f = Qt::MSWindowsFixedSizeDialogHint | Qt::Tool);
130 
133  static QMessageBox::StandardButton warning (
134  QWidget * parent, const QString & title, const QString & text,
135  QMessageBox::StandardButtons buttons = QMessageBox::Ok,
136  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
137  Qt::WindowFlags f = Qt::MSWindowsFixedSizeDialogHint | Qt::Tool);
138 
141  static QMessageBox::StandardButton warning(
142  QWidget * parent, const QString & title, const QString & text,
143  bool & checkBoxChecked, const QString& checkBoxText = QString::fromStdString("Do not show this dialog again"),
144  QMessageBox::StandardButtons buttons = QMessageBox::Ok,
145  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
146  Qt::WindowFlags f = Qt::MSWindowsFixedSizeDialogHint | Qt::Tool);
147 
149  static int calculateStepSize( int maxRange, int numberOfSteps );
155  static double calculateStepSize( double maxRange, int numberOfSteps, int decimals );
157 
158  private:
159 
162  static QMessageBox::StandardButton showMessageBox (
163  QMessageBox& mbox, QMessageBox::StandardButton defaultButton);
164 
165  };
166 
167 }
#define DT_DLL_VRVCOREQT
Definition: vrvCoreQt.h:20
Contains DLL export macros.
Provides static utility functions for Qt.
Definition: DtQtUtil.h:22

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)