msl.qt.utils module¶
General functions.
- msl.qt.utils.drag_drop_paths(event, *, pattern=None)[source]¶
Returns the list of file paths from a drag-enter or drop event.
- Parameters:
event (
QtGui.QDragEnterEvent
orQtGui.QDropEvent
) – A drag-enter or drop event.pattern (
str
, optional) –Include only the file paths that match the pattern. For example, to only include JPEG or JPG image files use
'*.jp*g'
.See
fnmatch.fnmatch()
.
- Returns:
- msl.qt.utils.save_image(widget, path, *, quality=-1)[source]¶
Save a widget to an image file.
- Parameters:
widget (
QtWidgets.QWidget
) – The widget to save as an image.path (
str
) – The file path to save the image to. The image format is chosen based on the file extension.quality (
int
, optional) – The quality factor. Must be in the range 0 to 100 or -1. Specify 0 to obtain small compressed files, 100 for large uncompressed files, and -1 (the default) to use the default settings.
- Returns:
QtGui.QPixmap
– The widget as a pixmap object.
- msl.qt.utils.screen_geometry(widget=None)[source]¶
Get the geometry of a desktop screen.
- Parameters:
widget (
QtWidgets.QWidget
, optional) – Get the geometry of the screen that contains this widget.- Returns:
QtCore.QRect
– If a widget is specified then the geometry of the screen that contains the widget otherwise returns the geometry of the primary screen (i.e., the screen where the main widget resides).