mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Moved MimeData into RimMimeData
p4#: 21317
This commit is contained in:
parent
427bf5a2dd
commit
9f07daefad
@ -89,6 +89,7 @@ set ( QT_MOC_HEADERS
|
||||
|
||||
ProjectDataModel/RimUiTreeModelPdm.h
|
||||
ProjectDataModel/RimUiTreeView.h
|
||||
ProjectDataModel/RimMimeData.h
|
||||
|
||||
UserInterface/RiuMainWindow.h
|
||||
UserInterface/RiuPreferencesDialog.h
|
||||
|
@ -38,6 +38,7 @@ ${CEE_CURRENT_LIST_DIR}RimUiTreeModelPdm.h
|
||||
${CEE_CURRENT_LIST_DIR}RimUiTreeView.h
|
||||
${CEE_CURRENT_LIST_DIR}RimReservoirCellResultsCacher.h
|
||||
${CEE_CURRENT_LIST_DIR}RimStatisticsCaseEvaluator.h
|
||||
${CEE_CURRENT_LIST_DIR}RimMimeData.h
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
@ -73,6 +74,7 @@ ${CEE_CURRENT_LIST_DIR}RimUiTreeModelPdm.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimUiTreeView.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimReservoirCellResultsCacher.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimStatisticsCaseEvaluator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimMimeData.cpp
|
||||
)
|
||||
|
||||
|
||||
|
81
ApplicationCode/ProjectDataModel/RimMimeData.cpp
Normal file
81
ApplicationCode/ProjectDataModel/RimMimeData.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaStdInclude.h"
|
||||
|
||||
#include "RimMimeData.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
MimeDataWithIndexes::MimeDataWithIndexes()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
MimeDataWithIndexes::MimeDataWithIndexes(const MimeDataWithIndexes & other) : QMimeData()
|
||||
{
|
||||
setIndexes(other.indexes());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void MimeDataWithIndexes::setIndexes(const QModelIndexList & indexes)
|
||||
{
|
||||
m_indexes = indexes;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QModelIndexList& MimeDataWithIndexes::indexes() const
|
||||
{
|
||||
return m_indexes;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool MimeDataWithIndexes::hasFormat(const QString &mimetype) const
|
||||
{
|
||||
return (mimetype == formatName());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList MimeDataWithIndexes::formats() const
|
||||
{
|
||||
QStringList supportedFormats = QMimeData::formats();
|
||||
supportedFormats << formatName();
|
||||
|
||||
return supportedFormats;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString MimeDataWithIndexes::formatName()
|
||||
{
|
||||
return "MimeDataWithIndexes";
|
||||
}
|
||||
|
46
ApplicationCode/ProjectDataModel/RimMimeData.h
Normal file
46
ApplicationCode/ProjectDataModel/RimMimeData.h
Normal file
@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QMimeData>
|
||||
#include <QModelIndex>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// MimeData class used to carry a QModelIndexList
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class MimeDataWithIndexes : public QMimeData
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MimeDataWithIndexes();
|
||||
MimeDataWithIndexes(const MimeDataWithIndexes & other);
|
||||
|
||||
void setIndexes(const QModelIndexList& indexes);
|
||||
const QModelIndexList& indexes() const;
|
||||
virtual bool hasFormat(const QString& mimetype) const;
|
||||
virtual QStringList formats() const;
|
||||
static QString formatName();
|
||||
|
||||
private:
|
||||
QModelIndexList m_indexes;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(MimeDataWithIndexes)
|
@ -40,6 +40,7 @@
|
||||
#include "RigGridManager.h"
|
||||
#include "RimCase.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RimMimeData.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -23,8 +23,6 @@
|
||||
#include "cafPdmDocument.h"
|
||||
#include "cafUiTreeModelPdm.h"
|
||||
|
||||
#include <QMimeData>
|
||||
|
||||
class QFileSystemWatcher;
|
||||
|
||||
class RimCellPropertyFilter;
|
||||
@ -35,55 +33,6 @@ class RimInputProperty;
|
||||
class RimStatisticsCase;
|
||||
class RimIdenticalGridCaseGroup;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// MimeData class used to carry a QModelIndexList
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class MimeDataWithIndexes : public QMimeData
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MimeDataWithIndexes()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
MimeDataWithIndexes(const MimeDataWithIndexes & other) : QMimeData()
|
||||
{
|
||||
setIndexes(other.indexes());
|
||||
}
|
||||
|
||||
void setIndexes(const QModelIndexList & indexes)
|
||||
{
|
||||
m_indexes = indexes;
|
||||
}
|
||||
|
||||
const QModelIndexList& indexes() const { return m_indexes; }
|
||||
|
||||
virtual bool hasFormat( const QString &mimetype ) const
|
||||
{
|
||||
return (mimetype == formatName());
|
||||
}
|
||||
|
||||
virtual QStringList formats() const
|
||||
{
|
||||
QStringList supportedFormats = QMimeData::formats();
|
||||
supportedFormats << formatName();
|
||||
|
||||
return supportedFormats;
|
||||
}
|
||||
|
||||
static QString formatName()
|
||||
{
|
||||
return "MimeDataWithIndexes";
|
||||
}
|
||||
|
||||
private:
|
||||
QModelIndexList m_indexes;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(MimeDataWithIndexes)
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RimStatisticsCase.h"
|
||||
#include "RimResultCase.h"
|
||||
#include "RimMimeData.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user