qt5

Make item delegate in QTableView not transparent

◇◆丶佛笑我妖孽 提交于 2019-12-24 23:09:24
问题 I issued in problem with custom item delegate for QTableView. That problem is completely illustrated by that screenshoot: We can see item content behind item delegate editor. What is the best way to hide that content or make item delegate not transparent? (how I can get background color/brush for edited row?) 回答1: You need to let your editor to paint its own background by enabling the autofill background property: editor->setAutoFillBackground(true); 回答2: widget->setStyleSheet("background

Positioning API support on desktop platforms

Deadly 提交于 2019-12-24 21:54:01
问题 I've tried to build a webkit app using HTML5 geoposition APIs to get the current coordinates. I've also turned on the geolocation feature but it fails to start with error Failed to start Geolocation service Then I've tried to use QGetPositionInfoSource , but it can't find any available source to use. I wonder, is Positioning API supported on desktop applications? 回答1: That's a big no-no . Directly from the documentation: The Qt Positioning API provides positioning information via QML and C++

QAudioInput from array

狂风中的少年 提交于 2019-12-24 20:19:23
问题 I have a device with microphones that connects to my computer through Ethernet and it cannot be seen by Qt as an audio device, so, I get packets from it and put them to QByteArray. I need to play these packets from stream. Somewhere in the Internet I found a solution to almost the same problem, but there internal microphone was used. #include <QApplication> #include <iostream> #include <cassert> #include <QCoreApplication> #include <QAudioInput> #include <QAudioOutput> #include <QBuffer> int

Why can I not assign this Qt property?

回眸只為那壹抹淺笑 提交于 2019-12-24 19:57:34
问题 Qt throws the following error at runtime. Unable to assign LIMITS_T to LIMITS_T I assume that Qt needs more meta data information, but I don't know what I missing. I have done everything to declare the metatype: limits.h class LIMITS_T : public QObject{ Q_OBJECT Q_PROPERTY(float min READ readMin WRITE writeMin NOTIFY minChanged) public: LIMITS_T() : QObject() {} LIMITS_T(const LIMITS_T& limit) : QObject() { this->min = limit.min; } float min = 0; float readMin() { return min; } void writeMin

Qt5 - Windows : inconsistent dll linkage error and definition of dllimport static data member not allowed

岁酱吖の 提交于 2019-12-24 19:26:38
问题 I am trying to build a project using Windows 10 and Qt5.12 . The small program is using the smtp protocol available here. I can confirm that on my Windows I have the OpenSSL 1.1.1c 28 May 2019 . On my Ubuntu 19.04 the same exact program compiles and run as usual but not on Windows . I am attaching below a print screen of the errors; however those are mostly of two types: 1) inconsistent dll linkage 2) definition of dllimport static data member not allowed Following this link it seems that

QToolButton with text: Overwrite minimal height to minic regular button height

爱⌒轻易说出口 提交于 2019-12-24 18:00:54
问题 I am displaying QToolButtons with icon plus text ( Qt::ToolButtonTextBesideIcon ) outside of a tool bar. Each button has a QAction associated with it which determines the used icon and the displayed text. All those buttons are placed inside a QGridLayout. So far so good. Unfortunately, it looks like that as soon as you add a QAction to a QToolButton, Qt automatically decides to shrink it down to the minimal size, which is not what I want given my QGridLayout. I used the following lines to

python 3 how to put pics inside my program

旧城冷巷雨未停 提交于 2019-12-24 17:53:09
问题 I have a program and couple of pics which I use in the program. icon.addPixmap(QtGui.QPixmap("logo_p3.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.label_6.setPixmap(QtGui.QPixmap("Logo-4.jpg")) Pics are in the same folder with the program. Is there any way to put pics INSIDE the program? (While they are just in the folder they can be easily changed or deleted, and I don't want it to happen) May be something like this: k=b'bytes of pic here' self.label_6.setPixmap(QtGui.QPixmap(k)) or any

SDL_CreateWindowFrom() with Qt widget under Mac OS

六眼飞鱼酱① 提交于 2019-12-24 15:19:21
问题 I am using libSDL2 in a Qt app. The code is working well under Linux and Windows but is failing under Mac OS. Here is the crash output: 2015-05-12 10:24:35.598 testapp[4621:105425] -[QNSView title]: unrecognized selector sent to instance 0x7fdfbac7b8e0 2015-05-12 10:24:35.643 testapp[4621:105425] An uncaught exception was raised 2015-05-12 10:24:35.643 testapp[4621:105425] -[QNSView title]: unrecognized selector sent to instance 0x7fdfbac7b8e0 2015-05-12 10:24:35.643 testapp[4621:105425] ( 0

How to remove this space(margin) from a QWidget form

爷,独闯天下 提交于 2019-12-24 14:52:50
问题 I have a QWidget form , then I have added QTextEdit on the form, but there is a space(margin) in the top. I tried to use the following: QWidget *widget = new QWidget(this); widget->layout()->setContentsMargins(0,0,0,0); But unfortunately, it did not do what I want. How to remove that space(margin) to be like the left , right and down side ? Full code QWidget *widget = new QWidget(this); QTextEdit *TextEdit = new QTextEdit(widget); QMdiSubWindow *mdiWindows = ui->mdiArea->addSubWindow(widget);

Qt Implementation of selecting items from list into other list (Dual List, Accumulator, List builder, TwoListSelection …)

一曲冷凌霜 提交于 2019-12-24 14:44:27
问题 I want to select an arbitrary amount of items from a list of arbitrary length. A dropdown (QComboBox) doesn't allow checkable items. A list of checkable items would become clumsy with a lot of items. I found this question in the User Experience SE subsite and this answer seems to be the solution that best suits my needs. It has many names, as a comment in said answer remarks: Dual List, Accumulator, List builder, TwoListSelection ... The version from OpenFaces.org shown in the answer linked