Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::utilqt Namespace Reference

Classes

class  EditorFileObserver
 
struct  Save
 
struct  WidgetCloseEventFilter
 

Functions

IVW_QTAPPLICATIONBASE_API void configureInviwoQtApp ()
 
IVW_QTAPPLICATIONBASE_API void configureInviwoDefaultNames ()
 
IVW_QTAPPLICATIONBASE_API void logQtMessages (QtMsgType type, const QMessageLogContext &context, const QString &msg)
 
IVW_QTAPPLICATIONBASE_API void configureFileSystemObserver (InviwoApplication &app)
 
IVW_QTAPPLICATIONBASE_API void configurePostEnqueueFront (InviwoApplication &app)
 
IVW_QTAPPLICATIONBASE_API void configurePoolResizeWait (InviwoApplication &app, QWidget *window)
 
IVW_QTAPPLICATIONBASE_API void setStyleSheetFile (const std::filesystem::path &file)
 
IVW_QTAPPLICATIONBASE_API void configurePalette ()
 
QString str (std::string_view str)
 
IVW_QTAPPLICATIONBASE_API std::locale getCurrentStdLocale ()
 getCurrentStdLocale This function returns the current system locale provided by Qt. If the Qt application has not been initialized, the returned value is the environment's default locale.
 
IVW_QTEDITOR_API QImage generatePreview (Processor &processor)
 
IVW_QTEDITOR_API QImage generatePreview (std::string_view classIdentifier, ProcessorFactory *factory)
 
IVW_QTEDITOR_API QImage generateProcessorPreview (const QString &classIdentifier, double opacity=1.0)
 
IVW_QTEDITOR_API QImage generateProcessorPreview (Processor &processor, double opacity=1.0)
 
IVW_QTEDITOR_API void saveProcessorPreviews (InviwoApplication *app, std::string &path)
 
template<typename Enum >
QVariant getData (const QModelIndex &index, Enum e)
 
QVariant getData (const QModelIndex &index, Qt::ItemDataRole r)
 
IVW_MODULE_OPENGLQT_API std::vector< std::shared_ptr< std::function< void()> > > setGLSLSyntaxHighlight (SyntaxHighlighter &sh, GLSLSyntaxHighlight &settings)
 
IVW_MODULE_PYTHON3QT_API std::vector< std::shared_ptr< std::function< void()> > > setPythonSyntaxHighlight (SyntaxHighlighter &sh, PythonSyntaxHighlight &settings)
 
IVW_MODULE_PYTHON3QT_API std::vector< std::shared_ptr< std::function< void()> > > setPythonOutputSyntaxHighlight (SyntaxHighlighter &sh, PythonSyntaxHighlight &settings)
 
IVW_MODULE_QTWIDGETS_API MouseButtons getMouseButtons (const QMouseEvent *e)
 Convert the button state when the event was generated to an inviwo button.
 
IVW_MODULE_QTWIDGETS_API MouseButton getMouseButtonCausingEvent (const QMouseEvent *e)
 Convert the button originally causing the event to an inviwo button.
 
IVW_MODULE_QTWIDGETS_API MouseButtons getMouseWheelButtons (const QWheelEvent *e)
 
IVW_MODULE_QTWIDGETS_API KeyModifiers getModifiers (const QInputEvent *e)
 
IVW_MODULE_QTWIDGETS_API GestureState getGestureState (const QGesture *e)
 
IVW_MODULE_QTWIDGETS_API IvwKey getKeyButton (const QKeyEvent *e)
 
IVW_MODULE_QTWIDGETS_API std::ios_base & localizeStream (std::ios_base &stream)
 localize The given stream is imbued with the currently set system locale provided by Qt.
 
QString toLocalQString (std::string_view str)
 create a QString from a UTF8-encoded std::string
 
QString toLocalQString (const std::string &str)
 create a QString from a UTF8-encoded std::string
 
std::string fromLocalQString (const QString &str)
 convert a QString to a localized 8bit std::string
 
QString toQString (std::string_view str)
 create a QString from a UTF8-encoded std::string
 
QString toQString (const std::string &str)
 create a QString from a UTF8-encoded std::string
 
