DynExp
Highly flexible laboratory automation for dynamically changing experiments.
|
Provides utilities related to Qt and Qt widgets within DynExp's Util namespace. More...
Go to the source code of this file.
Classes | |
class | Util::QWorker |
Implements a QObject belonging to a hardware adapter (derived from DynExp::HardwareAdapterBase) that operates in DynExpCore's worker thread, not in the main user interface thread. This is useful to move e.g. ethernet/serial communication operations from the user interface thread to a worker thread. After construction, QWorker instances have to be moved to the worker thread calling QWorker::MoveToWorkerThread(). More... | |
class | Util::MarkerGraphicsView |
Implements a QGraphicsView the user can interact with to insert graphical markers. Furthermore, the graphics view enables zooming into its content. More... | |
struct | Util::MarkerGraphicsView::MarkerType |
Data associated with one marker. More... | |
class | Util::QSortingListWidget |
Implements a QListWidget that sorts its items after inserting an item by drag & drop. More... | |
class | Util::NumericSortingTableWidgetItem |
Implements a QTableWidgetItem which contains numeric content such that table widget items can be numerically compared with each other. More... | |
class | Util::NumericOnlyItemDelegate |
Implements a QItemDelegate which forces e.g. a QTableWidgetItem's content to be numeric (double-precision). More... | |
class | Util::DigitalOnlyItemDelegate |
Implements a QItemDelegate which forces e.g. a QTableWidgetItem's content to be boolean (0 or 1). More... | |
Namespaces | |
DynExp | |
DynExp's main namespace contains the implementation of DynExp including classes to manage resources (DynExp objects like hardware adapters, instruments, and modules) as well as their dependencies and parameters. | |
Util | |
DynExp's Util namespace contains commonly used functions and templates as well as extensions to Qt and its widgets. | |
Typedefs | |
using | Util::TextType = std::string |
String type of text-type parameters (DynExp::ParamsBase::Param) More... | |
using | Util::TextRefType = std::string_view |
Reference-to-string type of text-type parameters (DynExp::ParamsBase::Param) More... | |
using | Util::TextListType = std::vector< TextType > |
List type of text-type parameters. More... | |
using | Util::TextListIndexType = size_t |
List index type of Util::TextListType . More... | |
template<typename ValueType > | |
using | Util::TextValueListType = std::vector< std::pair< TextType, ValueType > > |
Type of a list containing key-value pairs where key is a text of type Util::TextType . More... | |
Functions | |
const QLocale & | Util::GetDefaultQtLocale () |
Returns the default locale properties to be assigned to Qt widgets. More... | |
template<typename EnumType > | |
auto | Util::QtEnumToTextValueList (unsigned short SkipEntriesFront=0, unsigned short SkipEntriesEnd=0, unsigned short SkipCharsFront=0, unsigned short SkipCharsEnd=0) |
Returns a TextValueListType containing entries which reflect the items (names and values) of an enumeration registered to Qt's meta-object system. More... | |
void | Util::ActivateWindow (QWidget &Widget) |
Renders a window active and brings it to the front. More... | |
Q_DECLARE_METATYPE (Util::MarkerGraphicsView::MarkerType::IDType) | |
DOM functions | |
These functions can be used to walk through an (XML-)DOM tree. | |
std::vector< QDomNode > | Util::GetChildDOMNodes (const QDomElement &Parent, const QString &ChildTagName) |
Finds child nodes with a certain tag name. More... | |
QDomNode | Util::GetSingleChildDOMNode (const QDomElement &Parent, const QString &ChildTagName) |
Finds a single child node with a certain tag name. More... | |
QDomElement | Util::GetSingleChildDOMElement (const QDomElement &Parent, const QString &ChildTagName) |
Behaves like GetSingleChildDOMNode() but returns the node converted to a DOM element. More... | |
std::string | Util::GetStringFromDOMElement (const QDomElement &Parent, const QString &ChildTagName) |
Behaves like GetSingleChildDOMElement() but returns the text from a DOM element. More... | |
template<> | |
std::string | Util::GetTFromDOMElement (const QDomElement &Parent, const QString &ChildTagName) |
Behaves like GetSingleChildDOMElement() but returns the content from a DOM element converted to a certain type using Util::StrToT(). More... | |
QDomAttr | Util::GetDOMAttribute (const QDomElement &Element, const QString &AttributeName) |
Extracts an attribute from a DOM element. More... | |
std::string | Util::GetStringFromDOMAttribute (const QDomElement &Element, const QString &AttributeName) |
Behaves like GetDOMAttribute() but returns the text from the attribute. More... | |
template<> | |
std::string | Util::GetTFromDOMAttribute (const QDomElement &Element, const QString &AttributeName) |
Behaves like GetDOMAttribute() but returns the content from an attribute converted to a certain type using Util::StrToT(). More... | |
File open and save dialogs | |
QString | Util::PromptOpenFilePath (QWidget *Parent, const QString &Title, const QString &DefaultSuffix, const QString &NameFilter, const QString &InitialDirectory="") |
Opens a file dialog to ask the user to select a single existing file. More... | |
QString | Util::PromptSaveFilePath (QWidget *Parent, const QString &Title, const QString &DefaultSuffix, const QString &NameFilter, const QString &InitialDirectory="") |
Works as PromptOpenFilePath() but asks the user to select a single file which does not need to exist. More... | |
QString | Util::PromptSaveFilePathModule (DynExp::QModuleWidget *Parent, const QString &Title, const QString &DefaultSuffix, const QString &NameFilter) |
Works as PromptOpenFilePath() but asks the user to select a single file which does not need to exist. Furthermore, the dialog automatically derives the initial directory using QModuleWidget::GetDataSaveDirectory() and sets the new global directory for saving data to the folder containing the selected file when the user accepts the dialog. More... | |
Reading and writing files | |
bool | Util::SaveToFile (const QString &Filename, std::string_view Text) |
Saves a std::string_view to a file (using QFile). Creates a new file or truncates an existing file's content. More... | |
std::string | Util::ReadFromFile (const QString &Filename) |
Reads the entire content from a text file. More... | |
std::string | Util::ReadFromFile (const std::string &Filename) |
Reads the entire content from a text file. More... | |
std::string | Util::ReadFromFile (const std::filesystem::path &Filename) |
Reads the entire content from a text file. More... | |
Image manipulation | |
using | Util::ImageHistogramType = std::array< unsigned long long, 256 > |
Alias which represents a histogram as a std::array with 256 numeric bins. The lowest (highest) index represents the darkest (brightest) intensity. More... | |
using | Util::ImageRGBHistogramType = std::tuple< ImageHistogramType, ImageHistogramType, ImageHistogramType > |
Alias which represents a RGB histogram as a std::tuple of three ImageHistogramType elements. The first tuple element represents the histogram for red, the second for green, the third for blue. More... | |
QImage | Util::QImageFromBlobData (BlobDataType &&BlobData, int Width, int Height, int BytesPerLine, QImage::Format Format) |
Converts raw pixel data stored in a Util::BlobDataType object to a QImage transfering the ownership of BlobData's content. More... | |
ImageHistogramType | Util::ComputeIntensityHistogram (const QImage &Image) |
Computes an intensity (grayscale) histogram from a QImage object. More... | |
ImageRGBHistogramType | Util::ComputeRGBHistogram (const QImage &Image) |
Computes a RGB histogram from a QImage object. More... | |
ImageHistogramType | Util::ConvertRGBToIntensityHistogram (const ImageRGBHistogramType &RGBHistogram) |
Computes an intensity (grayscale) histogram from a RGB histogram. More... | |
QPolygonF | Util::MakeCrossPolygon (QPointF Center, unsigned int ArmLength) |
Returns a QPolygonF representing a cross-style marker. More... | |
Provides utilities related to Qt and Qt widgets within DynExp's Util namespace.
Definition in file QtUtil.h.
Q_DECLARE_METATYPE | ( | Util::MarkerGraphicsView::MarkerType::IDType | ) |