diff --git a/apps/opencs/view/world/dialoguesubview.cpp b/apps/opencs/view/world/dialoguesubview.cpp index 3a87e6cf31..168e555eae 100644 --- a/apps/opencs/view/world/dialoguesubview.cpp +++ b/apps/opencs/view/world/dialoguesubview.cpp @@ -130,30 +130,24 @@ QWidget* CSVWorld::NotEditableSubDelegate::createEditor( /* ==============================DialogueDelegateDispatcherProxy========================================== */ -CSVWorld::DialogueDelegateDispatcherProxy::refWrapper::refWrapper(const QModelIndex& index) - : mIndex(index) -{ -} - CSVWorld::DialogueDelegateDispatcherProxy::DialogueDelegateDispatcherProxy( QWidget* editor, CSMWorld::ColumnBase::Display display) : mEditor(editor) , mDisplay(display) - , mIndexWrapper(nullptr) { } void CSVWorld::DialogueDelegateDispatcherProxy::editorDataCommited() { - if (mIndexWrapper.get()) + if (mIndex.has_value()) { - emit editorDataCommited(mEditor, mIndexWrapper->mIndex, mDisplay); + emit editorDataCommited(mEditor, mIndex.value(), mDisplay); } } void CSVWorld::DialogueDelegateDispatcherProxy::setIndex(const QModelIndex& index) { - mIndexWrapper = std::make_unique(index); + mIndex = index; } QWidget* CSVWorld::DialogueDelegateDispatcherProxy::getEditor() const diff --git a/apps/opencs/view/world/dialoguesubview.hpp b/apps/opencs/view/world/dialoguesubview.hpp index b5108f3b0e..eb1c8d96d5 100644 --- a/apps/opencs/view/world/dialoguesubview.hpp +++ b/apps/opencs/view/world/dialoguesubview.hpp @@ -74,23 +74,14 @@ namespace CSVWorld QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override; }; - // this can't be nested into the DialogueDelegateDispatcher, because it needs to emit signals class DialogueDelegateDispatcherProxy : public QObject { Q_OBJECT - class refWrapper - { - public: - refWrapper(const QModelIndex& index); - - const QModelIndex& mIndex; - }; - QWidget* mEditor; CSMWorld::ColumnBase::Display mDisplay; - std::unique_ptr mIndexWrapper; + std::optional mIndex; public: DialogueDelegateDispatcherProxy(QWidget* editor, CSMWorld::ColumnBase::Display display);