OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
VersionGraph.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
11
12namespace ot {
13
14 class VersionGraphItem;
15
17 Q_OBJECT
18 public:
20 NoConfigFlags = 0 << 0,
21 IgnoreActivateRequestOnReadOnly = 1 << 0,
22 IgnoreSelectionHandlingOnReadOnly = 1 << 1
23 };
25
27 virtual ~VersionGraph();
28
29 void setupFromConfig(const VersionGraphCfg& _config);
30
31 void clear(void);
32
33 bool isCurrentVersionEndOfBranch(void) const;
34 bool isVersionIsEndOfBranch(const std::string& _versionName) const;
35
36 void setVersionGraphConfig(VersionGraphConfig _config, bool _active = true) { m_configFlags.setFlag(_config, _active); };
37 void setVersionGraphConfigFlags(const VersionGraphConfigFlags& _flags) { m_configFlags = _flags; };
38 const VersionGraphConfigFlags& getVersionGraphConfigFlags(void) const { return m_configFlags; };
39
40 Q_SIGNALS:
41 void versionDeselected(void);
42 void versionSelected(const std::string& _versionName);
43 void versionActivateRequest(const std::string& _versionName);
44
45 public Q_SLOTS:
46 void slotSelectionChanged(void);
47 void slotCenterOnActiveVersion(void);
48 void slotGraphicsItemDoubleClicked(const ot::GraphicsItem* _item);
49
50 protected:
51 virtual void showEvent(QShowEvent* _event) override;
52 virtual void paintEvent(QPaintEvent* _event) override;
53
54 private:
55 void updateVersionPositions(void);
56 QRectF calculateFittedViewportRect(void) const;
57 VersionGraphItem* getVersion(const std::string& _name) const;
58 void highlightVersion(const std::string& _name);
59
60 bool m_updateItemPositionRequired;
61 QRectF m_lastViewportRect;
62 std::string m_activeVersion;
63 std::string m_activeVersionBranch;
64 VersionGraphItem* m_rootItem;
65 VersionGraphConfigFlags m_configFlags;
66 };
67
68}
69
#define OT_ADD_FLAG_FUNCTIONS(___enumName)
Will add the default bitwise operations for the provided 32 bit bitfield. Use this at the bottom of t...
Definition Flags.h:60
#define OT_WIDGETS_API_EXPORT
Definition OTWidgetsAPIExport.h:12
This class is used to manage flags. Don't forget to add OT_ADD_FLAG_FUNCTIONS and the bottom of your ...
Definition Flags.h:91
Base class for all OpenTwin GraphicsItems GraphicsItems should be created by the GraphicsFactory and ...
Definition GraphicsItem.h:35
View widget used to display GraphicsItems Note that the View creates its own scene.
Definition GraphicsView.h:36
Definition VersionGraphCfg.h:13
Definition VersionGraph.h:16
VersionGraphConfig
Definition VersionGraph.h:19
void setVersionGraphConfig(VersionGraphConfig _config, bool _active=true)
Definition VersionGraph.h:36
const VersionGraphConfigFlags & getVersionGraphConfigFlags(void) const
Definition VersionGraph.h:38
void setVersionGraphConfigFlags(const VersionGraphConfigFlags &_flags)
Definition VersionGraph.h:37
Flags< VersionGraphConfig > VersionGraphConfigFlags
Definition VersionGraph.h:24
Definition VersionGraphItem.h:19
Definition Connector.h:8