summaryrefslogtreecommitdiff
path: root/silx/gui/qt
diff options
context:
space:
mode:
Diffstat (limited to 'silx/gui/qt')
-rw-r--r--silx/gui/qt/_qt.py8
-rw-r--r--silx/gui/qt/_utils.py8
2 files changed, 13 insertions, 3 deletions
diff --git a/silx/gui/qt/_qt.py b/silx/gui/qt/_qt.py
index 9615342..29a6354 100644
--- a/silx/gui/qt/_qt.py
+++ b/silx/gui/qt/_qt.py
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2004-2019 European Synchrotron Radiation Facility
+# Copyright (c) 2004-2020 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -224,6 +224,12 @@ elif BINDING == 'PyQt5':
Slot = pyqtSlot
+ # Disable PyQt5's cooperative multi-inheritance since other bindings do not provide it.
+ # See https://www.riverbankcomputing.com/static/Docs/PyQt5/multiinheritance.html?highlight=inheritance
+ class _Foo(object): pass
+ class QObject(QObject, _Foo): pass
+
+
elif BINDING == 'PySide2':
_logger.debug('Using PySide2 bindings')
diff --git a/silx/gui/qt/_utils.py b/silx/gui/qt/_utils.py
index f5915ae..4a7a1c0 100644
--- a/silx/gui/qt/_utils.py
+++ b/silx/gui/qt/_utils.py
@@ -56,12 +56,16 @@ def silxGlobalThreadPool():
""""Manage an own QThreadPool to avoid issue on Qt5 Windows with the
default Qt global thread pool.
+ A thread pool is create in lazy loading. With a maximum of 4 threads.
+ Else `qt.Thread.idealThreadCount()` is used.
+
:rtype: qt.QThreadPool
"""
global __globalThreadPoolInstance
if __globalThreadPoolInstance is None:
tp = _qt.QThreadPool()
- # This pointless command fixes a segfault with PyQt 5.9.1 on Windows
- tp.setMaxThreadCount(tp.maxThreadCount())
+ # Setting maxThreadCount fixes a segfault with PyQt 5.9.1 on Windows
+ maxThreadCount = min(4, tp.maxThreadCount())
+ tp.setMaxThreadCount(maxThreadCount)
__globalThreadPoolInstance = tp
return __globalThreadPoolInstance