Make trivial Qt <-> wx conversion functions inline
No real changes, just make often used and trivial functions inline as this like an obviously better thing to do.
This commit is contained in:
@@ -23,14 +23,36 @@
|
|||||||
// Rely on overloading and let the compiler pick the correct version, which makes
|
// Rely on overloading and let the compiler pick the correct version, which makes
|
||||||
// them easier to use then to write wxQtConvertQtRectToWxRect() or wxQtConvertWxRectToQtRect()
|
// them easier to use then to write wxQtConvertQtRectToWxRect() or wxQtConvertWxRectToQtRect()
|
||||||
|
|
||||||
wxPoint wxQtConvertPoint( const QPoint &point );
|
inline wxPoint wxQtConvertPoint( const QPoint &point )
|
||||||
QPoint wxQtConvertPoint( const wxPoint &point );
|
{
|
||||||
|
return wxPoint( point.x(), point.y() );
|
||||||
|
}
|
||||||
|
inline QPoint wxQtConvertPoint( const wxPoint &point )
|
||||||
|
{
|
||||||
|
return QPoint( point.x, point.y );
|
||||||
|
}
|
||||||
|
|
||||||
wxRect wxQtConvertRect( const QRect &rect );
|
inline wxRect wxQtConvertRect( const QRect &rect )
|
||||||
QRect wxQtConvertRect( const wxRect &rect );
|
{
|
||||||
|
return wxRect( rect.x(), rect.y(), rect.width(), rect.height() );
|
||||||
|
}
|
||||||
|
|
||||||
wxString wxQtConvertString( const QString &str );
|
inline QRect wxQtConvertRect( const wxRect &rect )
|
||||||
QString wxQtConvertString( const wxString &str );
|
{
|
||||||
|
return QRect( rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Check whether QString::toStdString/QString::toStdWString might be faster
|
||||||
|
|
||||||
|
inline wxString wxQtConvertString( const QString &str )
|
||||||
|
{
|
||||||
|
return wxString( str.toUtf8().data(), wxConvUTF8 );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QString wxQtConvertString( const wxString &str )
|
||||||
|
{
|
||||||
|
return QString( str.utf8_str() );
|
||||||
|
}
|
||||||
|
|
||||||
#if wxUSE_DATETIME
|
#if wxUSE_DATETIME
|
||||||
|
|
||||||
@@ -42,8 +64,20 @@ QDate wxQtConvertDate(const wxDateTime& date);
|
|||||||
|
|
||||||
#endif // wxUSE_DATETIME
|
#endif // wxUSE_DATETIME
|
||||||
|
|
||||||
wxSize wxQtConvertSize( const QSize &size );
|
inline wxSize wxQtConvertSize( const QSize &size )
|
||||||
QSize wxQtConvertSize( const wxSize &size );
|
{
|
||||||
|
if (size.isNull())
|
||||||
|
return wxDefaultSize;
|
||||||
|
|
||||||
|
return wxSize(size.width(), size.height());
|
||||||
|
}
|
||||||
|
inline QSize wxQtConvertSize( const wxSize &size )
|
||||||
|
{
|
||||||
|
if (size == wxDefaultSize)
|
||||||
|
return QSize();
|
||||||
|
|
||||||
|
return QSize(size.GetWidth(), size.GetHeight());
|
||||||
|
}
|
||||||
|
|
||||||
Qt::Orientation wxQtConvertOrientation( long style, wxOrientation defaultOrientation );
|
Qt::Orientation wxQtConvertOrientation( long style, wxOrientation defaultOrientation );
|
||||||
wxOrientation wxQtConvertOrientation( Qt::Orientation );
|
wxOrientation wxQtConvertOrientation( Qt::Orientation );
|
||||||
|
@@ -23,42 +23,6 @@
|
|||||||
#include "wx/qt/private/converter.h"
|
#include "wx/qt/private/converter.h"
|
||||||
|
|
||||||
|
|
||||||
wxPoint wxQtConvertPoint( const QPoint &point )
|
|
||||||
{
|
|
||||||
return wxPoint( point.x(), point.y() );
|
|
||||||
}
|
|
||||||
|
|
||||||
QPoint wxQtConvertPoint( const wxPoint &point )
|
|
||||||
{
|
|
||||||
return QPoint( point.x, point.y );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QRect wxQtConvertRect( const wxRect &rect )
|
|
||||||
{
|
|
||||||
return QRect( rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight() );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxRect wxQtConvertRect( const QRect &rect )
|
|
||||||
{
|
|
||||||
return wxRect( rect.x(), rect.y(), rect.width(), rect.height() );
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Check whether QString::toStdString/QString::toStdWString might be faster
|
|
||||||
|
|
||||||
wxString wxQtConvertString( const QString &str )
|
|
||||||
{
|
|
||||||
return wxString( str.toUtf8().data(), wxConvUTF8 );
|
|
||||||
}
|
|
||||||
|
|
||||||
QString wxQtConvertString( const wxString &str )
|
|
||||||
{
|
|
||||||
return QString( str.utf8_str() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if wxUSE_DATETIME
|
#if wxUSE_DATETIME
|
||||||
|
|
||||||
wxDateTime wxQtConvertDate(const QDate& date)
|
wxDateTime wxQtConvertDate(const QDate& date)
|
||||||
@@ -81,22 +45,6 @@ QDate wxQtConvertDate(const wxDateTime& date)
|
|||||||
|
|
||||||
#endif // wxUSE_DATETIME
|
#endif // wxUSE_DATETIME
|
||||||
|
|
||||||
wxSize wxQtConvertSize( const QSize &size )
|
|
||||||
{
|
|
||||||
if (size.isNull())
|
|
||||||
return wxDefaultSize;
|
|
||||||
|
|
||||||
return wxSize(size.width(), size.height());
|
|
||||||
}
|
|
||||||
|
|
||||||
QSize wxQtConvertSize( const wxSize &size )
|
|
||||||
{
|
|
||||||
if (size == wxDefaultSize)
|
|
||||||
return QSize();
|
|
||||||
|
|
||||||
return QSize(size.GetWidth(), size.GetHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt::Orientation wxQtConvertOrientation( long style, wxOrientation defaultOrientation )
|
Qt::Orientation wxQtConvertOrientation( long style, wxOrientation defaultOrientation )
|
||||||
{
|
{
|
||||||
if (( style & ( wxHORIZONTAL | wxVERTICAL )) == 0 )
|
if (( style & ( wxHORIZONTAL | wxVERTICAL )) == 0 )
|
||||||
|
Reference in New Issue
Block a user