mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 17:09:40 +00:00
Introduced multitype icon.
This commit is contained in:
parent
6662560cbc
commit
2afe3f3e57
5 changed files with 15 additions and 14 deletions
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include "universalid.hpp"
|
#include "universalid.hpp"
|
||||||
#include "columnbase.hpp"
|
#include "columnbase.hpp"
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
CSMWorld::TableMimeData::TableMimeData (UniversalId id)
|
CSMWorld::TableMimeData::TableMimeData (UniversalId id)
|
||||||
{
|
{
|
||||||
|
@ -79,7 +78,6 @@ bool CSMWorld::TableMimeData::holdsType (CSMWorld::UniversalId::Type type) const
|
||||||
|
|
||||||
bool CSMWorld::TableMimeData::holdsType (CSMWorld::ColumnBase::Display type) const
|
bool CSMWorld::TableMimeData::holdsType (CSMWorld::ColumnBase::Display type) const
|
||||||
{
|
{
|
||||||
std::cout<<type<<std::endl;
|
|
||||||
for (std::vector<UniversalId>::const_iterator it = mUniversalId.begin(); it != mUniversalId.end(); ++it)
|
for (std::vector<UniversalId>::const_iterator it = mUniversalId.begin(); it != mUniversalId.end(); ++it)
|
||||||
{
|
{
|
||||||
if (it->getType() == convertEnums (type))
|
if (it->getType() == convertEnums (type))
|
||||||
|
|
|
@ -133,9 +133,9 @@ void CSVWorld::GenericCreator::create()
|
||||||
std::string id = getId();
|
std::string id = getId();
|
||||||
std::auto_ptr<CSMWorld::CloneCommand> command (new CSMWorld::CloneCommand (
|
std::auto_ptr<CSMWorld::CloneCommand> command (new CSMWorld::CloneCommand (
|
||||||
dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel(mListId)), mClonedId, id, mClonedType));
|
dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel(mListId)), mClonedId, id, mClonedType));
|
||||||
|
|
||||||
mUndoStack.push(command.release());
|
mUndoStack.push(command.release());
|
||||||
|
|
||||||
emit done();
|
emit done();
|
||||||
emit requestFocus(id);
|
emit requestFocus(id);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
#include "../../model/world/data.hpp"
|
#include "../../model/world/data.hpp"
|
||||||
#include "../../model/world/commands.hpp"
|
#include "../../model/world/commands.hpp"
|
||||||
|
@ -477,27 +478,28 @@ void CSVWorld::Table::mouseMoveEvent (QMouseEvent* event)
|
||||||
|
|
||||||
void CSVWorld::Table::dragEnterEvent(QDragEnterEvent *event)
|
void CSVWorld::Table::dragEnterEvent(QDragEnterEvent *event)
|
||||||
{
|
{
|
||||||
// QModelIndex index = indexAt (event->pos());
|
|
||||||
|
|
||||||
// if (dynamic_cast<const CSMWorld::TableMimeData*> (event->mimeData())->holdsType (mModel->getColumnDisplay (index.column())))
|
|
||||||
// {
|
|
||||||
event->acceptProposedAction();
|
event->acceptProposedAction();
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::Table::dropEvent(QDropEvent *event)
|
void CSVWorld::Table::dropEvent(QDropEvent *event)
|
||||||
{
|
{
|
||||||
QModelIndex index = indexAt (event->pos());
|
QModelIndex index = indexAt (event->pos());
|
||||||
|
|
||||||
CSMWorld::ColumnBase::Display display = static_cast<CSMWorld::ColumnBase::Display>(mModel->headerData(index.column(), Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt());
|
CSMWorld::ColumnBase::Display display = static_cast<CSMWorld::ColumnBase::Display>
|
||||||
|
(mModel->headerData(index.column(), Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt());
|
||||||
|
|
||||||
if (dynamic_cast<const CSMWorld::TableMimeData*>(event->mimeData())->holdsType(display))
|
if (dynamic_cast<const CSMWorld::TableMimeData*>(event->mimeData())->holdsType(display))
|
||||||
{
|
{
|
||||||
event->acceptProposedAction();
|
const CSMWorld::TableMimeData* mime = dynamic_cast<const CSMWorld::TableMimeData*>(event->mimeData());
|
||||||
std::cout<<"Dropped/n";
|
CSMWorld::UniversalId record(mime->returnMatching(display));
|
||||||
} else {std::cout<<"Not Dropped\n";}
|
mUndoStack.push (new CSMWorld::ModifyCommand ( *mModel,
|
||||||
|
index,
|
||||||
|
QVariant(record.getId().c_str())
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::Table::dragMoveEvent(QDragMoveEvent *event)
|
void CSVWorld::Table::dragMoveEvent(QDragMoveEvent *event)
|
||||||
{
|
{
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
BIN
files/opencs/multitype.png
Normal file
BIN
files/opencs/multitype.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
|
@ -56,6 +56,7 @@
|
||||||
<file>spell.png</file>
|
<file>spell.png</file>
|
||||||
<file>static.png</file>
|
<file>static.png</file>
|
||||||
<file>weapon.png</file>
|
<file>weapon.png</file>
|
||||||
|
<file>multitype.png</file>
|
||||||
<file alias="startup/create-addon">raster/startup/big/create-addon.png</file>
|
<file alias="startup/create-addon">raster/startup/big/create-addon.png</file>
|
||||||
<file alias="startup/create-game">raster/startup/big/new-game.png</file>
|
<file alias="startup/create-game">raster/startup/big/new-game.png</file>
|
||||||
<file alias="startup/edit-content">raster/startup/big/edit-content.png</file>
|
<file alias="startup/edit-content">raster/startup/big/edit-content.png</file>
|
||||||
|
|
Loading…
Reference in a new issue