本文整理汇总了Python中PySide.QtGui方法的典型用法代码示例。如果您正苦于以下问题:Python PySide.QtGui方法的具体用法?Python PySide.QtGui怎么用?Python PySide.QtGui使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide
的用法示例。
在下文中一共展示了PySide.QtGui方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_pyqt5
# 需要导入模块: import PySide [as 别名]
# 或者: from PySide import QtGui [as 别名]
def _setup_pyqt5():
global QtCore, QtGui, QtWidgets, __version__, is_pyqt5, _getSaveFileName
if QT_API == QT_API_PYQT5:
from PyQt5 import QtCore, QtGui, QtWidgets
__version__ = QtCore.PYQT_VERSION_STR
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
QtCore.Property = QtCore.pyqtProperty
elif QT_API == QT_API_PYSIDE2:
from PySide2 import QtCore, QtGui, QtWidgets, __version__
else:
raise ValueError("Unexpected value for the 'backend.qt5' rcparam")
_getSaveFileName = QtWidgets.QFileDialog.getSaveFileName
def is_pyqt5():
return True
示例2: __init__
# 需要导入模块: import PySide [as 别名]
# 或者: from PySide import QtGui [as 别名]
def __init__(self, obj,*args):
QtGui.QWidget.__init__(self, *args)
obj.widget=self
self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
self.vollabel = QtGui.QLabel(obj.Object.Label)
self.pushButton02 = QtGui.QPushButton()
self.pushButton02.setText("close")
self.pushButton02.clicked.connect(self.hide)
dial = QDial()
dial.setNotchesVisible(True)
self.dial=dial
dial.setMaximum(100)
dial.valueChanged.connect(obj.dreher);
layout = QHBoxLayout()
layout = QtGui.QGridLayout()
layout.addWidget(self.vollabel, 0, 0)
layout.addWidget(self.pushButton02, 15, 0,1,4)
layout.addWidget(dial,3,0)
self.setLayout(layout)
self.setWindowTitle(obj.Object.target.Label)
示例3: has_binding
# 需要导入模块: import PySide [as 别名]
# 或者: from PySide import QtGui [as 别名]
def has_binding(api):
"""Safely check for PyQt4 or PySide, without importing
submodules
Parameters
----------
api : str [ 'pyqtv1' | 'pyqt' | 'pyside' | 'pyqtdefault']
Which module to check for
Returns
-------
True if the relevant module appears to be importable
"""
# we can't import an incomplete pyside and pyqt4
# this will cause a crash in sip (#1431)
# check for complete presence before importing
module_name = {QT_API_PYSIDE: 'PySide',
QT_API_PYQT: 'PyQt4',
QT_API_PYQTv1: 'PyQt4',
QT_API_PYQT_DEFAULT: 'PyQt4'}
module_name = module_name[api]
import imp
try:
#importing top level PyQt4/PySide module is ok...
mod = __import__(module_name)
#...importing submodules is not
imp.find_module('QtCore', mod.__path__)
imp.find_module('QtGui', mod.__path__)
imp.find_module('QtSvg', mod.__path__)
#we can also safely check PySide version
if api == QT_API_PYSIDE:
return check_version(mod.__version__, '1.0.3')
else:
return True
except ImportError:
return False
示例4: import_pyqt4
# 需要导入模块: import PySide [as 别名]
# 或者: from PySide import QtGui [as 别名]
def import_pyqt4(version=2):
"""
Import PyQt4
Parameters
----------
version : 1, 2, or None
Which QString/QVariant API to use. Set to None to use the system
default
ImportErrors rasied within this function are non-recoverable
"""
# The new-style string API (version=2) automatically
# converts QStrings to Unicode Python strings. Also, automatically unpacks
# QVariants to their underlying objects.
import sip
if version is not None:
sip.setapi('QString', version)
sip.setapi('QVariant', version)
from PyQt4 import QtGui, QtCore, QtSvg
if not check_version(QtCore.PYQT_VERSION_STR, '4.7'):
raise ImportError("IPython requires PyQt4 >= 4.7, found %s" %
QtCore.PYQT_VERSION_STR)
# Alias PyQt-specific functions for PySide compatibility.
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
# query for the API version (in case version == None)
version = sip.getapi('QString')
api = QT_API_PYQTv1 if version == 1 else QT_API_PYQT
return QtCore, QtGui, QtSvg, api
示例5: import_pyside
# 需要导入模块: import PySide [as 别名]
# 或者: from PySide import QtGui [as 别名]
def import_pyside():
"""
Import PySide
ImportErrors raised within this function are non-recoverable
"""
from PySide import QtGui, QtCore, QtSvg
return QtCore, QtGui, QtSvg, QT_API_PYSIDE
示例6: _getSaveFileName
# 需要导入模块: import PySide [as 别名]
# 或者: from PySide import QtGui [as 别名]
def _getSaveFileName(*args, **kwargs):
return (QtGui.QFileDialog.getSaveFileName(*args, **kwargs),
None)
示例7: _pyside_as_qt_object
# 需要导入模块: import PySide [as 别名]
# 或者: from PySide import QtGui [as 别名]
def _pyside_as_qt_object(widget):
from PySide.QtCore import QObject
from PySide.QtGui import QWidget
from PySide import QtGui
from shiboken import wrapInstance
if hasattr(widget, '__qt_object__'):
return widget.__qt_object__
ptr = _find_widget_ptr(widget)
qobject = wrapInstance(long(ptr), QObject)
meta = qobject.metaObject()
_class = meta.className()
_super = meta.superClass().className()
qclass = getattr(QtGui, _class, getattr(QtGui, _super, QWidget))
return wrapInstance(long(ptr), qclass)
示例8: _pyqt4_as_qt_object
# 需要导入模块: import PySide [as 别名]
# 或者: from PySide import QtGui [as 别名]
def _pyqt4_as_qt_object(widget):
from sip import wrapinstance
# Seting to api level 2 to better align with PySide behavior.
sip.setapi('QDate', 2)
sip.setapi('QDateTime', 2)
sip.setapi('QString', 2)
sip.setapi('QtextStream', 2)
sip.setapi('Qtime', 2)
sip.setapi('QUrl', 2)
sip.setapi('QVariant', 2)
from PyQt4.QtGui import QWidget
if hasattr(widget, '__qt_object__'):
return widget.__qt_object__
ptr = _find_widget_ptr(widget)
return wrapinstance(long(ptr), QWidget)
示例9: position
# 需要导入模块: import PySide [as 别名]
# 或者: from PySide import QtGui [as 别名]
def position(cls):
'''Return the current `(x, y)` position of the cursor.'''
qt = PyQt5.QtGui.QCursor
res = qt.pos()
return res.x(), res.y()
示例10: start
# 需要导入模块: import PySide [as 别名]
# 或者: from PySide import QtGui [as 别名]
def start(V=None):
mw=QtGui.qApp
ef=EventFilter(V)
FreeCAD.keyfilter=ef
mw.installEventFilter(ef)
示例11: stop
# 需要导入模块: import PySide [as 别名]
# 或者: from PySide import QtGui [as 别名]
def stop():
mw=QtGui.qApp
ef=FreeCAD.keyfilter
mw.removeEventFilter(ef)
#------------------------
示例12: showVersion
# 需要导入模块: import PySide [as 别名]
# 或者: from PySide import QtGui [as 别名]
def showVersion(self):
cl=self.Object.Proxy.__class__.__name__
PySide.QtGui.QMessageBox.information(None, "About ", "Animation" + cl +" Node\nVersion " + __vers__ )
示例13: __init__
# 需要导入模块: import PySide [as 别名]
# 或者: from PySide import QtGui [as 别名]
def __init__(self, obj,*args):
QtGui.QWidget.__init__(self, *args)
self.obj2=obj
FreeCAD.obj2=obj
self.vollabel = QtGui.QLabel(obj.Object.Label)
self.pushButton02 = QtGui.QPushButton()
self.pushButton02.clicked.connect(self.on_pushButton02_clicked)
self.pushButton02.setText("close")
self.listWidget = QListWidget()
for tn in self.obj2.Object._targets:
n=tn.Label
item = QListWidgetItem(n)
self.listWidget.addItem(item)
self.listWidget.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
self.combo = QtGui.QComboBox(self)
for i in FreeCAD.ActiveDocument.Objects:
self.combo.addItem(str(i.Label)+ " ")
self.pushButton03 = QtGui.QPushButton()
self.pushButton03.clicked.connect(self.on_pushButton03_clicked)
self.pushButton03.setText("add target")
self.pushButton04 = QtGui.QPushButton()
self.pushButton04.clicked.connect(self.on_pushButton04_clicked)
self.pushButton04.setText("remove selected targets")
layout = QtGui.QGridLayout()
layout.addWidget(self.vollabel, 0, 0)
layout.addWidget(self.pushButton02, 15, 0,1,4)
layout.addWidget(self.listWidget, 3, 0,1,4)
layout.addWidget(self.pushButton04, 4, 0,1,4)
layout.addWidget(self.combo, 5, 0,1,4)
layout.addWidget(self.pushButton03, 6, 0,1,4)
self.setLayout(layout)
self.setWindowTitle("Edit Coordinate System")
示例14: showVersion
# 需要导入模块: import PySide [as 别名]
# 或者: from PySide import QtGui [as 别名]
def showVersion(self):
QtGui.QMessageBox.information(None, "About Transform", "Transform Node\n2015 microelly\nVersion " + __vers__ +"\nstill very alpha")
#-----------------------
示例15: config
# 需要导入模块: import PySide [as 别名]
# 或者: from PySide import QtGui [as 别名]
def config(self):
self.dialog=TelescopWidget(self)
#self.dialog.show()
mw = FreeCADGui.getMainWindow()
#dock = QtGui.QDockWidget("Mein Dock", mw)
dock = QtGui.QDockWidget(self.Object.Label, mw)
dock.setStyleSheet("background-color:yellow;color:brown;")
mw.centralWidget = QtGui.QWidget(dock)
mw.addDockWidget(QtCore.Qt.LeftDockWidgetArea, dock)
dock.setWidget(self.dialog)