Rewrite wxListCtrl to use QTreeView and a custom model

This notably allows to support wxLC_VIRTUAL style.

Also implement support for checkboxes, improve in-place editing and
implement many other methods and missing functionality (e.g. send the
expected events now).

Closes https://github.com/wxWidgets/wxWidgets/pull/1229
This commit is contained in:
Graham Dawes
2019-02-15 17:16:08 +00:00
committed by Vadim Zeitlin
parent 95e5ed7395
commit 7454fc151b
2 changed files with 1202 additions and 312 deletions

View File

@@ -11,7 +11,8 @@
#include "wx/textctrl.h"
class wxQtListTreeWidget;
class QTreeWidgetItem;
class wxQtListModel;
class wxQtVirtualListModel;
class WXDLLIMPEXP_FWD_CORE wxImageList;
@@ -159,6 +160,11 @@ public:
// list or report view
long GetTopItem() const;
virtual bool HasCheckBoxes() const wxOVERRIDE;
virtual bool EnableCheckBoxes(bool enable = true) wxOVERRIDE;
virtual bool IsItemChecked(long item) const wxOVERRIDE;
virtual void CheckItem(long item, bool check) wxOVERRIDE;
// Add or remove a single window style
void SetSingleStyle(long style, bool add = true);
@@ -273,16 +279,21 @@ protected:
// Implement base class pure virtual methods.
virtual long DoInsertColumn(long col, const wxListItem& info) wxOVERRIDE;
QTreeWidgetItem *QtGetItem(int id) const;
wxImageList * m_imageListNormal; // The image list for normal icons
wxImageList * m_imageListSmall; // The image list for small icons
wxImageList * m_imageListState; // The image list state icons (not implemented yet)
bool m_ownsImageListNormal,
m_ownsImageListSmall,
m_ownsImageListState;
bool m_hasCheckBoxes;
private:
// Allow access to OnGetItemXXX() method from the virtual model class.
friend class wxQtVirtualListModel;
wxQtListTreeWidget *m_qtTreeWidget;
wxQtListModel *m_model;
wxDECLARE_DYNAMIC_CLASS( wxListCtrl );
};