Merge branch 'qt_fix_unitialised_fields' of https://github.com/GeoTeric/wxWidgets

Add missing field initialization to a number of wxQt controls.

See https://github.com/wxWidgets/wxWidgets/pull/1092
This commit is contained in:
Vadim Zeitlin
2019-01-08 00:38:53 +01:00
21 changed files with 80 additions and 21 deletions

View File

@@ -20,6 +20,8 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler);
wxApp::wxApp() wxApp::wxApp()
{ {
m_qtApplication = NULL; m_qtApplication = NULL;
m_qtArgc = 0;
m_qtArgv = NULL;
} }

View File

@@ -46,7 +46,8 @@ void wxQtCheckBox::clicked( bool checked )
} }
wxCheckBox::wxCheckBox() wxCheckBox::wxCheckBox() :
m_qtCheckBox(NULL)
{ {
} }

View File

@@ -37,7 +37,8 @@ void wxQtChoice::activated(int WXUNUSED(index))
} }
wxChoice::wxChoice() wxChoice::wxChoice() :
m_qtComboBox(NULL)
{ {
} }

View File

@@ -112,7 +112,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
const wxValidator& validator, const wxValidator& validator,
const wxString& name ) const wxString& name )
{ {
return Create( parent, id, value, pos, size, choices.size(), &choices[ 0 ], const wxString *pChoices = choices.size() ? &choices[ 0 ] : NULL;
return Create(parent, id, value, pos, size, choices.size(), pChoices,
style, validator, name ); style, validator, name );
} }

View File

@@ -117,14 +117,50 @@ bool wxQtDCImpl::CanGetTextExtent() const
void wxQtDCImpl::DoGetSize(int *width, int *height) const void wxQtDCImpl::DoGetSize(int *width, int *height) const
{ {
if (width) *width = m_qtPainter->device()->width(); QPaintDevice *pDevice = m_qtPainter->device();
if (height) *height = m_qtPainter->device()->height();
int deviceWidth;
int deviceHeight;
if ( pDevice )
{
deviceWidth = pDevice->width();
deviceHeight = pDevice->height();
}
else
{
deviceWidth = 0;
deviceHeight = 0;
}
if ( width )
*width = deviceWidth;
if ( height )
*height = deviceHeight;
} }
void wxQtDCImpl::DoGetSizeMM(int* width, int* height) const void wxQtDCImpl::DoGetSizeMM(int* width, int* height) const
{ {
if (width) *width = m_qtPainter->device()->widthMM(); QPaintDevice *pDevice = m_qtPainter->device();
if (height) *height = m_qtPainter->device()->heightMM();
int deviceWidthMM;
int deviceHeightMM;
if ( pDevice )
{
deviceWidthMM = pDevice->widthMM();
deviceHeightMM = pDevice->heightMM();
}
else
{
deviceWidthMM = 0;
deviceHeightMM = 0;
}
if ( width )
*width = deviceWidthMM;
if ( height )
*height = deviceHeightMM;
} }
int wxQtDCImpl::GetDepth() const int wxQtDCImpl::GetDepth() const

View File

@@ -29,7 +29,8 @@ wxQtProgressBar::wxQtProgressBar( wxWindow *parent, wxGauge *handler )
} }
wxGauge::wxGauge() wxGauge::wxGauge() :
m_qtProgressBar(NULL)
{ {
} }

View File

@@ -45,7 +45,8 @@ void wxQtListWidget::doubleClicked( const QModelIndex &index )
} }
wxListBox::wxListBox() wxListBox::wxListBox() :
m_qtListWidget(NULL)
{ {
Init(); Init();
} }

View File

@@ -154,6 +154,7 @@ void wxListCtrl::Init()
m_ownsImageListSmall = false; m_ownsImageListSmall = false;
m_imageListState = NULL; m_imageListState = NULL;
m_ownsImageListState = false; m_ownsImageListState = false;
m_qtTreeWidget = NULL;
} }
wxListCtrl::~wxListCtrl() wxListCtrl::~wxListCtrl()

