VR-Forces Developer's Guide
 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) 2022 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 class QLayout;
18 
19 namespace makVrv
20 {
21  class DtDe;
22 
23 
27  {
28  public:
29  // We check the Virtual Keys to differentiate between some of the
30  // keys that are mapped to the same QT enum.
31 
32  // Widows virtual key codes
33  // Only get the first 10 if numlock is on
34  static const unsigned int DtVK_NUMPAD0 = 0x60;
35  static const unsigned int DtVK_NUMPAD1 = 0x61;
36  static const unsigned int DtVK_NUMPAD2 = 0x62;
37  static const unsigned int DtVK_NUMPAD3 = 0x63;
38  static const unsigned int DtVK_NUMPAD4 = 0x64;
39  static const unsigned int DtVK_NUMPAD5 = 0x65;
40  static const unsigned int DtVK_NUMPAD6 = 0x66;
41  static const unsigned int DtVK_NUMPAD7 = 0x67;
42  static const unsigned int DtVK_NUMPAD8 = 0x68;
43  static const unsigned int DtVK_NUMPAD9 = 0x69;
44 
45  // Get these regardless of numlock state
46  static const unsigned int DtVK_MULTIPLY = 0x6A;
47  static const unsigned int DtVK_ADD = 0x6B;
48  static const unsigned int DtVK_SUBTRACT = 0x6D;
49  static const unsigned int DtVK_DECIMAL = 0x6E;
50  static const unsigned int DtVK_DIVIDE = 0x6F;
51 
52  // Linux virtual key codes
53  // Only get the first 10 if numlock is on
54  static const unsigned int DtVK_NUMPAD0_LINUX = 0xFFB0;
55  static const unsigned int DtVK_NUMPAD1_LINUX = 0xFFB1;
56  static const unsigned int DtVK_NUMPAD2_LINUX = 0xFFB2;
57  static const unsigned int DtVK_NUMPAD3_LINUX = 0xFFB3;
58  static const unsigned int DtVK_NUMPAD4_LINUX = 0xFFB4;
59  static const unsigned int DtVK_NUMPAD5_LINUX = 0xFFB5;
60  static const unsigned int DtVK_NUMPAD6_LINUX = 0xFFB6;
61  static const unsigned int DtVK_NUMPAD7_LINUX = 0xFFB7;
62  static const unsigned int DtVK_NUMPAD8_LINUX = 0xFFB8;
63  static const unsigned int DtVK_NUMPAD9_LINUX = 0xFFB9;
64 
65  // Get these regardless of numlock state
66  static const unsigned int DtVK_MULTIPLY_LINUX = 0xFFAA;
67  static const unsigned int DtVK_ADD_LINUX = 0xFFAB;
68  static const unsigned int DtVK_SUBTRACT_LINUX = 0xFFAD;
69  static const unsigned int DtVK_DECIMAL_LINUX = 0xFFAE;
70  static const unsigned int DtVK_DIVIDE_LINUX = 0xFFAF;
71 
72  public:
76  static QString eventTypeName(QEvent::Type eventType);
77 
81  static QString eventTypeName(QEvent const * event);
82 
85  static QMessageBox::StandardButton critical(DtDe& de,
86  QWidget * parent, const QString & title, const QString & text,
87  QMessageBox::StandardButtons buttons = QMessageBox::Ok,
88  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
89  Qt::WindowFlags f = Qt::Tool | Qt::MSWindowsFixedSizeDialogHint);
90 
93  static QMessageBox::StandardButton critical(DtDe& de,
94  QWidget * parent, const QString & title, const QString & text,
95  bool & checkBoxChecked, const QString& checkBoxText = QString::fromStdString("Do not show this dialog again"),
96  QMessageBox::StandardButtons buttons = QMessageBox::Ok,
97  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
98  Qt::WindowFlags f = Qt::Tool | Qt::MSWindowsFixedSizeDialogHint);
99 
102  static QMessageBox::StandardButton information (DtDe& de,
103  QWidget * parent, const QString & title, const QString & text,
104  const QString& checkBoxText = QString(),
105  QMessageBox::StandardButtons buttons = QMessageBox::Ok,
106  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
107  Qt::WindowFlags f = Qt::Tool | Qt::MSWindowsFixedSizeDialogHint );
108 
111  static QMessageBox::StandardButton information(DtDe& de,
112  QWidget * parent, const QString & title, const QString & text,
113  bool & checkBoxChecked, const QString& checkBoxText = QString::fromStdString("Do not show this dialog again"),
114  QMessageBox::StandardButtons buttons = QMessageBox::Ok,
115  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
116  Qt::WindowFlags f = Qt::Tool | Qt::MSWindowsFixedSizeDialogHint);
117 
120  static QMessageBox::StandardButton question (DtDe& de,
121  QWidget * parent, const QString & title, const QString & text,
122  QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No,
123  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
124  Qt::WindowFlags f = Qt::MSWindowsFixedSizeDialogHint | Qt::Tool);
125 
128  static QMessageBox::StandardButton question(DtDe& de,
129  QWidget * parent, const QString & title, const QString & text,
130  bool & checkBoxChecked, const QString& checkBoxText = QString::fromStdString("Do not show this dialog again"),
131  QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No,
132  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
133  Qt::WindowFlags f = Qt::MSWindowsFixedSizeDialogHint | Qt::Tool);
134 
137  static QMessageBox::StandardButton warning (DtDe& de,
138  QWidget * parent, const QString & title, const QString & text,
139  QMessageBox::StandardButtons buttons = QMessageBox::Ok,
140  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
141  Qt::WindowFlags f = Qt::MSWindowsFixedSizeDialogHint | Qt::Tool);
142 
145  static QMessageBox::StandardButton warning(DtDe& de,
146  QWidget * parent, const QString & title, const QString & text,
147  bool & checkBoxChecked, const QString& checkBoxText = QString::fromStdString("Do not show this dialog again"),
148  QMessageBox::StandardButtons buttons = QMessageBox::Ok,
149  QMessageBox::StandardButton defaultButton = QMessageBox::NoButton,
150  Qt::WindowFlags f = Qt::MSWindowsFixedSizeDialogHint | Qt::Tool);
151 
153  static int calculateStepSize( int maxRange, int numberOfSteps );
159  static double calculateStepSize( double maxRange, int numberOfSteps, int decimals );
161 
163  static void showLayout(QLayout* layout);
166  static void hideLayout(QLayout* layout);
168 
169  private:
170 
173  static QMessageBox::StandardButton showMessageBox (
174  QMessageBox& mbox, QMessageBox::StandardButton defaultButton);
175 
176  };
177 
178 }
#define DT_DLL_VRVCOREQT
Definition: vrvCoreQt.h:20
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
Provides static utility functions for Qt.
Definition: DtQtUtil.h:26

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)