本文整理匯總了Python中PyQt5.QtWidgets.QLineEdit.setFrame方法的典型用法代碼示例。如果您正苦於以下問題:Python QLineEdit.setFrame方法的具體用法?Python QLineEdit.setFrame怎麽用?Python QLineEdit.setFrame使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtWidgets.QLineEdit
的用法示例。
在下文中一共展示了QLineEdit.setFrame方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: createEditor
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setFrame [as 別名]
def createEditor(self, parent, option, index):
editor = QLineEdit(parent)
if self.max_length > 0:
editor.setMaxLength(self.max_length)
if self.validator is not None:
editor.setValidator(self.validator)
editor.setFrame(False)
return editor
示例2: createEditor
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setFrame [as 別名]
def createEditor(self, parent, option, index):
self.updateRects(option, index)
bgColor = self.bgColors.get(index, "white")
if self.mainLineRect.contains(self.lastPos):
# One line summary
self.editing = Outline.summarySentence
edt = QLineEdit(parent)
edt.setFocusPolicy(Qt.StrongFocus)
edt.setFrame(False)
f = QFont(option.font)
if self.newStyle():
f.setBold(True)
else:
f.setItalic(True)
edt.setAlignment(Qt.AlignCenter)
edt.setPlaceholderText(self.tr("One line summary"))
edt.setFont(f)
edt.setStyleSheet("background: {}; color: black;".format(bgColor))
return edt
elif self.titleRect.contains(self.lastPos):
# Title
self.editing = Outline.title
edt = QLineEdit(parent)
edt.setFocusPolicy(Qt.StrongFocus)
edt.setFrame(False)
f = QFont(option.font)
if self.newStyle():
f.setPointSize(f.pointSize() + 4)
else:
edt.setAlignment(Qt.AlignCenter)
f.setBold(True)
edt.setFont(f)
edt.setStyleSheet("background: {}; color: black;".format(bgColor))
# edt.setGeometry(self.titleRect)
return edt
else: # self.mainTextRect.contains(self.lastPos):
# Summary
self.editing = Outline.summaryFull
edt = QPlainTextEdit(parent)
edt.setFocusPolicy(Qt.StrongFocus)
edt.setFrameShape(QFrame.NoFrame)
try:
# QPlainTextEdit.setPlaceholderText was introduced in Qt 5.3
edt.setPlaceholderText(self.tr("Full summary"))
except AttributeError:
pass
edt.setStyleSheet("background: {}; color: black;".format(bgColor))
return edt
示例3: createEditor
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setFrame [as 別名]
def createEditor(self, parent, option, index):
self.updateRects(option, index)
if self.mainLineRect.contains(self.lastPos):
# One line summary
self.editing = Outline.summarySentence
edt = QLineEdit(parent)
edt.setFocusPolicy(Qt.StrongFocus)
edt.setFrame(False)
edt.setAlignment(Qt.AlignCenter)
edt.setPlaceholderText(self.tr("One line summary"))
f = QFont(option.font)
f.setItalic(True)
edt.setFont(f)
return edt
elif self.titleRect.contains(self.lastPos):
# Title
self.editing = Outline.title
edt = QLineEdit(parent)
edt.setFocusPolicy(Qt.StrongFocus)
edt.setFrame(False)
f = QFont(option.font)
# f.setPointSize(f.pointSize() + 1)
f.setBold(True)
edt.setFont(f)
edt.setAlignment(Qt.AlignCenter)
# edt.setGeometry(self.titleRect)
return edt
else: # self.mainTextRect.contains(self.lastPos):
# Summary
self.editing = Outline.summaryFull
edt = QPlainTextEdit(parent)
edt.setFocusPolicy(Qt.StrongFocus)
edt.setFrameShape(QFrame.NoFrame)
try:
# QPlainTextEdit.setPlaceholderText was introduced in Qt 5.3
edt.setPlaceholderText(self.tr("Full summary"))
except AttributeError:
pass
return edt
示例4: AffixLineEdit
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setFrame [as 別名]
class AffixLineEdit(QWidget):
"""Single-line edit control with prefix/suffix text."""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.prefix = QLabel()
self.suffix = QLabel()
self.edit = QLineEdit()
self.edit.setFrame(False)
self.setLayout(HBoxLayout([
self.prefix,
self.edit,
self.suffix,
], tight=True))
self.setAutoFillBackground(True)
def focusInEvent(self, event):
self.edit.setFocus()
event.accept()
示例5: createEditor
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setFrame [as 別名]
def createEditor(self, parent, option, index):
if index.column() != 2:
return None
originalValue = index.model().data(index, Qt.UserRole)
if not self.isSupportedType(originalValue):
return None
lineEdit = QLineEdit(parent)
lineEdit.setFrame(False)
if isinstance(originalValue, bool):
regExp = self.boolExp
elif isinstance(originalValue, float):
regExp = self.doubleExp
elif isinstance(originalValue, int):
regExp = self.signedIntegerExp
elif isinstance(originalValue, QByteArray):
regExp = self.byteArrayExp
elif isinstance(originalValue, QColor):
regExp = self.colorExp
elif isinstance(originalValue, QDate):
regExp = self.dateExp
elif isinstance(originalValue, QDateTime):
regExp = self.dateTimeExp
elif isinstance(originalValue, QTime):
regExp = self.timeExp
elif isinstance(originalValue, QPoint):
regExp = self.pointExp
elif isinstance(originalValue, QRect):
regExp = self.rectExp
elif isinstance(originalValue, QSize):
regExp = self.sizeExp
else:
regExp = QRegExp()
if not regExp.isEmpty():
validator = QRegExpValidator(regExp, lineEdit)
lineEdit.setValidator(validator)
return lineEdit
示例6: createEditor
# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setFrame [as 別名]
def createEditor(self, parent, option, index):
editor = QLineEdit(parent)
editor.setFrame(False)
editor.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
return editor