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