BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ModelView Namespace Reference

materialitems.h Collection of materials to populate MaterialModel. More...

Namespaces

 Callbacks
 
 Compatibility
 
 Constants
 
 EditorBuilders
 Collection of methods to build custom editors for trees/tables cells.
 
 Factory
 
 ItemDataRole
 Defines constants to be used as SessionItem data role.
 
 JsonUtils
 
 ProjectUtils
 Collection of utility functions to handle project saving and loading.
 
 Style
 
 Utils
 Collection of various widget-related utils.
 

Classes

class  AbstractEditorFactory
 Abstract editor factory for ViewModelDelegate. More...
 
class  AbstractItemCommand
 Abstract command interface to manipulate SessionItem in model context. More...
 
class  AdjustingScrollArea
 Modification of standard scroll area, which makes widget with dynamic layout occupy the whole available space. More...
 
class  AllChildrenStrategy
 Strategy to find children of given item: gives all actual children back. More...
 
class  AllItemsTreeView
 Widget holding standard QTreeView and intended for displaying all items of SessionModel. More...
 
class  ApplicationModelsInterface
 Interface to access application's model list for further manipulation. More...
 
class  AxisTitleController
 Propagates title settings from TextItem to QCPAxis. More...
 
class  BasicAxisItem
 Base class for all axes items. Has min, max defined, but nothing else. More...
 
class  BinnedAxisItem
 Item to represent an axis with arbitrary binning. More...
 
class  BoolEditor
 Custom editor for QVariant based on bool values. More...
 
class  CellDecoratorInterface
 Interface class to generate cell decorations (i.e. text) in Qt trees and tables. More...
 
class  ChildrenStrategyInterface
 Base class for strategies to find children, actual of fictional, of given item. More...
 
class  CollapsibleBar
 Horizontal collapsible bar, part of CollapsibleListWidget. More...
 
class  CollapsibleListWidget
 Vertical widget with column of panels displayed one under another. More...
 
class  ColorEditor
 Custom editor for QVariant based on QColor. More...
 
class  ColorMapCanvas
 Widget to show 2D data as color map. More...
 
class  ColorMapInfoFormatter
 Formats status string for current mouse position in QCPColorMap. More...
 
class  ColorMapItem
 Two-dimensional color map representation of Data2DItem. More...
 
class  ColorMapPlotController
 Establish communication between QCPColorMap and ColorMapItem. More...
 
class  ColorMapViewportItem
 Container with viewport and collection of ColorMapItem's to plot. More...
 
class  ColorMapViewportPlotController
 Establishes communications and mutual updates for ColorMapViewportItem and QCutomPlot. More...
 
class  ColorScalePlotController
 Establishes communication between QCPColorScale and ViewportAxisItem. More...
 
class  ComboProperty
 Custom property to define list of string values with multiple selections. More...
 
class  ComboPropertyEditor
 Custom editor for QVariant based on ComboProperty. More...
 
class  CommandAdapter
 Adapter to execute our commands within Qt undo/redo framework. More...
 
class  CommandService
 Provides undo/redo for all commands of SessionModel. More...
 
class  Comparators
 Helper class to register variant comparators. More...
 
class  CompoundItem
 Complex item holding mixed SessionItem types (single properties and other CompountItems). More...
 
class  ContainerItem
 Simple container to store any type of children. More...
 
struct  ConverterCallbacks
 Provides necessary callbacks to convert SessionItem to JSON and back. More...
 
struct  ConverterContext
 Collection of input paramters for SessionItemConverter. More...
 
class  CopyItemCommand
 Command to copy an item. More...
 
class  CustomEditor
 Base class for all custom variant editors. More...
 
class  CustomPlotProxyWidget
 Custom proxy widget to embed color map in graphics scene. More...
 
class  CustomPlotSceneAdapter
 Converts QGraphicsScene coordinates in the coordinates of local system of QCustomPlot and vice versa. More...
 
class  Data1DItem
 Represents one-dimensional data (axis and values). More...
 
class  Data1DPlotController
 Establishes communication between QCPGraph and Data1DItem. More...
 
class  Data2DItem
 Represents two-dimensional data (axes definition and 2d array of values). More...
 
class  Data2DPlotController
 Establish communication between QCPColorMap and Data2DItem. More...
 
class  DataRole
 Represents pair of data,role for SessionItemData. More...
 
