qt5

How to take webpage screenshots using QWebEngineView without opening window

可紊 提交于 2019-12-24 14:18:21
问题 I'm looking for a way to take website screenshots with QWebEngineView . The main goal is to develop a headless screencapture application that runs in the background. I've managed to get a minimal working example to work (see this for example). However, these examples require that the QWebEngineView widget is made visible, either with calls to QWebEngineView::show() , QWebEngineView::showMinimized() or even QWebEngineView::setVisible(true) , to be able to take a screen capture of a website. As

How do I implement the ability to edit a QTableWidget's vertical and horizontal header text in-line from the GUI instead of programmatically?

对着背影说爱祢 提交于 2019-12-24 10:48:18
问题 I have a QTableWidget that is displayed in the user interface that I can add and remove rows and columns using buttons. The problem is, when I add a row or column, I can change the data in the actual cells, but I cannot name the row or column. The name is simply a static number. Is there a way to allow the user of my program to perhaps double-click on a row/column header and edit the name in-line or something similar? Thanks. 回答1: As far as I know there is no built-in way to do this. However

Cmake: accessing qtvirtual keyboard module

我的梦境 提交于 2019-12-24 09:04:38
问题 Can anyone do a simple example of including qtvirtualkeyboard module into a cmake file? I want to access the classes but I cannot figure out how to include it. 回答1: This example should work. It was compiled using CMake 3.1.1 and Qt 5.11.1 The code is available in my GitHub account. The QML example is based on the example provided by Qt. Main CMakeLists.txt cmake_minimum_required(VERSION 3.1) # 3rd party tools find_package(Qt5 COMPONENTS Widgets Qml Quick REQUIRED) # Directory with the source

PyQt5 making dynamic widgets clickable and pass arguments to another function

限于喜欢 提交于 2019-12-24 08:44:10
问题 I am trying to make dynamic widgets and make them clickable. By clicking on one widget it should pass dynamic value to other widget. I have tried sender() and other options accessing the widget but nothing worked. All the widgets are sending information from the last widget. Below is the code: import sys from PyQt5.QtGui import QIcon, QPixmap from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, QPushButton, QLabel, QMessageBox,QSizePolicy, QLayoutItem,QFrame,QHBoxLayout,

Qt: data decryption using private/public key

走远了吗. 提交于 2019-12-24 08:39:39
问题 I want to decrypt data which has been encrypted using a private key. I can load the public key for decryption as follows: QFile file(":/sample.crt"); file.open(QIODevice::ReadOnly); const QByteArray bytes = file.readAll(); file.close(); QSslCertificate ssl(bytes, QSsl::Pem); //Key: ssl.publicKey(); But how can I use the key do decrypt the data? I know that there are 3rd party libraries like QCA (http://delta.affinix.com/qca/) but is it possible to do this with the built-in Qt functions?

QUdpSocket not working without bind

假如想象 提交于 2019-12-24 08:14:39
问题 I have to communicate with some device over UDP. The problem is that QUdpSocket doesn't not work at all without special case of bind(). I use the connectToHost() method for access to read()/write() functions. UDP exchange not working at all when using the code: m_udp.connectToHost(QHostAddress("192.168.100.15"), 4001); m_udp.waitForConnected(); The I don't receive any bytes. Message in Wireshark: The below code doesn't work too: m_udp.bind(QHostAddress("192.168.100.15"), 4001); m_udp

PyQt5 not finding installed Qt5 library

限于喜欢 提交于 2019-12-24 08:13:02
问题 On Ubuntu 16.0.4 , I am trying to run this PyQt5 script, and I have the distributed packages for Qt5 (via apt ) and PyQt5 (via pip3 ) installed. Error: sudo ./video_qt.py Traceback (most recent call last): File "./video_qt.py", line 8, in from PyQt5 import QtWidgets, QtCore ImportError: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not >found (required by /usr/local/lib/python3.5/dist-packages/PyQt5/QtWidgets.so) But it is there: ls /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 /usr/lib

QtCreator 4.1.0 dosn't show webengineview(QT 5.7) for MainWindow form editor

笑着哭i 提交于 2019-12-24 07:58:44
问题 I'm porting my app from QT 5.5 to QT 5.7. So I need to change WebKit to QWebeEngine, but I can't find QWebEngineView from Widget browser in Visual editor. How I get the QWebEngineView to Widget list. I have added QT += webenginewidgets to PRO file but it dosen't show the widgets. 回答1: Do you need the QWebEngineView in the Widget palette for any specific reason? You can use any of the web engine widgets directly from code (although it is of course not as simple as a drag-and-drop). As a simple

In a PySide2 app, how can I get the ID for a QWindow?

前提是你 提交于 2019-12-24 07:58:13
问题 In the version of PySide2 that ships with Maya2017, the winId method on the QWindow class seems to be missing: w.winId() Error: AttributeError: file <maya console> line 1: 'PySide2.QtGui.QWindow' object has no attribute 'winId' # Is there a way to get this value from an existing instance of QWindow? 回答1: I used Maya 2018 for macOS 10.11.6. Try this code. It works. from maya import OpenMayaUI as omui try: from PySide2.QtCore import * from PySide2.QtGui import * from PySide2.QtWidgets import *

Pointer to an element in QList

佐手、 提交于 2019-12-24 07:56:47
问题 I have a list of lists container with this type: QList< QList<UAVObject *> > objects; For some reason I would like to access one of the internal lists quickly. Can I store a pointer to an internal list? For example: QList<UAVObject *>& ref = objects[0]; QList<UAVObject *>* pt = &ref; Will the value of pt still be valid across different function calls and original objects manipulations? Let's assume that the objects list will only be added to and never removed from. 回答1: QList is not based on