2017-01-21 18:16:57 +01:00
|
|
|
|
#ifndef UTIL_H
|
|
|
|
|
|
#define UTIL_H
|
|
|
|
|
|
|
2017-02-26 19:29:50 +01:00
|
|
|
|
#include <string>
|
2017-01-21 18:16:57 +01:00
|
|
|
|
#include <QString>
|
2017-02-04 11:54:18 +01:00
|
|
|
|
#include <QTableView>
|
2017-01-21 18:16:57 +01:00
|
|
|
|
|
|
|
|
|
|
QString msfloatToHumanReadableString(float ms);
|
2017-02-04 11:54:18 +01:00
|
|
|
|
void copySelectionToClipboard(const QTableView *view);
|
2017-02-05 08:23:06 +01:00
|
|
|
|
QString ConvertToMultiLineCString(const QString &in);
|
2017-10-05 16:02:06 +02:00
|
|
|
|
QString ConvertToMultiLineRawCppString(const QString &in);
|
2017-02-05 13:35:41 +01:00
|
|
|
|
void exportTable(const QTableView *view, QTextStream &out);
|
2017-01-21 18:16:57 +01:00
|
|
|
|
|
2017-02-26 19:29:50 +01:00
|
|
|
|
inline QString stdStrToQ(const std::string &s)
|
|
|
|
|
|
{
|
|
|
|
|
|
return QString::fromUtf8(s.c_str());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline std::string qStrToStd(const QString &s)
|
|
|
|
|
|
{
|
|
|
|
|
|
return std::string(s.toUtf8().data());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline std::string qvarToStdStr(const QVariant &c)
|
|
|
|
|
|
{
|
|
|
|
|
|
return qStrToStd(c.toString());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-07 21:39:45 +01:00
|
|
|
|
namespace std {
|
|
|
|
|
|
|
|
|
|
|
|
template <>
|
|
|
|
|
|
struct hash<QString>
|
|
|
|
|
|
{
|
|
|
|
|
|
std::size_t operator()(const QString& s) const
|
|
|
|
|
|
{
|
|
|
|
|
|
return qHash(s);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-01-21 18:16:57 +01:00
|
|
|
|
#endif // UTIL_H
|