class  DefaultCellDecorator
 Generates default cell decorations for Qt trees and tables. More...
 
class  DefaultEditorFactory
 Default editor factory for cell editors in Qt trees and tables. More...
 
class  DefaultViewModel
 View model to show content of SessionModel in Qt widgets: two column tree with label/data. More...
 
class  DefaultViewModelController
 Controller for AbstractViewModel to show all items of SessionModel. More...
 
class  DoubleEditor
 Custom editor for QVariant based on double with possibility to set limits. More...
 
class  EditorFactoryInterface
 Interface for custom editor factory. More...
 
struct  empty_stack
 
class  ExternalProperty
 Property to carry text, color and identifier. More...
 
class  ExternalPropertyComboEditor
 Custom editor for table/tree cells to select ExternalProperty from the list of external properties. More...
 
class  ExternalPropertyEditor
 Custom editor for QVariant based on ExternalProperty. More...
 
class  FixedBinAxisItem
 Item to represent fixed bin axis. More...
 
class  GraphCanvas
 Widget to show scientific figure with multiple 1D graphs. More...
 
class  GraphInfoFormatter
 Formats status string for current mouse position in QCustomPlot with QCPGraph's. More...
 
class  GraphItem
 One-dimensional graph representation of Data1DItem. More...
 
class  GraphPlotController
 Establish communication between QCPGraph and GraphItem. More...
 
class  GraphViewportItem
 2D viewport specialized for showing multiple GraphItem's. More...
 
class  GraphViewportPlotController
 Establishes communications and mutual updates for GraphViewportItem and QCutomPlot. More...
 
class  GroupItem
 Group item holds collection of predefined items. More...
 
class  IFactory
 Base for factories. More...
 
class  InsertNewItemCommand
 Command for unddo/redo to insert new item. More...
 
class  IntegerEditor
 Custom editor for QVariant based on integer with possibility to set limits. More...
 
class  ItemBackupStrategy
 Interface to backup items for later restore. More...
 
class  ItemCatalogue
 Catalogue for item constructions. More...
 
class  ItemCopyStrategy
 Interface for deep item copying. More...
 
class  ItemFactory
 Default SessionItem factory. More...
 
class  ItemFactoryInterface
 Interface class for all factories capable of producing SessionItem's. More...
 
class  ItemListener
 Base class to subscribe to signals generated by SessionItem of certin type. More...
 
class  ItemListenerBase
 Provides sets of methods to subscribe to various signals generated by SessionItem. More...
 
class  ItemListenerInterface
 Interface to subscribe to various events happening with specific SessionItem. More...
 
class  ItemManager
 Manages item creation/registration for SessionModel. More...
 
class  ItemMapper
 Provides notifications on various changes for a specific item. More...
 
class  ItemPool
 Provides registration of SessionItem pointers and their unique identifiers in global memory pool. More...
 
class  ItemsTreeView
 Tree view to show items of SessionModel via ViewModel mechanism. More...
 
class  ItemsTreeViewInterface
 Saves and restores list of SessionModel's to/from disk using json format. More...
 
class  JsonDocument
 Saves and restores list of SessionModel's to/from disk using json format. More...
 
class  JsonItemBackupStrategy
 Provide backup of SessionItem using json strategy. More...
 
class  JsonItemContainerConverter
 Converter between SessionItemContainer and JSON object. More...
 
class  JsonItemConverter
 Converter between SessionItem and JSON object. More...
 
class  JsonItemConverterInterface
 Base class for all converters of SessionItem to/from JSON object. More...
 
class  JsonItemCopyStrategy
 Provide SessionItem copying using json based strategy. More...
 
class  JsonItemDataConverter
 Default converter of SessionItemData to/from json object. More...
 
class  JsonItemDataConverterInterface
 Base class for all converters of SessionItemData to/from JSON object. More...
 
class  JsonItemFormatAssistant
 Utility class to determine, whether given JSON object can represent various parts of SessionModel. More...
 
class  JsonItemTagsConverter
 Converter between SessionItemTags and JSON object. More...
 
class  JsonModelConverter
 Converter of SessionModel to/from json object with posibility to select one of convertion modes. More...
 
class  JsonModelConverterInterface
 Base class for all converters of SessionModel to/from json object. More...
 
class  JsonTagInfoConverter
 Default converter between TagInfo and json object. More...
 
class  JsonTagInfoConverterInterface
 Base class for all converters of TagInfo to/from json object. More...
 