QString toQString (const std::filesystem::path &path)
 
std::string fromQString (const QString &str)
 create a UTF8-encoded std::string from a QString
 
std::filesystem::path toPath (const QString &str)
 
constexpr QPointF toQPoint (dvec2 v)
 
constexpr QPoint toQPoint (ivec2 v)
 
constexpr dvec2 toGLM (QPointF v)
 
constexpr ivec2 toGLM (QPoint v)
 
constexpr dvec2 toGLM (QSizeF v)
 
constexpr ivec2 toGLM (QSize v)
 
constexpr QSizeF toQSize (dvec2 v)
 
constexpr QSize toQSize (ivec2 v)
 
vec3 tovec3 (const QColor &c)
 
ivec3 toivec3 (const QColor &c)
 
vec4 tovec4 (const QColor &c)
 
ivec4 toivec4 (const QColor &c)
 
constexpr QColor toQColor (const ivec3 &v)
 
constexpr QColor toQColor (const uvec3 &v)
 
constexpr QColor toQColor (const vec3 &v)
 
constexpr QColor toQColor (const ivec4 &v)
 
constexpr QColor toQColor (const uvec4 &v)
 
constexpr QColor toQColor (const vec4 &v)
 
IVW_MODULE_QTWIDGETS_API QPen cosmeticPen (const QBrush &brush, qreal width, Qt::PenStyle s=Qt::SolidLine, Qt::PenCapStyle c=Qt::SquareCap, Qt::PenJoinStyle j=Qt::BevelJoin)
 
IVW_MODULE_QTWIDGETS_API void paintCheckerBoard (QPainter &painter, const QRectF &rect)
 
IVW_MODULE_QTWIDGETS_API void paint (const TransferFunction &tf, QPainter &painter, const QRectF &rect)
 
IVW_MODULE_QTWIDGETS_API void paint (const IsoValueCollection &isoValues, QPainter &painter, const QRectF &rect)
 
IVW_MODULE_QTWIDGETS_API void paintMask (const dvec2 &mask, const dvec2 &range, QPainter &painter, const QRectF &rect)
 
IVW_MODULE_QTWIDGETS_API QPixmap toQPixmap (const TransferFunction &tf, const QSize &size)
 
IVW_MODULE_QTWIDGETS_API QPixmap toQPixmap (const TransferFunctionProperty &tfproperty, const QSize &size)
 
IVW_MODULE_QTWIDGETS_API QPixmap toQPixmap (const IsoValueProperty &property, const QSize &size)
 
IVW_MODULE_QTWIDGETS_API QPixmap toQPixmap (const IsoTFProperty &property, const QSize &size)
 
IVW_MODULE_QTWIDGETS_API QPixmap toQPixmap (const TFPropertyConcept &propertyConcept, const QSize &size)
 
IVW_MODULE_QTWIDGETS_API QPointF clamp (const QPointF &pos, const QRectF &rect)
 
IVW_MODULE_QTWIDGETS_API QMainWindow * getApplicationMainWindow ()
 Retrieve the QMainWindow named "InviwoMainWindow" from QApplication.
 
IVW_MODULE_QTWIDGETS_API QPoint movePointOntoDesktop (const QPoint &point, const QSize &size, bool decorationOffset=true)
 Moves point to become relative to the main window and thereby visible.
 
IVW_MODULE_QTWIDGETS_API QPoint offsetWidget ()
 Offset widgets based on order added such that they do not end up on top of each other. Base offset of (350, 100). The offset will be increased by (40, 40) every time the function is called. Furthermore, the horizontal offset will be increased by 200 every tenth time.
 
IVW_MODULE_QTWIDGETS_API QMenu * addMenu (std::string_view menuName, const std::string &before)
 
IVW_MODULE_QTWIDGETS_API QMenu * addMenu (std::string_view menuName, QMenu *before=nullptr)
 
IVW_MODULE_QTWIDGETS_API QMenu * getMenu (std::string_view menuName, bool createIfNotFound=false)
 
IVW_MODULE_QTWIDGETS_API QImage layerToQImage (const Layer &layer)
 
