Skip to content
Snippets Groups Projects
Commit 15ae6d56 authored by t.knopff's avatar t.knopff
Browse files

Use string constant for vector item type name

parent 441c0ce1
No related branches found
No related tags found
1 merge request!138Refactor model: vector item
......@@ -15,6 +15,7 @@
#include "GUI/Models/ComponentUtils.h"
#include "GUI/Models/AxesItems.h"
#include "GUI/Models/MaterialDataItems.h"
#include "GUI/Models/VectorItem.h"
namespace {
QList<const SessionItem*> groupItems(const SessionItem& item);
......@@ -24,7 +25,7 @@ const QStringList& GUI::Model::ComponentUtils::propertyRelatedTypes()
{
static const QStringList result = {"Property",
"GroupProperty",
"Vector",
VectorItem::M_TYPE,
BasicAxisItem::M_TYPE,
AmplitudeAxisItem::M_TYPE,
MaterialRefractiveDataItem::M_TYPE};
......
......@@ -14,6 +14,7 @@
#include "GUI/Models/FilterPropertyProxy.h"
#include "GUI/Models/SessionModel.h"
#include "GUI/Models/VectorItem.h"
int FilterPropertyProxy::columnCount(const QModelIndex& parent) const
{
......@@ -36,7 +37,7 @@ bool FilterPropertyProxy::filterAcceptsRow(int sourceRow, const QModelIndex& sou
if (!sourceParent.isValid())
return true;
const QString modelType = index.data(SessionFlags::ModelTypeRole).toString();
if (modelType == "Property" || modelType == "GroupProperty" || modelType == "Vector")
if (modelType == "Property" || modelType == "GroupProperty" || modelType == VectorItem::M_TYPE)
return false;
return true; //! sourceModel()->data(index, Qt::DisplayRole).isValid();
......
......@@ -91,7 +91,7 @@ ItemCatalog::ItemCatalog()
addItem<FootprintNoneItem>();
addItem<FootprintGaussianItem>();
addItem<FootprintSquareItem>();
add("Vector", create_new<VectorItem>);
addItem<VectorItem>();
add("Property", create_new<PropertyItem>);
add("AnisoPyramid", create_new<AnisoPyramidItem>);
......
......@@ -18,7 +18,9 @@ const QString VectorItem::P_X = "X";
const QString VectorItem::P_Y = "Y";
const QString VectorItem::P_Z = "Z";
VectorItem::VectorItem() : SessionItem("Vector")
const QString VectorItem::M_TYPE = "Vector";
VectorItem::VectorItem() : SessionItem(M_TYPE)
{
addProperty(P_X, 0.0)->setLimits(RealLimits::limitless()).setToolTip("x-coordinate");
addProperty(P_Y, 0.0)->setLimits(RealLimits::limitless()).setToolTip("y-coordinate");
......
......@@ -24,6 +24,9 @@ public:
static const QString P_X;
static const QString P_Y;
static const QString P_Z;
static const QString M_TYPE;
VectorItem();
double x() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment