4 #ifndef pqCoreUtilities_h 5 #define pqCoreUtilities_h 8 #include "pqEventDispatcher.h" 14 #include <QMessageBox> 17 #include <QStringList> 30 typedef QObject Superclass;
37 void eventInvoked(
vtkObject*,
unsigned long,
void*);
42 void executeEvent(
vtkObject*,
unsigned long,
void*);
62 static void setMainWidget(QWidget* widget) { pqCoreUtilities::MainWidget = widget; }
65 if (!pqCoreUtilities::MainWidget)
67 pqCoreUtilities::MainWidget = pqCoreUtilities::findMainWindow();
69 return pqCoreUtilities::MainWidget;
75 static void processEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents)
77 pqEventDispatcher::processEvents(flags);
86 static QString getParaViewUserDirectory();
91 static QString getParaViewApplicationDirectory();
98 static QString getParaViewApplicationDataDirectory();
104 static QStringList findParaviewPaths(
105 QString directoryOrFileName,
bool lookupInAppDir,
bool lookupInUserDir);
106 static QString getNoneExistingFileName(QString expectedFilePath);
117 static unsigned long connect(
vtkObject* vtk_object,
int vtk_event_id, QObject* qobject,
118 const char* signal_or_slot, Qt::ConnectionType
type = Qt::AutoConnection);
138 static bool promptUser(
const QString& settingsKey, QMessageBox::Icon icon,
const QString&
title,
139 const QString& message, QMessageBox::StandardButtons buttons, QWidget* parentWdg =
nullptr);
147 static QMessageBox::Button promptUserGeneric(
const QString& title,
const QString& message,
148 QMessageBox::Icon icon, QMessageBox::StandardButtons buttons, QWidget* parentWidget);
159 static QString number(
double value,
int lowExponent = -6,
int highExponent = 20);
165 static QString formatFullNumber(
double value);
172 static QString formatDouble(
double value,
int notation,
bool shortAccurate,
int precision,
173 int fullLowExponent = -6,
int fullHighExponent = 20);
176 static QString formatNumber(
double value);
179 static QString formatTime(
double value);
187 static QString formatMemoryFromKiBValue(
double memoryInKB,
int precision = 2);
194 static void initializeClickMeButton(QAbstractButton* button);
200 static void setPaletteHighlightToOk(QPalette& palette);
206 static void setPaletteHighlightToWarning(QPalette& palette);
212 static void setPaletteHighlightToCritical(QPalette& palette);
218 static void removeRecursively(QDir
dir);
224 static void remove(
const QString& filePath);
227 static QWidget* findMainWindow();
228 static QPointer<QWidget> MainWidget;
static QWidget * mainWidget()
INTERNAL CLASS (DO NOT USE).
pqCoreUtilities is a collection of arbitrary utility functions that can be used by the application...
static void processEvents(QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
Call QApplication::processEvents plus make sure the testing framework is.
static void setMainWidget(QWidget *widget)
When popping up dialogs, it's generally better if we set the parent widget for those dialogs to be th...