How to change UI in same window using PyQt5?

You have to use a QStackedWidget import os import sys from PyQt5 import QtCore, QtGui, QtWidgets, uic ui_folder = os.path.join(“frontend”, “ui”) about_company_ui, _ = uic.loadUiType(os.path.join(ui_folder, “about_company.ui”)) intern_placement_ui, _ = uic.loadUiType(os.path.join(ui_folder, “intern_placement.ui”)) class InternPlacement(QtWidgets.QMainWindow, intern_placement_ui): def __init__(self, parent=None): super(InternPlacement, self).__init__(parent) self.setupUi(self) class AboutCompany(QtWidgets.QMainWindow, about_company_ui): def __init__(self, parent=None): super(AboutCompany, self).__init__(parent) self.setupUi(self) if __name__ == “__main__”: app = … Read more

Qt5. Embed QWidget object in QML

Qt Quick 2 uses a scene graph for efficient rendering on the GPU. Unfortunately this makes it impossible to embed classic widgets into the scene. The old approach to embed such widgets with the help of QGraphicsProxyWidget works only with Qt Quick 1, because internally it uses a QGraphicsView for all the heavy lifting and … Read more

Draw Rectangular overlay on QWidget at click

This answer is in a series of my overlay-related answers: first, second, third. One way of doing it is: Have a semi-transparent overlay widget that is also transparent to mouse events. In the event filter, track the clicks and the resizing of the objects by adjusting the overlay’s geometry to match that of the target … Read more

QLabel does not display in QWidget

Widgets when they are visible for the first time call to be visible to their children, but since you are creating it afterwards they probably are not calling that method, a possible solution is to call the show method. void ChatWidget::displayChatAfterButtonPressed() { QLabel *lbl; lbl=new QLabel(this); lbl->setText(“Hello World 2”); lbl->show(); } comment: it seems strange … Read more