src/eric7/WebBrowser/ZoomManager/ZoomValuesModel.py

branch
eric7
changeset 10436
f6881d10e995
parent 10069
435cc5875135
child 10439
21c28b0f9e41
equal deleted inserted replaced
10435:c712d09cc839 10436:f6881d10e995
19 19
20 def __init__(self, manager, parent=None): 20 def __init__(self, manager, parent=None):
21 """ 21 """
22 Constructor 22 Constructor
23 23
24 @param manager reference to the zoom values manager (ZoomManager) 24 @param manager reference to the zoom values manager
25 @param parent reference to the parent object (QObject) 25 @type ZoomManager
26 @param parent reference to the parent object
27 @type QObject
26 """ 28 """
27 super().__init__(parent) 29 super().__init__(parent)
28 30
29 self.__manager = manager 31 self.__manager = manager
30 manager.changed.connect(self.__zoomValuesChanged) 32 manager.changed.connect(self.__zoomValuesChanged)
43 45
44 def removeRows(self, row, count, parent=None): 46 def removeRows(self, row, count, parent=None):
45 """ 47 """
46 Public method to remove entries from the model. 48 Public method to remove entries from the model.
47 49
48 @param row start row (integer) 50 @param row start row
49 @param count number of rows to remove (integer) 51 @type int
50 @param parent parent index (QModelIndex) 52 @param count number of rows to remove
51 @return flag indicating success (boolean) 53 @type int
54 @param parent parent index
55 @type QModelIndex
56 @return flag indicating success
57 @rtype bool
52 """ 58 """
53 if parent is None: 59 if parent is None:
54 parent = QModelIndex() 60 parent = QModelIndex()
55 61
56 if parent.isValid(): 62 if parent.isValid():
71 77
72 def rowCount(self, parent=None): 78 def rowCount(self, parent=None):
73 """ 79 """
74 Public method to get the number of rows of the model. 80 Public method to get the number of rows of the model.
75 81
76 @param parent parent index (QModelIndex) 82 @param parent parent index
77 @return number of rows (integer) 83 @type QModelIndex
84 @return number of rows
85 @rtype int
78 """ 86 """
79 if parent is None: 87 if parent is None:
80 parent = QModelIndex() 88 parent = QModelIndex()
81 89
82 if parent.isValid(): 90 if parent.isValid():
86 94
87 def columnCount(self, parent=None): # noqa: U100 95 def columnCount(self, parent=None): # noqa: U100
88 """ 96 """
89 Public method to get the number of columns of the model. 97 Public method to get the number of columns of the model.
90 98
91 @param parent parent index (QModelIndex) (Unused) 99 @param parent parent index (Unused)
92 @return number of columns (integer) 100 @type QModelIndex
101 @return number of columns
102 @rtype int
93 """ 103 """
94 return len(self.__headers) 104 return len(self.__headers)
95 105
96 def data(self, index, role): 106 def data(self, index, role):
97 """ 107 """
98 Public method to get data from the model. 108 Public method to get data from the model.
99 109
100 @param index index to get data for (QModelIndex) 110 @param index index to get data for
101 @param role role of the data to retrieve (integer) 111 @type QModelIndex
112 @param role role of the data to retrieve
113 @type int
102 @return requested data 114 @return requested data
115 @rtype Any
103 """ 116 """
104 if index.row() >= self.__manager.sitesCount() or index.row() < 0: 117 if index.row() >= self.__manager.sitesCount() or index.row() < 0:
105 return None 118 return None
106 119
107 site = self.__manager.allSiteNames()[index.row()] 120 site = self.__manager.allSiteNames()[index.row()]
120 133
121 def headerData(self, section, orientation, role=Qt.ItemDataRole.DisplayRole): 134 def headerData(self, section, orientation, role=Qt.ItemDataRole.DisplayRole):
122 """ 135 """
123 Public method to get the header data. 136 Public method to get the header data.
124 137
125 @param section section number (integer) 138 @param section section number
126 @param orientation header orientation (Qt.Orientation) 139 @type int
127 @param role data role (Qt.ItemDataRole) 140 @param orientation header orientation
141 @type Qt.Orientation
142 @param role data role
143 @type Qt.ItemDataRole
128 @return header data 144 @return header data
145 @rtype Any
129 """ 146 """
130 if ( 147 if (
131 orientation == Qt.Orientation.Horizontal 148 orientation == Qt.Orientation.Horizontal
132 and role == Qt.ItemDataRole.DisplayRole 149 and role == Qt.ItemDataRole.DisplayRole
133 ): 150 ):

eric ide

mercurial