Tag Archives: qt

Python – writing visual interface (Python + pycharm + pyqt)

Recently began to learn Python, but only to see the theory, a few lines of code, think it is not interesting, I want to use Python to write a visual interface. Then I searched relevant materials and found PyQt. As I had just seen Qt a while ago and had a good impression on Qt, I thought using PyQt should be a more pleasant choice.
1, the preface
The version of PyQt should be the same as the version of Python. The version of PyQt I use here is PyQT5-5.6-GPL-Py3.5-QT5.6.0-x64.exe. For details, please search directly. Since this version requires the V3.5 version of Python, you need to install Python3.5 first and then PyQt. To make it easier to write code, you install PyCharm (version: PyCharm-Community-2017.3.2.exe). PyCharm +Python3.5+ PyQT5.6 is a Python visual programming tool that allows you to install and download Python Charm, Python3.5 and PyQT5.6. Visual programming in Python based on the latest version of PyChart 2018.3+Python3.7+ PyQT5.11 will also be introduced at the end of this article.
2, start
1) Open PyCharm and configure the relevant Settings
Open the PyCharm interface as follows:

Click the “Configure” drop-down button at the bottom right of the screen and select “Settings”, as shown below:

Open the following setting interface:

As shown above, select the Python version installed on this machine from the “Project Interpreter” graphics card. Normally, it will automatically recognize the Python version installed on this machine, as shown in Figure 3.5;
After the configuration is completed, click “OK” to return to the Start screen.
Select “Create New Project “, select the Project path and Project name, then click “Create”, and the following interface will pop up:

At this point, the working environment is ready;
3, write,
1) First, create a.py file, tentatively named pyqt.py
Next, the file you need to import PyQt is as follows:

import sys
from PyQt5.QtWidgets import QWidget, QApplication

Note that if the prompt fails to find the corresponding file, make sure the PyQT5 installation path is in the environment variable!
Then add the main function first:

if __name__ == "__main__":
    app = QApplication(sys.argv)
    sys.exit(app.exec_())

The next step is to add interface-related functions:

#class Example
class Example(QWidget):
    def __init__(self):
        super(Example, self).__init__()
        self.InitUI()

    def InitUI(self):
        self.btn = QPushButton("Dialog", self)
        self.btn.move(20, 20)
        self.btn.clicked.connect(self.ShowDialog)

        self.le = QLineEdit(self)
        self.le.move(130, 22)

        self.setWindowTitle("Input Dialog")
        self.show()

    def ShowDialog(self):
        text,ok = QInputDialog.getText(self, "Input Dialog", "Enter your name:")
        if ok:
            self.le.setText(str(text))

As shown in the code above, in Python, the interface is mainly generated by the class. In the class, you can generate the interface, create the control, create the control’s response function, connect the control and the control’s response function.
The function __init__(self) can be understood as the constructor of this class, where the initialization of the interface is performed.
The function initUI (self) is mainly used to generate interface controls;
When the class is created, you simply call the class in the main function. This is as follows:

if __name__ == "__main__":
    app = QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())

In the above code, a button (BTN), an edit box (le) and a button response function (showDialog) are mainly added in the interface, in which a standard input window is opened in the showDialog response function, and the value entered in the standard input window is displayed in the edit box (le).

Results:

4, extension,
In the following, I made a more complex example, mainly to simulate the solution of exchange rate. The interface is mainly shown as follows:

It mainly involves button, edit box, Label, layout, etc.
This is written in the same file as the first example, and can be downloaded by following the link:
http://download.csdn.net/download/bailang_zhizun/10249579
5. The latest version configuration method
Configure the visual programming environment with the latest versions of Python, PyQt, and PyCharm.
First install Python3.7, then install PyChart 2018.3, configure the Python interpreter to the local directory of Python3.7, and then install PyQT5.11.
Install PyQt5.11 is in the form of PIP + wheel files installed, download url: https://pypi.org/project/PyQt5/#files
About the installation of the PIP please refer to https://blog.csdn.net/bailang_zhizun/article/details/84563095
Put the downloaded pyqt5-5.11.3-5.11.2-cp35.cp36.cp37.cp38-none-win_amd64.whl file in the appropriate location.
Open CMD and enter the installation command as follows:

Enter and the PIP will automatically install the file:

At this point, PyQT5.11 is installed successfully.
You can test it with the code above.
6. Install PyQT5 in Python 2.7 under Ubuntu
These are all documented installments of PyQT5 on Windows + Python 3. According to the official website of pyqt5, pyqt5 is only available for python3, but not for python2.7, so you can install pyqt5 online. Here is how to install pyqt5 in Ubuntu+python2.7:
Open a terminal in Ubuntu and type:

$sudo apt-get install python-pyqt5

After the installation is completed, you can directly import PyQt5 on the code editing page, and it is available for personal testing.
In addition, it seems that the above method can also be used to install PyQT5 in Ubuntu + Python 3 environment, also through the command installation:

$sudo apt-get install python3-pyqt5

It’s untested, but it should work.
 

QT encountered in CentOS installation( qt.qpa.plugin : Could not load the Qt platform plugin “xcb” )

I don’t believe it. How hard is it to install Qt on Linux?I reinstalled the system several times and got drunk. Here are the problems I encountered:
Round1:
After installation, execute the QTCreator prompt:
Linux qt “qt.qpa.plugin: Could not load the Qt platform plugin “xcb” ”

sudo gedit ~/.bashrc
sudo gedit ~/.bashrc
sudo gedit ~/.bashrc

export QT_DEBUG_PLUGINS=1
export LD_LIBRARY_PATH=/opt/Qt5.13.1/5.13.1/gcc_64/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/Qt5.13.1/Tools/QtCreator/lib:$LD_LIBRARY_PATH

The last two sentences are from the link library path added to the search path, do not know whether to work.
Emphasized in fact the first sentence here, and after the configuration items, QtCreator will output a lot of information, so we can be targeted, step by step to solve the problem/
the changes to take effect

sudo source  ~/.bashrc

round2:
Execute the QtCreator program again from the command line, and output a bunch of log information. Skip to the end to find a prompt:
always load the library/opt/Qt5.13.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb. So: (libxkbcommon – x11. So. 0: unable to open the Shared object file: Don’t have that file or directory)
QLibraryPrivate: : loadPlugin failed on “/ opt/Qt5.13.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb. So” : “Always load the library/opt/Qt5.13.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb. So: (libxkbcommon – x11. So. 0: unable to open the Shared object file: no files or directories)”

obviously failure load of dynamic link library, first check whether there is the file exists, then look at whether the dependent libraries are able to find success:

ldd  /opt/Qt5.13.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so

Libxkbcommon is not available, you need to install the library, use yum to install:

yum -y install libxkbcommon-x11-devel

Round 3 lacks DBUS
If you continue, there is still an error. If you skip to the last line, there is still an error
/ opt/Qt5.13.1/Tools/QtCreator/bin/QtCreator: relocation error:/opt/Qt5.13.1/Tools/QtCreator/lib/Qt/plugins/platforms /.. /.. /lib/ libqt5dbus.so.5: Symbol dbus_message_set_allow_interactive_authorization, version LIBDBUS_1_3 not defined in file libbus-1.so.3 with link time reference

yum -y install dbus-devel

round4
Continue with the following error
Opt/Qt5.13.1/Tools/QtCreator/bin/QtCreator: symbol lookup error:/opt/Qt5.13.1/Tools/QtCreator/lib/Qt/plugins/platforms /.. /.. /lib/ libqt5xcbqpa.so.5: undefined Symbol: FT_GET_FONT_FORMAT

yum -y install freetype-devel

Export QT_DEBUG_PLUGINS=1. You may not have the same problem as me, but with the output, you can solve it step by step.

Vs2012 compiling PCL dependency library vtk7.0

Software preparation:
1. Download the source code compression package VTK-7.0.0.zip from the VTK official website and extract it.
2. Download the installation package QT-Opensource-Windows-x86-MSVC2012_OpenGL-5.3.2. exe from the Qt official website, and install it by default.
3. Download the installation package cmake-3.0.2-win32-x86.exe from the official website of CMake, and install it by default.
Cmake set
1. Check Groupd and Advanced, and set the source code directory and build directory.
2. Press the Configure button, select VisualStudio 11 2012, click OK, and wait for the configuration to complete.
3. At the VTK node, locate and check VTK_GROUP_QT. Press the Configure button and wait for the configuration to complete. When done, CMake will report an error and click OK.
4. In the UngroundedEntries node with a red background, locate and change the value of VTK_QT_VERSION to 5. Set the value of QT_QMAKE_EXECUTABLE to C:/Qt/Qt5.3.2/5.3/msvc2012_opengl/bin/qmake. Exe. Press the Configure button and wait for the configuration to complete. When done, CMake will report an error and click OK.
5. In the UngroundedEntries node with red background, set the value of Qt5_DIR to C:/Qt/ qt5.3.2/5.3/msvc2012_opengl/lib/cmake/Qt5. Press the Configure button and wait for the configuration to complete. When done, CMake will no longer report errors.
6. On the CMAKE node, locate the CMAKE_INSTALL_PREFIX node and use the default Settings. This value is the installation directory of the VTK after compilation.
7. Click Add Entry button, set Name to CMAKE_DEBUG_POSTFIX, Type to STRING, Value to -GD, and click OK after setting. Press the Configure button and wait for the configuration to complete. Set this to ensure that the debug version of lib, DLL and release version of lib, the DLL name is different, to prevent later installation, both overwrite.
8. Click the Generate button and wait for the project VS file to be generated.
9. Locate the plugininstall. cmake file in the GUISupport\Qt folder of the build directory. Open it with Notepad and take line 5
SET (VTK_INSTALL_QT_PLUGIN_FILE QVTKWidgetPlugin. DLL)
Replace with
IF(BUILD_TYPE MATCHES Debug)
SET (VTK_INSTALL_QT_PLUGIN_FILE “QVTKWidgetPlugin – gd. DLL)”
ELSE()
SET (VTK_INSTALL_QT_PLUGIN_FILE QVTKWidgetPlugin. DLL)
ENDIF()
Note: Make sure that qvtkwidgetPlugin-gd.dll and qvtkwidgetPlugin.dll are surrounded by double quotation marks after substitution. Otherwise, subsequent compilation will return an error.
Save. This modification can prevent the QVTKWidgetPlugin file from being found when installing Qt plugin during debugging.

VS2012 compilation

1. Run VS as an administrator, click File, Open, and the dialog box pops up. Find the vtk.sln file in the path and open it.
2. In Solution Manager, go to ALL_BUILD, right-click, and click Build. Wait for VS to compile. When finished, find Install, click the right mouse button, and click Create.
3. Change the solution configuration to Release. In Solution Manager, go to ALL_BUILD, right-click, and click Build. Wait for VS to compile. When finished, find Install, click the right mouse button, and click Create.
4. After the above steps are completed, the compiled file will be in the path set by CMAKE_INSTALL_PREFIX.

Howto Install and Configure VTK on Ubuntu

Howto Install and Configure VTK on Ubuntu

    Download vtk-5.10.1.tar.gz fromhttp://vtk.org/VTK/resources/software.html#latestand extract; $cd/home/chen/Downloads/VTK5.10.1/ $mkdir VTKBin $cd VTKBin $cmake .. $ccmake .. configure as follows:
    press c to configure, and press g togenerate and exit;
    $make copy the include files andlibraries to system directories: $sudo make install copy the plugin to qt:

      $cd /usr/lib/qt4 sudo mkdir plugins cd plugins sudo mkdir designer sudo cp~/Downloads/VTK5.10.1/VTKBin/bin/libQVTKWidgetPlugin. so/usr/lib/qt4/plugins/designer open qtcreator (can be installedfrom Ubuntu Software Center) create one Gui application and open the ui by qtdesigner tocheck QVTKWidget.

To use VTK in your own project, addfollowing to the CMakeLists.txt in your project:
########################################################
#VTK
#set(VTK_DIR”~/Downloads/vtk/VTK5.10.1/build”)
set(VTK_DIR “/usr/local/lib/vtk-5.10”)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
########################################################

add target link libraries to yourproject: ${VTK_LIBRARIES} QVTK

A complete example of using VTKtogether with Qt in a CMake project can be found at:
http://blog.csdn.net/owldestiny/article/details/8806128.

Herewe give a complete CMake project using both Qt and VTK, the completeprogram can be download athttp://download.csdn.net/detail/owldestiny/5262489:
Theproject structure is:
└──QtVtkTest
├──bin
│  └── QtVtkTest
├──build
├──CMakeLists.txt
├──include
│  └── QtVtkTest.h
├──qrc
├──src
│  ├── main.cpp
│  └── QtVtkTest.cpp
└──ui
└── QtVtkTest.ui

Inthis project we do not use qrc.
TheCMakeLists.txt is:
======================================================================
cmake_minimum_required(VERSION2.8)
project(QtVtkPCLTest)

set(CMAKE_BUILD_TYPEdebug)
########################################################
#Qt
find_package(Qt4REQUIRED)
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
########################################################

########################################################
#VTK
#set(VTK_DIR”~/Downloads/vtk/VTK5.10.1/build”)
set(VTK_DIR”/usr/local/lib/vtk-5.10″)
find_package(VTKREQUIRED)
include(${VTK_USE_FILE})
#MESSAGE(STATUS${VTK_LIBRARIES})
########################################################

########################################################
#PCL
find_package(PCL1.3 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
########################################################

########################################################
#Projectsettings
#set(PROJECT_SOURCESmain.cpp)#all sources files
set(LIBRARY_OUTPUT_PATH${PROJECT_SOURCE_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH${PROJECT_SOURCE_DIR}/bin)
include_directories(${PROJECT_SOURCE_DIR}/include${CMAKE_CURRENT_BINARY_DIR})#to include ui_*.h generated byQT4_WRAP_UI, you should include ${CMAKE_CURRENT_BINARY_DIR}
aux_source_directory(${PROJECT_SOURCE_DIR}/src/PROJECT_SOURCES)
########################################################

########################################################
#GenerateQt files
set(PROJECT_HEADERS${PROJECT_SOURCE_DIR}/include/QtVtkPCLTest.h)#only headers includeQ_OBJECT
QT4_WRAP_CPP(PROJECT_HEADERS_MOC${PROJECT_HEADERS})

set(PROJECT_UI${PROJECT_SOURCE_DIR}/ui/QtVtkPCLTest.ui)#ui file
QT4_WRAP_UI(PROJECT_UI_UIC${PROJECT_UI})
#file(COPY${PROJECT_UI_UIC} DESTINATION ${PROJECT_SOURCE_DIR}/include/)#copyui_.h file to include
#message(STATUSPROJECT_UI: ${PROJECT_UI})
#message(STATUSPROJECT_UI_UIC: ${PROJECT_UI_UIC})
#message(STATUSCMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR})
#message(STATUSPROJECT_BINARY_DIR: ${PROJECT_BINARY_DIR})
#message(STATUSCMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR})
#message(STATUSPROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR})
#message(STATUSCMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR})

#set(PROJECT_RC${PROJECT_SOURCE_DIR}/qrc)#resource files
#QT4_WRAP_RESOURCES(PROJECT_RC_RCC${PROJECT_RC})
########################################################

########################################################
#generateexecutables and link libraries
add_executable(QtVtkPCLTest${PROJECT_SOURCES} ${PROJECT_HEADERS_MOC} ${PROJECT_UI_UIC})#${PROJECT_RC_RCC})
target_link_libraries(QtVtkPCLTest${QT_LIBRARIES} ${VTK_LIBRARIES} QVTK ${PCL_LIBRARIES})#QVTKQVTKWidget for VTK in Qt
======================================================================

The QtVtkTest. ui(only including one QVTKWidget) can be generated and edited by QtDesigner as:
======================================================================

<?xml version="1.0"encoding="UTF-8"?>
<ui version="4.0">
<class>mainWindow</class>
<widget class="QMainWindow"name="mainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>722</width>
<height>512</height>
</rect>
</property>
<property name="windowTitle">
<string>Qt VTK Test</string>
</property>
<widget class="QWidget"name="centralwidget">
<widget class="QVTKWidget"name="qvtkWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>691</width>
<height>471</height>
</rect>
</property>
</widget>
</widget>
<widget class="QStatusBar"name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
<class>QVTKWidget</class>
<extends>QWidget</extends>
<header>QVTKWidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

======================================================================

The main.cpp is:
======================================================================

#include <QApplication>
#include "QtVtkTest.h"


int main(int argc, char**argv)
{
QApplication app(argc,argv);
Qt_QtVtkTest qtTest;
qtTest.show();

return app.exec();
}

======================================================================

TheQtVtkTest.h is:
======================================================================

#include <QtGui/QMainWindow>
#include "ui_QtVtkTest.h"

class Qt_QtVtkTest: publicQMainWindow
{
Q_OBJECT
public:
Qt_QtVtkTest()
{
ui.setupUi(this);
}
public:
Ui::mainWindow ui;

};

======================================================================

Installation of Ubuntu + VTK

Sudo apt-get install libvtk5.2 libvtk5-qt4-dev sudo apt-get install libvtk5.2 libvtk5-qt4-dev
Different Ubuntu versions support different versions of VTK, here is Ubuntu 10.04, followed by QT4 support.
 
two
1. Download source code
Address: http://www.vtk.org/VTK/resources/software.html
The version is the latest
2. Unzip
The tar ZXVF… .
A VTK folder is created in the current directory
3. Install OpenGL
apt-get install mesa-common-dev libgl1-mesa-dev
4. Install ccmake
sudo apt-get install cmake-curses-gui
5.cd VTK
6.mkdir VTK-build
7.cd VTK-build
8.ccmake .. /
9. Press C to start the configuration and set VTK_USE_QT to ON. BUILD_SHARED_LIBS is set to ON
10. Press T to enter detailed setup, then locate QT_QMake_Executable, press ENTER to modify, and change QMAKE
The path of the input, for example:/home/zhang/QtSDK/Desktop/Qt/4.8.0/GCC/bin/qmake. Confirm and press Enter to exit the modification.
11. Press C to check the Settings.
12. Confirm by C.
13. Press G to generate makefile and exit CCMAKE automatically
14.make
15.sudo make install.
 
Add (.pro file) to the project
INCLUDEPATH =/usr/local/include/VTK to 5.10
LIBS + = L/usr/local/lib/VTK – 5.10 \
 
5.2
INCLUDEPATH =/usr/include/VTK to 5.2
LIBS += -L/usr/lib \
Select as needed at the end
-lvtkCommon -lvtksys -lQVTK -lvtkViews -lvtkWidgets -lvtkInfovis -lvtkRendering -lvtkGraphics -lvtkImaging -lvtkIO -lvtkFiltering -lvtklibxml2 -lvtkDICOMParser -lvtkpng -lvtkpng -lvtktiff -lvtkzlib -lvtkjpeg -lvtkalglib -lvtkexpat -lvtkverdict -lvtkmetaio -lvtkNetCDF -lvtksqlite -lvtkexoIIc -lvtkftgl -lvtkfreetype -lvtkHybrid
 
Command line compilation
G + + – o Cylinder – O3 – I/usr/include/VTK – 5.2 – L/usr/local/lib – Wno – deprecated – lvtkCommon lvtkDICOMParser – lvtkexoIIc – lvtkFiltering – LVTKFTGL – lvtkGenericFiltering lvtkGraphics — lvtkHybrid -lvtkImaging -lvtkIO -lvtkNetCDF -lvtkRendering -lvtksys -lvtkVolumeRendering -lvtkWidgets Cylinder.cxx
 
 

VTK (1) — compile and install

Project environment: QT+VTK+ CMAKE


The file packages used in this article are:

    visual studio 2013
    DXSDK_Jun10
    Cmake – 3.3.2 rainfall distribution on 10-12 – win32 – x86
    Qt5.7
    Qt – v – system.addin – 1 – opensource
    TBB (Thread Building Blocks)
    VTK 7.1

1. Install Visual Studio 2013 Community

    Download https://www.visualstudio.com/downloads/download-visual-studio-vs
    Select Visual Studio 2013 ->; Community 2013
    Download and install community default locations and default optional features (takes about half an hour to complete)

Common mistakes and solutions of cmake + QT + VTK

1. Installation environment
Cmake3.0 + QT4.8.6 + VTK5.10
PS.VTK6.10 or above can only be used with QT5.0 or above versions
2. Compile and install
Reference: http://blog.csdn.net/www_doling_net/article/details/8532742
3. Common mistakes
1, Could not find a package configuration file provided by “Qt5Widgets” with
any of the following names:

Qt5WidgetsConfig. Cmake
Qt5Widgets – config. Cmake

Add the installation prefix of “Qt5Widgets” to CMAKE_PREFIX_PATH or set
“Qt5Widgets_DIR” to a directory containing one of the above files. If
“Qt5widgets” provides a separate development package or SDK, be sure it has
been installed.
This error is generally caused by the incorrect selection of the version number of Qt. Carefully check whether the version number of Qt is 4 or 5. We can solve it.
2

Failing to find Glu32 is usually due to the wrong path. Be careful to check the installation path.
3. There are a lot of things you can’t select from the CMake process, such as the build file. You have to install something in order to be able to cmake, so try to follow the tutorial as much as possible.
What problems can leave a message below, a lot of problems, have not been able to recall in time.

Qt5 when compiling VTK_ The solution of dir-notfound

The module Module_vtkGUISupportQt and Module_vtkViewsQt are opened, and Qt5 is used. Qt5_DIR-NOTFOUND error CMake Configure Qt5_DIR-NOTFOUND error The solution is as follows.
1. QT5 installation path
Take my computer’s QT5 installation path as an example. On my computer, Qt is installed in: E: Toolkits\Qt\Qt5.5.1.
2. VTK source file path
I am using the official release of VTK 7.0.0.rc2. Unzip the VTK source code to: E:\Toolkits\ vtk-7.0.0.rc2 \source on my computer
QT5_DIR – NotFound = QT5_DIR – NotFound = QT5_DIR – NotFound
Open the file E:\Toolkits\ vtk-7.0.0.rc2 \source\ cmMakelists.txt in line 1 of the file as follows:

cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)

Add a line of script that reads:

cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
set (CMAKE_PREFIX_PATH "E:/Toolkits/Qt/Qt5.5.1/qtbase")

Configure Generate. Configure Generate.

Compilation errors and warnings encountered in QT and their solutions

Preface: study QT also has a period of time, during encountered a lot of various problems, write this summary paste, on the one hand to oneself a summary, on the one hand to give everyone a reference. Update irregularly ~
1.No rule to make target '.. /dd.bmp', needed by 'debug/qrc_res.stop
The file image.qrc has been compiled. Deleting the file from the resource directory will not change the compiled image.qrc file.

0 1. Delete corresponding resource file, add new
2. Comment out the corresponding code in.pro first, then remove the comment after compilation, then compile again will not report an error.

#RESOURCES += \
#    image.qrc

2:-1: error: [release/qrc_image.cpp] error 1br> <>bb3


Common errors and solutions of Qt development application under Ubuntu

Error: HelloWorld directly report error… :-1: error: cannot find -lGL
Reason: Lack of GL library
Sudo apt-get install libgl1-mesa-dev

I downloaded the latest version of QT-everywhere5.3.1, after porting it to the board directly created a Qt Quick program to run on the board, prompted the following error, can not find the solution online, ask how to solve this problem, thank you.
# ./qmlpng
QEglFSImx6Hooks will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync.
If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1
QQmlApplicationEngine failed to load component
qrc:///main.qml:1 module “QtQuick” is not installed
qrc:///main.qml:2 module “QtQuick.Controls” is not installed
qrc:///main.qml:1 module “QtQuick” is not installed
qrc:///main.qml:2 module “QtQuick.Controls” is not installed

Qrc :// main. QML :1 module “QtQuick” is not installed. $QTDIR/ QML will be installed in a folder if you install it.

QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
Failed to create OpenGL context for format QsurfaceFormat (version 2.0, options QFlags(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaB

Or try export QML_IMPORT_PATH=$QTDIR/ QML. It is not clear what it is, it may be different from project to project.

Export QML2_IMPORT_PATH=$QTDIR/ QML =$QTDIR/ QML
If this is not desired, you can override this via:
QEglFSImx6Hooks will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync.
If this is not desired, you can override this via: Export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1

The original address: http://www.qtcn.org/bbs/read-htm-tid-56902.html

On the problem that VTK + QT process can’t end after closing the program

Settle the qt + VTK + ikt display dicom image problems, when writing the program found another more fatal problem, namely the end of the program, the master can’t quit, just window closes, test for a long time, found that can’t jump into a destructor after close the window or write their own close function, simply close the window.
I later on qt to intercept window’s close button events, method from http://sunshine1106.blog.51cto.com/1371108/305106/, the author summarizes the study reference, but even perform qApp – & gt; The exit (0), or qApp – & gt; The quit () or qApp – & gt; Functions such as closeAllWindows () still cannot terminate the main program process.
Then I define setAttribute(Qt:: wa_deleteonClose, true) at the beginning; It doesn’t do the trick.
Later I tried to delete the VTKImageView2 object I had defined for VTKSmartPoint by calling its own delete function fastDelete (), and when I ran it I found that the process had been deleted.
Although the goal has been achieved, but still feel strange, the previous online introduction said that the VTK SmartPoint class is able to automatically delete the pointer according to the program, memory resources release, I do not know why in my program it can not automatically release.
A description of the Delete and FastDelete functions in the SmartPoint class is as follows:

<span style="font-size:14px;">  // Description:
  // Delete a VTK object.  This method should always be used to delete
  // an object when the New() method was used to create it. Using the
  // C++ delete method will not work with reference counting.
  virtual void Delete();

  // Description:
  // Delete a reference to this object.  This version will not invoke
  // garbage collection and can potentially leak the object if it is
  // part of a reference loop.  Use this method only when it is known
  // that the object has another reference and would not be collected
  // if a full garbage collection check were done.
  virtual void FastDelete();</span>