View File

@@ -50,7 +50,8 @@ void wxQtTabWidget::currentChanged(int index)
} }
wxNotebook::wxNotebook() wxNotebook::wxNotebook() :
m_qtTabWidget(NULL)
{ {
} }

View File

@@ -56,7 +56,10 @@ void wxQtButtonGroup::buttonClicked(int index) {
wxIMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl); wxIMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl);
wxRadioBox::wxRadioBox() wxRadioBox::wxRadioBox() :
m_qtGroupBox(NULL),
m_qtButtonGroup(NULL),
m_qtBoxLayout(NULL)
{ {
} }

View File

@@ -13,7 +13,8 @@
#include <QtWidgets/QRadioButton> #include <QtWidgets/QRadioButton>
wxRadioButton::wxRadioButton() wxRadioButton::wxRadioButton() :
m_qtRadioButton(NULL)
{ {
} }

View File

@@ -27,7 +27,8 @@ class wxQtScrollBar : public wxQtEventSignalHandler< QScrollBar, wxScrollBar >
}; };
wxScrollBar::wxScrollBar() wxScrollBar::wxScrollBar() :
m_qtScrollBar(NULL)
{ {
} }

View File

@@ -46,7 +46,8 @@ void wxQtSlider::valueChanged(int position)
} }
wxSlider::wxSlider() wxSlider::wxSlider() :
m_qtSlider(NULL)
{ {
} }

View File

@@ -41,7 +41,8 @@ void wxQtSpinButton::valueChanged(int value)
} }
wxSpinButton::wxSpinButton() wxSpinButton::wxSpinButton() :
m_qtSpinBox(NULL)
{ {
} }

View File

@@ -18,7 +18,8 @@
#include <QtWidgets/QSpinBox> #include <QtWidgets/QSpinBox>
template< typename T, typename Widget > template< typename T, typename Widget >
wxSpinCtrlQt< T, Widget >::wxSpinCtrlQt() wxSpinCtrlQt< T, Widget >::wxSpinCtrlQt() :
m_qtSpinBox(NULL)
{ {
} }

View File

@@ -21,7 +21,8 @@ public:
}; };
wxStaticBitmap::wxStaticBitmap() wxStaticBitmap::wxStaticBitmap() :
m_qtLabel(NULL)
{ {
} }

View File

@@ -23,7 +23,8 @@ public:
}; };
wxStaticBox::wxStaticBox() wxStaticBox::wxStaticBox() :
m_qtGroupBox(NULL)
{ {
} }

View File

@@ -12,7 +12,8 @@
#include <QtWidgets/QFrame> #include <QtWidgets/QFrame>
wxStaticLine::wxStaticLine() wxStaticLine::wxStaticLine() :
m_qtFrame(NULL)
{ {
} }

View File

@@ -22,7 +22,8 @@ public:
}; };
wxStaticText::wxStaticText() wxStaticText::wxStaticText() :
m_qtLabel(NULL)
{ {
} }

View File

@@ -105,6 +105,7 @@ void wxStatusBar::Refresh( bool eraseBackground, const wxRect *rect )
void wxStatusBar::Init() void wxStatusBar::Init()
{ {
m_qtStatusBar = NULL;
m_qtPanes = NULL; m_qtPanes = NULL;
} }

View File

@@ -1074,6 +1074,7 @@ bool wxWindowQt::QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event )
dc.SetDeviceClippingRegion( m_updateRegion ); dc.SetDeviceClippingRegion( m_updateRegion );
wxEraseEvent erase( GetId(), &dc ); wxEraseEvent erase( GetId(), &dc );
erase.SetEventObject(this);
if ( ProcessWindowEvent(erase) ) if ( ProcessWindowEvent(erase) )
{ {
// background erased, don't do it again // background erased, don't do it again