66
77try :
88 from PyQt6 .QtWidgets import QApplication , QWidget , QVBoxLayout , QLabel
9- from PyQt6 .QtCore import Qt , QModelIndex
9+ from PyQt6 .QtCore import Qt , QModelIndex , qVersion
10+ from PyQt6 .QtGui import QImage
1011 from PyQt6 .QtSql import QSqlDatabase , QSqlQueryModel , QSqlQuery
1112
1213 Qt .Horizontal = Qt .Orientation .Horizontal
1920except ImportError as e :
2021
2122 from PyQt5 .QtWidgets import QApplication , QWidget , QVBoxLayout , QLabel
22- from PyQt5 .QtCore import Qt , QModelIndex
23+ from PyQt5 .QtCore import Qt , QModelIndex , qVersion
24+ from PyQt6 .QtGui import QImage
2325 from PyQt5 .QtSql import QSqlDatabase , QSqlQueryModel , QSqlQuery
2426
2527 from utils .FileListModel import FileListModel
@@ -37,8 +39,13 @@ def data(self, index: QModelIndex, role: int = Qt.DisplayRole) -> object:
3739 return super ().data (index , role )
3840
3941
40- ICON_WIDTH , ICON_HEIGHT = 128 , 128
41- IMAGE_CACHE = dict ()
42+ WINDOW_TITLE : str = f"lazy-images. Qt v{ qVersion ()} "
43+
44+ ICON_WIDTH : int = 128
45+ ICON_HEIGHT : int = 128
46+
47+ IMAGE_CACHE : dict [str , QImage | None ] = dict ()
48+
4249
4350
4451class MainWindow (QWidget ):
@@ -87,6 +94,7 @@ def __init__(self) -> None:
8794
8895 def _on_added_new_items (self ) -> None :
8996 self .setWindowTitle (
97+ f"{ WINDOW_TITLE } . "
9098 f"Items. "
9199 f"SQL: { self .model_sql .rowCount ()} / { self .total_rows_sql } ({ self .model_sql .rowCount () / self .total_rows_sql :.1%} ) | "
92100 f"FILES: { self .model_files .rowCount ()} / { self .total_rows_sql } ({ self .model_files .rowCount () / self .total_rows_sql :.1%} )"
0 commit comments