mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added CopyReferencesToClipboardFeature
This commit is contained in:
@@ -79,3 +79,67 @@ QString MimeDataWithIndexes::formatName()
|
||||
return "MimeDataWithIndexes";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
MimeDataWithReferences::MimeDataWithReferences()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
MimeDataWithReferences::MimeDataWithReferences(const MimeDataWithReferences& other)
|
||||
{
|
||||
setReferences(other.references());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void MimeDataWithReferences::setReferences(const std::vector<QString>& references)
|
||||
{
|
||||
m_references = references;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<QString>& MimeDataWithReferences::references() const
|
||||
{
|
||||
return m_references;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool MimeDataWithReferences::hasFormat(const QString& mimetype) const
|
||||
{
|
||||
return (mimetype == formatName());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList MimeDataWithReferences::formats() const
|
||||
{
|
||||
QStringList supportedFormats = QMimeData::formats();
|
||||
supportedFormats << formatName();
|
||||
|
||||
return supportedFormats;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString MimeDataWithReferences::formatName()
|
||||
{
|
||||
return "MimeDataWithReferences";
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
|
||||
#include <QMimeData>
|
||||
#include <QModelIndex>
|
||||
#include <QStringList>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -44,3 +47,27 @@ private:
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(MimeDataWithIndexes)
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// MimeData class used to carry string references to pdm objects
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class MimeDataWithReferences : public QMimeData
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MimeDataWithReferences();
|
||||
MimeDataWithReferences(const MimeDataWithReferences& other);
|
||||
|
||||
void setReferences(const std::vector<QString>& references);
|
||||
const std::vector<QString>& references() const;
|
||||
virtual bool hasFormat(const QString& mimetype) const;
|
||||
virtual QStringList formats() const;
|
||||
static QString formatName();
|
||||
|
||||
private:
|
||||
std::vector<QString> m_references;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(MimeDataWithReferences)
|
||||
|
||||
@@ -525,10 +525,12 @@ void RimProject::computeUtmAreaOfInterest()
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseFaultColors.h"
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -544,9 +546,14 @@ void RimProject::actionsBasedOnSelection(std::vector<QAction*>& actions)
|
||||
caf::PdmUiItem* uiItem = uiItems[0];
|
||||
CVF_ASSERT(uiItem);
|
||||
|
||||
if (dynamic_cast<RimEclipseCase*>(uiItem))
|
||||
if (dynamic_cast<RimGeoMechView*>(uiItem))
|
||||
{
|
||||
commandIds << "RicEclipseCaseCopy";
|
||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseCase*>(uiItem))
|
||||
{
|
||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||
|
||||
commandIds << "RicEclipseCasePaste";
|
||||
commandIds << "RicEclipseCaseClose";
|
||||
commandIds << "RicEclipseCaseNewView";
|
||||
|
||||
Reference in New Issue
Block a user