コード例 #1
0
        #print(study_list)
        #print(series_list)

        return study_list, series_list


if __name__ == "__main__":

    #Set up the application window
    app = QGuiApplication(sys.argv)

    #Expose the list to the Qml code
    m_Database = QSqlDatabase()
    m_Database = QSqlDatabase.addDatabase("QSQLITE")
    m_Database.setDatabaseName("C:\dev\Work\python\SQLTest\o3.db")

    # Don't know why it is not working with (.mde file?, ...)
    #    m_Database = QSqlDatabase.addDatabase("QODBC");
    #    m_Database.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb)}; FIL={MS Access}; DBQ=C:\\OnDemand3DApp\\Users\\Common\\MasterDB\\lucion.mde;")

    if (not m_Database.open()):
        qDebug("ERROR")
    else:
        qDebug("DB Opened")

    my_StudyModel = myStudyModel()
    my_SeriesModel = studySeriesModel()
    my_StudyModel.selectRow.connect(my_SeriesModel.refreshUID)
    # Temporarily, setting default path manually
    path = "C:\\dev\\Work\\TestData"
コード例 #2
0
import re
import sys

from PySide2.QtCore import QSize, Qt
from PySide2.QtSql import QSqlDatabase, QSqlTableModel
from PySide2.QtWidgets import (
    QApplication,
    QLineEdit,
    QMainWindow,
    QTableView,
    QVBoxLayout,
    QWidget,
)

db = QSqlDatabase("QSQLITE")
db.setDatabaseName("chinook.sqlite")
db.open()


class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        container = QWidget()
        layout = QVBoxLayout()

        self.search = QLineEdit()
        self.search.textChanged.connect(self.update_filter)
        self.table = QTableView()

        layout.addWidget(self.search)
コード例 #3
0
ファイル: main_window.py プロジェクト: dasfalke/python-books
"""
Project: python-books
File: main_window.py
"""
from PySide2.QtSql import QSqlDatabase, QSqlTableModel
from PySide2.QtWidgets import QApplication, QMainWindow, QTableView

# temp db connection
db = QSqlDatabase("QSQLITE")
db.setDatabaseName("books.db")
db.open()


class MainWindow(QMainWindow):
    """
    Class responsible for displaying primary interface.
    """
    def __init__(self):
        super().__init__()

        self.table = QTableView()
        self.model = QSqlTableModel(db=db)
        self.table.setModel(self.model)
        self.model.setTable("hello")
        self.model.select()
        self.setCentralWidget(self.table)


app = QApplication([])
window = MainWindow()
window.show()