Beispiel #1
0
 def configureView(self):
     super().configureView()
     self._lookup_delegate = QSqlRelationalDelegate(self._view)
     self._view.setItemDelegateForColumn(self.fieldIndex("country_id"),
                                         self._lookup_delegate)
     self._view.setItemDelegateForColumn(self.fieldIndex("src_id"),
                                         self._lookup_delegate)
Beispiel #2
0
    def __init__(self, fil=None, parent=None):
        super(ScoreMgrWindow, self).__init__(parent)
        self.setupUi(self)

        print(fil)
        self.model = ScoreModel(fil=fil, parent=self)
        self.tableView.setModel(self.model.model)
        self.delegate = QSqlRelationalDelegate(self.tableView)
        self.tableView.setItemDelegate(self.delegate)
Beispiel #3
0
    def __init__(self, parent):
        super(TmplMgrWindow, self).__init__(parent)
        self.setupUi(self)

        self.backButton.clicked.connect(self.close)
        self.removeButton.clicked.connect(self.remove)
        self.saveButton.clicked.connect(self.save)
        self.viewButton.clicked.connect(self.view)

        self.tmpl = TmplModel(self)
        self.tableView.setModel(self.tmpl.model)
        self.delegate = QSqlRelationalDelegate(self.tableView)
        self.tableView.setItemDelegate(self.delegate)
Beispiel #4
0
    def configureView(self):
        super().configureView()
        self._view.setColumnWidth(
            self.fieldIndex("timestamp"),
            self._view.fontMetrics().width("00/00/0000 00:00:00") * 1.1)
        self._view.setColumnWidth(self.fieldIndex("quote"), 100)

        self._lookup_delegate = QSqlRelationalDelegate(self._view)
        self._view.setItemDelegateForColumn(self.fieldIndex("asset_id"),
                                            self._lookup_delegate)
        self._timestamp_delegate = TimestampDelegate(parent=self._view)
        self._view.setItemDelegateForColumn(self.fieldIndex("timestamp"),
                                            self._timestamp_delegate)
    def __init__(self, parent):
        super(TmplSelectDialog, self).__init__(parent)
        self.setupUi(self)

        self.cancelButton.clicked.connect(self.close)
        self.okButton.clicked.connect(self.ok)
        self.okButton.setDisabled(True)

        self.tmpl = TmplModel(self)
        self.tableView.setModel(self.tmpl.model)
        self.delegate = QSqlRelationalDelegate(self.tableView)
        self.tableView.setItemDelegate(self.delegate)

        self.tableView.clicked.connect(self.on_tableView_clicked)
Beispiel #6
0
    def configureView(self):
        super().configureView()
        self._view.setColumnWidth(self.fieldIndex("active"), 32)
        self._view.setColumnWidth(
            self.fieldIndex("reconciled_on"),
            self._view.fontMetrics().width("00/00/0000 00:00:00") * 1.1)
        self._view.setColumnWidth(self.fieldIndex("country_id"), 50)

        self._lookup_delegate = QSqlRelationalDelegate(self._view)
        self._view.setItemDelegateForColumn(self.fieldIndex("currency_id"),
                                            self._lookup_delegate)
        self._view.setItemDelegateForColumn(self.fieldIndex("country_id"),
                                            self._lookup_delegate)
        self._peer_delegate = PeerSelectorDelegate()
        self._view.setItemDelegateForColumn(self.fieldIndex("organization_id"),
                                            self._peer_delegate)
        self._timestamp_delegate = TimestampDelegate(parent=self._view)
        self._view.setItemDelegateForColumn(self.fieldIndex("reconciled_on"),
                                            self._timestamp_delegate)
        self._bool_delegate = BoolDelegate(self._view)
        self._view.setItemDelegateForColumn(self.fieldIndex("active"),
                                            self._bool_delegate)
    def __init__(self):
        super().__init__()

        self.table = QTableView()

        self.model = QSqlRelationalTableModel(db=db)

        self.table.setModel(self.model)

        # tag::setRelation[]
        self.model.setTable("Track")
        self.model.setRelation(2, QSqlRelation("Album", "AlbumId", "Title"))
        self.model.setRelation(3, QSqlRelation("MediaType", "MediaTypeId", "Name"))
        self.model.setRelation(4, QSqlRelation("Genre", "GenreId", "Name"))

        delegate = QSqlRelationalDelegate(self.table)
        self.table.setItemDelegate(delegate)

        self.model.select()
        # end::setRelation[]

        self.setMinimumSize(QSize(1024, 600))
        self.setCentralWidget(self.table)