--- a/src/eric7/EricWidgets/EricModelMenu.py Tue Dec 19 11:04:03 2023 +0100 +++ b/src/eric7/EricWidgets/EricModelMenu.py Tue Dec 19 19:57:08 2023 +0100 @@ -27,7 +27,8 @@ """ Constructor - @param parent reference to the parent widget (QWidget) + @param parent reference to the parent widget + @type QWidget """ super().__init__(parent) @@ -67,6 +68,7 @@ Public method to add any actions before the tree. @return flag indicating if any actions were added + @rtype bool """ return False @@ -80,7 +82,8 @@ """ Public method to set the model for the menu. - @param model reference to the model (QAbstractItemModel) + @param model reference to the model + @type QAbstractItemModel """ self.__model = model @@ -88,7 +91,8 @@ """ Public method to get a reference to the model. - @return reference to the model (QAbstractItemModel) + @return reference to the model + @rtype QAbstractItemModel """ return self.__model @@ -96,7 +100,8 @@ """ Public method to set the maximum number of entries to show. - @param rows maximum number of entries to show (integer) + @param rows maximum number of entries to show + @type int """ self.__maxRows = rows @@ -104,7 +109,8 @@ """ Public method to get the maximum number of entries to show. - @return maximum number of entries to show (integer) + @return maximum number of entries to show + @rtype int """ return self.__maxRows @@ -112,7 +118,8 @@ """ Public method to set the first separator. - @param offset row number of the first separator (integer) + @param offset row number of the first separator + @type int """ self.__firstSeparator = offset @@ -120,7 +127,8 @@ """ Public method to get the first separator. - @return row number of the first separator (integer) + @return row number of the first separator + @rtype int """ return self.__firstSeparator @@ -128,7 +136,8 @@ """ Public method to set the index of the root item. - @param index index of the root item (QModelIndex) + @param index index of the root item + @type QModelIndex """ self.__root = index @@ -136,7 +145,8 @@ """ Public method to get the index of the root item. - @return index of the root item (QModelIndex) + @return index of the root item + @rtype QModelIndex """ return self.__root @@ -144,7 +154,8 @@ """ Public method to set the role of the status bar text. - @param role role of the status bar text (integer) + @param role role of the status bar text + @type int """ self.__statusBarTextRole = role @@ -152,7 +163,8 @@ """ Public method to get the role of the status bar text. - @return role of the status bar text (integer) + @return role of the status bar text + @rtype int """ return self.__statusBarTextRole @@ -160,7 +172,8 @@ """ Public method to set the role of the separator. - @param role role of the separator (integer) + @param role role of the separator + @type int """ self.__separatorRole = role @@ -168,7 +181,8 @@ """ Public method to get the role of the separator. - @return role of the separator (integer) + @return role of the separator + @rtype int """ return self.__separatorRole @@ -190,7 +204,8 @@ """ Public method to get the menu that is used to populate sub menu's. - @return reference to the menu (EricModelMenu) + @return reference to the menu + @rtype EricModelMenu """ return EricModelMenu(self) @@ -199,10 +214,14 @@ Public method to put all the children of a parent into a menu of a given length. - @param parent index of the parent item (QModelIndex) - @param max_ maximum number of entries (integer) - @param parentMenu reference to the parent menu (QMenu) - @param menu reference to the menu to be populated (QMenu) + @param parent index of the parent item + @type QModelIndex + @param max_ maximum number of entries + @type int + @param parentMenu reference to the parent menu + @type QMenu + @param menu reference to the menu to be populated + @type QMenu """ if menu is None: v = parent @@ -247,8 +266,10 @@ """ Private method to create an action. - @param idx index of the item to create an action for (QModelIndex) - @return reference to the created action (QAction) + @param idx index of the item to create an action for + @type QModelIndex + @return reference to the created action + @rtype QAction """ icon = idx.data(Qt.ItemDataRole.DecorationRole) if icon == NotImplemented or icon is None: @@ -265,10 +286,14 @@ """ Public method to create an action. - @param icon icon of the action (QIcon) - @param text text of the action (string) - @param parent reference to the parent object (QObject) - @return reference to the created action (QAction) + @param icon icon of the action + @type QIcon + @param text text of the action + @type str + @param parent reference to the parent object + @type QObject + @return reference to the created action + @rtype QAction """ fm = QFontMetrics(self.font()) if self.__maxWidth == -1: @@ -281,7 +306,8 @@ """ Private slot to handle the triggering of an action. - @param action reference to the action that was triggered (QAction) + @param action reference to the action that was triggered + @type QAction """ idx = self.index(action) if idx.isValid(): @@ -292,8 +318,10 @@ """ Public method to get the index of an action. - @param action reference to the action to get the index for (QAction) - @return index of the action (QModelIndex) + @param action reference to the action to get the index for + @type QAction + @return index of the action + @rtype QModelIndex """ if action is None: return QModelIndex() @@ -311,7 +339,8 @@ """ Protected method to handle drag enter events. - @param evt reference to the event (QDragEnterEvent) + @param evt reference to the event + @type QDragEnterEvent """ if self.__model is not None: mimeTypes = self.__model.mimeTypes() @@ -325,7 +354,8 @@ """ Protected method to handle drop events. - @param evt reference to the event (QDropEvent) + @param evt reference to the event + @type QDropEvent """ if self.__model is not None: act = self.actionAt(evt.position().toPoint()) @@ -357,7 +387,8 @@ """ Protected method handling mouse press events. - @param evt reference to the event object (QMouseEvent) + @param evt reference to the event object + @type QMouseEvent """ if evt.button() == Qt.MouseButton.LeftButton: self.__dragStartPosition = evt.position().toPoint() @@ -367,7 +398,8 @@ """ Protected method to handle mouse move events. - @param evt reference to the event (QMouseEvent) + @param evt reference to the event + @type QMouseEvent """ if self.__model is None: super().mouseMoveEvent(evt) @@ -418,7 +450,8 @@ """ Protected method handling mouse release events. - @param evt reference to the event object (QMouseEvent) + @param evt reference to the event object + @type QMouseEvent """ self._mouseButton = evt.button() self._keyboardModifiers = evt.modifiers() @@ -439,7 +472,8 @@ """ Public method to remove a menu entry. - @param idx index of the entry to be removed (QModelIndex) + @param idx index of the entry to be removed + @type QModelIndex """ row = idx.row() self.__model.removeRow(row, self.__root)