Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
qt_utils.h File Reference
#include <QAbstractProxyModel>
#include <QComboBox>
#include <QFileDialog>
#include <QFormLayout>
#include <QMetaEnum>
#include <QPalette>
#include <QPoint>
#include <QRect>
#include <QSize>
#include <QString>
#include <QTreeView>
#include <misc/global.h>
Include dependency graph for qt_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  sf::PaletteColors
 Type to hold palette colors. More...
 

Namespaces

namespace  sf
 

Functions

std::ostream & operator<< (std::ostream &os, const QString &qs)
 Operator stream a QString instance to ans std ostream.
 
QPoint operator- (const QPoint &pt, const QSize &sz)
 Allows moving a QPoint using a QSize.
 
QPoint operator+ (const QPoint &pt, const QSize &sz)
 Allows moving a QPoint using a QSize.
 
QRect operator+ (const QRect &rc, const QSize &sz)
 Allows adjusting the QRect size using a QSize.
 
QRect operator- (const QRect &rc, const QSize &sz)
 Allows adjusting the QRect size using a QSize.
 
QRect operator+ (const QRect &rc, const QPoint &pt)
 Allows adjusting the QRect position using a QPoint.
 
QRect operator+= (QRect &rc, const QPoint &pt)
 Allows adjusting the QRect position using a QPoint.
 
QRect operator- (const QRect &rc, const QPoint &pt)
 Allows adjusting the QRect position using a QPoint.
 
QRect operator-= (QRect &rc, const QPoint &pt)
 Allows adjusting the QRect position using a QPoint.
 
QRect & inflate (QRect &r, int sz)
 Inflates the passed rect on all sides using an integer.
 
constexpr QRect inflated (const QRect &r, int sz)
 Inflates a copy the rectangle an integer and returns it.
 
QSize asQSize (const QPoint &pt)
 Gets the passed Qt point as a Qt size class.
 
QSizeF asQSizeF (const QPointF &pt)
 Gets the passed Qt point as a Qt size class.
 
_MISC_FUNC std::string sf::toString (const QRect &rect)
 Converts the passed Qt rectangle into a std string.
 
_MISC_FUNC QRect sf::moveRectWithinRect (const QRect &outer, const QRect &inner)
 Moves the inner in to the outer rectangle.
 
_MISC_FUNC QMetaObject::Connection sf::connectByName (const QWidget *widget, const QString &sender_name, const char *signal_name, const QObject *receiver, const char *method_name, Qt::ConnectionType ct=Qt::AutoConnection)
 Connects signals by name of sender and name of signal.
 
_MISC_FUNC QStringList sf::getObjectNamePath (const QObject *object, bool use_rtti=false)
 Gets all the parent names from the object's parent in a string list.
 
_MISC_FUNC QLayout * sf::getWidgetLayout (const QWidget *widget)
 Gets the layout containing the passed widget.
 
_MISC_FUNC int sf::indexFromComboBox (const QComboBox *comboBox, const QVariant &value, int default_index=-1)
 Gets the index from the passed data value of the passed combo box widget.
 
_MISC_FUNC QPair< int, QFormLayout::ItemRole > sf::getLayoutPosition (const QFormLayout *layout, QObject *target)
 Gets the position (row, role) from the passed target object in te form-layout.
 
_MISC_FUNC int sf::getLayoutIndex (const QBoxLayout *layout, QObject *target)
 Gets the index from the passed target object in te box-layout.
 
void sf::resizeColumnsToContents (QTreeView *treeView)
 Resizes all columns to content of a tree view except the last column.
 
_MISC_FUNC void sf::dumpObjectProperties (const QObject *obj)
 Dumps all the object properties in qDebug().
 
template<typename T >
T * sf::getSourceModel (const QAbstractItemModel *am)
 Gets the model type pointer from the passed abstract model pointer.
 
_MISC_FUNC QModelIndex sf::getSourceModelIndex (const QModelIndex &index)
 Gets the source index in case a proxy model has been used.
 
_MISC_FUNC void sf::expandTreeView (QTreeView *tv, bool expand=true, const QModelIndex &index={})
 Expands or collapses a tree view's items.
 
_MISC_FUNC bool sf::isGuiApplication ()
 Checks if the running QCoreApplication is a GUI application.
 
std::ostream & operator<< (std::ostream &os, const QRect &rect)
 Output stream operator for a QRect class.
 

Function Documentation

◆ asQSize()

QSize asQSize ( const QPoint &  pt)
inline

Gets the passed Qt point as a Qt size class.

Parameters
ptQt point instance.
Returns
Qt Size instance.

◆ asQSizeF()

QSizeF asQSizeF ( const QPointF &  pt)
inline

Gets the passed Qt point as a Qt size class.

Parameters
ptQt point instance.
Returns
Qt Size instance.

◆ inflate()

QRect & inflate ( QRect &  r,
int  sz 
)
inline

Inflates the passed rect on all sides using an integer.

◆ inflated()

constexpr QRect inflated ( const QRect &  r,
int  sz 
)
constexpr

Inflates a copy the rectangle an integer and returns it.

◆ operator+() [1/3]

QPoint operator+ ( const QPoint &  pt,
const QSize &  sz 
)
inline

Allows moving a QPoint using a QSize.

◆ operator+() [2/3]

QRect operator+ ( const QRect &  rc,
const QPoint &  pt 
)
inline

Allows adjusting the QRect position using a QPoint.

◆ operator+() [3/3]

QRect operator+ ( const QRect &  rc,
const QSize &  sz 
)
inline

Allows adjusting the QRect size using a QSize.

◆ operator+=()

QRect operator+= ( QRect &  rc,
const QPoint &  pt 
)
inline

Allows adjusting the QRect position using a QPoint.

◆ operator-() [1/3]

QPoint operator- ( const QPoint &  pt,
const QSize &  sz 
)
inline

Allows moving a QPoint using a QSize.

◆ operator-() [2/3]

QRect operator- ( const QRect &  rc,
const QPoint &  pt 
)
inline

Allows adjusting the QRect position using a QPoint.

◆ operator-() [3/3]

QRect operator- ( const QRect &  rc,
const QSize &  sz 
)
inline

Allows adjusting the QRect size using a QSize.

◆ operator-=()

QRect operator-= ( QRect &  rc,
const QPoint &  pt 
)
inline

Allows adjusting the QRect position using a QPoint.

◆ operator<<() [1/2]

std::ostream & operator<< ( std::ostream &  os,
const QRect &  rect 
)
inline

Output stream operator for a QRect class.

◆ operator<<() [2/2]

std::ostream & operator<< ( std::ostream &  os,
const QString &  qs 
)
inline

Operator stream a QString instance to ans std ostream.