Skip to content

Utilities

Functions, classes, and decorators for working with Qt, in superqt.utils, superqt.fonticon, and superqt.cmap.

Icons

superqt has two ways to create icons from icon libraries: see Icons for how they compare.

Object Description
QIconifyIcon A QIcon with any of the SVG icons from Iconify.
icon Create a QIcon from a glyph in an icon font.
setTextIcon Show a glyph from an icon font as the text of a widget.
font Create the QFont of an icon font.
addFont Add an OTF or TTF font file to the icon font registry.
IconFont Base class for defining the glyphs of an icon font.
IconFontMeta Metaclass of IconFont, which turns its attributes into glyph keys.
ENTRY_POINT The entry point group that font plugins register with.
IconOpts Options for drawing an icon in a given state (color, scale, and so on).
Animation, spin, pulse Animations for font icons.

Threading

Object Description
thread_worker Decorator that makes a function, or generator, run in another thread when called.
create_worker Create a worker that runs a function, or generator, in another thread.
FunctionWorker QRunnable with signals, that runs a function.
GeneratorWorker QRunnable with signals, that runs a generator (and can be paused, resumed, and sent values).
WorkerBase Base class of the workers.
new_worker_qthread Run a QObject worker in a new QThread.
ensure_main_thread Decorator that makes a function run in the main thread.
ensure_object_thread Decorator that makes a QObject method run in the object's thread.

Signals

Object Description
qthrottled Decorator that limits how often a function runs.
qdebounced Decorator that delays a function until it stops being called.
QSignalThrottler Emits its triggered signal at most once per timeout, however often throttle() is called.
QSignalDebouncer Emits its triggered signal once throttle() hasn't been called for a timeout.
signals_blocked Context manager that blocks the signals of QObjects.

Messages and errors

Object Description
QMessageHandler Context manager that captures Qt's log messages (from qDebug, qWarning, and so on).
exceptions_as_dialog Context manager that shows exceptions in a dialog.

Miscellaneous

Object Description
CodeSyntaxHighlight A QSyntaxHighlighter that highlights code with Pygments.
draw_colormap Draw a colormap onto a QPainter or QPaintDevice.
QColormapItemDelegate An item delegate that draws colormaps in item views.
qimage_to_array Convert a QImage to a NumPy array.
QStyleOptionToggleSwitch The style option that QToggleSwitch draws itself with (for subclasses).
MONTEREY_SLIDER_STYLES_FIX A style sheet that works around a slider bug of Qt 5 on macOS 12+.