QT

The left tab of the QT-ToolButton custom interface (simple and beautiful)

The left tab of the QT-ToolButton custom interface 1. Effect preview 2. Form initialization 3. Set the key signal connection and key mutual exclusive display 4. Add qss interface beautification 5. Key class header files and source files 6. Download all code 1. Effect preview 2. Form initialization Initialize the toolbutton state property, set the …

The left tab of the QT-ToolButton custom interface (simple and beautiful) Read More »

Solution The problem of unable to input Chinese in Qt under ubuntu

Environment: ubuntu16.04, Qt5.12.9 After installing QT in the [Ubuntu] system, Chinese is not supported by default. The specific solutions are as follows: First install fcitx-frontend-qt5 sudo apt-get install fcitx-frontend-qt5 Then check the installation directory of fcitx-frontend-qt5 ls -l /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so Under normal circumstances, there will be after the installation libfcitxplatforminputcontextplugin.so, and then copy the library to …

Solution The problem of unable to input Chinese in Qt under ubuntu Read More »

Qt video surveillance window layout

Show results bandicam 2022-08-04 16-32-54-248 source code head File #ifndef VIDEOSURVEILLANCE_H #define VIDEOSURVEILLANCE_H #include <QWidget> #include <QEvent> #include <QMouseEvent> #include <QMenu> #include <QLabel> #include <QLayout> #include <QHBoxLayout> #include <QVBoxLayout> QT_BEGIN_NAMESPACE namespace Ui { class videoSurveillance; } QT_END_NAMESPACE struct WidgetLayout { QWidget* widget; QVBoxLayout* layout; QLabel* label; WidgetLayout() {} }; class videoSurveillance : public QWidget { …

Qt video surveillance window layout Read More »

Qt toolbar control addition, layout of multiple Dock windows

Toolbar controls Add drop-down menu to toolbar Since it is not possible to add a button icon to the toolbar by means of QAction, the drop-down menu needs to be added to the toolbar by means of code. QComboBox *m = new QComboBox(this); m->addItem(tr("red")); m->addItem(tr("green")); m->setToolTip(tr("color choice")); ui->mainToolBar->addWidget(m); Spacing settings between toolbar QAction components //such …

Qt toolbar control addition, layout of multiple Dock windows Read More »

Qt resize setting window size is invalid; how to set can be zoomed in and out after setFixedSize

In the window resize(w,h), if the value of w or h is less than the w, h of a control in the window, then the resize is invalid in this direction. At this time, Qt will automatically generate a suitable value. Can be setFixedSize(w,h)used instead resize(w,h)to achieve the effect of setting the window size How …

Qt resize setting window size is invalid; how to set can be zoomed in and out after setFixedSize Read More »

Qt listens to keyboard events and determines that the enter key is pressed

For keyboard events, include the header file in the qt window class and override the keyPressEvent function #include <QKeyEvent> … class MainWindow : public QMainWindow { Q_OBJECT public: void keyPressEvent(QKeyEvent *); … }; Implement the function, since the enter key has two values ​​Qt::Key_Return and Qt::Key_Enter, there are two case cases. For case statements, when …

Qt listens to keyboard events and determines that the enter key is pressed Read More »

QT Foundation Day 4 (4) Qt Event Mechanism Event Basic Concepts, Common Event Mechanisms, Event Handling and Event Rewriting

Let’s start with the introduction first. Everyone knows that when we use the mobile phone to click the QQ icon on the screen, we enter the QQ software. How is this achieved? Is it really because we clicked on the qq icon before we entered the software?         Now, let’s understand the principle …

QT Foundation Day 4 (4) Qt Event Mechanism Event Basic Concepts, Common Event Mechanisms, Event Handling and Event Rewriting Read More »

QT Click the button to change the text in the input box to display the enhanced version

Today, I originally felt that the previous version was okay, and then the teacher said that it can be improved. Later, I felt that I could write this after editing it. Initial version: QT click the button to change the text display in the input box (plaintext or ciphertext) – Programmer Sought Finished product first. …

QT Click the button to change the text in the input box to display the enhanced version Read More »