Fix painting logic in wxQt wxClientDC implementation

The original drawing mechanism was generating lots of QWarning messages
when running samples (e.g. htlbox, caret, etc.) and in some cases was
not actually completely drawing every element of the sample. The issue
was that the QPicture was being shared incorrectly between wxWindow and
wxClientDC and attempts to start painting, update, etc. were generating
console warnings.

Closes https://github.com/wxWidgets/wxWidgets/pull/1152
This commit is contained in:
chris2oph
2019-01-31 09:49:11 +00:00
committed by Vadim Zeitlin
parent 7d2e6e805f
commit f8c345ca95
4 changed files with 51 additions and 13 deletions

View File

@@ -210,7 +210,7 @@ void wxWindowQt::Init()
m_horzScrollBar = NULL;
m_vertScrollBar = NULL;
m_qtPicture = new QPicture();
m_qtPicture = NULL;
m_qtPainter = new QPainter();
m_mouseInside = false;
@@ -251,7 +251,6 @@ wxWindowQt::~wxWindowQt()
DestroyChildren(); // This also destroys scrollbars
delete m_qtPicture;
delete m_qtPainter;
#if wxUSE_ACCEL
@@ -1126,7 +1125,7 @@ bool wxWindowQt::QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event )
{
bool handled;
if ( m_qtPicture->isNull() )
if ( m_qtPicture == NULL )
{
// Real paint event (not for wxClientDC), prepare the background
switch ( GetBackgroundStyle() )
@@ -1558,9 +1557,9 @@ QScrollArea *wxWindowQt::QtGetScrollBarsContainer() const
return m_qtContainer;
}
QPicture *wxWindowQt::QtGetPicture() const
void wxWindowQt::QtSetPicture( QPicture* pict )
{
return m_qtPicture;
m_qtPicture = pict;
}
QPainter *wxWindowQt::QtGetPainter()