15 #ifndef BORNAGAIN_MVVM_VIEW_MVVM_WIDGETS_WIDGETUTILS_H
16 #define BORNAGAIN_MVVM_VIEW_MVVM_WIDGETS_WIDGETUTILS_H
18 #include "mvvm/view_export.h"
20 #include <QStringList>
54 MVVM_VIEW_EXPORT QString
ProjectWindowTitle(
const QString& project_dir,
bool is_modified);
73 MVVM_VIEW_EXPORT QString
ClickableText(
const QString& text,
const QString& tag = {});
79 MVVM_VIEW_EXPORT QStringList
toStringList(
const std::vector<std::string>& vec);
82 MVVM_VIEW_EXPORT std::vector<std::string>
fromStringList(
const QStringList& string_list);
85 MVVM_VIEW_EXPORT QByteArray
serialize(
const QStringList& data);
88 MVVM_VIEW_EXPORT QStringList
deserialize(
const QByteArray& byteArray);
MVVM_VIEW_EXPORT std::string RandomNamedColor()
Returns the name of random color.
MVVM_VIEW_EXPORT int HeightOfLetterM()
Returns height of the letter 'M' deduced from current font metrics.
MVVM_VIEW_EXPORT QStringList deserialize(const QByteArray &byteArray)
Converts byte array to vector of strings.
MVVM_VIEW_EXPORT QString WithTildeHomePath(const QString &path)
Returns a string where Linux path to the file is striped using '~/'.
MVVM_VIEW_EXPORT bool IsWindowsHost()
Returns true if it is Windows.
MVVM_VIEW_EXPORT QSize SizeOfLetterM()
Returns size corresponding to actual size of letter M basing on current font metrics.
MVVM_VIEW_EXPORT bool IsMacHost()
Returns true if it is Mac.
MVVM_VIEW_EXPORT QByteArray serialize(const QStringList &data)
Converts vector of strings to byte array.
MVVM_VIEW_EXPORT QStringList toStringList(const std::vector< std::string > &vec)
Converts vector of strings to QStringList.
MVVM_VIEW_EXPORT QString ClickableText(const QString &text, const QString &tag={})
Returns text wrapped into 'href' tag to provide clickable links in QLabel.
MVVM_VIEW_EXPORT void ScaleLabelFont(QLabel *label, double scale)
Set label's font size to system font size scaled by given factor.
MVVM_VIEW_EXPORT QMainWindow * FindMainWindow()
Finds main window.
MVVM_VIEW_EXPORT QColor RandomColor()
Returns random color.
MVVM_VIEW_EXPORT std::vector< std::string > fromStringList(const QStringList &string_list)
Converts vector of strings to QStringList.
MVVM_VIEW_EXPORT int WidthOfLetterM()
Returns width of the letter 'M' deduced from current font metrics.
MVVM_VIEW_EXPORT bool IsLinuxHost()
Returns true if it is Linux.
MVVM_VIEW_EXPORT int SystemPointSize()
Returns size in points of default system font.
MVVM_VIEW_EXPORT QString ProjectWindowTitle(const QString &project_dir, bool is_modified)
Returns a title composed from last part of project path, and is_modified flag.
materialitems.h Collection of materials to populate MaterialModel.