From 740bcdc81a8af82ccbeb4abc403bd80e218b146e Mon Sep 17 00:00:00 2001 From: Mariano Reingart Date: Mon, 29 Sep 2014 04:01:13 +0000 Subject: [PATCH] Block qt signals when manually setting value to avoid emitting an event in wxQT, thanks @seandpagnier git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77927 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/qt/calctrl.cpp | 4 ++++ src/qt/slider.cpp | 8 ++++++++ src/qt/spinctrl.cpp | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/src/qt/calctrl.cpp b/src/qt/calctrl.cpp index c2353cbc08..619f7566d7 100644 --- a/src/qt/calctrl.cpp +++ b/src/qt/calctrl.cpp @@ -135,7 +135,9 @@ bool wxCalendarCtrl::SetDate(const wxDateTime& date) if ( !m_qtCalendar ) return false; + m_qtCalendar->blockSignals(true); m_qtCalendar->setSelectedDate(wxQtConvertDate(date)); + m_qtCalendar->blockSignals(false); return true; } @@ -154,8 +156,10 @@ bool wxCalendarCtrl::SetDateRange(const wxDateTime& lowerdate, if ( !m_qtCalendar ) return false; + m_qtCalendar->blockSignals(true); m_qtCalendar->setMinimumDate(wxQtConvertDate(lowerdate)); m_qtCalendar->setMaximumDate(wxQtConvertDate(upperdate)); + m_qtCalendar->blockSignals(false); return true; } diff --git a/src/qt/slider.cpp b/src/qt/slider.cpp index 55161736cd..2f944c9b83 100644 --- a/src/qt/slider.cpp +++ b/src/qt/slider.cpp @@ -67,7 +67,11 @@ bool wxSlider::Create(wxWindow *parent, { m_qtSlider = new wxQtSlider( parent, this ); m_qtSlider->setOrientation( wxQtConvertOrientation( style, wxSL_HORIZONTAL ) ); + + m_qtSlider->blockSignals(true); SetRange( minValue, maxValue ); + m_qtSlider->blockSignals(false); + // draw ticks marks (default bellow if horizontal, right if vertical): if ( style & wxSL_VERTICAL ) { @@ -89,12 +93,16 @@ int wxSlider::GetValue() const void wxSlider::SetValue(int value) { + m_qtSlider->blockSignals(true); m_qtSlider->setValue( value ); + m_qtSlider->blockSignals(false); } void wxSlider::SetRange(int minValue, int maxValue) { + m_qtSlider->blockSignals(true); m_qtSlider->setRange( minValue, maxValue ); + m_qtSlider->blockSignals(false); } int wxSlider::GetMin() const diff --git a/src/qt/spinctrl.cpp b/src/qt/spinctrl.cpp index 26dc2a4f95..edf77f7305 100644 --- a/src/qt/spinctrl.cpp +++ b/src/qt/spinctrl.cpp @@ -53,13 +53,17 @@ bool wxSpinCtrlQt< T, Widget >::Create( wxWindow *parent, wxWindowID id, template< typename T, typename Widget > void wxSpinCtrlQt< T, Widget >::SetValue( T val ) { + m_qtSpinBox->blockSignals(true); m_qtSpinBox->setValue( val ); + m_qtSpinBox->blockSignals(false); } template< typename T, typename Widget > void wxSpinCtrlQt< T, Widget >::SetRange( T min, T max ) { + m_qtSpinBox->blockSignals(true); m_qtSpinBox->setRange( min, max ); + m_qtSpinBox->blockSignals(false); } template< typename T, typename Widget >