src/eric7/EricWidgets/EricToolBox.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9473
3f23dbf37dbe
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
15 class EricVerticalToolBox(QToolBox): 15 class EricVerticalToolBox(QToolBox):
16 """ 16 """
17 Class implementing a ToolBox class substituting QToolBox to support wheel 17 Class implementing a ToolBox class substituting QToolBox to support wheel
18 events. 18 events.
19 """ 19 """
20
20 def __init__(self, parent=None): 21 def __init__(self, parent=None):
21 """ 22 """
22 Constructor 23 Constructor
23 24
24 @param parent reference to the parent widget (QWidget) 25 @param parent reference to the parent widget (QWidget)
25 """ 26 """
26 super().__init__(parent) 27 super().__init__(parent)
27 28
28 29
29 class EricHorizontalToolBox(EricTabWidget): 30 class EricHorizontalToolBox(EricTabWidget):
30 """ 31 """
31 Class implementing a vertical QToolBox like widget. 32 Class implementing a vertical QToolBox like widget.
32 """ 33 """
34
33 def __init__(self, parent=None): 35 def __init__(self, parent=None):
34 """ 36 """
35 Constructor 37 Constructor
36 38
37 @param parent reference to the parent widget (QWidget) 39 @param parent reference to the parent widget (QWidget)
38 """ 40 """
39 EricTabWidget.__init__(self, parent) 41 EricTabWidget.__init__(self, parent)
40 self.setTabPosition(QTabWidget.TabPosition.West) 42 self.setTabPosition(QTabWidget.TabPosition.West)
41 self.setUsesScrollButtons(True) 43 self.setUsesScrollButtons(True)
42 44
43 def addItem(self, widget, icon, text): 45 def addItem(self, widget, icon, text):
44 """ 46 """
45 Public method to add a widget to the toolbox. 47 Public method to add a widget to the toolbox.
46 48
47 @param widget reference to the widget to be added (QWidget) 49 @param widget reference to the widget to be added (QWidget)
48 @param icon the icon to be shown (QIcon) 50 @param icon the icon to be shown (QIcon)
49 @param text the text to be shown (string) 51 @param text the text to be shown (string)
50 @return index of the added widget (integer) 52 @return index of the added widget (integer)
51 """ 53 """
52 index = self.addTab(widget, icon, "") 54 index = self.addTab(widget, icon, "")
53 self.setTabToolTip(index, text) 55 self.setTabToolTip(index, text)
54 return index 56 return index
55 57
56 def insertItem(self, index, widget, icon, text): 58 def insertItem(self, index, widget, icon, text):
57 """ 59 """
58 Public method to add a widget to the toolbox. 60 Public method to add a widget to the toolbox.
59 61
60 @param index position at which the widget should be inserted (integer) 62 @param index position at which the widget should be inserted (integer)
61 @param widget reference to the widget to be added (QWidget) 63 @param widget reference to the widget to be added (QWidget)
62 @param icon the icon to be shown (QIcon) 64 @param icon the icon to be shown (QIcon)
63 @param text the text to be shown (string) 65 @param text the text to be shown (string)
64 @return index of the added widget (integer) 66 @return index of the added widget (integer)
65 """ 67 """
66 index = self.insertTab(index, widget, icon, "") 68 index = self.insertTab(index, widget, icon, "")
67 self.setTabToolTip(index, text) 69 self.setTabToolTip(index, text)
68 return index 70 return index
69 71
70 def removeItem(self, index): 72 def removeItem(self, index):
71 """ 73 """
72 Public method to remove a widget from the toolbox. 74 Public method to remove a widget from the toolbox.
73 75
74 @param index index of the widget to remove (integer) 76 @param index index of the widget to remove (integer)
75 """ 77 """
76 self.removeTab(index) 78 self.removeTab(index)
77 79
78 def setItemToolTip(self, index, toolTip): 80 def setItemToolTip(self, index, toolTip):
79 """ 81 """
80 Public method to set the tooltip of an item. 82 Public method to set the tooltip of an item.
81 83
82 @param index index of the item (integer) 84 @param index index of the item (integer)
83 @param toolTip tooltip text to be set (string) 85 @param toolTip tooltip text to be set (string)
84 """ 86 """
85 self.setTabToolTip(index, toolTip) 87 self.setTabToolTip(index, toolTip)
86 88
87 def setItemEnabled(self, index, enabled): 89 def setItemEnabled(self, index, enabled):
88 """ 90 """
89 Public method to set the enabled state of an item. 91 Public method to set the enabled state of an item.
90 92
91 @param index index of the item (integer) 93 @param index index of the item (integer)
92 @param enabled flag indicating the enabled state (boolean) 94 @param enabled flag indicating the enabled state (boolean)
93 """ 95 """
94 self.setTabEnabled(index, enabled) 96 self.setTabEnabled(index, enabled)

eric ide

mercurial