本文整理汇总了Python中AnyQt.QtWidgets.QGraphicsView.setAlignment方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsView.setAlignment方法的具体用法?Python QGraphicsView.setAlignment怎么用?Python QGraphicsView.setAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtWidgets.QGraphicsView
的用法示例。
在下文中一共展示了QGraphicsView.setAlignment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OWSilhouettePlot
# 需要导入模块: from AnyQt.QtWidgets import QGraphicsView [as 别名]
# 或者: from AnyQt.QtWidgets.QGraphicsView import setAlignment [as 别名]
#.........这里部分代码省略.........
gui.widgetLabel(box, "Bar width:")
gui.hSlider(
box, self, "bar_size", minValue=1, maxValue=10, step=1,
callback=self._update_bar_size, addSpace=6)
gui.widgetLabel(box, "Annotations:")
self.annotation_cb = gui.comboBox(
box, self, "annotation_var_idx", contentsLength=14,
callback=self._update_annotations)
self.annotation_var_model = itemmodels.VariableListModel(parent=self)
self.annotation_var_model[:] = ["None"]
self.annotation_cb.setModel(self.annotation_var_model)
ibox = gui.indentedBox(box, 5)
self.ann_hidden_warning = warning = gui.widgetLabel(
ibox, "(increase the width to show)")
ibox.setFixedWidth(ibox.sizeHint().width())
warning.setVisible(False)
gui.rubber(self.controlArea)
gui.separator(self.buttonsArea)
box = gui.vBox(self.buttonsArea, "Output")
# Thunk the call to commit to call conditional commit
gui.checkBox(box, self, "add_scores", "Add silhouette scores",
callback=lambda: self.commit())
gui.auto_commit(
box, self, "auto_commit", "Commit",
auto_label="Auto commit", box=False)
# Ensure that the controlArea is not narrower than buttonsArea
self.controlArea.layout().addWidget(self.buttonsArea)
self.scene = QGraphicsScene()
self.view = QGraphicsView(self.scene)
self.view.setRenderHint(QPainter.Antialiasing, True)
self.view.setAlignment(Qt.AlignTop | Qt.AlignLeft)
self.mainArea.layout().addWidget(self.view)
def sizeHint(self):
sh = self.controlArea.sizeHint()
return sh.expandedTo(QSize(600, 720))
@Inputs.data
@check_sql_input
def set_data(self, data):
"""
Set the input dataset.
"""
self.closeContext()
self.clear()
error_msg = ""
warning_msg = ""
candidatevars = []
if data is not None:
candidatevars = [
v for v in data.domain.variables + data.domain.metas
if v.is_discrete and len(v.values) >= 2]
if not candidatevars:
error_msg = "Input does not have any suitable labels."
data = None
self.data = data
if data is not None:
self.cluster_var_model[:] = candidatevars
if data.domain.class_var in candidatevars:
self.cluster_var_idx = \
candidatevars.index(data.domain.class_var)
else:
示例2: OWQualityControl
# 需要导入模块: from AnyQt.QtWidgets import QGraphicsView [as 别名]
# 或者: from AnyQt.QtWidgets.QGraphicsView import setAlignment [as 别名]
class OWQualityControl(widget.OWWidget):
name = "Quality Control"
description = "Experiment quality control"
icon = "../widgets/icons/QualityControl.svg"
priority = 5000
inputs = [("Experiment Data", Orange.data.Table, "set_data")]
outputs = []
DISTANCE_FUNCTIONS = [("Distance from Pearson correlation",
dist_pcorr),
("Euclidean distance",
dist_eucl),
("Distance from Spearman correlation",
dist_spearman)]
settingsHandler = SetContextHandler()
split_by_labels = settings.ContextSetting({})
sort_by_labels = settings.ContextSetting({})
selected_distance_index = settings.Setting(0)
def __init__(self, parent=None):
super().__init__(parent)
## Attributes
self.data = None
self.distances = None
self.groups = None
self.unique_pos = None
self.base_group_index = 0
## GUI
box = gui.widgetBox(self.controlArea, "Info")
self.info_box = gui.widgetLabel(box, "\n")
## Separate By box
box = gui.widgetBox(self.controlArea, "Separate By")
self.split_by_model = itemmodels.PyListModel(parent=self)
self.split_by_view = QListView()
self.split_by_view.setSelectionMode(QListView.ExtendedSelection)
self.split_by_view.setModel(self.split_by_model)
box.layout().addWidget(self.split_by_view)
self.split_by_view.selectionModel().selectionChanged.connect(
self.on_split_key_changed)
## Sort By box
box = gui.widgetBox(self.controlArea, "Sort By")
self.sort_by_model = itemmodels.PyListModel(parent=self)
self.sort_by_view = QListView()
self.sort_by_view.setSelectionMode(QListView.ExtendedSelection)
self.sort_by_view.setModel(self.sort_by_model)
box.layout().addWidget(self.sort_by_view)
self.sort_by_view.selectionModel().selectionChanged.connect(
self.on_sort_key_changed)
## Distance box
box = gui.widgetBox(self.controlArea, "Distance Measure")
gui.comboBox(box, self, "selected_distance_index",
items=[name for name, _ in self.DISTANCE_FUNCTIONS],
callback=self.on_distance_measure_changed)
self.scene = QGraphicsScene()
self.scene_view = QGraphicsView(self.scene)
self.scene_view.setRenderHints(QPainter.Antialiasing)
self.scene_view.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
self.mainArea.layout().addWidget(self.scene_view)
self.scene_view.installEventFilter(self)
self._disable_updates = False
self._cached_distances = {}
self._base_index_hints = {}
self.main_widget = None
self.resize(800, 600)
def clear(self):
"""Clear the widget state."""
self.data = None
self.distances = None
self.groups = None
self.unique_pos = None
with disable_updates(self):
self.split_by_model[:] = []
self.sort_by_model[:] = []
self.main_widget = None
self.scene.clear()
self.info_box.setText("\n")
self._cached_distances = {}
def set_data(self, data=None):
"""Set input experiment data."""
self.closeContext()
self.clear()
#.........这里部分代码省略.........