From 47e3813d91a73a16b12fcf15929692fe32791f50 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 14 Sep 2019 23:52:22 +0200 Subject: [PATCH] Move wx<->Qt alignment conversion functions to the top No real changes, this is just a refactoring in preparation for the future changes (use "git show --color-moved" to view the diff). --- src/qt/listctrl.cpp | 62 ++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/src/qt/listctrl.cpp b/src/qt/listctrl.cpp index 6149e7fc3a..f7ccd13e6e 100644 --- a/src/qt/listctrl.cpp +++ b/src/qt/listctrl.cpp @@ -26,6 +26,39 @@ #include "wx/qt/private/winevent.h" #include "wx/qt/private/treeitemfactory.h" +namespace +{ + +Qt::AlignmentFlag wxQtConvertTextAlign(wxListColumnFormat align) +{ + switch (align) + { + case wxLIST_FORMAT_LEFT: + return Qt::AlignLeft; + case wxLIST_FORMAT_RIGHT: + return Qt::AlignRight; + case wxLIST_FORMAT_CENTRE: + return Qt::AlignCenter; + } + return Qt::AlignLeft; +} + +wxListColumnFormat wxQtConvertAlignFlag(int align) +{ + switch (align) + { + case Qt::AlignLeft: + return wxLIST_FORMAT_LEFT; + case Qt::AlignRight: + return wxLIST_FORMAT_RIGHT; + case Qt::AlignCenter: + return wxLIST_FORMAT_CENTRE; + } + return wxLIST_FORMAT_LEFT; +} + +} // anonymous namespace + class wxQtListTreeWidget : public wxQtEventSignalHandler< QTreeWidget, wxListCtrl > { public: @@ -106,35 +139,6 @@ void wxQtListTreeWidget::itemActivated(QTreeWidgetItem *qitem, int column) } -Qt::AlignmentFlag wxQtConvertTextAlign(wxListColumnFormat align) -{ - switch (align) - { - case wxLIST_FORMAT_LEFT: - return Qt::AlignLeft; - case wxLIST_FORMAT_RIGHT: - return Qt::AlignRight; - case wxLIST_FORMAT_CENTRE: - return Qt::AlignCenter; - } - return Qt::AlignLeft; -} - -wxListColumnFormat wxQtConvertAlignFlag(int align) -{ - switch (align) - { - case Qt::AlignLeft: - return wxLIST_FORMAT_LEFT; - case Qt::AlignRight: - return wxLIST_FORMAT_RIGHT; - case Qt::AlignCenter: - return wxLIST_FORMAT_CENTRE; - } - return wxLIST_FORMAT_LEFT; -} - - wxListCtrl::wxListCtrl() { Init();