50 |
51 |
51 def __init__(self, parent=None): |
52 def __init__(self, parent=None): |
52 """ |
53 """ |
53 Constructor |
54 Constructor |
54 |
55 |
55 @param parent reference to the parent widget (QWidget) |
56 @param parent reference to the parent widget |
|
57 @type QWidget |
56 """ |
58 """ |
57 EricTabWidget.__init__(self, parent) |
59 EricTabWidget.__init__(self, parent) |
58 self.setTabPosition(QTabWidget.TabPosition.West) |
60 self.setTabPosition(QTabWidget.TabPosition.West) |
59 self.setUsesScrollButtons(True) |
61 self.setUsesScrollButtons(True) |
60 |
62 |
61 def addItem(self, widget, icon, text): |
63 def addItem(self, widget, icon, text): |
62 """ |
64 """ |
63 Public method to add a widget to the toolbox. |
65 Public method to add a widget to the toolbox. |
64 |
66 |
65 @param widget reference to the widget to be added (QWidget) |
67 @param widget reference to the widget to be added |
66 @param icon the icon to be shown (QIcon) |
68 @type QWidget |
67 @param text the text to be shown (string) |
69 @param icon the icon to be shown |
68 @return index of the added widget (integer) |
70 @type QIcon |
|
71 @param text the text to be shown |
|
72 @type str |
|
73 @return index of the added widget |
|
74 @rtype int |
69 """ |
75 """ |
70 index = self.addTab(widget, icon, "") |
76 index = self.addTab(widget, icon, "") |
71 self.setTabToolTip(index, text) |
77 self.setTabToolTip(index, text) |
72 return index |
78 return index |
73 |
79 |
74 def insertItem(self, index, widget, icon, text): |
80 def insertItem(self, index, widget, icon, text): |
75 """ |
81 """ |
76 Public method to add a widget to the toolbox. |
82 Public method to add a widget to the toolbox. |
77 |
83 |
78 @param index position at which the widget should be inserted (integer) |
84 @param index position at which the widget should be inserted |
79 @param widget reference to the widget to be added (QWidget) |
85 @type int |
80 @param icon the icon to be shown (QIcon) |
86 @param widget reference to the widget to be added |
81 @param text the text to be shown (string) |
87 @type QWidget |
82 @return index of the added widget (integer) |
88 @param icon the icon to be shown |
|
89 @type QIcon |
|
90 @param text the text to be shown |
|
91 @type str |
|
92 @return index of the added widget |
|
93 @rtype int |
83 """ |
94 """ |
84 index = self.insertTab(index, widget, icon, "") |
95 index = self.insertTab(index, widget, icon, "") |
85 self.setTabToolTip(index, text) |
96 self.setTabToolTip(index, text) |
86 return index |
97 return index |
87 |
98 |
88 def removeItem(self, index): |
99 def removeItem(self, index): |
89 """ |
100 """ |
90 Public method to remove a widget from the toolbox. |
101 Public method to remove a widget from the toolbox. |
91 |
102 |
92 @param index index of the widget to remove (integer) |
103 @param index index of the widget to remove |
|
104 @type int |
93 """ |
105 """ |
94 self.removeTab(index) |
106 self.removeTab(index) |
95 |
107 |
96 def setItemToolTip(self, index, toolTip): |
108 def setItemToolTip(self, index, toolTip): |
97 """ |
109 """ |
98 Public method to set the tooltip of an item. |
110 Public method to set the tooltip of an item. |
99 |
111 |
100 @param index index of the item (integer) |
112 @param index index of the item |
101 @param toolTip tooltip text to be set (string) |
113 @type int |
|
114 @param toolTip tooltip text to be set |
|
115 @type str |
102 """ |
116 """ |
103 self.setTabToolTip(index, toolTip) |
117 self.setTabToolTip(index, toolTip) |
104 |
118 |
105 def setItemEnabled(self, index, enabled): |
119 def setItemEnabled(self, index, enabled): |
106 """ |
120 """ |
107 Public method to set the enabled state of an item. |
121 Public method to set the enabled state of an item. |
108 |
122 |
109 @param index index of the item (integer) |
123 @param index index of the item |
110 @param enabled flag indicating the enabled state (boolean) |
124 @type int |
|
125 @param enabled flag indicating the enabled state |
|
126 @type bool |
111 """ |
127 """ |
112 self.setTabEnabled(index, enabled) |
128 self.setTabEnabled(index, enabled) |
113 |
129 |
114 def setCurrentWidget(self, widget): |
130 def setCurrentWidget(self, widget): |
115 """ |
131 """ |
116 Public slot to set the current widget. |
132 Public slot to set the current widget. |
117 |
133 |
118 @param widget reference to the widget to become the current widget |
134 @param widget reference to the widget to become the current widget |
119 (QWidget) |
135 @type QWidget |
120 """ |
136 """ |
121 try: |
137 try: |
122 index = self.indexOf(widget) |
138 index = self.indexOf(widget) |
123 if index < 0: |
139 if index < 0: |
124 # not found, set first widget as default |
140 # not found, set first widget as default |