From 113822d024795140572c64b8cd6afae695c53d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C4=83t=C4=83lin=20R=C4=83ceanu?= Date: Wed, 27 Feb 2019 16:58:35 +0200 Subject: [PATCH] Change member variable type --- include/wx/qt/statusbar.h | 4 +--- src/qt/statusbar.cpp | 17 +++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/include/wx/qt/statusbar.h b/include/wx/qt/statusbar.h index 7d289327fc..df9ae9891d 100644 --- a/include/wx/qt/statusbar.h +++ b/include/wx/qt/statusbar.h @@ -10,8 +10,6 @@ #include "wx/statusbr.h" -#include - class QLabel; class QStatusBar; @@ -47,7 +45,7 @@ private: void UpdateFields(); QStatusBar *m_qtStatusBar; - QScopedPointer< QList > m_qtPanes; // should this really be a pointer? + wxVector m_qtPanes; wxDECLARE_DYNAMIC_CLASS(wxStatusBar); }; diff --git a/src/qt/statusbar.cpp b/src/qt/statusbar.cpp index fa30dbb23a..729fa66535 100644 --- a/src/qt/statusbar.cpp +++ b/src/qt/statusbar.cpp @@ -48,7 +48,6 @@ bool wxStatusBar::Create(wxWindow *parent, wxWindowID WXUNUSED(winid), long style, const wxString& WXUNUSED(name)) { m_qtStatusBar = new wxQtStatusBar( parent, this ); - m_qtPanes.reset(new QList()); if ( style & wxSTB_SIZEGRIP ) m_qtStatusBar->setSizeGripEnabled(true); @@ -65,10 +64,10 @@ bool wxStatusBar::GetFieldRect(int i, wxRect& rect) const wxCHECK_MSG( (i >= 0) && ((size_t)i < m_panes.GetCount()), false, "invalid statusbar field index" ); - if ( static_cast(m_qtPanes->count()) != m_panes.GetCount() ) + if ( m_qtPanes.size() != m_panes.GetCount() ) const_cast(this)->UpdateFields(); - rect = wxQtConvertRect((*m_qtPanes)[i]->geometry()); + rect = wxQtConvertRect(m_qtPanes[i]->geometry()); return true; } @@ -89,10 +88,10 @@ int wxStatusBar::GetBorderY() const void wxStatusBar::DoUpdateStatusText(int number) { - if ( static_cast(m_qtPanes->count()) != m_panes.GetCount() ) + if ( m_qtPanes.size() != m_panes.GetCount() ) UpdateFields(); - (*m_qtPanes)[number]->setText( wxQtConvertString( m_panes[number].GetText() ) ); + m_qtPanes[number]->setText( wxQtConvertString( m_panes[number].GetText() ) ); } // Called each time number/size of panes changes @@ -112,11 +111,13 @@ void wxStatusBar::UpdateFields() { // is it a good idea to recreate all the panes every update? - while ( !m_qtPanes->isEmpty() ) + for ( wxVector::const_iterator it = m_qtPanes.begin(); + it != m_qtPanes.end(); ++it ) { //Remove all panes - delete m_qtPanes->takeLast(); + delete *it; } + m_qtPanes.clear(); for (size_t i = 0; i < m_panes.GetCount(); i++) { @@ -124,7 +125,7 @@ void wxStatusBar::UpdateFields() int width = m_panes[i].GetWidth(); QLabel *pane = new QLabel( m_qtStatusBar ); - m_qtPanes->append( pane ); + m_qtPanes.push_back(pane); if ( width >= 0 ) {