LineEdits for ID values accept drops with a proper type

c++11
Stanislav Bas 10 years ago
parent 27ece7f36a
commit 64701b273d

@ -13,13 +13,20 @@ namespace
}
}
CSVWidget::DropLineEdit::DropLineEdit(QWidget *parent, CSMWorld::UniversalId::Type type)
CSVWidget::DropLineEdit::DropLineEdit(CSMWorld::UniversalId::Type type, QWidget *parent)
: QLineEdit(parent),
mDropType(type)
{
setAcceptDrops(true);
}
CSVWidget::DropLineEdit::DropLineEdit(CSMWorld::ColumnBase::Display display, QWidget *parent)
: QLineEdit(parent),
mDropType(CSMWorld::TableMimeData::convertEnums(display))
{
setAcceptDrops(true);
}
void CSVWidget::DropLineEdit::dragEnterEvent(QDragEnterEvent *event)
{
if (canAcceptEventData(event))

@ -3,6 +3,7 @@
#include <QLineEdit>
#include "../../model/world/columnbase.hpp"
#include "../../model/world/universalid.hpp"
namespace CSMDoc
@ -33,8 +34,8 @@ namespace CSVWidget
///< \return -1 if there is no suitable data (ID type)
public:
DropLineEdit(QWidget *parent = 0,
CSMWorld::UniversalId::Type type = CSMWorld::UniversalId::Type_None);
DropLineEdit(CSMWorld::UniversalId::Type type, QWidget *parent = 0);
DropLineEdit(CSMWorld::ColumnBase::Display display, QWidget *parent = 0);
protected:
void dragEnterEvent(QDragEnterEvent *event);

@ -28,7 +28,7 @@ QWidget *CSVWorld::IdCompletionDelegate::createEditor(QWidget *parent,
}
CSMWorld::IdCompletionManager &completionManager = getDocument().getIdCompletionManager();
CSVWidget::DropLineEdit *editor = new CSVWidget::DropLineEdit(parent);
CSVWidget::DropLineEdit *editor = new CSVWidget::DropLineEdit(display, parent);
editor->setCompleter(completionManager.getCompleter(display).get());
return editor;
}

@ -253,7 +253,7 @@ QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleO
case CSMWorld::ColumnBase::Display_Video:
case CSMWorld::ColumnBase::Display_GlobalVariable:
return new CSVWidget::DropLineEdit(parent);
return new CSVWidget::DropLineEdit(CSMWorld::UniversalId::Type_None, parent);
case CSMWorld::ColumnBase::Display_ScriptLines:

Loading…
Cancel
Save