QGraphicsView remove ui properties, in favor of definitions in custom class
This commit is contained in:
parent
696d0d2fb1
commit
b761aa3956
@ -2,6 +2,7 @@ import os
|
||||
import tempfile
|
||||
from logging import debug
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractScrollArea,
|
||||
QGraphicsPixmapItem,
|
||||
QGraphicsScene,
|
||||
QGraphicsView,
|
||||
@ -30,6 +31,13 @@ class AlbumArtGraphicsView(QGraphicsView):
|
||||
super().__init__(parent)
|
||||
self.setAcceptDrops(True)
|
||||
self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||
self.setMinimumSize(200, 200)
|
||||
self.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
||||
self.setSizeAdjustPolicy(QAbstractScrollArea.SizeAdjustPolicy.AdjustIgnored)
|
||||
self.setInteractive(False)
|
||||
self.setResizeAnchor(QGraphicsView.ViewportAnchor.AnchorViewCenter)
|
||||
self.setViewportUpdateMode(QGraphicsView.ViewportUpdateMode.FullViewportUpdate)
|
||||
self.album_art_scene: QGraphicsScene = QGraphicsScene()
|
||||
self.customContextMenuRequested.connect(self.showContextMenu)
|
||||
|
||||
|
||||
18
ui.py
18
ui.py
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'ui.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.11
|
||||
# Created by: PyQt5 UI code generator 5.15.10
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
@ -30,20 +30,6 @@ class Ui_MainWindow(object):
|
||||
self.vlayoutAlbumArt.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)
|
||||
self.vlayoutAlbumArt.setObjectName("vlayoutAlbumArt")
|
||||
self.albumGraphicsView = AlbumArtGraphicsView(self.centralwidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.albumGraphicsView.sizePolicy().hasHeightForWidth())
|
||||
self.albumGraphicsView.setSizePolicy(sizePolicy)
|
||||
self.albumGraphicsView.setMinimumSize(QtCore.QSize(200, 200))
|
||||
self.albumGraphicsView.setMaximumSize(QtCore.QSize(16777215, 16777215))
|
||||
self.albumGraphicsView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
||||
self.albumGraphicsView.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.albumGraphicsView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.albumGraphicsView.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustIgnored)
|
||||
self.albumGraphicsView.setInteractive(False)
|
||||
self.albumGraphicsView.setResizeAnchor(QtWidgets.QGraphicsView.AnchorViewCenter)
|
||||
self.albumGraphicsView.setViewportUpdateMode(QtWidgets.QGraphicsView.FullViewportUpdate)
|
||||
self.albumGraphicsView.setObjectName("albumGraphicsView")
|
||||
self.vlayoutAlbumArt.addWidget(self.albumGraphicsView)
|
||||
self.hLayoutHead.addLayout(self.vlayoutAlbumArt)
|
||||
@ -208,7 +194,7 @@ class Ui_MainWindow(object):
|
||||
self.verticalLayout_3.setStretch(0, 20)
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 1152, 21))
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 1152, 41))
|
||||
self.menubar.setObjectName("menubar")
|
||||
self.menuFile = QtWidgets.QMenu(self.menubar)
|
||||
self.menuFile.setObjectName("menuFile")
|
||||
|
||||
44
ui.ui
44
ui.ui
@ -34,47 +34,7 @@
|
||||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="AlbumArtGraphicsView" name="albumGraphicsView">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustIgnored</enum>
|
||||
</property>
|
||||
<property name="interactive">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="resizeAnchor">
|
||||
<enum>QGraphicsView::AnchorViewCenter</enum>
|
||||
</property>
|
||||
<property name="viewportUpdateMode">
|
||||
<enum>QGraphicsView::FullViewportUpdate</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="AlbumArtGraphicsView" name="albumGraphicsView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@ -373,7 +333,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1152</width>
|
||||
<height>21</height>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user