本文整理汇总了Python中PyQt4.QtGui.QItemSelectionModel方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QItemSelectionModel方法的具体用法?Python QtGui.QItemSelectionModel怎么用?Python QtGui.QItemSelectionModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui
的用法示例。
在下文中一共展示了QtGui.QItemSelectionModel方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _pyside
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QItemSelectionModel [as 别名]
def _pyside():
import PySide
from PySide import QtGui, QtCore, QtUiTools
_remap(PySide, "QtWidgets", QtGui)
_remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel)
_remap(QtCore, "QStringListModel", QtGui.QStringListModel)
_remap(QtCore, "QItemSelection", QtGui.QItemSelection)
_remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel)
_remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel)
try:
from PySide import QtWebKit
_remap(PySide, "QtWebKitWidgets", QtWebKit)
except ImportError:
# QtWebkit is optional in Qt, therefore might not be available
pass
_add(PySide, "__binding__", PySide.__name__)
_add(PySide, "load_ui", lambda fname: QtUiTools.QUiLoader().load(fname))
_add(PySide, "translate", lambda context, sourceText, disambiguation, n: (
QtCore.QCoreApplication(context, sourceText,
disambiguation, None, n)))
_add(PySide, "setSectionResizeMode", QtGui.QHeaderView.setResizeMode)
_maintain_backwards_compatibility(PySide)
return PySide
示例2: _pyside
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QItemSelectionModel [as 别名]
def _pyside():
import PySide
from PySide import QtGui, QtCore, QtUiTools
_remap(PySide, "QtWidgets", QtGui)
_remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel)
_remap(QtCore, "QStringListModel", QtGui.QStringListModel)
_remap(QtCore, "QItemSelection", QtGui.QItemSelection)
_remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel)
_remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel)
try:
from PySide import QtWebKit
_remap(PySide, "QtWebKitWidgets", QtWebKit)
except ImportError:
"QtWebkit is optional in Qt, therefore might not be available"
_add(QtCompat, "__binding__", PySide.__name__)
_add(QtCompat, "__binding_version__", PySide.__version__)
_add(QtCompat, "__qt_version__", PySide.QtCore.qVersion())
_add(QtCompat, "load_ui", lambda fname: QtUiTools.QUiLoader().load(fname))
_add(QtCompat, "setSectionResizeMode", QtGui.QHeaderView.setResizeMode)
_add(QtCompat, "translate",
lambda context, sourceText, disambiguation, n:
QtCore.QCoreApplication.translate(context,
sourceText,
disambiguation,
QtCore.QCoreApplication.CodecForTr,
n))
_maintain_backwards_compatibility(PySide)
return PySide
示例3: _pyside
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QItemSelectionModel [as 别名]
def _pyside():
import PySide
from PySide import QtGui, QtCore, QtUiTools
_remap(PySide, "QtWidgets", QtGui)
_remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel)
_remap(QtCore, "QStringListModel", QtGui.QStringListModel)
_remap(QtCore, "QItemSelection", QtGui.QItemSelection)
_remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel)
_remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel)
try:
from PySide import QtWebKit
_remap(PySide, "QtWebKitWidgets", QtWebKit)
except ImportError:
# QtWebkit is optional in Qt, therefore might not be available
pass
_add(PySide, "__binding__", PySide.__name__)
_add(PySide, "load_ui", _pyside_loadui)
_add(PySide, "translate", lambda context, sourceText, disambiguation, n: (
QtCore.QCoreApplication(context, sourceText,
disambiguation, None, n)))
_add(PySide, "setSectionResizeMode", QtGui.QHeaderView.setResizeMode)
_maintain_backwards_compatibility(PySide)
return PySide
示例4: __init__
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QItemSelectionModel [as 别名]
def __init__(self, parent = None, session = None):
super(SettingsTab, self).__init__(parent)
self.session = session
self.layout = QtGui.QGridLayout()
self.setLayout(self.layout)
racers_box = QtGui.QGroupBox("Racer Configuration")
racers_box_layout = QtGui.QGridLayout()
racers_box.setLayout(racers_box_layout)
self.layout.addWidget(racers_box,0,0)
self.racers_table = QtGui.QTableView(self)
self.racers_table.doubleClicked.connect(self.edit_racer)
self.racers_table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
self.racers_table.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
self.racers_table_model = SQLAlchemyTableModel(session, Racer, [
('name', Racer.name, 'name'),
('hostname', Racer.hostname, 'hostname'),
('location', Racer.location, 'location')])
self.racers_table_selection_model = QtGui.QItemSelectionModel(self.racers_table_model)
self.racers_table.setModel(self.racers_table_selection_model.model())
self.racers_table.setSelectionModel(self.racers_table_selection_model)
racers_box_layout.addWidget(self.racers_table,0,0, 1, 3)
racers_add_button = QtGui.QPushButton("Add")
racers_add_button.released.connect(self.add_racer)
racers_box_layout.addWidget(racers_add_button, 1, 0)
racers_edit_button = QtGui.QPushButton("Edit")
racers_edit_button.released.connect(self.edit_racer)
racers_box_layout.addWidget(racers_edit_button, 1, 1)
racers_delete_button = QtGui.QPushButton("Delete")
racers_delete_button.released.connect(self.delete_racer)
racers_box_layout.addWidget(racers_delete_button, 1, 2)
示例5: _pyqt4
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QItemSelectionModel [as 别名]
def _pyqt4():
# Attempt to set sip API v2 (must be done prior to importing PyQt4)
import sip
try:
sip.setapi("QString", 2)
sip.setapi("QVariant", 2)
sip.setapi("QDate", 2)
sip.setapi("QDateTime", 2)
sip.setapi("QTextStream", 2)
sip.setapi("QTime", 2)
sip.setapi("QUrl", 2)
except AttributeError:
raise ImportError
# PyQt4 < v4.6
except ValueError:
# API version already set to v1
raise ImportError
import PyQt4.Qt
from PyQt4 import QtCore, QtGui, uic
_remap(PyQt4, "QtWidgets", QtGui)
_remap(QtCore, "Signal", QtCore.pyqtSignal)
_remap(QtCore, "Slot", QtCore.pyqtSlot)
_remap(QtCore, "Property", QtCore.pyqtProperty)
_remap(QtCore, "QItemSelection", QtGui.QItemSelection)
_remap(QtCore, "QStringListModel", QtGui.QStringListModel)
_remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel)
_remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel)
_remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel)
try:
from PyQt4 import QtWebKit
_remap(PyQt4, "QtWebKitWidgets", QtWebKit)
except ImportError:
# QtWebkit is optional in Qt , therefore might not be available
pass
_add(PyQt4, "QtCompat", self)
_add(PyQt4, "__binding__", PyQt4.__name__)
_add(PyQt4, "load_ui", lambda fname: uic.loadUi(fname))
_add(PyQt4, "translate", lambda context, sourceText, disambiguation, n: (
QtCore.QCoreApplication(context, sourceText,
disambiguation, None, n)))
_add(PyQt4, "setSectionResizeMode", QtGui.QHeaderView.setResizeMode)
_maintain_backwards_compatibility(PyQt4)
return PyQt4
示例6: _pyqt4
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QItemSelectionModel [as 别名]
def _pyqt4():
# Attempt to set sip API v2 (must be done prior to importing PyQt4)
import sip
try:
sip.setapi("QString", 2)
sip.setapi("QVariant", 2)
sip.setapi("QDate", 2)
sip.setapi("QDateTime", 2)
sip.setapi("QTextStream", 2)
sip.setapi("QTime", 2)
sip.setapi("QUrl", 2)
except AttributeError:
raise ImportError
# PyQt4 < v4.6
except ValueError:
# API version already set to v1
raise ImportError
import PyQt4.Qt
from PyQt4 import QtCore, QtGui, uic
_remap(PyQt4, "QtWidgets", QtGui)
_remap(QtCore, "Signal", QtCore.pyqtSignal)
_remap(QtCore, "Slot", QtCore.pyqtSlot)
_remap(QtCore, "Property", QtCore.pyqtProperty)
_remap(QtCore, "QItemSelection", QtGui.QItemSelection)
_remap(QtCore, "QStringListModel", QtGui.QStringListModel)
_remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel)
_remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel)
_remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel)
try:
from PyQt4 import QtWebKit
_remap(PyQt4, "QtWebKitWidgets", QtWebKit)
except ImportError:
"QtWebkit is optional in Qt , therefore might not be available"
_add(QtCompat, "__binding__", PyQt4.__name__)
_add(QtCompat, "__binding_version__", PyQt4.QtCore.PYQT_VERSION_STR)
_add(QtCompat, "__qt_version__", PyQt4.QtCore.QT_VERSION_STR)
_add(QtCompat, "load_ui", lambda fname: uic.loadUi(fname))
_add(QtCompat, "setSectionResizeMode", QtGui.QHeaderView.setResizeMode)
# PySide2 differs from Qt4 in that Qt4 has one extra argument
# which is always `None`. The lambda arguments represents the PySide2
# interface, whereas the arguments passed to `.translate` represent
# those expected of a Qt4 binding.
_add(QtCompat, "translate",
lambda context, sourceText, disambiguation, n:
QtCore.QCoreApplication.translate(context,
sourceText,
disambiguation,
QtCore.QCoreApplication.CodecForTr,
n))
_maintain_backwards_compatibility(PyQt4)
return PyQt4