qt

QPainter::drawImage() glitches in Qt 5.10

流过昼夜 提交于 2021-02-08 09:50:44
问题 My application draws a 3D rendering to an offline QImage (without OpenGL for historical reasons) and then draws that QImage in a widget like this: void Render3dModel::paintEvent(QPaintEvent *event) { // Update model and render new image m_model.calculate(); QImage image = m_model.getImage(); // Draw image in widget QPainter painter(this); painter.drawImage(QPointF(0, 0), image); } The image gets repainted based on mouse movements using QWidget::update(): void Render3dModel::mouseMoveEvent

How can I change the mouse pointer when mouse over text with QStyledItemDelegate?

半世苍凉 提交于 2021-02-08 09:16:24
问题 How can I change the mouse icon when the mouse is over the text in item delegate? I have this part, but I can't find any example to change the mouse pointer. What am I missing? void ListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { if (index.isValid()) { int j = index.column(); if(j==4) { QString headerText_DisplayRole = index.data(Qt::DisplayRole).toString() ; QApplication::style()->drawPrimitive( QStyle::PE_PanelItemViewItem,

How can I change the mouse pointer when mouse over text with QStyledItemDelegate?

余生颓废 提交于 2021-02-08 09:16:15
问题 How can I change the mouse icon when the mouse is over the text in item delegate? I have this part, but I can't find any example to change the mouse pointer. What am I missing? void ListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { if (index.isValid()) { int j = index.column(); if(j==4) { QString headerText_DisplayRole = index.data(Qt::DisplayRole).toString() ; QApplication::style()->drawPrimitive( QStyle::PE_PanelItemViewItem,

How can I apply a colortable to my grayscale 8 bit image and convert it correctly in Qt?

╄→尐↘猪︶ㄣ 提交于 2021-02-08 08:56:19
问题 I would like to convert my grayscale_8 QImage to an Indexed_8 with a colortable. I found have found and tested functions that generate a colormap (MATLAB jet) accurately -- here is my code: for (double i = 0; i < 256; ++i) { double hi = 255; double lo = 0; double r = -4.0 * std::abs(i - 255.0 * 3.0 / 4) + 255.0 * 3.0 / 2; double g = -4.0 * std::abs(i - 255.0 * 2.0 / 4) + 255.0 * 3.0 / 2; double b = -4.0 * std::abs(i - 255.0 * 1.0 / 4) + 255.0 * 3.0 / 2; CP->colortable.append(qRgb(r < lo ? lo

How to plot the amplitude of audio file with c++?

狂风中的少年 提交于 2021-02-08 08:53:16
问题 I'm trying to create a program, using Qt (c++), which can plot the amplitude Signal (plot like audacity but dynamic waveform) when I playback an audio file (.wav, .mp3) using QAudiooutput and QIODevice . What I've done: with QAudioouput I can play the any audio file, with qwtplot I can plot any signal in 2D, in this case, x-axis will be time and y-axis will be the amplitude. Now, my problem is how to get the amplitude for each second (time)? Any help would be appreciated. 回答1: The normal,

can someone help me modify this code. I'm trying to Display a checkerboard C++ QT

风格不统一 提交于 2021-02-08 08:48:19
问题 I'm new to Qt and C++. I'm trying to create a checker/chess board where each square is an object. What I'm trying to figure out is how to have each square object be a part of the board object I'm declaring and display that on the screen. I can display a widget on the screen by using MyWidget.show() in the main class. But I want to do something like Board.show() and have all of the square objects that are members of that class(that have a height, width, and color) show up. With the code I

Determine visible size of a QTreeWidget column

℡╲_俬逩灬. 提交于 2021-02-08 08:44:21
问题 I need to determine the VISIBLE width of a column within a QTreeWidget. I'll explain my problem with a small example. A QTreeWidget defines three columns with the fixed width of col 1=200 px, col 2=100 px and col 3=300 px. The widget itself has a ( resizeable ) width of 350. The width of all colums ( 200 + 100 + 300 = 600 ) exeeds the with of the widget, so a scrollbar is shown. For some special calculation I need to know the visible width of the third column: Case A would be quite easy, I

Qt compile error: C2280: attempting to reference a deleted function

只谈情不闲聊 提交于 2021-02-08 08:41:50
问题 I have a relatively simple class that contains a layout with a few widgets (labels, lineEdits, pushButtons) that gets displayed as a card. It all works fine until I try to add signals and slots. The header file, below, compiles fine with the sections commented-out as shown. #include <QString> #include <QObject> #include <QWidget> class KMLFile //: public QObject { //Q_OBJECT public: KMLFile(); ~KMLFile(); QString m_originalFilename; QString m_originalPath; QString m_proposedFilename; QString

QT WebGL-stream, virtualKeyboard and touch screen problem

让人想犯罪 __ 提交于 2021-02-08 07:41:52
问题 As I see, the virtualKeyboard (plugin) sends touch and click event when qml application is running over WegGL-stream. Now I've trouble finding an easy workaround.. Does anyone have a good idea? Further is it a virtualKeyboard or a QPA-Plugin bug? Tried with QT 5.13.0, MSVC2017 64Bit / MinGW 64Bit compiler, Windows10, Chrome 76.0.3809.132 64Bit / Firefox. If application is not running over WebGL-stream, everthing works fine in terms of touch and click events. // Tests with QT Quick Virtual

Python QT Application with vlc does not show fullscreen

守給你的承諾、 提交于 2021-02-08 06:44:24
问题 I am working on an application where several vlc streams (rtsp) are shown and by double-clicking one of them, the stream should be displayed fullscreen. The application is python 3.7 using pyqt5 and vlc-qt. Code as follows: import sys import vlc from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtWebEngineWidgets import * from PyQt5.QtPrintSupport import * class MainWindow(QMainWindow): def __init__(self, *args, **kwargs): super(MainWindow, self)._