Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
I may be slow to respond.

Edwin Yllanes eyllanesc

:octocat:
I may be slow to respond.
View GitHub Profile
@eyllanesc
eyllanesc / asyncprovider.py
Last active Oct 10, 2021
Examples of QtMultimedia in Qt6
View asyncprovider.py
import asyncio
from functools import cached_property, partial
from PyQt6.QtCore import (
pyqtSlot as Slot,
)
from utils import FrameProvider
import cv2
@eyllanesc
eyllanesc / main.py
Created Aug 4, 2021
PDF Viewer with QtWebEngine
View main.py
import sys
from PyQt5 import QtCore, QtWidgets, QtWebEngineWidgets
def main():
print(
f"PyQt5 version: {QtCore.PYQT_VERSION_STR}, Qt version: {QtCore.QT_VERSION_STR}"
)
@eyllanesc
eyllanesc / read_and_write_example.py
Last active Jun 11, 2021
Functions to save and restore Widgets in PyQt.
View read_and_write_example.py
import sys
from PyQt5.QtCore import QFileInfo, QSettings
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import qApp, QApplication, QMainWindow, QFormLayout, QLineEdit, QTabWidget, QWidget, QAction
def restore(settings):
finfo = QFileInfo(settings.fileName())
@eyllanesc
eyllanesc / main.py
Last active Apr 26, 2021
Load geojson that weigh more than 2MB in QtWebEngine
View main.py
import os.path
from PyQt5.QtWidgets import QApplication, QVBoxLayout, QWidget
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtWebEngineCore import QWebEngineUrlRequestInterceptor
import folium
from qfolium import FoliumApplication
@eyllanesc
eyllanesc / CompleterWithQSqlTableModel.pro
Created Sep 22, 2017
Example QCompleter with QSqlTableModel
View CompleterWithQSqlTableModel.pro
#-------------------------------------------------
#
# Project created by QtCreator 2017-09-17T11:02:01
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets sql
View 47339044.py
import sys
import PyQt5
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
# This is our window from QtCreator
import mainwindow_auto
class DataCaptureThread(QThread):
View QTreeView-CheckBoxOnSelectedItems.pro
#-------------------------------------------------
#
# Project created by QtCreator 2017-09-01T21:56:52
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
View main.py
from PySide2.QtCore import Qt, QSize, QRect, QEvent
from PySide2.QtWidgets import QStyledItemDelegate, QStyleOptionViewItem, QApplication, QStyle, QTableWidget, \
QTableWidgetItem
class ItemDelegate(QStyledItemDelegate):
def paint(self, painter, option, index):
opt = QStyleOptionViewItem(option)
if index.column() == 0:
textMargin = QApplication.style().pixelMetric(QStyle.PM_FocusFrameHMargin) + 1
View 47091216.py
from PyQt5.QtCore import *
from PyQt5.QtGui import QDrag
from PyQt5.QtWidgets import *
class TreeWidget(QTreeWidget):
customMimeType = "application/x-customTreeWidgetdata"
def mimeTypes(self):
mimetypes = QTreeWidget.mimeTypes(self)
View main.py
import sys
import os
from PySide2.QtCore import Qt, QObject, Signal, Slot, Property
from PySide2.QtWidgets import QApplication
from PySide2.QtQml import QQmlApplicationEngine
my_list = ['here','is','my','list']
class Manager(QObject):