Do not explicitly set selection to -1 when deleting all pages
Avoid calling wxNotebook::SetSelection(-1) when the notebook is cleared. Closes https://github.com/wxWidgets/wxWidgets/pull/1254
This commit is contained in:
committed by
Vadim Zeitlin
parent
bb27020ab3
commit
ca68cd50f2
@@ -167,13 +167,22 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const
|
||||
|
||||
bool wxNotebook::DeleteAllPages()
|
||||
{
|
||||
if ( !wxNotebookBase::DeleteAllPages() )
|
||||
return false;
|
||||
// Nothing to do if the notebook was not created yet,
|
||||
// and return true just like other ports do.
|
||||
if ( !m_qtTabWidget )
|
||||
return true;
|
||||
|
||||
// Block signals to not receive selection changed updates
|
||||
// which are sent by Qt after the selected page was deleted.
|
||||
m_qtTabWidget->blockSignals(true);
|
||||
m_qtTabWidget->clear();
|
||||
|
||||
// Pages will be deleted one by one in the base class.
|
||||
// There's no need to explicitly clear() the Qt control.
|
||||
bool deleted = wxNotebookBase::DeleteAllPages();
|
||||
|
||||
m_qtTabWidget->blockSignals(false);
|
||||
return true;
|
||||
|
||||
return deleted;
|
||||
}
|
||||
|
||||
int wxNotebook::SetSelection(size_t page)
|
||||
|
Reference in New Issue
Block a user