Skip to content

Implement Qt6 compatibility #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions a00_qpip/metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name=qpip
qgisMinimumVersion=3.18
description=PIP dependencies manager for QGIS plugins
version=dev
supportsQt6=True
author=OPENGIS.ch
[email protected]

Expand Down
2 changes: 1 addition & 1 deletion a00_qpip/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def check_deps(self, additional_plugins=[]) -> Union[MainDialog, bool]:

def promt_install(self, dialog: MainDialog):
"""Promts the install dialog and ask the user what to install"""
if dialog.exec_():
if dialog.exec(): # Qt6 compatibility
reqs_to_uninstall = dialog.reqs_to_uninstall
if reqs_to_uninstall:
log(f"Will uninstall selected dependencies : {reqs_to_uninstall}")
Expand Down
9 changes: 7 additions & 2 deletions a00_qpip/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Dict, List

from pkg_resources import DistributionNotFound, VersionConflict
from PyQt5 import uic
from qgis.PyQt import uic
from qgis.core import QgsApplication
from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtGui import QColor
Expand Down Expand Up @@ -30,7 +30,12 @@ def __init__(self, libs: List[Lib], check_on_startup, check_on_install):
def make_widget(label, tooltip=None):
item = QTableWidgetItem(label)
item.setToolTip(tooltip)
item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
try:
# Qt6
item.setFlags(Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled)
except AttributeError:
# Qt5
item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
return item

def make_error_widget(error_type):
Expand Down
7 changes: 6 additions & 1 deletion a00_qpip/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ def run_cmd(args, description="running a system command"):
progress_dlg = QProgressDialog(
description, "Abort", 0, 0, parent=iface.mainWindow()
)
progress_dlg.setWindowModality(Qt.WindowModal)
try:
# t6
progress_dlg.setWindowModality(Qt.WindowModality.WindowModal)
except AttributeError:
# Qt5
progress_dlg.setWindowModality(Qt.WindowModal)
progress_dlg.show()

startupinfo = None
Expand Down