IVW_MODULE_QTWIDGETS_API std::string toBase64 (const QImage &image, std::string_view format="PNG", int quality=-1)
 
IVW_MODULE_QTWIDGETS_API QImage fromBase64 (std::string_view base64, std::string_view format="PNG")
 
IVW_MODULE_QTWIDGETS_API QIcon fromBase64ToIcon (std::string_view base64, std::string_view format="PNG")
 
IVW_MODULE_QTWIDGETS_API std::vector< std::pair< std::string, QImage > > getCanvasImages (ProcessorNetwork *network, bool alpha=true)
 
IVW_MODULE_QTWIDGETS_API void addImageActions (QMenu &menu, const Image &image, LayerType visibleLayer=LayerType::Color, size_t visibleIndex=10000)
 
IVW_MODULE_QTWIDGETS_API void addViewActions (QMenu &menu, EventPropagator *ep)
 
QString windowTitleHelper (const QString &title, const QWidget *widget)
 
constexpr int refEm ()
 
constexpr double refSpaceEm ()
 
IVW_MODULE_QTWIDGETS_API int refSpacePx (const QWidget *w)
 
IVW_MODULE_QTWIDGETS_API QSize emToPx (const QWidget *w, QSizeF)
 
IVW_MODULE_QTWIDGETS_API int emToPx (const QWidget *w, double em)
 
IVW_MODULE_QTWIDGETS_API int emToPx (const QFontMetrics &m, double em)
 
IVW_MODULE_QTWIDGETS_API void setFullScreenAndOnTop (QWidget *widget, bool fullScreen, bool onTop)
 
template<typename T >
int decimals (T inc)
 
IVW_MODULE_QTWIDGETS_API std::vector< std::string > getMonoSpaceFonts ()
 Get a list of all available mono space font.
 
IVW_MODULE_QTWIDGETS_API size_t getDefaultMonoSpaceFontIndex ()
 Index of the system mono space font.
 

Detailed Description

utilqt

Function Documentation

◆ configureFileSystemObserver()

IVW_QTAPPLICATIONBASE_API void inviwo::utilqt::configureFileSystemObserver ( InviwoApplication & app)

Installs a fileSystem observer service based on Qt file observers in the inviwo app Should be called after constructing QApplication

◆ configureInviwoDefaultNames()

IVW_QTAPPLICATIONBASE_API void inviwo::utilqt::configureInviwoDefaultNames ( )

Sets the standard inviwo names in the QApplication Sets the Organization Name and Domain, and application name and icon The names are used when saving/loading qt settings. Should be called after constructing QApplication

◆ configureInviwoQtApp()

IVW_QTAPPLICATIONBASE_API void inviwo::utilqt::configureInviwoQtApp ( )

Configure Qt OpenGL settings for inviwo Should be called before constructing a QApplication

◆ configurePalette()

IVW_QTAPPLICATIONBASE_API void inviwo::utilqt::configurePalette ( )

Configure the global palette to use the same link colors as in the help widget and stylesheet

◆ configurePoolResizeWait()

IVW_QTAPPLICATIONBASE_API void inviwo::utilqt::configurePoolResizeWait ( InviwoApplication & app,
QWidget * window )

Configure the inviwo pool resize to work with the qt event system

◆ configurePostEnqueueFront()

IVW_QTAPPLICATIONBASE_API void inviwo::utilqt::configurePostEnqueueFront ( InviwoApplication & app)

Make the inviwo app post enqueue work with the qt event system Should be called after constructing QApplication

◆ generatePreview() [1/2]

IVW_QTEDITOR_API QImage inviwo::utilqt::generatePreview ( Processor & processor)

Generate an image of a processor including port connections and port names

◆ generatePreview() [2/2]

IVW_QTEDITOR_API QImage inviwo::utilqt::generatePreview ( std::string_view classIdentifier,
ProcessorFactory * factory )

Generate an image of a processor including port connections and port names

◆ generateProcessorPreview()

IVW_QTEDITOR_API QImage inviwo::utilqt::generateProcessorPreview ( const QString & classIdentifier,
double opacity = 1.0 )

