本文整理汇总了Python中AnyQt.QtWidgets.QLineEdit.setStyleSheet方法的典型用法代码示例。如果您正苦于以下问题:Python QLineEdit.setStyleSheet方法的具体用法?Python QLineEdit.setStyleSheet怎么用?Python QLineEdit.setStyleSheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtWidgets.QLineEdit
的用法示例。
在下文中一共展示了QLineEdit.setStyleSheet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OWSql
# 需要导入模块: from AnyQt.QtWidgets import QLineEdit [as 别名]
# 或者: from AnyQt.QtWidgets.QLineEdit import setStyleSheet [as 别名]
#.........这里部分代码省略.........
callback=self.open_table)
gui.checkBox(box, self, "download",
"Download data to local memory",
callback=self.open_table)
gui.rubber(self.buttonsArea)
QTimer.singleShot(0, self.select_table)
def _load_credentials(self):
self._parse_host_port()
cm = self._credential_manager(self.host, self.port)
self.username = cm.username
self.password = cm.password
if self.username:
self.usernametext.setText(self.username)
if self.password:
self.passwordtext.setText(self.password)
def _save_credentials(self):
cm = self._credential_manager(self.host, self.port)
cm.username = self.username or ''
cm.password = self.password or ''
def _credential_manager(self, host, port):
return CredentialManager("SQL Table: {}:{}".format(host, port))
def error(self, id=0, text=""):
super().error(id, text)
err_style = 'QLineEdit {border: 2px solid red;}'
if 'server' in text or 'host' in text:
self.servertext.setStyleSheet(err_style)
else:
self.servertext.setStyleSheet('')
if 'role' in text:
self.usernametext.setStyleSheet(err_style)
else:
self.usernametext.setStyleSheet('')
if 'database' in text:
self.databasetext.setStyleSheet(err_style)
else:
self.databasetext.setStyleSheet('')
def _parse_host_port(self):
hostport = self.servertext.text().split(':')
self.host = hostport[0]
self.port = hostport[1] if len(hostport) == 2 else None
def connect(self):
self._parse_host_port()
self.database, _, self.schema = self.databasetext.text().partition('/')
self.username = self.usernametext.text() or None
self.password = self.passwordtext.text() or None
try:
if self.backendcombo.currentIndex() < 0:
return
backend = self.backends[self.backendcombo.currentIndex()]
self.backend = backend(dict(
host=self.host,
port=self.port,
database=self.database,
user=self.username,
password=self.password
))