Fraxinus  22.04-rc5
An IGT application
cxFilePathProperty.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #include "cxFilePathProperty.h"
13 
14 #include <iostream>
15 #include <QDomElement>
16 #include <QStringList>
17 #include "cxTypeConversions.h"
18 #include "cxLogger.h"
19 
20 namespace cx
21 {
22 
24 {
25 
26 }
27 
31 FilePathPropertyPtr FilePathProperty::initialize(const QString& uid, QString name, QString help, QString value, QStringList paths, QDomNode root)
32 {
34  retval->mUid = uid;
35  retval->mName = name.isEmpty() ? uid : name;
36  retval->mHelp = help;
37  retval->mFilePath.setFilepath(value);
38  foreach (QString path, paths)
39  retval->mFilePath.appendRootPath(path);
40  retval->mStore = XmlOptionItem(uid, root.toElement());
41  retval->mFilePath.setFilepath(retval->mStore.readValue(value));
42  return retval;
43 }
44 
45 QString FilePathProperty::getUid() const
46 {
47  return mUid;
48 }
49 
51 {
52  return mHelp;
53 }
54 
55 void FilePathProperty::setHelp(QString val)
56 {
57  if (val == mHelp)
58  return;
59 
60  mHelp = val;
61  emit changed();
62 }
63 
65 {
66  return this->getValue();
67 }
68 
70 {
71  this->setValue(val.toString());
72 }
73 
74 } // namespace cx
virtual QString getHelp() const
return a descriptive help string for the data, used for example as a tool tip.
virtual void setHelp(QString val)
Helper class for storing one string value in an xml document.
virtual void setValueFromVariant(QVariant val)
virtual QString getValue() const
virtual QVariant getValueAsVariant() const
virtual QString getUid() const
void changed()
emit when the underlying data value is changed: The user interface will be updated.
static FilePathPropertyPtr initialize(const QString &uid, QString name, QString help, QString value, QStringList paths, QDomNode root=QDomNode())
virtual bool setValue(const QString &value)
boost::shared_ptr< class FilePathProperty > FilePathPropertyPtr
Namespace for all CustusX production code.