Tag Archives: qt

The crash of delete after QT removeitem in qgraphicsscene and the display residue

Problem description

In the process of using QT’s graphicsview framework to create and interact with user-defined items, you need to remove unnecessary user-defined items. However, after the user-defined items interact with the re implemented rotation and scaling, removeitem () + delete will occasionally cause the error of accessing illegal memory, and even if you only use removeitem (), there will occasionally be residual items in the view.

Solutions

Using setitemindex method of qgraphicsscene (qgraphicsscene:: Noindex);
to disable quick query of index can solve the above problem.

other

For the problem of whether to delete after using removeitem(), the official question has given a clear explanation

The ownership of item is passed on to the caller (i.e., qgraphics scene will no longer delete item when destroyed).
remove the item and all its children from the scene. Ownership of the item is passed to the caller (that is, qgraphicsscene will not delete the item when it is destroyed).

So remember to delete

glCreateProgram error

Troubleshut< opengl>:

Problem Description:

Today, I encountered an OpenGL error. I doubted my life. The error report is as follows:
glcreateprogram() is a function in glew. I thought that the library connection was wrong. Then I connected all kinds of glew32.lib to the computer for a long time. By chance, I found that glew had no init and fainted…

Solution:

Execute before calling:
/* initialize glew. */
glewexperimental = GL_ TRUE;
GLenum err = glewInit();
if (err != GLEW_ OK)
{
std::cout << “Error initializing GLEW: ” << glewGetErrorString(err)
<< std::endl;
std::exit(EXIT_ FAILURE);
}

C + + common errors: “error: XXX in namespace ‘STD’ does not name a template type”

Error “error: XXX in namespace ‘STD’ does not name a template type”
is reported

Or “error: XXX does not name a type”

Cause of error

The corresponding header file was not imported

resolvent

Add the corresponding header file

string

#include <string>

list

#include <list>

vector

#include <vector>

function

#include <functional>

Compiling QT project under vs encountered “error 89error msb6006:“ cmd.exe ”Exited with code 3

Pro files have been compiled in Qt Creater, cross-platform Qt is compiled under VS2010, this part see how to cross-platform Qt compilation related knowledge, here do not repeat.
Error 89error MSB6006: “cmd.exe” has been exited, code is 3. According to the method of http://blog.csdn.net/mlj318/article/details/6778605 online to try, not solve the problem.
Right-click on the project properties and select Convert Projext to Qt Add in Project.

Qaudiooutput play sound

Voice QAudioOutput: : setVolume set size, there will be noise
solution is setSampleType by UnSignedInt SignedInt instead

QAudioFormat fmt;
fmt.setSampleType(QAudioFormat::SignedInt);

Reference since:
https://stackoverflow.com/questions/32821706/noise-after-changing-volume-in-qaudiooutput

Configuration and use of qt5.9.6 and vs2015

To do the interface but MFC is really, so decisive try Qt to achieve interface, Qt5.9.6 +VS2015+ OpenCV2.4.13
Software used: QT5.9.6
VS2015
Reference address: Qt5.7 + VS2015 environment structures, https://blog.csdn.net/liang19890820/article/details/53931813
VS2015 called QT small routines: https://blog.csdn.net/horizons_kong/article/details/53006047
Qt Creator and v + Qt some small notable difference at https://blog.csdn.net/qq295456059/article/details/52781726
1. Download and install VS2015 and QT5.9.6
Enter VS2015 official download page, download VS2015 Community Edition – Visual Studio Community.
When installing, remember to check the VC++ option of the programming language option, other directly default, as shown in the figure below, otherwise Qt may not detect the compiler, I have encountered this problem, I will record it later.
           
QT5.9.6 Download and install
Enter the official download page of Qt, I downloaded 5.9.6, you can choose the version, it is recommended to choose a newer version, I downloaded Qt – Opensource-Windows-x86-5.9.6. exe, click download can be.
Then install, default next step, but pay attention to the installation component selection, as shown in the figure below, MinGW and msvc2015-64bit(self-adjusting selection) be sure to check.
The other steps are the default next step. After installation, go to the Start screen and open Qt Creater.
2. Configure Qt Creator
Open Qt Creator, and the interface looks like this
To realize the mutual invocation of VS and Qt, you also need to configure Qt Creator. Click Tools ->; Options – & gt; Build and Run –
You need to configure the compiler, debugger, and so on. If C++ has been checked, the compiler will automatically detect VS2015. If you have not checked the “Visual C++” option when installing VS2015, the compiler will automatically detect VS2015.
Note: it doesn’t matter if it can’t be detected, do not uninstall and reinstall. You can modify it according to the following figure.
Enter the control panel ->; Programs and features, find Microsoft Visual Studio Community 2015 Updates, right-click and select “Change”.
Then check VC++ again as mentioned before. At this point, you can be surprised to find a compiler
Click on the Build Suite in the following image. You can see the warning symbol displayed in front of the build suite that is automatically detected. The debugger section shows “None”, indicating that the debugger has not been configured.
      
3. Configure the debugger
The debugger is not available by default, but again, it is necessary to download the Windbg manually. The debugger download address: https://www.microsoft.com/zh-cn/p/windbg-preview/9pgjgd53tn86?rtc=1
Then install can be, install the following tick, the default installation
As long as you can implement the following image, detect the Debugger in the Debugger is automatically detected
4. Configuration VS
To implement VS call Qt, you need to install the related plug-in, as shown in the figure below.
Select: online, search the keyword “Qt”, and relevant plug-ins will appear, as shown in the figure below. Select to download:
When you’re done, you’ll find Qt VS Tools in the menu bar
 
5. Configuration of QT
Select: Qt VS Tools ->; Qt Options, configuring Qt 5.7. Click “Add” button, Path select D:\ QT \ QT5.7.1 \5.7\ MSVC2015_64, then click “OK” to save.
Note: Unable to find a Qt build! Will appear when creating a Qt project if Qt is not configured. error
The following figure
 
Here, VS2015 + QT5.9.6 configuration is completed, the next blog, write how to use QT in VS interface
— — — — — — — — — — — — — — — — — — — — —
the author: students with excellent grades home occupy
source: CSDN
the original: https://blog.csdn.net/guanzhen3657/article/details/81486116
copyright statement: this article original articles for bloggers, reproduced please attach link to blog!

QGIS uses qt4.6.3 to upgrade to the version compiled by qt4.8.3


To extend functionality, upgrade the Qt version of QGIS, which can be quickly upgraded using the CMake tool.

Step 1: Type the source data path from the CMake UI, such as: D:\Projects\numbers\source
Step 2: in the CMake UI interface to Build the project path, such as: D: \ Projects \ Numbers \ Build, CMake will automatically load at this time the Build qgis engineering under the



Step 3: Click Geneate Configure to generate a new project. Then you can develop with VS

QT learning 3: configuration and testing of QT creator 2.4.1 development environment

1. System environment
Host operating system: Ubuntu 10.04
Host compiler: gcc4.4.3,
Cross compiler: arm-linux-gcc-4.3.2
Prerequisites: build three compiled versions of Qt4.6.3: PC,X86, ARM
 
2. Install
Qt_SDK_Lin32_offline_v1_2_en.run
Download address: http://www.developer.nokia.com/dp?uri=http%3A%2F%2Fsw.nokia.com%2Fid%2F8ea74da4-fec1-4277-8b26-c58cc82e204b%2FQt_SDK_Lin32_offline
 
Run it directly and follow the default steps to install it. It’s included
Qt creator — against 2.4.1
 
3. Configuration of Qt-Creator development environment
1. Start Qt-Creator.
2. In the QT-Creator menu bar Tools–>; Options opens the Options window.
3. On the left side of the Options screen, click Build & Run—> The right side of QtVersions displays the QTVersions setting interface.

 
4. Click Add on the right side to Add the path of qmake:

At this point, Qt- Creator is configured.
 
 
 
5 sample
Here is divided into two parts, first compiled under x86, and run under QVFB, and then compiled under ARM, moved to the development board to run.
From/usr/local/Trolltech QtEmbedded 4.6.3/demos copy books routines to root under/TMP folder.
 
5.1×86 compilation and debugging
5.1.1 Start Qt-Creator, File–>; Open File or Project,
Open the root/TMP/books/books. Pro.
 
5.1.2 Select Compiler

Click Finish and the screen appears

The lower on the left allows you to modify compiler-specific configurations at any time
 
5.1.3 Modify the configuration
Click and add the -qws parameter, because you want to run under QVFB

 
5.1.3 compile

5.1.3 run
Start the QVFB
#qvfb -width800 -height 480 &
Run

So this is the result
 
5.2 Compiling and debugging under ARN
Leave it on hold
 

 

Reference:
1. Qt embedded environment construction and transplantation
http://blog.chinaunix.net/uid-26119896-id-3141782.html
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Make :arm-linux-g++:Command Not Found Make :arm-linux-g++:Command Not Found Make :arm-linux-g++:Command Not Found: Make :arm-linux-g++:Command Not Found: Make :arm-linux-g++:Command Not Found

Upgrading QT4 project to Qt5 project

QT5 and QT4, there are a lot of changes and differences, you can refer to: changes from QT4 to QT5.
I am a computer installed Qt5.9.1, running in the c + + GUI Qt4 programming (second edition) with some problems happened when source program, this article will introduce how to upgrade to Qt5 Qt4 engineering, and run in the new version of the Qt Creator.
in the c + + GUI Qt4 programming (second edition) programs in the second chapter gotocell2 as an example, the original project directory contains the following five files:
.
and then open the gotocell2 pro file, Qt Creator will start to appear the interface for the following.

ick Configure Project to enter the Project configuration screen. In the General box, check Shadow Build, and then modify the Build Directory to suit your needs. Then click the Run button in the left toolbar.
Note: Neither the project file path nor the Build path can contain Chinese characters.

run as a result of an error, cannot find the relevant header files:
in.
solution is pro file begins with the following two lines of code:

QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

If you run it again, it will return an error. Because the change to the.pro file you just made requires a qmake to take effect.
In the project directory navigation window, select the project root folder ->; Right click – & gt; The Run qmake. Rerun it, and you get the desired result.

Because this project is relatively simple, the module used is few, so just modify the. Pro file can be. However, if the project is large and uses more functional modules, more modifications may be needed to run the program correctly.
#include <
#include <
#include <
#include < QtGui> change to include < QtWidgets> .