Code review changes
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_TREEITEM_DELEGATE_H
|
||||
#define _WX_TREEITEM_DELEGATE_H
|
||||
#ifndef _WX_QT_PRIVATE_TREEITEM_DELEGATE_H
|
||||
#define _WX_QT_PRIVATE_TREEITEM_DELEGATE_H
|
||||
|
||||
#include <QtWidgets/QStyledItemDelegate>
|
||||
|
||||
@@ -28,7 +28,10 @@ public:
|
||||
|
||||
QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &WXUNUSED(option), const QModelIndex &index) const wxOVERRIDE
|
||||
{
|
||||
m_current_model_index = index;
|
||||
if ( m_textCtrl != NULL )
|
||||
destroyEditor(m_textCtrl->GetHandle(), m_currentModelIndex);
|
||||
|
||||
m_currentModelIndex = index;
|
||||
m_textCtrl = new wxQtListTextCtrl(m_parent, parent);
|
||||
m_textCtrl->SetFocus();
|
||||
return m_textCtrl->GetHandle();
|
||||
@@ -36,9 +39,9 @@ public:
|
||||
|
||||
void destroyEditor(QWidget *WXUNUSED(editor), const QModelIndex &WXUNUSED(index)) const wxOVERRIDE
|
||||
{
|
||||
if (!wxTheApp->IsScheduledForDestruction(m_textCtrl))
|
||||
if ( m_textCtrl != NULL )
|
||||
{
|
||||
m_current_model_index = QModelIndex();
|
||||
m_currentModelIndex = QModelIndex(); // invalidate the index
|
||||
wxTheApp->ScheduleForDestruction(m_textCtrl);
|
||||
m_textCtrl = NULL;
|
||||
}
|
||||
@@ -56,7 +59,7 @@ public:
|
||||
|
||||
QModelIndex GetCurrentModelIndex() const
|
||||
{
|
||||
return m_current_model_index;
|
||||
return m_currentModelIndex;
|
||||
}
|
||||
|
||||
void AcceptModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||
@@ -67,7 +70,7 @@ public:
|
||||
private:
|
||||
wxWindow* m_parent;
|
||||
mutable wxTextCtrl* m_textCtrl;
|
||||
mutable QModelIndex m_current_model_index;
|
||||
mutable QModelIndex m_currentModelIndex;
|
||||
};
|
||||
|
||||
#endif // _WX_TREEITEM_DELEGATE_H
|
||||
#endif // _WX_QT_PRIVATE_TREEITEM_DELEGATE_H
|
||||
|
@@ -7,8 +7,8 @@
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_TREEITEM_FACTORY_H_
|
||||
#define _WX_TREEITEM_FACTORY_H_
|
||||
#ifndef _WX_QT_PRIVATE_TREEITEM_FACTORY_H_
|
||||
#define _WX_QT_PRIVATE_TREEITEM_FACTORY_H_
|
||||
|
||||
#include <QtWidgets/QItemEditorFactory>
|
||||
#include <QtWidgets/QTreeWidget>
|
||||
@@ -91,11 +91,11 @@ public:
|
||||
qItemDelegate->setItemEditorFactory(this);
|
||||
}
|
||||
|
||||
virtual QWidget* createEditor(
|
||||
int WXUNUSED(userType),
|
||||
QWidget* parent
|
||||
) const wxOVERRIDE
|
||||
QWidget* createEditor(int WXUNUSED(userType), QWidget* parent) const wxOVERRIDE
|
||||
{
|
||||
if (m_textCtrl != NULL)
|
||||
ClearEditor();
|
||||
|
||||
m_textCtrl = new wxQtListTextCtrl(m_parent, parent);
|
||||
m_textCtrl->SetFocus();
|
||||
return m_textCtrl->GetHandle();
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
return m_textCtrl;
|
||||
}
|
||||
|
||||
void ClearEditor()
|
||||
void ClearEditor() const
|
||||
{
|
||||
delete m_textCtrl;
|
||||
m_textCtrl = NULL;
|
||||
@@ -119,4 +119,4 @@ private:
|
||||
wxDECLARE_NO_COPY_CLASS(wxQtTreeItemEditorFactory);
|
||||
};
|
||||
|
||||
#endif //_WX_TREEITEM_FACTORY_H_
|
||||
#endif //_WX_QT_PRIVATE_TREEITEM_FACTORY_H_
|
||||
|
@@ -75,7 +75,6 @@ public:
|
||||
virtual wxTreeItemId GetFocusedItem() const wxOVERRIDE;
|
||||
|
||||
virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const wxOVERRIDE;
|
||||
|
||||
virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const wxOVERRIDE;
|
||||
virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const wxOVERRIDE;
|
||||
virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const wxOVERRIDE;
|
||||
|
Reference in New Issue
Block a user