Moved several files from pglab project to pglablib
This commit is contained in:
parent
206d734ff5
commit
f4538069cb
44 changed files with 45 additions and 44 deletions
44
pglablib/util.h
Normal file
44
pglablib/util.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#ifndef UTIL_H
|
||||
#define UTIL_H
|
||||
|
||||
#include <string>
|
||||
#include <QString>
|
||||
#include <QTableView>
|
||||
|
||||
QString msfloatToHumanReadableString(float ms);
|
||||
void copySelectionToClipboard(const QTableView *view);
|
||||
QString ConvertToMultiLineCString(const QString &in);
|
||||
QString ConvertToMultiLineRawCppString(const QString &in);
|
||||
void exportTable(const QTableView *view, QTextStream &out);
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
|
||||
namespace std {
|
||||
|
||||
template <>
|
||||
struct hash<QString>
|
||||
{
|
||||
std::size_t operator()(const QString& s) const
|
||||
{
|
||||
return qHash(s);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // UTIL_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue