本文整理汇总了Python中PySide.QtGui.QGraphicsScene方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QGraphicsScene方法的具体用法?Python QtGui.QGraphicsScene怎么用?Python QtGui.QGraphicsScene使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui
的用法示例。
在下文中一共展示了QtGui.QGraphicsScene方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: additional_gui_setup
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QGraphicsScene [as 别名]
def additional_gui_setup(self):
# Additional GUI setup
self.graphicsView_banner.mouseDoubleClickEvent = MainWindow.banner_double_click
self.setWindowTitle(__appname__)
self.scene_banner = QtGui.QGraphicsScene()
self.graphicsView_banner.setScene(self.scene_banner)
self.scene_banner.addPixmap(QtGui.QPixmap(":images/banner.png"))
self._path_message("", MainWindow.MSG_OK)
self._avoid_message("", MainWindow.MSG_OK)
self.lineEdit_source.setFocus()
# Auto-completion
system_list = self.nav.eve_db.system_name_list()
for line_edit_field in [
self.lineEdit_source,
self.lineEdit_destination,
self.lineEdit_avoid_name,
self.lineEdit_set_dest,
]:
completer = QtGui.QCompleter(system_list, self)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
line_edit_field.setCompleter(completer)
# Signals
self.pushButton_eve_login.clicked.connect(self.btn_eve_login_clicked)
self.pushButton_player_location.clicked.connect(self.btn_player_location_clicked)
self.pushButton_find_path.clicked.connect(self.btn_find_path_clicked)
self.pushButton_crest_config.clicked.connect(self.btn_crest_config_clicked)
self.pushButton_trip_config.clicked.connect(self.btn_trip_config_clicked)
self.pushButton_trip_get.clicked.connect(self.btn_trip_get_clicked)
self.pushButton_avoid_add.clicked.connect(self.btn_avoid_add_clicked)
self.pushButton_avoid_delete.clicked.connect(self.btn_avoid_delete_clicked)
self.pushButton_avoid_clear.clicked.connect(self.btn_avoid_clear_clicked)
self.pushButton_set_dest.clicked.connect(self.btn_set_dest_clicked)
self.pushButton_reset.clicked.connect(self.btn_reset_clicked)
self.lineEdit_source.returnPressed.connect(self.line_edit_source_return)
self.lineEdit_destination.returnPressed.connect(self.line_edit_destination_return)
self.lineEdit_avoid_name.returnPressed.connect(self.line_edit_avoid_name_return)
self.lineEdit_set_dest.returnPressed.connect(self.btn_set_dest_clicked)
self.tableWidget_path.itemSelectionChanged.connect(self.table_item_selection_changed)
示例2: initUI
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QGraphicsScene [as 别名]
def initUI(self):
vbox = QtGui.QVBoxLayout()
btn = QtGui.QPushButton('Dialog', self)
btn.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
btn.move(20, 20)
vbox.addWidget(btn)
btn.clicked.connect(self.showDialog)
self.lbl = QtGui.QLabel('Knowledge only matters', self)
self.lbl.move(130, 20)
vbox.addWidget(self.lbl)
width = 250
height = 180
self.graphicsScene = QtGui.QGraphicsScene(0,0,width*0.8,height/2)
self.dimPreview = QtSvg.QGraphicsSvgItem()
self.dimSVGRenderer = QtSvg.QSvgRenderer()
self.dimSVGRenderer.load( QtCore.QByteArray( '''<svg width="%i" height="%i"></svg>''' % (width, height)) )
self.dimPreview.setSharedRenderer( self.dimSVGRenderer )
self.graphicsScene.addItem( self.dimPreview )
self.graphicsView = QtGui.QGraphicsView( self.graphicsScene )
vbox.addWidget( self.graphicsView )
self.setLayout(vbox)
self.setGeometry(300, 300, width, height)
self.setWindowTitle('Font dialog')
self.show()
示例3: initExtra
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QGraphicsScene [as 别名]
def initExtra(self):
graphicsScene = QtGui.QGraphicsScene(0,0,30,30)
pen = QtGui.QPen( QtGui.QColor(0,0,0,0) )
pen.setWidth(0.0)
rect = ClickRect(-100, -100, 200, 200)
rect.setPen(pen)
rect.clickFun = self.clickFun
graphicsScene.addItem(rect)
self.graphicsScene = graphicsScene #protect from garbage collector
self.colorRect = rect
示例4: generateWidget
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QGraphicsScene [as 别名]
def generateWidget(self, dimensioningProcess):
self.dimensioningProcess = dimensioningProcess
groupbox = QtGui.QGroupBox("Grid Options")
groupbox.setCheckable( True )
groupbox.toggled.connect( self.groupBoxToggled )
self.groupbox = groupbox
checked = self.dd_parms.GetBool("show_grid_options",True)
groupbox.setChecked(checked)
vbox = QtGui.QVBoxLayout()
gridOn_checkbox = QtGui.QCheckBox('grid on')
gridOn_checkbox.setChecked( self.dd_parms.GetBool( 'grid_on', False ))
gridOn_checkbox.stateChanged.connect( self.gridOn_checkbox_stateChanged )
vbox.addWidget( gridOn_checkbox )
self.gridOn_checkbox = gridOn_checkbox
spacingSpinbox = QtGui.QDoubleSpinBox()
spacingSpinbox.setValue( self.dd_parms.GetFloat( 'grid_spacing', default_grid_spacing ) )
spacingSpinbox.setMinimum( 0.01 )
spacingSpinbox.setDecimals( 2 )
spacingSpinbox.setSingleStep( 0.5 )
spacingSpinbox.setSuffix('mm')
spacingSpinbox.valueChanged.connect( self.spacingSpinbox_valueChanged )
vbox.addLayout( DimensioningTaskDialog_generate_row_hbox('spacing', spacingSpinbox) )
self.spacingSpinbox = spacingSpinbox
displayPeriodSpinbox = QtGui.QSpinBox()
displayPeriodSpinbox.setValue( min( self.dd_parms.GetInt( 'grid_display_period', default_grid_display_period ), 200) )
displayPeriodSpinbox.setMinimum( 0 )
displayPeriodSpinbox.valueChanged.connect( self.displayPeriodSpinbox_valueChanged )
vbox.addLayout( DimensioningTaskDialog_generate_row_hbox('display period', displayPeriodSpinbox) )
self.displayPeriodSpinbox = displayPeriodSpinbox
clr = QtGui.QColor(*unsignedToRGB(self.dd_parms.GetUnsigned( 'grid_color', default_grid_clr )) )
graphicsScene = QtGui.QGraphicsScene(0,0,30,30)
pen = QtGui.QPen( QtGui.QColor(0,0,0,0) )
pen.setWidth(0.0)
rect = ClickRect(-100, -100, 200, 200)
rect.setPen(pen)
rect.clickFun = self.specifyNewGridColor
graphicsScene.addItem(rect)
self.graphicsScene = graphicsScene #protect from garbage collector
self.colorRect = rect
self.colorRect.setBrush( QtGui.QBrush( clr ) )
colorBox = QtGui.QGraphicsView( self.graphicsScene )
colorBox.setMaximumWidth( 60 )
colorBox.setMaximumHeight( 30 )
colorBox.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff )
colorBox.setVerticalScrollBarPolicy( QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff )
vbox.addLayout( DimensioningTaskDialog_generate_row_hbox( 'color', colorBox ) )
lineWidthSpinbox = QtGui.QDoubleSpinBox()
lineWidthSpinbox.setValue( self.dd_parms.GetFloat( 'grid_line_width', default_grid_line_width ) )
lineWidthSpinbox.setMinimum( 0. )
lineWidthSpinbox.setDecimals( 2 )
lineWidthSpinbox.setSingleStep( 0.05 )
lineWidthSpinbox.valueChanged.connect( self.lineWidthSpinbox_valueChanged )
vbox.addLayout( DimensioningTaskDialog_generate_row_hbox('lineWidth', lineWidthSpinbox) )
self.lineWidthSpinbox = lineWidthSpinbox
groupbox.setLayout(vbox)
return groupbox