10
10
QSocketNotifier , pyqtSignal , pyqtSlot )
11
11
from PyQt6 .QtGui import QKeySequence , QShortcut
12
12
from PyQt6 .QtWidgets import (QApplication , QGraphicsView , QGridLayout ,
13
- QHBoxLayout , QMainWindow , QPushButton , QWidget )
13
+ QHBoxLayout , QVBoxLayout , QMainWindow , QPushButton , QWidget )
14
14
15
15
from .qt_items import EndTextOverlay
16
16
from .qt_scene import PelitaScene , blue_col , red_col
@@ -175,6 +175,11 @@ def setupUi(self):
175
175
self .view = GameView (self .scene )
176
176
self .view .setCacheMode (QGraphicsView .CacheModeFlag .CacheBackground )
177
177
178
+ game_layout_w = QWidget (self )
179
+ game_layout = QVBoxLayout (game_layout_w )
180
+ game_layout .addWidget (self .view )
181
+ game_layout .addStretch ()
182
+
178
183
bottom_info = QWidget (self )
179
184
bottom_info_layout = QHBoxLayout (bottom_info )
180
185
@@ -189,7 +194,7 @@ def setupUi(self):
189
194
grid_layout .addWidget (self .stats_blue , 1 , 0 )
190
195
grid_layout .addWidget (self .stats_red , 1 , 1 )
191
196
192
- grid_layout .addWidget (self . view , 2 , 0 , 1 , 2 )
197
+ grid_layout .addWidget (game_layout_w , 2 , 0 , 1 , 2 )
193
198
grid_layout .addWidget (bottom_info , 3 , 0 , 1 , 2 )
194
199
grid_layout .addWidget (self .button , 4 , 0 , 1 , 2 )
195
200
@@ -340,6 +345,15 @@ class GameView(QGraphicsView):
340
345
def __init__ (self , scene , parent = None ):
341
346
super ().__init__ (scene , parent )
342
347
348
+ def minimumHeight (self ) -> int :
349
+ return super ().minimumHeight ()
350
+
351
+ def hasHeightForWidth (self ) -> bool :
352
+ return True
353
+
354
+ def heightForWidth (self , a0 : int ) -> int :
355
+ return a0 // 2
356
+
343
357
def resizeEvent (self , event ) -> None :
344
358
if self .scene ().shape :
345
359
x , y = self .scene ().shape
0 commit comments