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