Talking about the layout of pyqt5 in QMain Windows



If the parent class is QMainWindow in pyqt5, the layout class, QGridLayout, QHBoxLayout and QVBoxLayout are not suitable for use.


It’s good to use these three layout classes in a custom class with QWidget as its parent, but you need to write a few more sentences when using QMainWindow. As follows:

widget = QWidget()

Where do these words go? After your layout statement, gridLayout refers to

gridLayout = QGridLayout(self)

Add these words and use them as well as in QWidget.

In this article, the layout of pyqt5 in QMainWindows is discussed. The editor has shared all the contents. I hope to give you a reference, and I hope you will support developpaer more.

Recommended Today

Implementation of PHP Facades

Example <?php class RealRoute{ public function get(){ Echo’Get me’; } } class Facade{ public static $resolvedInstance; public static $app; public static function __callStatic($method,$args){ $instance = static::getFacadeRoot(); if(!$instance){ throw new RuntimeException(‘A facade root has not been set.’); } return $instance->$method(…$args); } // Get the Facade root object public static function getFacadeRoot() { return static::resolveFacadeInstance(static::getFacadeAccessor()); } protected […]