21 """ |
21 """ |
22 QObject.__init__(self, parent) |
22 QObject.__init__(self, parent) |
23 |
23 |
24 self.breakpoints = [] |
24 self.breakpoints = [] |
25 self.header = [ |
25 self.header = [ |
26 QVariant(self.trUtf8("Filename")), |
26 self.trUtf8("Filename"), |
27 QVariant(self.trUtf8("Line")), |
27 self.trUtf8("Line"), |
28 QVariant(self.trUtf8('Condition')), |
28 self.trUtf8('Condition'), |
29 QVariant(self.trUtf8('Temporary')), |
29 self.trUtf8('Temporary'), |
30 QVariant(self.trUtf8('Enabled')), |
30 self.trUtf8('Enabled'), |
31 QVariant(self.trUtf8('Ignore Count')), |
31 self.trUtf8('Ignore Count'), |
32 ] |
32 ] |
33 self.alignments = [QVariant(Qt.Alignment(Qt.AlignLeft)), |
33 self.alignments = [Qt.Alignment(Qt.AlignLeft), |
34 QVariant(Qt.Alignment(Qt.AlignRight)), |
34 Qt.Alignment(Qt.AlignRight), |
35 QVariant(Qt.Alignment(Qt.AlignLeft)), |
35 Qt.Alignment(Qt.AlignLeft), |
36 QVariant(Qt.Alignment(Qt.AlignHCenter)), |
36 Qt.Alignment(Qt.AlignHCenter), |
37 QVariant(Qt.Alignment(Qt.AlignHCenter)), |
37 Qt.Alignment(Qt.AlignHCenter), |
38 QVariant(Qt.Alignment(Qt.AlignRight)), |
38 Qt.Alignment(Qt.AlignRight), |
39 QVariant(Qt.Alignment(Qt.AlignHCenter)), |
39 Qt.Alignment(Qt.AlignHCenter), |
40 ] |
40 ] |
41 |
41 |
42 def columnCount(self, parent = QModelIndex()): |
42 def columnCount(self, parent = QModelIndex()): |
43 """ |
43 """ |
44 Public method to get the current column count. |
44 Public method to get the current column count. |
63 """ |
63 """ |
64 Public method to get the requested data. |
64 Public method to get the requested data. |
65 |
65 |
66 @param index index of the requested data (QModelIndex) |
66 @param index index of the requested data (QModelIndex) |
67 @param role role of the requested data (Qt.ItemDataRole) |
67 @param role role of the requested data (Qt.ItemDataRole) |
68 @return the requested data (QVariant) |
68 @return the requested data |
69 """ |
69 """ |
70 if not index.isValid(): |
70 if not index.isValid(): |
71 return QVariant() |
71 return None |
72 |
72 |
73 if role == Qt.DisplayRole or role == Qt.ToolTipRole: |
73 if role == Qt.DisplayRole or role == Qt.ToolTipRole: |
74 if index.column() < len(self.header): |
74 if index.column() < len(self.header): |
75 return QVariant(self.breakpoints[index.row()][index.column()]) |
75 return self.breakpoints[index.row()][index.column()] |
76 |
76 |
77 if role == Qt.TextAlignmentRole: |
77 if role == Qt.TextAlignmentRole: |
78 if index.column() < len(self.alignments): |
78 if index.column() < len(self.alignments): |
79 return self.alignments[index.column()] |
79 return self.alignments[index.column()] |
80 |
80 |
81 return QVariant() |
81 return None |
82 |
82 |
83 def flags(self, index): |
83 def flags(self, index): |
84 """ |
84 """ |
85 Public method to get item flags. |
85 Public method to get item flags. |
86 |
86 |
97 Public method to get header data. |
97 Public method to get header data. |
98 |
98 |
99 @param section section number of the requested header data (integer) |
99 @param section section number of the requested header data (integer) |
100 @param orientation orientation of the header (Qt.Orientation) |
100 @param orientation orientation of the header (Qt.Orientation) |
101 @param role role of the requested data (Qt.ItemDataRole) |
101 @param role role of the requested data (Qt.ItemDataRole) |
102 @return header data (QVariant) |
102 @return header data |
103 """ |
103 """ |
104 if orientation == Qt.Horizontal and role == Qt.DisplayRole: |
104 if orientation == Qt.Horizontal and role == Qt.DisplayRole: |
105 if section >= len(self.header): |
105 if section >= len(self.header): |
106 return QVariant("") |
106 return "" |
107 else: |
107 else: |
108 return self.header[section] |
108 return self.header[section] |
109 |
109 |
110 return QVariant() |
110 return None |
111 |
111 |
112 def index(self, row, column, parent = QModelIndex()): |
112 def index(self, row, column, parent = QModelIndex()): |
113 """ |
113 """ |
114 Public method to create an index. |
114 Public method to create an index. |
115 |
115 |