qt5

How do you port QUrl addQueryItem to Qt5's QUrlQuery?

╄→гoц情女王★ 提交于 2019-12-31 21:22:52
问题 In Qt 4, the following code using QUrl works: QUrl u; foreach (const settings::PostItem & pi, settings.post) u.addQueryItem(pi.name, pi.value); postData = u.encodedQuery(); NOTES : this code is from wkhtmltopdf and postData is a QByteArray. However, Qt 5 does not have the addQueryItem() function anymore. How do you port this code? 回答1: In order to ensure compatibility with Qt 4, add the following lines at the top of your file: #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) # include <QUrlQuery>

How do you port QUrl addQueryItem to Qt5's QUrlQuery?

白昼怎懂夜的黑 提交于 2019-12-31 21:22:30
问题 In Qt 4, the following code using QUrl works: QUrl u; foreach (const settings::PostItem & pi, settings.post) u.addQueryItem(pi.name, pi.value); postData = u.encodedQuery(); NOTES : this code is from wkhtmltopdf and postData is a QByteArray. However, Qt 5 does not have the addQueryItem() function anymore. How do you port this code? 回答1: In order to ensure compatibility with Qt 4, add the following lines at the top of your file: #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) # include <QUrlQuery>

Warning QPainter inside paintEvent [duplicate]

两盒软妹~` 提交于 2019-12-31 06:18:09
问题 This question already has an answer here : paintEvent in QTableView derived class: Paint device returned engine == 0, type: 1 (1 answer) Closed 2 months ago . I tried to draw some more information in QChartView so I re-implement paintEvent virtual void paintEvent(QPaintEvent *event) { QChartView::paintEvent(event); OmenChart *mchr = dynamic_cast<OmenChart *>(this->chart()); if(mchr == nullptr) return; QPainter painter(this); const int labelOffset = 2 + 2; painter.setFont(this->font());

How to code a drop-down selection box with auto-completer in Qt5 (pyqt5)

北战南征 提交于 2019-12-31 05:09:18
问题 A GUI I am amending must show a drop-down read-only list of text lines (a QComboBox), in which the user will choose one line. As there may be several dozen items in this list, I would like to incorporate the ability for the operator to type a string while focus is on the drop-down and have it auto-position at the first element containing that string (not necessarily a leading sub-string). It seems impossible to implement anything like this using a QComboBox with a QCompleter because as the

LD_LIBRARY_PATH failing while trying to run Qt app

[亡魂溺海] 提交于 2019-12-31 03:46:10
问题 I want to run a Qt 5 based application usind dynamic libraries on Linux. In summary, a script will copy the executable and other relevant files, including all required .so inside a lib folder, to the desired destination and a script calling gksudo will work as caller to the app. Till now everything works fine till I call the executable script: the app doesn't run. When I ask to run with sudo , it tells me that a library (Qt5SerialPort...) is missing. Running ldd over the actual executable I

QT QWebEngine render after scrolling?

回眸只為那壹抹淺笑 提交于 2019-12-31 01:27:08
问题 Saving an image of a webpage with a WebEngineView works fine, but when I want to scroll and save another image, the resulting image does not show the website has been scrolled (it shows the top of the webpage). My question is: how do I scroll down in the QWebEngineView then save a screen shot that shows the correctly scrolled webpage? I take a screenshot at the top of the webpage, scroll down ~700 pixels, wait for a javascript callback to trigger which then takes another screenshot. The

Android back button press doesn't trigger keys.onreleased qml

烂漫一生 提交于 2019-12-30 18:57:31
问题 I am creating a program in Qt5.3 and Qtquick2.1. I am trying to capture back button press on android in my code using Keys.onReleased. But that event is not getting triggered. Also I have set the item focus to true. But still no success. Here is the code sample import QtQuick 2.1 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 Rectangle { id: main2 focus: true width: Screen.Width height: Screen.Height Keys.enabled: true Keys

Android back button press doesn't trigger keys.onreleased qml

核能气质少年 提交于 2019-12-30 18:57:06
问题 I am creating a program in Qt5.3 and Qtquick2.1. I am trying to capture back button press on android in my code using Keys.onReleased. But that event is not getting triggered. Also I have set the item focus to true. But still no success. Here is the code sample import QtQuick 2.1 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 Rectangle { id: main2 focus: true width: Screen.Width height: Screen.Height Keys.enabled: true Keys

How to convert 'QVideoFrame' with YUV data to 'QVideoframe' with RGBA32 data in Qt?

眉间皱痕 提交于 2019-12-30 11:10:38
问题 I receive QVideoFrames from webcam, and they contain image data in YUV format ( QVideoFrame::Format_YUV420P ). How can I convert one such frame to one with QVideoFrame::Format_ARGB32 or QVideoFrame::Format_RGBA32 ? Can I do it without going low level, using just existing functionality in Qt5 ? Example: QVideoFrame convertFormat(const QVideoFrame &inputframe, QVideoFrame::PixelFormat outputFormat) { // What comes here? } //Usage QVideoFrame converted = convertFormat(mySourceFrame, QVideoFrame:

Show Qt3D stuff inside QWidget in Qt5

不羁的心 提交于 2019-12-30 11:01:35
问题 So I felt all warm and fuzzy inside after reading that Qt3D has re-emerged in a v2.0 and is in fact becoming a part of Qt5 soon and that parts of it is already available for testing as a tech preview. I set out with a simple plan, I would have Qt3D working inside a widget in my existing C++/widgets based application. However the only example I could find that shows how to use Qt3D from C++ is called basicshapes-cpp, and it shows some shapes rendered in a separate OpenGL/Qt3D prepared window