From 740e6ffc1846dfb060397592988038ecd26e4a9f Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Wed, 29 May 2024 13:35:54 +0300 Subject: [PATCH 1/7] wxQt: put cursor hotspot at 0, 0 by default. This has worked in other ports because wxAtoi of empty string returns 0. --- src/qt/cursor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/cursor.cpp b/src/qt/cursor.cpp index 328095943a..9a69c45d57 100644 --- a/src/qt/cursor.cpp +++ b/src/qt/cursor.cpp @@ -165,9 +165,9 @@ void wxCursor::InitFromImage( const wxImage & image ) GetHandle() = QCursor(*bmp.GetHandle(), image.HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_X) ? - image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X) : -1, + image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X) : 0, image.HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y) ? - image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y) : -1); + image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y) : 0); } #endif // wxUSE_IMAGE From 9ac8d732fbe096df1084fcb0154e0782264c7b0e Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Wed, 29 May 2024 13:40:53 +0300 Subject: [PATCH 2/7] wxQt: support DPI-independent pixels. --- include/wx/features.h | 2 +- include/wx/qt/bitmap.h | 5 ++++ include/wx/qt/window.h | 4 +++ interface/wx/bitmap.h | 2 +- src/qt/anybutton.cpp | 2 +- src/qt/bitmap.cpp | 55 ++++++++++++++++++++++++++++++++++++++---- src/qt/dcmemory.cpp | 2 ++ src/qt/display.cpp | 34 +++++++++++++++++++------- src/qt/listctrl.cpp | 5 ++-- src/qt/notebook.cpp | 5 ++-- src/qt/window.cpp | 27 +++++++++++++++++++++ 11 files changed, 120 insertions(+), 23 deletions(-) diff --git a/include/wx/features.h b/include/wx/features.h index fa7a9cf286..344d1a33f8 100644 --- a/include/wx/features.h +++ b/include/wx/features.h @@ -112,7 +112,7 @@ physical pixels and a window must be 200px wide to have the same apparent size in high DPI as in normal DPI. */ -#if defined(__WXGTK3__) || defined(__WXMAC__) +#if defined(__WXGTK3__) || defined(__WXMAC__) || defined(__WXQT__) #define wxHAS_DPI_INDEPENDENT_PIXELS // This is an older synonym kept only for compatibility diff --git a/include/wx/qt/bitmap.h b/include/wx/qt/bitmap.h index 2eaa230d6f..a5bbf3268e 100644 --- a/include/wx/qt/bitmap.h +++ b/include/wx/qt/bitmap.h @@ -38,6 +38,9 @@ public: virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) override; virtual bool Create(int width, int height, const wxDC& dc); + virtual void SetScaleFactor(double scale); + virtual double GetScaleFactor() const; + virtual int GetHeight() const override; virtual int GetWidth() const override; virtual int GetDepth() const override; @@ -83,6 +86,8 @@ protected: virtual wxGDIRefData *CreateGDIRefData() const override; virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override; + virtual bool DoCreate(const wxSize& sz, double scale, int depth) override; + private: #if wxUSE_IMAGE void InitFromImage(const wxImage& image, int depth, double WXUNUSED(scale)); diff --git a/include/wx/qt/window.h b/include/wx/qt/window.h index 2cc2ac8c15..47e44ae77b 100644 --- a/include/wx/qt/window.h +++ b/include/wx/qt/window.h @@ -101,6 +101,10 @@ public: // get the (average) character size for the current font virtual int GetCharHeight() const override; virtual int GetCharWidth() const override; + virtual double GetContentScaleFactor() const override; + + virtual wxSize GetDPI() const; + virtual double GetDPIScaleFactor() const override; virtual void SetScrollbar( int orient, int pos, diff --git a/interface/wx/bitmap.h b/interface/wx/bitmap.h index ebc3d6bc05..88311706ce 100644 --- a/interface/wx/bitmap.h +++ b/interface/wx/bitmap.h @@ -528,7 +528,7 @@ public: The physical size of the bitmap created by this function depends on the platform and will be the same as @a size on the platforms for which `wxHAS_DPI_INDEPENDENT_PIXELS` is not defined (e.g. wxMSW) or @a size - multiplied by @a scale for those where it is (e.g. wxGTK3 and wxOSX). + multiplied by @a scale for those where it is (e.g. wxGTK3, wxOSX and wxQt). In other words, this function is the same as CreateWithDIPSize() if `wxHAS_DPI_INDEPENDENT_PIXELS` is defined, but not otherwise. diff --git a/src/qt/anybutton.cpp b/src/qt/anybutton.cpp index 721d5af5dd..c300b30363 100644 --- a/src/qt/anybutton.cpp +++ b/src/qt/anybutton.cpp @@ -104,7 +104,7 @@ void wxAnyButton::QtSetBitmap( const wxBitmapBundle &bitmapBundle ) if ( pixmap != nullptr ) { m_qtPushButton->setIcon(QIcon(*pixmap)); - m_qtPushButton->setIconSize(pixmap->rect().size()); + m_qtPushButton->setIconSize(pixmap->rect().size() / pixmap->devicePixelRatio()); InvalidateBestSize(); } diff --git a/src/qt/bitmap.cpp b/src/qt/bitmap.cpp index b98a13d984..0a2a046cb9 100644 --- a/src/qt/bitmap.cpp +++ b/src/qt/bitmap.cpp @@ -230,13 +230,15 @@ wxBitmap::wxBitmap(const wxString &filename, wxBitmapType type ) } #if wxUSE_IMAGE -void wxBitmap::InitFromImage(const wxImage& image, int depth, double WXUNUSED(scale) ) +void wxBitmap::InitFromImage(const wxImage& image, int depth, double scale ) { wxMask* mask = nullptr; auto qtImage = depth == 1 ? QBitmap::fromImage(ConvertImage(image), Qt::ThresholdDither) : QPixmap::fromImage(ConvertImage(image, &mask)); + qtImage.setDevicePixelRatio(scale); + m_refData = new wxBitmapRefData(qtImage, mask); } @@ -271,9 +273,38 @@ bool wxBitmap::Create(const wxSize& sz, int depth ) return Create(sz.GetWidth(), sz.GetHeight(), depth); } -bool wxBitmap::Create(int width, int height, const wxDC& WXUNUSED(dc)) +bool wxBitmap::Create(int width, int height, const wxDC& dc) { - return Create(width, height); + return DoCreate(wxSize(width, height), + dc.GetContentScaleFactor(), + wxBITMAP_SCREEN_DEPTH); +} + +bool wxBitmap::DoCreate(const wxSize& size, double scale, int depth) +{ + Create(size*scale, depth); + M_PIXDATA.setDevicePixelRatio( scale ); + + return true; +} + +void wxBitmap::SetScaleFactor(double scale) +{ + wxCHECK_RET( IsOk(), "invalid bitmap" ); + + if ( M_PIXDATA.devicePixelRatio() != scale ) + { + AllocExclusive(); + + M_PIXDATA.setDevicePixelRatio( scale ); + } +} + +double wxBitmap::GetScaleFactor() const +{ + wxCHECK_MSG( IsOk(), -1, "invalid bitmap" ); + + return M_PIXDATA.devicePixelRatio(); } int wxBitmap::GetHeight() const @@ -378,9 +409,23 @@ void wxBitmap::SetMask(wxMask *mask) M_MASK = mask; } -wxBitmap wxBitmap::GetSubBitmap(const wxRect& rect) const +wxBitmap wxBitmap::GetSubBitmap(const wxRect& r) const { - wxBitmap bmp = wxBitmap(M_PIXDATA.copy(wxQtConvertRect(rect))); + wxBitmap bmp; + + const double s = M_PIXDATA.devicePixelRatio(); + const wxRect rect(wxRound(r.x * s), wxRound(r.y * s), wxRound(r.width * s), wxRound(r.height * s)); + + const int w = rect.width; + const int h = rect.height; + + wxCHECK_MSG(rect.x >= 0 && rect.y >= 0 && + rect.x + w <= M_PIXDATA.width() && + rect.y + h <= M_PIXDATA.height(), + bmp, wxT("invalid bitmap region")); + + bmp = wxBitmap(M_PIXDATA.copy(wxQtConvertRect(rect))); + bmp.SetScaleFactor(s); if ( M_MASK && M_MASK->GetHandle() ) { diff --git a/src/qt/dcmemory.cpp b/src/qt/dcmemory.cpp index 7126414034..65911d70d5 100644 --- a/src/qt/dcmemory.cpp +++ b/src/qt/dcmemory.cpp @@ -57,6 +57,8 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) m_qtPixmap = bitmap.GetHandle(); if ( bitmap.IsOk() && !m_qtPixmap->isNull() ) { + m_contentScaleFactor = bitmap.GetScaleFactor(); + // apply mask before drawing wxMask *mask = bitmap.GetMask(); if ( mask && mask->GetHandle() ) diff --git a/src/qt/display.cpp b/src/qt/display.cpp index 37c1d8493f..f89d595863 100644 --- a/src/qt/display.cpp +++ b/src/qt/display.cpp @@ -11,9 +11,13 @@ #include "wx/display.h" #include "wx/private/display.h" #include -#include +#include #include "wx/qt/private/converter.h" +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) + #include +#endif + class wxDisplayImplQt : public wxDisplayImpl { public: @@ -22,6 +26,7 @@ public: virtual wxRect GetGeometry() const override; virtual wxRect GetClientArea() const override; virtual int GetDepth() const override; + virtual double GetScaleFactor() const override; #if wxUSE_DISPLAY virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const override; @@ -37,17 +42,22 @@ wxDisplayImplQt::wxDisplayImplQt( unsigned n ) wxRect wxDisplayImplQt::GetGeometry() const { - return wxQtConvertRect( QApplication::desktop()->screenGeometry( GetIndex() )); + return wxQtConvertRect(QApplication::screens().value(GetIndex())->geometry()); } wxRect wxDisplayImplQt::GetClientArea() const { - return wxQtConvertRect( QApplication::desktop()->availableGeometry( GetIndex() )); + return wxQtConvertRect(QApplication::screens().value(GetIndex())->availableGeometry()); } int wxDisplayImplQt::GetDepth() const { - return IsPrimary() ? QApplication::desktop()->depth() : 0; + return QApplication::screens().value(GetIndex())->depth(); +} + +double wxDisplayImplQt::GetScaleFactor() const +{ + return QApplication::screens().value(GetIndex())->devicePixelRatio(); } #if wxUSE_DISPLAY @@ -58,9 +68,11 @@ wxArrayVideoModes wxDisplayImplQt::GetModes(const wxVideoMode& WXUNUSED(mode)) c wxVideoMode wxDisplayImplQt::GetCurrentMode() const { - int width = QApplication::desktop()->width(); - int height = QApplication::desktop()->height(); - int depth = QApplication::desktop()->depth(); + QScreen *screen = QApplication::screens().value(GetIndex()); + + int width = screen->size().width(); + int height = screen->size().height(); + int depth = screen->depth(); return wxVideoMode( width, height, depth ); } @@ -91,12 +103,16 @@ wxDisplayImpl *wxDisplayFactoryQt::CreateDisplay(unsigned n) unsigned wxDisplayFactoryQt::GetCount() { - return QApplication::desktop()->screenCount(); + return QApplication::screens().size(); } int wxDisplayFactoryQt::GetFromPoint(const wxPoint& pt) { - return QApplication::desktop()->screenNumber( wxQtConvertPoint( pt )); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + return QApplication::screens().indexOf(QApplication::screenAt(wxQtConvertPoint(pt))); +#else + return QApplication::desktop()->screenNumber(wxQtConvertPoint(pt)); +#endif } //############################################################################## diff --git a/src/qt/listctrl.cpp b/src/qt/listctrl.cpp index 35db24e2b3..e080c4403e 100644 --- a/src/qt/listctrl.cpp +++ b/src/qt/listctrl.cpp @@ -1898,9 +1898,8 @@ void wxListCtrl::DoUpdateImages(int which) if ( imageList ) { - int width, height; - imageList->GetSize(0, width, height); - m_qtTreeWidget->setIconSize(QSize(width, height)); + const wxBitmap bitmap = imageList->GetBitmap(0); + m_qtTreeWidget->setIconSize(wxQtConvertSize(bitmap.GetLogicalSize())); m_qtTreeWidget->update(); } } diff --git a/src/qt/notebook.cpp b/src/qt/notebook.cpp index 6a10f5aae6..5980e4583d 100644 --- a/src/qt/notebook.cpp +++ b/src/qt/notebook.cpp @@ -145,9 +145,8 @@ void wxNotebook::OnImagesChanged() { wxImageList* const imageList = GetUpdatedImageListFor(this); - int width, height; - imageList->GetSize(0, width, height); - m_qtTabWidget->setIconSize(QSize(width, height)); + const wxBitmap bitmap = imageList->GetBitmap(0); + m_qtTabWidget->setIconSize(wxQtConvertSize(bitmap.GetLogicalSize())); m_qtTabWidget->update(); } } diff --git a/src/qt/window.cpp b/src/qt/window.cpp index 6cbb6a9f3c..2abc0cb979 100644 --- a/src/qt/window.cpp +++ b/src/qt/window.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -679,6 +680,32 @@ int wxWindowQt::GetCharWidth() const return ( GetHandle()->fontMetrics().averageCharWidth() ); } +double wxWindowQt::GetContentScaleFactor() const +{ + if (GetHandle()) + { + QWidget* npw = GetHandle()->nativeParentWidget(); + + if (npw) + { + QWindow *win = npw->windowHandle(); + return win->devicePixelRatio(); + } + } + + return qApp->devicePixelRatio(); +} + +double wxWindowQt::GetDPIScaleFactor() const +{ + return GetContentScaleFactor(); +} + +wxSize wxWindowQt::GetDPI() const +{ + return MakeDPIFromScaleFactor(GetDPIScaleFactor()); +} + void wxWindowQt::DoGetTextExtent(const wxString& string, int *x, int *y, int *descent, int *externalLeading, const wxFont *font ) const { From ddd53cb5838edf937c5899c6e337ff2d0cf7527f Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Wed, 29 May 2024 16:34:47 +0300 Subject: [PATCH 3/7] wxQt: vertically center cell content in wxListCtrl. --- src/qt/listctrl.cpp | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/qt/listctrl.cpp b/src/qt/listctrl.cpp index e080c4403e..e6064d93dd 100644 --- a/src/qt/listctrl.cpp +++ b/src/qt/listctrl.cpp @@ -31,29 +31,29 @@ namespace { -Qt::AlignmentFlag wxQtConvertTextAlign(wxListColumnFormat align) +Qt::Alignment wxQtConvertTextAlign(wxListColumnFormat align) { switch (align) { case wxLIST_FORMAT_LEFT: - return Qt::AlignLeft; + return Qt::AlignLeft | Qt::AlignVCenter; case wxLIST_FORMAT_RIGHT: - return Qt::AlignRight; + return Qt::AlignRight | Qt::AlignVCenter; case wxLIST_FORMAT_CENTRE: - return Qt::AlignCenter; + return Qt::AlignHCenter | Qt::AlignVCenter; } - return Qt::AlignLeft; + return Qt::AlignLeft | Qt::AlignVCenter; } wxListColumnFormat wxQtConvertAlignFlag(int align) { - switch (align) + switch (align & Qt::AlignHorizontal_Mask) { case Qt::AlignLeft: return wxLIST_FORMAT_LEFT; case Qt::AlignRight: return wxLIST_FORMAT_RIGHT; - case Qt::AlignCenter: + case Qt::AlignHCenter: return wxLIST_FORMAT_CENTRE; } return wxLIST_FORMAT_LEFT; @@ -230,7 +230,7 @@ public: : QVariant(); case Qt::TextAlignmentRole: - return columnItem.m_align; + return static_cast(columnItem.m_align); case Qt::CheckStateRole: return col == 0 && m_listCtrl->HasCheckBoxes() @@ -306,7 +306,7 @@ public: return header.m_label; case Qt::TextAlignmentRole: - return header.m_align; + return static_cast(header.m_align); case Qt::DecorationRole: { @@ -647,14 +647,27 @@ public: if ( row == -1 || static_cast(row) >= m_rows.size() ) { - m_rows.push_back(RowItem(m_headers.size())); + size_t colCount = m_headers.size(); + RowItem rowItem(colCount); + + for (size_t i = 0; i < colCount; i++) + rowItem.m_columns[i].m_align = m_headers[i].m_align; + + m_rows.push_back(rowItem); newRowIndex = m_rows.size() - 1; } else { std::vector::iterator i = m_rows.begin(); std::advance(i, row); - m_rows.insert(i, RowItem(m_headers.size())); + + size_t colCount = m_headers.size(); + RowItem rowItem(colCount); + + for (size_t col = 0; col < colCount; col++) + rowItem.m_columns[col].m_align = m_headers[col].m_align; + + m_rows.insert(i, rowItem); newRowIndex = row; } @@ -805,7 +818,7 @@ private: struct ColumnItem { ColumnItem() : - m_align(Qt::AlignLeft), + m_align(Qt::AlignLeft | Qt::AlignVCenter), m_image(-1), m_selectedImage(-1) { @@ -815,7 +828,7 @@ private: QColor m_backgroundColour; QColor m_textColour; QFont m_font; - Qt::AlignmentFlag m_align; + Qt::Alignment m_align; int m_image; int m_selectedImage; }; From d100df35df0e5388ab842997a975521d0dafc8c0 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Wed, 29 May 2024 17:23:23 +0300 Subject: [PATCH 4/7] wxQt: improve best size calculation for wxTextCtrl. The size hint provided by Qt is usually too large for being a min size. --- src/qt/textctrl.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qt/textctrl.cpp b/src/qt/textctrl.cpp index 9d7f98b474..aee6643f46 100644 --- a/src/qt/textctrl.cpp +++ b/src/qt/textctrl.cpp @@ -701,7 +701,11 @@ wxTextCtrl::~wxTextCtrl() wxSize wxTextCtrl::DoGetBestSize() const { - return wxTextCtrlBase::DoGetBestSize(); + if (IsSingleLine()) + return wxQtConvertSize(m_qtEdit->GetHandle()->sizeHint()); + + return wxSize(80, + 1 + GetCharHeight() * wxMax(wxMin(GetNumberOfLines(), 10), 2)); } int wxTextCtrl::GetLineLength(long lineNo) const From d778532c5c14e064dd2d162430a70ed88300a979 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Wed, 29 May 2024 19:23:06 +0300 Subject: [PATCH 5/7] wxQt: replace deprecated API usage in settings and radiobox. --- src/qt/radiobox.cpp | 10 +++++----- src/qt/settings.cpp | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/qt/radiobox.cpp b/src/qt/radiobox.cpp index 53cb5172b9..e144949c7e 100644 --- a/src/qt/radiobox.cpp +++ b/src/qt/radiobox.cpp @@ -36,7 +36,7 @@ public: wxQtSignalHandler(handler) { connect(this, - static_cast(&QButtonGroup::buttonClicked), + static_cast(&QButtonGroup::buttonClicked), this, &wxQtButtonGroup::buttonClicked); } @@ -46,17 +46,17 @@ public: } private: - void buttonClicked(int index); + void buttonClicked(QAbstractButton *qbutton); }; -void wxQtButtonGroup::buttonClicked(int index) +void wxQtButtonGroup::buttonClicked(QAbstractButton *qbutton) { wxRadioBox *handler = GetRadioBox(); if ( handler ) { wxCommandEvent event( wxEVT_RADIOBOX, handler->GetId() ); - event.SetInt(index); - event.SetString(wxQtConvertString(button(index)->text())); + event.SetInt(buttons().indexOf(qbutton)); + event.SetString(wxQtConvertString(qbutton->text())); EmitEvent( event ); } } diff --git a/src/qt/settings.cpp b/src/qt/settings.cpp index f9bad86b12..42798833ec 100644 --- a/src/qt/settings.cpp +++ b/src/qt/settings.cpp @@ -11,6 +11,7 @@ #include "wx/settings.h" #include "wx/qt/private/converter.h" #include +#include #include #include #include @@ -196,10 +197,10 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, const wxWindow* WXUN return QApplication::style()->pixelMetric(QStyle::PM_IconViewIconSize); case wxSYS_SCREEN_X: - return QApplication::desktop()->screenGeometry().width(); + return QApplication::primaryScreen()->size().width(); case wxSYS_SCREEN_Y: - return QApplication::desktop()->screenGeometry().height(); + return QApplication::primaryScreen()->size().height(); case wxSYS_HSCROLL_Y: case wxSYS_VSCROLL_X: From 6a34c8916e8e3469cec5e81a4fc7ffcfe7fb0efa Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Thu, 30 May 2024 02:33:27 +0300 Subject: [PATCH 6/7] wxQt: fix crash in wxListCtrl if the window gets destructed while an editor is open. --- src/qt/listctrl.cpp | 5 +++++ src/qt/textctrl.cpp | 1 + 2 files changed, 6 insertions(+) diff --git a/src/qt/listctrl.cpp b/src/qt/listctrl.cpp index e6064d93dd..dfa633eb37 100644 --- a/src/qt/listctrl.cpp +++ b/src/qt/listctrl.cpp @@ -1006,6 +1006,11 @@ public: if (!current_index.isValid()) return; + // closeEditor can be called through wxQtLineEdit destructor, + // after m_qtEdit in wxTextCtrl has been deleted. + if (!m_itemDelegate.GetEditControl() || m_itemDelegate.GetEditControl()->IsBeingDeleted()) + return; + const wxString editedText = m_itemDelegate.GetEditControl()->GetLineText(0); wxListEvent event; diff --git a/src/qt/textctrl.cpp b/src/qt/textctrl.cpp index aee6643f46..9142a799b5 100644 --- a/src/qt/textctrl.cpp +++ b/src/qt/textctrl.cpp @@ -697,6 +697,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxTextCtrl::~wxTextCtrl() { delete m_qtEdit; + m_qtEdit = nullptr; } wxSize wxTextCtrl::DoGetBestSize() const From 2f91491a2d54cbb1708b8be7050cabab32cb094d Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Thu, 30 May 2024 02:38:42 +0300 Subject: [PATCH 7/7] Remove wxQt special-case in wxTextCtrl::GetBestSize test. Best size for multiline text controls is now calculated similarly to wxGTK. --- tests/controls/textctrltest.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/controls/textctrltest.cpp b/tests/controls/textctrltest.cpp index 6928169903..123e4f5fb6 100644 --- a/tests/controls/textctrltest.cpp +++ b/tests/controls/textctrltest.cpp @@ -1364,18 +1364,11 @@ TEST_CASE("wxTextCtrl::GetBestSize", "[wxTextCtrl][best-size]") s += s; const wxSize sizeVeryLong = getBestSizeFor(s); -#ifndef __WXQT__ // Control with a few lines of text in it should be taller. CHECK( sizeMedium.y > sizeEmpty.y ); // And a control with many lines in it should be even more so. CHECK( sizeLong.y > sizeMedium.y ); -#else - // Under wxQt, the multiline textctrl has a fixed calculated best size - // regardless of its content. - CHECK( sizeMedium.y == sizeEmpty.y ); - CHECK( sizeLong.y == sizeMedium.y ); -#endif // However there is a cutoff at 10 lines currently, so anything longer than // that should still have the same best size.