QWidget|QFrame sets the background to be transparent and can have a border color

QWidget|QFrame sets the background to be transparent and can have a border color Chapter1 “Qt” part 6 QSS Qt style sheet – interface beautification 1($$$) Chapter2 [QT] QSS beautification – basic knowledge Chapter3 QWidget|QFrame sets the background to be transparent and can have a border color Reference link Chapter4 Several methods for setting form (QWidget) […]

Realize displaying another QWidget on a QWidget, and change the size of the sub-window by dragging the four sides and four corners of the sub-window with the mouse

#include <QtWidgets> class ChildWidget : public QWidget { public: ChildWidget(QWidget *parent = nullptr) : QWidget(parent) { setAutoFillBackground(true); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); } protected: void paintEvent(QPaintEvent *event) override { Q_UNUSED(event); // Draw the color of the child window QPainter painter(this); painter.fillRect(rect(), Qt::blue); } }; class ParentWidget : public QWidget { public: ParentWidget(QWidget *parent = nullptr) : QWidget(parent) { […]

PySide6 solves the problem of QWidget moving when embedded in QGraphicsView, providing two ideas: QGraphicsProxyWidget and QGraphicsWidget.

Project application: When we need to make QWidget move in QGraphicsView Problem description Since we need to use QWidget in the view, we need to convert it to QGraphicsProxyWidget and set it to the corresponding Flag, but when we run it we will find:It does not move as we expected Cause analysis: For Items without […]

Qt – Set QWidget transparency method

1. Several methods to set the transparency of a form (QWidget) in Qt 1.1 Set the background color of the form To add code in the constructor, you need to add the header file qpalette or qgui QPalette pal = palette(); pal.setColor(QPalette::Background, QColor(0x00,0xff,0x00,0x00)); setPalette(pal); This is accomplished by setting the background color of the form […]

Qt – QWidget events

Events are emitted at different times by the system or Qt itself. When the user presses the mouse, types on the keyboard, or other circumstances, a corresponding event will be emitted. Some events are emitted in response to user operations, such as keyboard events; others are automatically emitted by the system, such as timing events. […]

QWidget draws a transparent background and draws an irregular form solution

1. Environment introduction QT version: 5.12.6 Compiler: MinGW 32 MQTT protocol: Write it yourself by referring to the 3.1.1 version document (not using QT’s qmqtt) Function introduction: Use QT to write the MQTT client (according to the mqtt official document 3.1.1, implement the process code by yourself, without using other libraries), log in to the […]

The ultimate use of Qt’s Qwidget! ! !

Directory Introduction to Qwidget Use of PyQT’s Qwidget Alternative usage of Qwidget Qwidget C++ example Qwidget General Introduction QWidget is the base class of all user interface objects in Qt, mainly used for interface display. The underlying mechanism of QWidget is composed of QPaintDevice and QPaintEngine. QPaintDevice is an abstract class that provides an interface […]

QAction, QWidgetAction, QActionGroup

QAction 1. Description Within an application, many frequently used commands can be invoked through menus, toolbar buttons, and keyboard shortcuts. Since users expect every command to be executed in the same way, it is useful to represent each command as an action, regardless of the user interface being used. 2. Type members 1. enum QAction::ActionEvent: […]

QT–QWidget window class

1. Basic concept of QWidget The QWidget class is the parent class of all window classes (the control class also belongs to the window class), The QObject of the parent class of the QWidget class means that all window class objects can realize automatic recovery of memory resources as long as the parent object is […]

Related API functions of QWidget

Directory Related API functions of QWidget set parent object window position window size Window title and icon Signal slot function Example 1 (set window size): Example 2 (moving windows, modifying windows, obtaining window position information): Example 3 (modify window title and icon, right-click to generate menu items) QWidget is a base class in Qt, which […]