|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2012 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing combobox classes using the eric5 line edits. |
|
8 """ |
|
9 |
|
10 from PyQt4.QtGui import QComboBox |
|
11 |
|
12 from .E5LineEdit import E5LineEdit, E5ClearableLineEdit |
|
13 |
|
14 |
|
15 class E5ComboBox(QComboBox): |
|
16 """ |
|
17 Class implementing a combobox using the eric5 line edit. |
|
18 """ |
|
19 def __init__(self, parent=None, inactiveText=""): |
|
20 """ |
|
21 Constructor |
|
22 |
|
23 @param parent reference to the parent widget (QWidget) |
|
24 @param inactiveText text to be shown on inactivity (string) |
|
25 """ |
|
26 super().__init__(parent) |
|
27 |
|
28 self.setMinimumHeight(24) |
|
29 |
|
30 self.__lineedit = E5LineEdit(self, inactiveText) |
|
31 self.setLineEdit(self.__lineedit) |
|
32 |
|
33 self.setMinimumHeight(self.__lineedit.minimumHeight() + 3) |
|
34 |
|
35 def inactiveText(self): |
|
36 """ |
|
37 Public method to get the inactive text. |
|
38 |
|
39 return inactive text (string) |
|
40 """ |
|
41 return self.__lineedit.inactiveText() |
|
42 |
|
43 def setInactiveText(self, inactiveText): |
|
44 """ |
|
45 Public method to set the inactive text. |
|
46 |
|
47 @param inactiveText text to be shown on inactivity (string) |
|
48 """ |
|
49 self.__lineedit.setInactiveText() |
|
50 |
|
51 |
|
52 class E5ClearableComboBox(E5ComboBox): |
|
53 """ |
|
54 Class implementing a combobox using the eric5 line edit. |
|
55 """ |
|
56 def __init__(self, parent=None, inactiveText=""): |
|
57 """ |
|
58 Constructor |
|
59 |
|
60 @param parent reference to the parent widget (QWidget) |
|
61 @param inactiveText text to be shown on inactivity (string) |
|
62 """ |
|
63 super().__init__(parent, inactiveText) |
|
64 |
|
65 self.__lineedit = E5ClearableLineEdit(self, inactiveText) |
|
66 self.setLineEdit(self.__lineedit) |