This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt5.QtCore import pyqtSlot, QSortFilterProxyModel, Qt, QUrl, QDir, QAbstractListModel | |
from PyQt5.QtGui import QGuiApplication | |
from PyQt5.QtQml import QQmlApplicationEngine | |
class SortProxyModel(QSortFilterProxyModel): | |
@pyqtSlot(str, Qt.SortOrder) | |
def sortData(self, roleName, order): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------- | |
# | |
# Project created by QtCreator 2017-09-17T11:02:01 | |
# | |
#------------------------------------------------- | |
QT += core gui | |
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import PyQt5 | |
from PyQt5.QtWidgets import * | |
from PyQt5.QtCore import * | |
# This is our window from QtCreator | |
import mainwindow_auto | |
class DataCaptureThread(QThread): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------- | |
# | |
# Project created by QtCreator 2017-09-01T21:56:52 | |
# | |
#------------------------------------------------- | |
QT += core gui | |
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt4.QtCore import * | |
from PyQt4.QtGui import * | |
from PyQt4.QtWebKit import * | |
if __name__ == '__main__': | |
app = QApplication(sys.argv) | |
view = QWebView() | |
view.settings().setAttribute(QWebSettings.JavascriptEnabled, True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PySide2.QtWidgets import * | |
from PySide2.QtCore import * | |
class Model(QAbstractTableModel): | |
def __init__(self, cycles = [[]], headers = [], parent = None): | |
QAbstractTableModel.__init__(self, parent) | |
self.cycles = cycles | |
self.headers = headers | |
self.values_checked = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PySide2.QtCore import Property, QObject, Signal, QCoreApplication, QTimer | |
class QtProperty(Property): | |
def __init__(self, value, name='', type_=None, notify=None): | |
if type_ and notify: | |
super().__init__(type_, self.getter, self.setter, notify=notify) | |
self.value = value | |
self.name = name | |
def getter(self, inst=None): |