Skip to content

Instantly share code, notes, and snippets.

View poptosic's full-sized avatar

Milorad Pop-Tosic poptosic

View GitHub Profile
@poptosic
poptosic / test.py
Created March 16, 2017 11:34
Deadlock when endResetModel() triggers ImageProvider asynchronously
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtCore import QAbstractListModel
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtCore import QVariant
from PyQt5.QtGui import QImage
from PyQt5.QtQml import QQmlApplicationEngine
from PyQt5.QtQuick import QQuickImageProvider
@poptosic
poptosic / test.py
Last active March 3, 2017 11:02
Demonstrates a possible regression in PyQt5.8 where calling QJSValue.toVariant() on a javascript object passed from QML which contains null as a value of one of its attributes, leads to this error: TypeError: unable to convert a C++ 'QVariantMap' instance to a Python object.
import sys
from PyQt5.QtCore import QObject, pyqtSlot
from PyQt5.QtCore import QVariant
from PyQt5.QtQml import QQmlApplicationEngine
from PyQt5.QtWidgets import QApplication
class Context(QObject):
@pyqtSlot(QVariant)
@poptosic
poptosic / WebEngineTest.qml
Last active October 27, 2015 16:26
This gist demonstrates a bug in PyQt 5.5.1 (possibly 5.5.0 too) on Windows where explicitly destroying a dynamically created WebEngineView leads to a stack overflow crash on shutdown.
import QtQuick 2.5
Rectangle {
width: 800
height: 600
color: "#eee"
property var obj