You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
839 B
33 lines
839 B
#!/usr/bin/env python |
|
#-*- coding: utf-8 -*- |
|
|
|
import sys |
|
|
|
sys.path.append(sys.argv[1]) |
|
|
|
from PyQt5 import QtCore |
|
from PyQt5 import QtWidgets |
|
|
|
from PyKF5 import KItemModels |
|
|
|
def main(): |
|
app = QtWidgets.QApplication(sys.argv) |
|
|
|
stringListModel = QtCore.QStringListModel(["Monday", "Tuesday", "Wednesday", |
|
"Thursday", "Friday", "Saturday", "Sunday"]); |
|
|
|
selectionModel = QtCore.QItemSelectionModel() |
|
selectionModel.setModel(stringListModel) |
|
|
|
selectionProxy = KItemModels.KSelectionProxyModel() |
|
selectionProxy.setSelectionModel(selectionModel) |
|
selectionProxy.setSourceModel(stringListModel) |
|
|
|
assert(selectionProxy.rowCount() == 0) |
|
|
|
selectionModel.select(stringListModel.index(0, 0), QtCore.QItemSelectionModel.Select) |
|
|
|
assert(selectionProxy.rowCount() == 1) |
|
|
|
if __name__ == '__main__': |
|
main()
|
|
|