39 #ifndef __OPENFLUID_UICOMMON_UIHELPERS_HPP__ 40 #define __OPENFLUID_UICOMMON_UIHELPERS_HPP__ 49 namespace openfluid {
namespace ui {
namespace common {
54 return QColor(qrand() % 256,qrand() % 256,qrand() % 256);
62 inline void fixLineEdit(QLineEdit* LineEdit,QRegExp SearchRegExp = QRegExp(
"[^\\w]"),QString NewStr =
"_")
64 int CPos = LineEdit->cursorPosition();
65 LineEdit->setText(LineEdit->text().replace(SearchRegExp,NewStr));
66 LineEdit->setCursorPosition(CPos);
74 inline QIcon
getIcon(
const QString& IconName,
const QString& ResourcePath,
bool IsLight =
false)
76 QString IconSuffix =
"dark";
80 QIcon TmpIcon(QString(
":%1/icons/%2_%3.png").arg(ResourcePath).arg(IconName).arg(IconSuffix));
83 TmpIcon.addPixmap(QPixmap(QString(
":%1/icons/%2_grayed.png").arg(ResourcePath).arg(IconName)),QIcon::Disabled);
QColor getRandomColor()
Definition: UIHelpers.hpp:52
QIcon getIcon(const QString &IconName, const QString &ResourcePath, bool IsLight=false)
Definition: UIHelpers.hpp:74
Definition: ApplicationException.hpp:47
void fixLineEdit(QLineEdit *LineEdit, QRegExp SearchRegExp=QRegExp("[^\]"), QString NewStr="_")
Definition: UIHelpers.hpp:62