PrimeWorldEditor/src/Editor/UICommon.h

43 lines
1.0 KiB
C
Raw Normal View History

#ifndef UICOMMON
#define UICOMMON
#include <Common/TString.h>
#include <QMap>
#include <QString>
2016-03-28 02:26:33 +00:00
#define TO_QSTRING(Str) UICommon::ToQString(Str)
#define TO_TSTRING(Str) UICommon::ToTString(Str)
#define TO_TWIDESTRING(Str) UICommon::ToTWideString(Str)
#define TO_CCOLOR(Clr) CColor::Integral(Clr.red(), Clr.green(), Clr.blue(), Clr.alpha())
#define TO_QCOLOR(Clr) QColor(Clr.R * 255, Clr.G * 255, Clr.B * 255, Clr.A * 255)
namespace UICommon
{
extern QMap<QString,QString> FilterMap;
2016-03-27 19:09:38 +00:00
QString ExtensionFilterString(const QString& rkExtension);
// TString/TWideString <-> QString
2016-03-27 19:09:38 +00:00
inline QString ToQString(const TString& rkStr)
{
2016-03-27 19:09:38 +00:00
return QString::fromStdString(rkStr.ToStdString());
}
2016-03-27 19:09:38 +00:00
inline QString ToQString(const TWideString& rkStr)
{
2016-03-27 19:09:38 +00:00
return QString::fromStdWString(rkStr.ToStdString());
}
2016-03-27 19:09:38 +00:00
inline TString ToTString(const QString& rkStr)
{
2016-03-27 19:09:38 +00:00
return TString(rkStr.toStdString());
}
2016-03-27 19:09:38 +00:00
inline TWideString ToTWideString(const QString& rkStr)
{
2016-03-27 19:09:38 +00:00
return TWideString(rkStr.toStdWString());
}
}
#endif // UICOMMON