Generate an image of a processor

Parameters
classIdentifierclass Identifier of the processor to generate the preview for.
opacityif opacity is less than one, the output image will be semitransparent, range [0,1]

◆ getApplicationMainWindow()

IVW_MODULE_QTWIDGETS_API QMainWindow * inviwo::utilqt::getApplicationMainWindow ( )

Retrieve the QMainWindow named "InviwoMainWindow" from QApplication.

Returns
The main window if the application contains the widget, otherwise null.

◆ getCurrentStdLocale()

IVW_QTAPPLICATIONBASE_API std::locale inviwo::utilqt::getCurrentStdLocale ( )

getCurrentStdLocale This function returns the current system locale provided by Qt. If the Qt application has not been initialized, the returned value is the environment's default locale.

Returns
std::locale Qt locale converted to std::locale

◆ getDefaultMonoSpaceFontIndex()

IVW_MODULE_QTWIDGETS_API size_t inviwo::utilqt::getDefaultMonoSpaceFontIndex ( )

Index of the system mono space font.

Returns the index of the default system mono space font in the list given by getMonoSpaceFonts

See also
getMonoSpaceFonts()
Returns
the index or 0 if the default font was not found

◆ getMonoSpaceFonts()

IVW_MODULE_QTWIDGETS_API std::vector< std::string > inviwo::utilqt::getMonoSpaceFonts ( )

Get a list of all available mono space font.

Queries the QFontDatabase for all font that isFixedPitch

◆ getMouseButtonCausingEvent()

IVW_MODULE_QTWIDGETS_API MouseButton inviwo::utilqt::getMouseButtonCausingEvent ( const QMouseEvent * e)

Convert the button originally causing the event to an inviwo button.

Converts QMouseEvent::getButton().

Note
Qt does not include the button that caused a release event in the regular QMouseEvent::getButtons function, which is why a separate conversion function is necessary
Parameters
ethe QT Mouse Event
Returns
MouseEvent::MouseButton

◆ getMouseButtons()

IVW_MODULE_QTWIDGETS_API MouseButtons inviwo::utilqt::getMouseButtons ( const QMouseEvent * e)

Convert the button state when the event was generated to an inviwo button.

Converts QMouseEvent::getButtons().

◆ localizeStream()

IVW_MODULE_QTWIDGETS_API std::ios_base & inviwo::utilqt::localizeStream ( std::ios_base & stream)

localize The given stream is imbued with the currently set system locale provided by Qt.

Parameters
streamthe locale is imbued onto this stream
Returns
std::ios_base& reference to the input stream

◆ logQtMessages()

IVW_QTAPPLICATIONBASE_API void inviwo::utilqt::logQtMessages ( QtMsgType type,
const QMessageLogContext & context,
const QString & msg )

A logging function that redirects qt log messages to the inviwo LogCentral. Can be installed by calling qInstallMessageHandler(&logQtMessages)

◆ movePointOntoDesktop()

IVW_MODULE_QTWIDGETS_API QPoint inviwo::utilqt::movePointOntoDesktop ( const QPoint & point,
const QSize & size,
bool decorationOffset = true )

Moves point to become relative to the main window and thereby visible.

Positions saved for one screen setup may end up outside on other setups. Apply this function to make sure that the widget ends up visible on the screen.

See also
CanvasProcessorWidgetQt
Parameters
pointThe previous screen position of the widget
sizeThe size of the widget
decorationOffsetOffset widget below top horizontal window bar
Returns
The adapted point on the screen, same as input point if no adjustment was necessary

◆ offsetWidget()

IVW_MODULE_QTWIDGETS_API QPoint inviwo::utilqt::offsetWidget ( )

Offset widgets based on order added such that they do not end up on top of each other. Base offset of (350, 100). The offset will be increased by (40, 40) every time the function is called. Furthermore, the horizontal offset will be increased by 200 every tenth time.

Returns

◆ setStyleSheetFile()

IVW_QTAPPLICATIONBASE_API void inviwo::utilqt::setStyleSheetFile ( const std::filesystem::path & file)

Sets a new style sheet file in the QApplication