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();
97 static QStringList findParaviewPaths(
98 QString directoryOrFileName,
bool lookupInAppDir,
bool lookupInUserDir);
99 static QString getNoneExistingFileName(QString expectedFilePath);
110 static unsigned long connect(
vtkObject* vtk_object,
int vtk_event_id, QObject* qobject,
111 const char* signal_or_slot, Qt::ConnectionType
type = Qt::AutoConnection);
131 static bool promptUser(
const QString& settingsKey, QMessageBox::Icon icon,
const QString&
title,
132 const QString& message, QMessageBox::StandardButtons buttons, QWidget* parentWdg =
nullptr);
140 static QMessageBox::Button promptUserGeneric(
const QString& title,
const QString& message,
141 QMessageBox::Icon icon, QMessageBox::StandardButtons buttons, QWidget* parentWidget);
152 static QString number(
double value,
int lowExponent = -6,
int highExponent = 20);
158 static QString formatFullNumber(
double value);
165 static QString formatDouble(
double value,
int notation,
bool shortAccurate,
int precision,
166 int fullLowExponent = -6,
int fullHighExponent = 20);
169 static QString formatNumber(
double value);
172 static QString formatTime(
double value);
180 static QString formatMemoryFromKiBValue(
double memoryInKB,
int precision = 2);
187 static void initializeClickMeButton(QAbstractButton* button);
193 static void setPaletteHighlightToOk(QPalette& palette);
199 static void setPaletteHighlightToWarning(QPalette& palette);
205 static void setPaletteHighlightToCritical(QPalette& palette);
211 static void removeRecursively(QDir
dir);
217 static void remove(
const QString& filePath);
220 static QWidget* findMainWindow();
221 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...