-1

I want to make a GUI with QtDesigner.

There is a QFrame for the PyVista plot but the plot doesn't fill the full frame.

Here is my code:

from PySide6.QtWidgets import QApplication, QMainWindow
from QT_Designer.Validation import Ui_MainWindow
from pyvistaqt import QtInteractor, MainWindow


class Frm_main(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

        # Window (Plotter or Frame)
        self.plotter = QtInteractor(self.f_window)  

The plot just fills half of the frame

I tried to set the plotter to full_screen or change the layout of the frame but neither fixes the issue.

RaHeSch
  • 13
  • 3
  • Use [layout managers](https://doc.qt.io/qt-6/layout.html), even [in Designer](https://doc.qt.io/qt-6/designer-layouts.html). – musicamante Jan 05 '23 at 14:08
  • Yes i think this is the solution, but i cant set a layout for the frame with the Designer. Probably i miss there something. – RaHeSch Jan 05 '23 at 15:03
  • Note that you already have a layout (and you should) in which you have that frame, then you probably don't need that frame at all, and you can just remove it and add `self.plotter` to that layout instead. If you still need a frame as container for some reason, and you want to set a layout, then just add a random widget to that container, set the layout, and remove that widget right after that. – musicamante Jan 05 '23 at 15:18

1 Answers1

0

I looked at a view examples and find now a solution:

from PySide6.QtWidgets import QApplication, QMainWindow, QVBoxLayout
from QT_Designer.Validation import Ui_MainWindow
from pyvistaqt import QtInteractor, MainWindow

class Frm_main(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

        vlayout = QVBoxLayout()

        # Window (Plotter or Frame)
        self.plotter = QtInteractor(self.f_window)  
        vlayout.addWidget(self.plotter.interactor)
        self.f_window.setLayout(vlayout)

Now the plotter is in the full frame :)

RaHeSch
  • 13
  • 3