Isis 3 Programmer Reference
TableColumn.cpp
1 
7 /* SPDX-License-Identifier: CC0-1.0 */
8 
9 #include "TableColumn.h"
10 
11 #include <algorithm>
12 #include <iostream>
13 
14 #include <QString>
15 
16 
17 using std::swap;
18 
19 
20 namespace Isis {
21  TableColumn::TableColumn(QString text, bool m_readOnlyStatus,
22  bool affectsNetStructure) {
23  nullify();
24 
25  m_title = new QString(text);
26  m_visible = true;
27  m_readOnly = m_readOnlyStatus;
28  m_affectsNetworkStructure = affectsNetStructure;
29  m_ascendingSortOrder = true;
30  }
31 
32 
33  TableColumn::TableColumn(const TableColumn &other) {
34  nullify();
35 
36  m_title = new QString(*other.m_title);
37  m_visible = other.m_visible;
38  m_readOnly = other.m_readOnly;
39  m_width = other.m_width;
40  }
41 
42 
43  TableColumn::~TableColumn() {
44  delete m_title;
45  m_title = NULL;
46  }
47 
48 
49  QString TableColumn::getTitle() const {
50  return *m_title;
51  }
52 
53 
54  void TableColumn::setTitle(QString text) {
55  *m_title = text;
56  }
57 
58 
59  TableColumn &TableColumn::operator=(TableColumn other) {
60  swap(*m_title, *other.m_title);
61  swap(m_visible, other.m_visible);
62  swap(m_readOnly, other.m_readOnly);
63  swap(m_width, other.m_width);
64 
65  return *this;
66  }
67 
68 
69  bool TableColumn::isVisible() const {
70  return m_visible;
71  }
72 
73 
74  void TableColumn::setVisible(bool visibility) {
75  m_visible = visibility;
76  emit visibilityChanged();
77  }
78 
79 
80  int TableColumn::getWidth() const {
81  return m_width;
82  }
83 
84 
85  void TableColumn::setWidth(int newWidth) {
86  m_width = newWidth;
87  emit widthChanged();
88  }
89 
90 
91  bool TableColumn::isReadOnly() const {
92  return m_readOnly;
93  }
94 
95 
96  bool TableColumn::hasNetworkStructureEffect() const {
97  return m_affectsNetworkStructure;
98  }
99 
100 
101  bool TableColumn::sortAscending() const {
102  return m_ascendingSortOrder;
103  }
104 
105 
106  void TableColumn::setSortAscending(bool ascending) {
107  m_ascendingSortOrder = ascending;
108  emit sortOutDated();
109  }
110 
111 
112  void TableColumn::nullify() {
113  m_title = NULL;
114  }
115 }
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16