class  JsonVariantConverter
 Default converter between supported variants and json objects. More...
 
class  JsonVariantConverterInterface
 Base class for all supported converters of Variant to/from json object. More...
 
class  LabelDataRowStrategy
 Constructs row of QStandardItem's for given SessionItem. More...
 
class  LinkedItem
 Item to store a persistent link to other arbitrary items. More...
 
class  LostFocusFilter
 Event filter to prevent loss of the focus. More...
 
class  ModelDocumentInterface
 Pure virtual interface to save and restore session models to/from disk. More...
 
class  ModelHasChangedController
 Tracks changes in the model. More...
 
class  ModelListener
 Templated class for all objects willing to listen for changes in concrete SessionModel. More...
 
class  ModelListenerBase
 Provides sets of methods to subscribe to various signals generated by SessionModel. More...
 
class  ModelListenerInterface
 Interface to subscribe to various signals generated by SessionModel. More...
 
class  ModelMapper
 Provides notifications on various SessionModel changes. More...
 
class  MouseMoveReporter
 Tracks mouse moves in QCustomPlot canvas. More...
 
struct  MousePosInfo
 Aggregate to hold mouse position info in QCustomPlot context. More...
 
class  MoveItemCommand
 Command for unddo/redo framework to move item from one parent to another. More...
 
class  Path
 Supports navigation through SessionModel. More...
 
class  PenController
 Establishes communication between QCPGraph and PenItem. More...
 
class  PenItem
 Represents basics settings of QPen. More...
 
class  PointwiseAxisItem
 Item to represent pointwise axis. More...
 
class  ProgressHandler
 Maintain information about progress of a computation. More...
 
class  Project
 Project represents content of all application models in a folder on disk. More...
 
class  ProjectChangedController
 Tracks changes in all models. More...
 
struct  ProjectContext
 Provides necessary information for Project construction. More...
 
class  ProjectInterface
 Interface to manipulate projects on disk. More...
 
class  ProjectManager
 Responsible for handling new/save/save-as/close Project logic, where the Project represents a collection of serialized application models in the project directory. More...
 
class  ProjectManagerDecorator
 Decorator for ProjectManager to provide interaction with the user on open/save-as requests. More...
 
class  ProjectManagerInterface
 Interface class for ProjectManager family. More...
 
class  PropertiesRowStrategy
 Constructs row of QStandardItem's for given SessionItem. More...
 
class  PropertyFlatView
 Widget holding grid layout with editors and intended for displaying all properties of given SessionItem. More...
 
class  PropertyFlatViewModel
 View model to show content of SessionModel in Qt widgets. More...
 
class  PropertyFlatViewModelController
 Controller for AbstractViewModel to show item properties. More...
 
