本文整理汇总了Python中AnyQt.QtWidgets.QLineEdit.setToolTip方法的典型用法代码示例。如果您正苦于以下问题:Python QLineEdit.setToolTip方法的具体用法?Python QLineEdit.setToolTip怎么用?Python QLineEdit.setToolTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtWidgets.QLineEdit
的用法示例。
在下文中一共展示了QLineEdit.setToolTip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OWSql
# 需要导入模块: from AnyQt.QtWidgets import QLineEdit [as 别名]
# 或者: from AnyQt.QtWidgets.QLineEdit import setToolTip [as 别名]
class OWSql(OWWidget):
name = "SQL Table"
id = "orange.widgets.data.sql"
description = "Load data set from SQL."
icon = "icons/SQLTable.svg"
priority = 30
category = "Data"
keywords = ["data", "file", "load", "read", "SQL"]
class Outputs:
data = Output("Data", Table, doc="Attribute-valued data set read from the input file.")
settings_version = 2
want_main_area = False
resizing_enabled = False
host = Setting(None)
port = Setting(None)
database = Setting(None)
schema = Setting(None)
username = ""
password = ""
table = Setting(None)
sql = Setting("")
guess_values = Setting(True)
download = Setting(False)
materialize = Setting(False)
materialize_table_name = Setting("")
class Information(OWWidget.Information):
data_sampled = Msg("Data description was generated from a sample.")
class Error(OWWidget.Error):
connection = Msg("{}")
no_backends = Msg("Please install a backend to use this widget")
missing_extension = Msg("Database is missing extension{}: {}")
def __init__(self):
super().__init__()
self.backend = None
self.data_desc_table = None
self.database_desc = None
vbox = gui.vBox(self.controlArea, "Server", addSpace=True)
box = gui.vBox(vbox)
self.backends = BackendModel(Backend.available_backends())
self.backendcombo = QComboBox(box)
if len(self.backends):
self.backendcombo.setModel(self.backends)
else:
self.Error.no_backends()
box.setEnabled(False)
box.layout().addWidget(self.backendcombo)
self.servertext = QLineEdit(box)
self.servertext.setPlaceholderText('Server')
self.servertext.setToolTip('Server')
self.servertext.editingFinished.connect(self._load_credentials)
if self.host:
self.servertext.setText(self.host if not self.port else
'{}:{}'.format(self.host, self.port))
box.layout().addWidget(self.servertext)
self.databasetext = QLineEdit(box)
self.databasetext.setPlaceholderText('Database[/Schema]')
self.databasetext.setToolTip('Database or optionally Database/Schema')
if self.database:
self.databasetext.setText(
self.database if not self.schema else
'{}/{}'.format(self.database, self.schema))
box.layout().addWidget(self.databasetext)
self.usernametext = QLineEdit(box)
self.usernametext.setPlaceholderText('Username')
self.usernametext.setToolTip('Username')
box.layout().addWidget(self.usernametext)
self.passwordtext = QLineEdit(box)
self.passwordtext.setPlaceholderText('Password')
self.passwordtext.setToolTip('Password')
self.passwordtext.setEchoMode(QLineEdit.Password)
box.layout().addWidget(self.passwordtext)
self._load_credentials()
self.tables = TableModel()
tables = gui.hBox(box)
self.tablecombo = QComboBox(
minimumContentsLength=35,
sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLength
)
self.tablecombo.setModel(self.tables)
self.tablecombo.setToolTip('table')
tables.layout().addWidget(self.tablecombo)
self.connect()
#.........这里部分代码省略.........
示例2: OWSelectAttributes
# 需要导入模块: from AnyQt.QtWidgets import QLineEdit [as 别名]
# 或者: from AnyQt.QtWidgets.QLineEdit import setToolTip [as 别名]
class OWSelectAttributes(widget.OWWidget):
name = "Select Columns"
description = "Select columns from the data table and assign them to " \
"data features, classes or meta variables."
icon = "icons/SelectColumns.svg"
priority = 100
inputs = [("Data", Table, "set_data")]
outputs = [("Data", Table), ("Features", widget.AttributeList)]
want_main_area = False
want_control_area = True
settingsHandler = SelectAttributesDomainContextHandler()
domain_role_hints = ContextSetting({})
auto_commit = Setting(False)
def __init__(self):
super().__init__()
self.controlArea = QWidget(self.controlArea)
self.layout().addWidget(self.controlArea)
layout = QGridLayout()
self.controlArea.setLayout(layout)
layout.setContentsMargins(4, 4, 4, 4)
box = gui.vBox(self.controlArea, "Available Variables",
addToLayout=False)
self.filter_edit = QLineEdit()
self.filter_edit.setToolTip("Filter the list of available variables.")
box.layout().addWidget(self.filter_edit)
if hasattr(self.filter_edit, "setPlaceholderText"):
self.filter_edit.setPlaceholderText("Filter")
self.completer = QCompleter()
self.completer.setCompletionMode(QCompleter.InlineCompletion)
self.completer_model = QStringListModel()
self.completer.setModel(self.completer_model)
self.completer.setModelSorting(
QCompleter.CaseSensitivelySortedModel)
self.filter_edit.setCompleter(self.completer)
self.completer_navigator = CompleterNavigator(self)
self.filter_edit.installEventFilter(self.completer_navigator)
def dropcompleted(action):
if action == Qt.MoveAction:
self.commit()
self.available_attrs = VariableListModel(enable_dnd=True)
self.available_attrs_proxy = VariableFilterProxyModel()
self.available_attrs_proxy.setSourceModel(self.available_attrs)
self.available_attrs_view = VariablesListItemView(
acceptedType=Orange.data.Variable)
self.available_attrs_view.setModel(self.available_attrs_proxy)
aa = self.available_attrs
aa.dataChanged.connect(self.update_completer_model)
aa.rowsInserted.connect(self.update_completer_model)
aa.rowsRemoved.connect(self.update_completer_model)
self.available_attrs_view.selectionModel().selectionChanged.connect(
partial(self.update_interface_state, self.available_attrs_view))
self.available_attrs_view.dragDropActionDidComplete.connect(dropcompleted)
self.filter_edit.textChanged.connect(self.update_completer_prefix)
self.filter_edit.textChanged.connect(
self.available_attrs_proxy.set_filter_string)
box.layout().addWidget(self.available_attrs_view)
layout.addWidget(box, 0, 0, 3, 1)
box = gui.vBox(self.controlArea, "Features", addToLayout=False)
self.used_attrs = VariableListModel(enable_dnd=True)
self.used_attrs_view = VariablesListItemView(
acceptedType=(Orange.data.DiscreteVariable,
Orange.data.ContinuousVariable))
self.used_attrs_view.setModel(self.used_attrs)
self.used_attrs_view.selectionModel().selectionChanged.connect(
partial(self.update_interface_state, self.used_attrs_view))
self.used_attrs_view.dragDropActionDidComplete.connect(dropcompleted)
box.layout().addWidget(self.used_attrs_view)
layout.addWidget(box, 0, 2, 1, 1)
box = gui.vBox(self.controlArea, "Target Variable", addToLayout=False)
self.class_attrs = ClassVarListItemModel(enable_dnd=True)
self.class_attrs_view = ClassVariableItemView(
acceptedType=(Orange.data.DiscreteVariable,
Orange.data.ContinuousVariable))
self.class_attrs_view.setModel(self.class_attrs)
self.class_attrs_view.selectionModel().selectionChanged.connect(
partial(self.update_interface_state, self.class_attrs_view))
self.class_attrs_view.dragDropActionDidComplete.connect(dropcompleted)
self.class_attrs_view.setMaximumHeight(24)
box.layout().addWidget(self.class_attrs_view)
layout.addWidget(box, 1, 2, 1, 1)
box = gui.vBox(self.controlArea, "Meta Attributes", addToLayout=False)
self.meta_attrs = VariableListModel(enable_dnd=True)
self.meta_attrs_view = VariablesListItemView(
acceptedType=Orange.data.Variable)
self.meta_attrs_view.setModel(self.meta_attrs)
self.meta_attrs_view.selectionModel().selectionChanged.connect(
#.........这里部分代码省略.........
示例3: variables_filter
# 需要导入模块: from AnyQt.QtWidgets import QLineEdit [as 别名]
# 或者: from AnyQt.QtWidgets.QLineEdit import setToolTip [as 别名]
def variables_filter(model, parent=None, accepted_type=Orange.data.Variable,
view_type=VariablesListItemView):
"""
GUI components: ListView with a lineedit which works as a filter. One can write
a variable name in a edit box and possible matches are then shown in a listview.
"""
def update_completer_model():
""" This gets called when the model for available attributes changes
through either drag/drop or the left/right button actions.
"""
nonlocal original_completer_items
items = ["%s=%s" % item for v in model for item in v.attributes.items()]
new = sorted(set(items))
if new != original_completer_items:
original_completer_items = new
completer_model.setStringList(original_completer_items)
def update_completer_prefix():
""" Prefixes all items in the completer model with the current
already done completion to enable the completion of multiple keywords.
"""
nonlocal original_completer_items
prefix = str(completer.completionPrefix())
if not prefix.endswith(" ") and " " in prefix:
prefix, _ = prefix.rsplit(" ", 1)
items = [prefix + " " + item
for item in original_completer_items]
else:
items = original_completer_items
old = list(map(str, completer_model.stringList()))
if set(old) != set(items):
completer_model.setStringList(items)
original_completer_items = []
filter_edit = QLineEdit()
filter_edit.setToolTip("Filter the list of available variables.")
filter_edit.setPlaceholderText("Filter")
completer_model = QStringListModel()
completer = QCompleter(completer_model, filter_edit)
completer.setCompletionMode(QCompleter.InlineCompletion)
completer.setModelSorting(QCompleter.CaseSensitivelySortedModel)
filter_edit.setCompleter(completer)
completer_navigator = CompleterNavigator(parent)
filter_edit.installEventFilter(completer_navigator)
proxy = VariableFilterProxyModel()
proxy.setSourceModel(model)
view = view_type(acceptedType=accepted_type)
view.setModel(proxy)
model.dataChanged.connect(update_completer_model)
model.rowsInserted.connect(update_completer_model)
model.rowsRemoved.connect(update_completer_model)
filter_edit.textChanged.connect(update_completer_prefix)
filter_edit.textChanged.connect(proxy.set_filter_string)
return filter_edit, view