forked from teamnwah/openmw-tes3coop
accept drops from filters table. Cool. ☺
This commit is contained in:
parent
e2dce53543
commit
e348c6baa9
9 changed files with 34 additions and 10 deletions
|
@ -154,7 +154,7 @@ void CSVFilter::EditWidget::createFilterRequest (std::vector< std::pair< std::st
|
||||||
if (ss.str().length() >4)
|
if (ss.str().length() >4)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
insert (QString::fromStdString (ss.str().c_str()));
|
insert (QString::fromUtf8(ss.str().c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,3 +194,10 @@ std::string CSVFilter::EditWidget::generateFilter (std::pair< std::string, std::
|
||||||
|
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVFilter::EditWidget::useFilterRequest (const std::string& idOfFilter)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
insert(QString::fromUtf8(idOfFilter.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,8 @@ namespace CSVFilter
|
||||||
|
|
||||||
void createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >& filterSource,
|
void createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >& filterSource,
|
||||||
Qt::DropAction action);
|
Qt::DropAction action);
|
||||||
|
|
||||||
|
void useFilterRequest(const std::string& idOfFilter);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ CSVFilter::FilterBox::FilterBox (CSMWorld::Data& data, QWidget *parent)
|
||||||
connect(this, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)),
|
connect(this, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)),
|
||||||
recordFilterBox, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)));
|
recordFilterBox, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)));
|
||||||
|
|
||||||
|
connect(this, SIGNAL(useFilterRequest(const std::string&)), recordFilterBox, SIGNAL(useFilterRequest(const std::string&)));
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ namespace CSVFilter
|
||||||
void recordDropped (std::vector<CSMWorld::UniversalId>& types, Qt::DropAction action);
|
void recordDropped (std::vector<CSMWorld::UniversalId>& types, Qt::DropAction action);
|
||||||
void createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >& filterSource,
|
void createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >& filterSource,
|
||||||
Qt::DropAction action);
|
Qt::DropAction action);
|
||||||
|
void useFilterRequest(const std::string& idOfFilter);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,4 +27,6 @@ CSVFilter::RecordFilterBox::RecordFilterBox (CSMWorld::Data& data, QWidget *pare
|
||||||
|
|
||||||
connect(this, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)),
|
connect(this, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)),
|
||||||
editWidget, SLOT(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)));
|
editWidget, SLOT(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)));
|
||||||
|
|
||||||
|
connect(this, SIGNAL(useFilterRequest(const std::string&)), editWidget, SLOT(useFilterRequest(const std::string&)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace CSVFilter
|
||||||
void filterChanged (boost::shared_ptr<CSMFilter::Node> filter);
|
void filterChanged (boost::shared_ptr<CSMFilter::Node> filter);
|
||||||
void createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >& filterSource,
|
void createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >& filterSource,
|
||||||
Qt::DropAction action);
|
Qt::DropAction action);
|
||||||
|
void useFilterRequest(const std::string& idOfFilter);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,10 +64,9 @@ namespace CSVWorld
|
||||||
|
|
||||||
void dragEnterEvent(QDragEnterEvent *event);
|
void dragEnterEvent(QDragEnterEvent *event);
|
||||||
|
|
||||||
void dropEvent(QDropEvent *event);
|
|
||||||
|
|
||||||
void dragMoveEvent(QDragMoveEvent *event);
|
void dragMoveEvent(QDragMoveEvent *event);
|
||||||
|
|
||||||
|
void dropEvent(QDropEvent *event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "tablesubview.hpp"
|
#include "tablesubview.hpp"
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QEvent>
|
||||||
|
|
||||||
#include "../../model/doc/document.hpp"
|
#include "../../model/doc/document.hpp"
|
||||||
#include "../../model/world/tablemimedata.hpp"
|
#include "../../model/world/tablemimedata.hpp"
|
||||||
|
@ -44,7 +45,7 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
||||||
|
|
||||||
mTable->tableSizeUpdate();
|
mTable->tableSizeUpdate();
|
||||||
mTable->selectionSizeUpdate();
|
mTable->selectionSizeUpdate();
|
||||||
mTable->installEventFilter(this);
|
mTable->viewport()->installEventFilter(this);
|
||||||
mBottom->installEventFilter(this);
|
mBottom->installEventFilter(this);
|
||||||
filterBox->installEventFilter(this);
|
filterBox->installEventFilter(this);
|
||||||
|
|
||||||
|
@ -68,6 +69,8 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
||||||
connect(filterBox, SIGNAL(recordDropped(std::vector<CSMWorld::UniversalId>&, Qt::DropAction)),
|
connect(filterBox, SIGNAL(recordDropped(std::vector<CSMWorld::UniversalId>&, Qt::DropAction)),
|
||||||
this, SLOT(createFilterRequest(std::vector<CSMWorld::UniversalId>&, Qt::DropAction)));
|
this, SLOT(createFilterRequest(std::vector<CSMWorld::UniversalId>&, Qt::DropAction)));
|
||||||
|
|
||||||
|
connect(this, SIGNAL(useFilterRequest(const std::string&)), filterBox, SIGNAL(useFilterRequest(const std::string&)));
|
||||||
|
|
||||||
connect(this, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)),
|
connect(this, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)),
|
||||||
filterBox, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)));
|
filterBox, SIGNAL(createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >&, Qt::DropAction)));
|
||||||
}
|
}
|
||||||
|
@ -114,9 +117,16 @@ void CSVWorld::TableSubView::createFilterRequest (std::vector< CSMWorld::Univers
|
||||||
|
|
||||||
bool CSVWorld::TableSubView::eventFilter (QObject* object, QEvent* event)
|
bool CSVWorld::TableSubView::eventFilter (QObject* object, QEvent* event)
|
||||||
{
|
{
|
||||||
|
if (event->type() == QEvent::Drop)
|
||||||
|
{
|
||||||
|
QDropEvent* drop = dynamic_cast<QDropEvent*>(event);
|
||||||
|
const CSMWorld::TableMimeData* data = dynamic_cast<const CSMWorld::TableMimeData*>(drop->mimeData());
|
||||||
|
bool handled = data->holdsType(CSMWorld::UniversalId::Type_Filter);
|
||||||
|
if (handled)
|
||||||
|
{
|
||||||
|
emit useFilterRequest(data->returnMatching(CSMWorld::UniversalId::Type_Filter).getId());
|
||||||
|
}
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::TableSubView::dropEvent (QDropEvent* event)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
|
@ -41,14 +41,15 @@ namespace CSVWorld
|
||||||
|
|
||||||
virtual void setStatusBar (bool show);
|
virtual void setStatusBar (bool show);
|
||||||
|
|
||||||
|
protected:
|
||||||
bool eventFilter(QObject* object, QEvent *event);
|
bool eventFilter(QObject* object, QEvent *event);
|
||||||
void dropEvent(QDropEvent *event);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void cloneRequest(const std::string&,
|
void cloneRequest(const std::string&,
|
||||||
const CSMWorld::UniversalId::Type);
|
const CSMWorld::UniversalId::Type);
|
||||||
void createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >& filterSource,
|
void createFilterRequest(std::vector<std::pair<std::string, std::vector<std::string> > >& filterSource,
|
||||||
Qt::DropAction action);
|
Qt::DropAction action);
|
||||||
|
void useFilterRequest(const std::string& idOfFilter);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue