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