class  PropertyItem
 Item to carry concrete editable entity (e.g. More...
 
class  PropertyItemsFlatStrategy
 Strategy to find children of given item: flat alignment. More...
 
class  PropertyItemsStrategy
 Strategy to find children of given item: only property item will be given, all top level items will be filtered out, all inactive children of GroupItem will be filtered out. More...
 
class  PropertyTableViewModel
 View model to show content of SessionModel in Qt widgets: all item properties as a table row. More...
 
class  PropertyTableViewModelController
 Controller for AbstractViewModel to show item properties in table layout. More...
 
class  PropertyTreeView
 Widget holding standard QTreeView and intended for displaying all properties of given SessionItem. More...
 
class  PropertyViewModel
 View model to show content of SessionModel in Qt widgets. More...
 
class  PropertyViewModelController
 Controller for AbstractViewModel to show item properties. More...
 
class  RealLimits
 Limits for double. More...
 
class  RemoveItemCommand
 Command for unddo/redo framework to remove item from a model using child's tag and row. More...
 
class  RoleDependentEditorFactory
 Editor factory for cell editors in Qt trees and tables, relies on EDITORTYPE role stored on board of SessionItem. More...
 
class  RootViewItem
 Represents root item. More...
 
class  RowStrategyInterface
 Base class to construct row of ViewItem's from given SessionItem. More...
 
class  SceneAdapterInterface
 Interface to convert coordinates of "scene" to coordinates of "widget". More...
 
class  ScientificDoubleEditor
 Custom editor for QVariant based on double with scientific notation support. More...
 
class  ScientificSpinBox
 
class  ScientificSpinBoxEditor
 Custom editor for QVariant based on double with scientific notation support. More...
 
class  SelectableComboBoxEditor
 Adds multi-selection capabilities to QComboBox. More...
 
class  SessionItem
 The main object representing an editable/displayable/serializable entity. More...
 
class  SessionItemContainer
 Holds collection of SessionItem objects related to the same tag. More...
 
class  SessionItemData
 Handles data roles for SessionItem. More...
 
class  SessionItemTags
 Collection of SessionItem's containers according to their tags. More...
 
class  SessionModel
 Main class to hold hierarchy of SessionItem objects. More...
 
class  SetValueCommand
 Command for unddo/redo framework to set the data of SessionItem. More...
 
class  Signal
 Callback container for specific client type. More...
 
class  SignalBase
 Container to hold callbacks in the context of ModelMapper. More...
 
class  StatusLabel
 Shows a single line of text on a white background. More...
 
class  StatusStringFormatterInterface
 Pure virtual interface to format string with status info corresponding to the current mouse position on QCustomPlot. More...
 
class  StatusStringReporter
 Reports back status string composed for current mouse position in QCustomPlot. More...
 
class  TagInfo
 Holds info about single tag for SessionItem. More...
 
class  TagRow
 Aggregate to hold (tag, row) information for SessionModel. More...
 
class  TextItem
 Represent text item on plot. More...
 
class  threadsafe_stack
 Thread-safe stack borrowed from Anthony Williams, C++ Concurrency in Action, Second edition. More...
 
class  TopItemsStrategy
 Strategy to find children of given item: only top level items will be given, all property items will be filtered out. More...
 
class  TopItemsTreeView
 Widget holding standard QTreeView and intended for displaying all top level items of SessionModel. More...
 
class  TopItemsViewModel
 View model to show top level items of SessionModel in Qt trees and tables. More...
 
class  TopItemsViewModelController
 Controller for AbstractViewModel to show top level items. More...
 
class  UndoStack
 Default undo stack implementation. More...
 
class  UndoStackInterface
 Interface class for undo/redo stack. More...
 
class  UniqueIdGenerator
 Provides generation of unique SessionItem itentifier. More...
 
struct  UserInteractionContext
 Defines the context to interact with the user regarding save/save-as/create-new project scenarious. More...
 
class  VariantDependentEditorFactory
 Editor factory for cell editors in Qt trees and tables, relies on variant type stored as DATA role on board of SessionItem. More...
 
class  VectorItem
 Vector item with three x,y,z property items. More...
 
class  ViewDataItem
 Represents data role of SessionItem in any cell of Qt's trees and tables. More...
 
class  ViewEmptyItem
 Represents empty cell of tree or table. More...
 
class  ViewItem
 Represents the view of SessionItem's data in a single cell of ViewModel. More...
 
class  ViewLabelItem
 Represents display name of SessionItem in any cell of Qt's trees and tables. More...
 
class  ViewModel
 Main class to represent content of SessionModel in Qt's trees and tables. More...
 
class  ViewModelBase
 Base class for all view models to show content of SessionModel in Qt views. More...
 
class  ViewModelController
 Propagates changes from SessionModel to its ViewModelBase. More...
 
class  ViewModelControllerBuilder
 Builder class for ViewModelController. More...
 
class  ViewModelDelegate
 Model delegate to provide editing/painting for custom variants. More...
 
class  ViewportAxisItem
 Item to represent viewport axis. More...
 
class  ViewportAxisPlotController
 Establishes communication between QCPAxis and ViewportAxisItem. More...
 
class  ViewportItem
 Base class to represent 2D viewport. More...
 
class  WheelEventFilter
 Event filter to install on combo boxes and spin boxes to ignore wheel events during scrolling. More...
 

Typedefs

using CommandResult = std::variant< bool, ModelView::SessionItem * >
 Results of command execution. More...
 
using identifier_type = std::string
 
using item_factory_func_t = std::function< std::unique_ptr< SessionItem >()>
 Definition for item factory funciton. More...
 
using model_type = std::string
 

Enumerations

enum  Appearance { NOFLAGS = 0x000 , ENABLED = 0x001 , EDITABLE = 0x002 }
 
enum class  ConverterMode { none , clone , copy , project }
 Flags to define converter behavior on the way from SessionItem to JSON and back. More...
 
enum class  SaveChangesAnswer { SAVE = 0 , DISCARD = 1 , CANCEL = 2 }
 Possible user answers on question "Project was modified". More...
 

Functions

std::unique_ptr< StatusStringReporterCreateColorMapReporter (QCustomPlot *custom_plot, std::function< void(const std::string &)> callback)
 Creates reporter for status string in QCustomPlot containing QCPColorMap. More...
 
std::unique_ptr< StatusStringReporterCreateGraphReporter (QCustomPlot *custom_plot, std::function< void(const std::string &)> callback)
 Creates reporter for status string in QCustomPlot containing graphs. More...
 
MVVM_MODEL_EXPORT std::unique_ptr< ItemBackupStrategyCreateItemBackupStrategy (const SessionModel *model)
 Creates strategy suitable for item saving/restoring. More...
 
std::unique_ptr< JsonItemConverterInterfaceCreateItemCloneConverter (const ItemFactoryInterface *item_factory)
 Creates JSON item converter intended for item cloning. More...
 
std::unique_ptr< JsonItemConverterInterfaceCreateItemCopyConverter (const ItemFactoryInterface *item_factory)
 Creates JSON item converter intended for item copying. More...
 
MVVM_MODEL_EXPORT std::unique_ptr< ItemCopyStrategyCreateItemCopyStrategy (const SessionModel *model)
 Returns strategy for item copying. More...
 
std::unique_ptr< JsonItemConverterInterfaceCreateItemProjectConverter (const ItemFactoryInterface *item_factory)
 Creates JSON item converter intended for saving on disk. More...
 
std::unique_ptr< ModelDocumentInterfaceCreateJsonDocument (const std::vector< SessionModel * > &models)
 Creates JsonDocument to save and load models. More...
 
MVVM_MODEL_EXPORT std::unique_ptr< JsonModelConverterInterfaceCreateModelCloneConverter ()
 Creates a JSON model converter intended for model cloning. More...
 
MVVM_MODEL_EXPORT std::unique_ptr< JsonModelConverterInterfaceCreateModelCopyConverter ()
 Creates a JSON model converter intended for model copying. More...
 
MVVM_MODEL_EXPORT std::unique_ptr< JsonModelConverterInterfaceCreateModelProjectConverter ()
 Creates a JSON model converter intended for save/load of the project on disk. More...
 
std::unique_ptr< ProjectManagerInterfaceCreateProjectManager (const ProjectContext &project_context, const UserInteractionContext &user_context)
 Creates default ProjectManager to save and load models. More...
 
MVVM_MODEL_EXPORT std::unique_ptr< ItemCatalogueCreateStandardItemCatalogue ()
 Creates a catalog of items supported by SessionModel out-of-the-box. More...
 
bool isRebuildItemDataAndTagFromJson (ConverterMode mode)
 Returns true if item content should be reconstructed from JSON. More...
 
bool isRegenerateIdWhenBackFromJson (ConverterMode mode)
 Returns true if given mode requires ID regeneration instead of using the one stored in JSON. More...
 
template<typename T >
item_factory_func_t ItemFactoryFunction ()
 Creates factory function for item of specific type. More...
 
std::string ProjectVersion ()
 Returns project version string. More...
 
int ProjectVersionMajor ()
 Returns major project version. More...
 
int ProjectVersionMinor ()
 Returns minor project version. More...
 
int ProjectVersionPatch ()
 Returns patch project version. More...
 

Detailed Description

materialitems.h Collection of materials to populate MaterialModel.

Various common utils for unit tests.

Typedef Documentation

◆ CommandResult

using ModelView::CommandResult = typedef std::variant<bool, ModelView::SessionItem*>

Results of command execution.

Definition at line 25 of file commandresult.h.

◆ identifier_type

using ModelView::identifier_type = typedef std::string

Definition at line 22 of file types.h.

◆ item_factory_func_t

using ModelView::item_factory_func_t = typedef std::function<std::unique_ptr<SessionItem>()>

Definition for item factory funciton.

Definition at line 26 of file function_types.h.

◆ model_type

using ModelView::model_type = typedef std::string

Definition at line 23 of file types.h.

Enumeration Type Documentation

◆ Appearance

Enumerator
NOFLAGS 
ENABLED 
EDITABLE 

Definition at line 38 of file mvvm_types.h.

38  {
39  NOFLAGS = 0x000,
40  ENABLED = 0x001, // enabled in Qt widgets; when disabled, will be shown in gray
41  EDITABLE = 0x002 // editable in Qt widgets; readonly otherwise
42 };

◆ ConverterMode

Flags to define converter behavior on the way from SessionItem to JSON and back.

Enumerator
none 

undefined converter mode

clone 

full deep copying with item identifiers preserved

copy 

full deep copying with item identifiers regenerated

project 

selective copying for saving/loading the project (tags and data created by item, updated from JSON)

Definition at line 47 of file jsonitem_types.h.

47  {
48  none, //!< undefined converter mode
49  clone, //!< full deep copying with item identifiers preserved
50  copy, //!< full deep copying with item identifiers regenerated
51  project //!< selective copying for saving/loading the project (tags and data created by item,
52  //!< updated from JSON)
53 };
@ copy
full deep copying with item identifiers regenerated
@ none
undefined converter mode
@ project
selective copying for saving/loading the project (tags and data created by item, updated from JSON)
@ clone
full deep copying with item identifiers preserved

◆ SaveChangesAnswer

Possible user answers on question "Project was modified".

Enumerator
SAVE 
DISCARD 
CANCEL 

Definition at line 28 of file project_types.h.

Function Documentation

◆ CreateColorMapReporter()

MVVM_VIEW_EXPORT std::unique_ptr< StatusStringReporter > ModelView::CreateColorMapReporter ( QCustomPlot *  custom_plot,
std::function< void(const std::string &)>  callback 
)

Creates reporter for status string in QCustomPlot containing QCPColorMap.

Definition at line 30 of file statusstringreporterfactory.cpp.

31 {
32  return std::make_unique<StatusStringReporter>(custom_plot, callback,
33  std::make_unique<ColorMapInfoFormatter>());
34 }

Referenced by ColorMapCanvas::ColorMapCanvasImpl::ColorMapCanvasImpl().

◆ CreateGraphReporter()

MVVM_VIEW_EXPORT std::unique_ptr< StatusStringReporter > ModelView::CreateGraphReporter ( QCustomPlot *  custom_plot,
std::function< void(const std::string &)>  callback 
)

Creates reporter for status string in QCustomPlot containing graphs.

Definition at line 23 of file statusstringreporterfactory.cpp.

24 {
25  return std::make_unique<StatusStringReporter>(custom_plot, callback,
26  std::make_unique<GraphInfoFormatter>());
27 }

Referenced by ModelView::GraphCanvas::GraphCanvasImpl::GraphCanvasImpl().

◆ CreateItemBackupStrategy()

std::unique_ptr< ModelView::ItemBackupStrategy > ModelView::CreateItemBackupStrategy ( const SessionModel model)

Creates strategy suitable for item saving/restoring.

Restored item will have same identifiers as original.

Definition at line 21 of file commandutils.cpp.

22 {
23  assert(model);
24  return std::make_unique<JsonItemBackupStrategy>(model->factory());
25 }

References ModelView::SessionModel::factory().

Referenced by ModelView::CopyItemCommand::CopyItemCommand(), and ModelView::RemoveItemCommand::RemoveItemCommand().

Here is the call graph for this function:

◆ CreateItemCloneConverter()

MVVM_MODEL_EXPORT std::unique_ptr< JsonItemConverterInterface > ModelView::CreateItemCloneConverter ( const ItemFactoryInterface item_factory)

Creates JSON item converter intended for item cloning.

Saves full deep copy of item to JSON. When restoring from JSON, reconstruct everything, including item's unique ID. Used for backup.

Definition at line 26 of file itemconverterfactory.cpp.

27 {
28  ConverterContext context{item_factory, ConverterMode::clone};
29  return std::make_unique<JsonItemConverter>(context);
30 }

References clone.

Referenced by ModelView::JsonItemBackupStrategy::JsonItemBackupStrategy(), and TEST_F().

◆ CreateItemCopyConverter()

MVVM_MODEL_EXPORT std::unique_ptr< JsonItemConverterInterface > ModelView::CreateItemCopyConverter ( const ItemFactoryInterface item_factory)

Creates JSON item converter intended for item copying.

Saves full deep copy of item to JSON. When restoring from JSON, will regenerate item's ID to make it unique. Used for copying of item together with its children.

Definition at line 37 of file itemconverterfactory.cpp.

38 {
39  ConverterContext context{item_factory, ConverterMode::copy};
40  return std::make_unique<JsonItemConverter>(context);
41 }

References copy.

Referenced by ModelView::JsonItemCopyStrategy::JsonItemCopyStrategy(), and TEST_F().

◆ CreateItemCopyStrategy()

std::unique_ptr< ModelView::ItemCopyStrategy > ModelView::CreateItemCopyStrategy ( const SessionModel model)

Returns strategy for item copying.

Identifiers of the copy will be different from identifiers of the original.

Definition at line 28 of file commandutils.cpp.

29 {
30  assert(model);
31  return std::make_unique<JsonItemCopyStrategy>(model->factory());
32 }

References ModelView::SessionModel::factory().

Referenced by ModelView::CopyItemCommand::CopyItemCommand().

Here is the call graph for this function:

◆ CreateItemProjectConverter()

MVVM_MODEL_EXPORT std::unique_ptr< JsonItemConverterInterface > ModelView::CreateItemProjectConverter ( const ItemFactoryInterface item_factory)

Creates JSON item converter intended for saving on disk.

When saving on disk:

  • Only selected data roles of items are saved (i.e. DATA, IDENTIFIER)
  • All tags with its content are saved as usual When loading from disk:
  • Only selected roles are taken from JSON (i.e. DATA, IDENTIFIER), other roles (e.g. TOOLTIPS) are taken from memory.
  • Property tags are updated, universal tags reconstructed.

Definition at line 53 of file itemconverterfactory.cpp.

54 {
55  ConverterContext context{item_factory, ConverterMode::project};
56  return std::make_unique<JsonItemConverter>(context);
57 }

References project.

Referenced by TEST_F().

◆ CreateJsonDocument()

MVVM_MODEL_EXPORT std::unique_ptr< ModelDocumentInterface > ModelView::CreateJsonDocument ( const std::vector< SessionModel * > &  models)

Creates JsonDocument to save and load models.

Definition at line 20 of file modeldocumentfactory.cpp.

21 {
22  return std::make_unique<JsonDocument>(models);
23 }

Referenced by ModelView::Project::ProjectImpl::process().

◆ CreateModelCloneConverter()

std::unique_ptr< ModelView::JsonModelConverterInterface > ModelView::CreateModelCloneConverter ( )

Creates a JSON model converter intended for model cloning.

Saves a full deep copy of model in JSON. When restoring, reconstruct full copy. This will lead to item ID's which are identical to original.

Definition at line 24 of file modelconverterfactory.cpp.

25 {
26  return std::make_unique<JsonModelConverter>(ConverterMode::clone);
27 }

Referenced by ModelView::Utils::CreateClone().

◆ CreateModelCopyConverter()

std::unique_ptr< ModelView::JsonModelConverterInterface > ModelView::CreateModelCopyConverter ( )

Creates a JSON model converter intended for model copying.

Saves a full deep copy of model in JSON. When restoring, reconstruct full copy and regenerate item's ID to make them unique.

Definition at line 33 of file modelconverterfactory.cpp.

34 {
35  return std::make_unique<JsonModelConverter>(ConverterMode::copy);
36 }

Referenced by ModelView::Utils::CreateCopy(), and ModelView::JsonUtils::ModelToJsonString().

◆ CreateModelProjectConverter()

std::unique_ptr< ModelView::JsonModelConverterInterface > ModelView::CreateModelProjectConverter ( )

Creates a JSON model converter intended for save/load of the project on disk.

When saving to disk, only certain data is saved. When loading from disk, items in memory is gently updated from JSON content.

Definition at line 42 of file modelconverterfactory.cpp.

43 {
44  return std::make_unique<JsonModelConverter>(ConverterMode::project);
45 }

Referenced by ModelView::JsonDocument::load(), and ModelView::JsonDocument::save().

◆ CreateProjectManager()

MVVM_MODEL_EXPORT std::unique_ptr< ProjectManagerInterface > ModelView::CreateProjectManager ( const ProjectContext project_context,
const UserInteractionContext user_context 
)

Creates default ProjectManager to save and load models.

Definition at line 21 of file projectmanagerfactory.cpp.

23 {
24  return std::make_unique<ProjectManagerDecorator>(project_context, user_context);
25 }

Referenced by gui2::ProjectHandler::initProjectManager().

◆ CreateStandardItemCatalogue()

std::unique_ptr< ItemCatalogue > ModelView::CreateStandardItemCatalogue ( )

Creates a catalog of items supported by SessionModel out-of-the-box.

Definition at line 20 of file itemcataloguefactory.cpp.

21 {
22  auto result = std::make_unique<ItemCatalogue>();
23  result->registerItem<ColorMapItem>();
24  result->registerItem<ColorMapViewportItem>();
25  result->registerItem<CompoundItem>();
26  result->registerItem<ContainerItem>();
27  result->registerItem<Data1DItem>();
28  result->registerItem<Data2DItem>();
29  result->registerItem<FixedBinAxisItem>();
30  result->registerItem<GraphItem>();
31  result->registerItem<GraphViewportItem>();
32  result->registerItem<LinkedItem>();
33  result->registerItem<PenItem>();
34  result->registerItem<PointwiseAxisItem>();
35  result->registerItem<PropertyItem>();
36  result->registerItem<SessionItem>();
37  result->registerItem<TextItem>();
38  result->registerItem<VectorItem>();
39  result->registerItem<ViewportAxisItem>();
40  return result;
41 }
Two-dimensional color map representation of Data2DItem.
Definition: colormapitem.h:28
Container with viewport and collection of ColorMapItem's to plot.
Complex item holding mixed SessionItem types (single properties and other CompountItems).
Definition: compounditem.h:28
Simple container to store any type of children.
Definition: containeritem.h:25
Represents one-dimensional data (axis and values).
Definition: data1ditem.h:30
Represents two-dimensional data (axes definition and 2d array of values).
Definition: data2ditem.h:29
Item to represent fixed bin axis.
Definition: axisitems.h:75
One-dimensional graph representation of Data1DItem.
Definition: graphitem.h:29
2D viewport specialized for showing multiple GraphItem's.
Item to store a persistent link to other arbitrary items.
Definition: linkeditem.h:30
Represents basics settings of QPen.
Item to represent pointwise axis.
Definition: axisitems.h:94
Item to carry concrete editable entity (e.g.
Definition: propertyitem.h:27
The main object representing an editable/displayable/serializable entity.
Definition: sessionitem.h:38
Represent text item on plot.
Vector item with three x,y,z property items.
Definition: vectoritem.h:24
Item to represent viewport axis.
Definition: axisitems.h:43

Referenced by ModelView::SessionModel::setItemCatalogue(), and TEST_F().

◆ isRebuildItemDataAndTagFromJson()

bool ModelView::isRebuildItemDataAndTagFromJson ( ConverterMode  mode)
inline

Returns true if item content should be reconstructed from JSON.

Definition at line 62 of file jsonitem_types.h.

63 {
64  return mode != ConverterMode::project;
65 }

References project.

Referenced by ModelView::JsonItemConverter::JsonItemConverterImpl::populate_item(), and TEST_F().

◆ isRegenerateIdWhenBackFromJson()

bool ModelView::isRegenerateIdWhenBackFromJson ( ConverterMode  mode)
inline

Returns true if given mode requires ID regeneration instead of using the one stored in JSON.

Definition at line 56 of file jsonitem_types.h.

57 {
58  return mode == ConverterMode::copy;
59 }

References copy.

Referenced by ModelView::JsonItemConverter::JsonItemConverterImpl::populate_item(), and TEST_F().

◆ ItemFactoryFunction()

template<typename T >
item_factory_func_t ModelView::ItemFactoryFunction ( )

Creates factory function for item of specific type.

Definition at line 29 of file function_types.h.

30 {
31  return []() { return std::make_unique<T>(); };
32 }

◆ ProjectVersion()

std::string ModelView::ProjectVersion ( )
inline

Returns project version string.

Definition at line 47 of file version.h.

48 {
49  const std::string project_version = "0.2.0";
50  return project_version;
51 }

◆ ProjectVersionMajor()

int ModelView::ProjectVersionMajor ( )
inline

Returns major project version.

Definition at line 26 of file version.h.

27 {
28  const int project_version_major = 0;
29  return project_version_major;
30 }

◆ ProjectVersionMinor()

int ModelView::ProjectVersionMinor ( )
inline

Returns minor project version.

Definition at line 33 of file version.h.

34 {
35  const int project_version_minor = 2;
36  return project_version_minor;
37 }

◆ ProjectVersionPatch()

int ModelView::ProjectVersionPatch ( )
inline

Returns patch project version.

Definition at line 40 of file version.h.

41 {
42  const int project_version_path = 0;
43  return project_version_path;
44 }