From 2a9462a260cd44d1ad748bb4ca9c4cba7f3a68d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C4=83t=C4=83lin=20R=C4=83ceanu?= Date: Wed, 2 Jan 2019 03:09:00 +0200 Subject: [PATCH] Honor text alignment for spin controls in wxQt Add support for wxALIGN_CENTRE_HORIZONTAL and wxALIGN_RIGHT flags. Closes https://github.com/wxWidgets/wxWidgets/pull/1108 --- src/qt/spinctrl.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/qt/spinctrl.cpp b/src/qt/spinctrl.cpp index e7cdeddff7..60df847a50 100644 --- a/src/qt/spinctrl.cpp +++ b/src/qt/spinctrl.cpp @@ -40,6 +40,11 @@ bool wxSpinCtrlQt< T, Widget >::Create( wxWindow *parent, wxWindowID id, if ( style & wxSP_WRAP ) m_qtSpinBox->setWrapping(true); + if ( style & wxALIGN_CENTRE_HORIZONTAL ) + m_qtSpinBox->setAlignment(Qt::AlignHCenter); + else if ( style & wxALIGN_RIGHT ) + m_qtSpinBox->setAlignment(Qt::AlignRight); + m_qtSpinBox->setAccelerated(true); // to match gtk behavior SetRange( min, max );