Исправлен вывод элемена ComboBox + выбор файла

master-3.5
parent 336db0386f
commit 830c3f1b8f

@ -537,11 +537,11 @@ class FileOpenWgt(qt.QWidget):
def setText(self, text):
return self.lineEdit.setText(text)
class ComboFileWgt(qt.QWidget):
class ComboFileWgt(qt.QLabel):
# textChanged = qt.Signal()
def __init__(self, parent, type, choice = None, caption=None, \
value=None, comments = None):
qt.QWidget.__init__(self,parent)
qt.QLabel.__init__(self,parent)
self.type = type
self.caption = caption
self.value = value
@ -560,24 +560,15 @@ class ComboFileWgt(qt.QWidget):
if self.comments:
self.comments.append(value)
self.hlayout = qt.QHBoxLayout(self)
self.ComboBox = qt.QComboBox(self)
self.ComboBox.setDuplicatesEnabled(False)
self.layout = qt.QHBoxLayout(self)
self.layout.setContentsMargins(0,0,0,0)
self.ComboBox = qt.QComboBox()
self.setContentsMargins(0,0,0,0)
self.ComboBox.currentIndexChanged.connect(self.setCursorPos)
self.ComboBox.setEditable(True)
self.lineEdit = self.ComboBox.lineEdit()
#self.lineEdit = qt.QLineEdit(self)
#self.ComboBox.setLineEdit(self.lineEdit)
#self.lineEdit.setStyleSheet('QLineEdit {background:white;margin: 1px;}')
self.ComboBox.currentIndexChanged.connect(self.setCursorPos)
# self.lineEdit.setStyleSheet("QLineEdit {border: none;}")
self.ComboWidget = qt.QLabel(self)
self.ComboWidget.setContentsMargins(0,0,0,0)
ComboLayout = qt.QVBoxLayout(self.ComboWidget)
ComboLayout.setContentsMargins(0,0,0,0)
ComboLayout.addWidget(self.ComboBox)
self.unsetErrorBorder()
self.setFixedHeight(self.ComboBox.sizeHint().height()+2)
self.layout.addWidget(self.ComboBox)
self.view_value = []
if choice:
@ -610,12 +601,10 @@ class ComboFileWgt(qt.QWidget):
self.button.setIcon(icon)
else:
self.button.setText(_('Open'))
# self.button.setStyleSheet("QToolButton {border: none;}")
self.button.clicked.connect(self.file_dialog)
self.hlayout.addWidget(self.ComboWidget)
self.hlayout.addWidget(self.button)
self.hlayout.setSpacing(0)
self.layout.addWidget(self.button)
self.unsetErrorBorder()
def setCursorPos(self, num = None):
self.lineEdit.setCursorPosition(0)
@ -662,12 +651,12 @@ class ComboFileWgt(qt.QWidget):
self.ComboBox.setCurrentIndex(self.ComboBox.count()-1)
def setErrorBorder(self):
style = ".QLabel {border: 1px solid red; margin: 0px;}"
self.ComboWidget.setStyleSheet(style)
style = ".ComboFileWgt {border: 1px solid red; margin: 0px;}"
self.setStyleSheet(style)
def unsetErrorBorder(self):
style = "QLabel {border: 1px solid transparent; margin: 0px;}"
self.ComboWidget.setStyleSheet(style)
style = ".ComboFileWgt {border: 1px solid transparent; margin: 0px;}"
self.setStyleSheet(style)
class ReadonlyCheckBox(qt.QCheckBox):
def __init__(self, parent):

Loading…
Cancel
Save