qt

QQuickView - resize the content without delay / lag

孤者浪人 提交于 2021-02-20 19:12:11
问题 An image often being the easiest way to explain something, here is a little screengrab of the problem I'm having: If you look at the right side of the window, you can see that the content is resized with a visible lag / delay. It's a problem that happens in quite a lot of applications, but I was wondering if there is a way to fix this in a Qt application using QQuickView and QML content. Basically my application is created like this: QQuickView view; view.resize(400, 200); view.setResizeMode

QQuickView - resize the content without delay / lag

丶灬走出姿态 提交于 2021-02-20 19:11:21
问题 An image often being the easiest way to explain something, here is a little screengrab of the problem I'm having: If you look at the right side of the window, you can see that the content is resized with a visible lag / delay. It's a problem that happens in quite a lot of applications, but I was wondering if there is a way to fix this in a Qt application using QQuickView and QML content. Basically my application is created like this: QQuickView view; view.resize(400, 200); view.setResizeMode

Qt那些事0.0.27 之 QUdpSocket组播通讯

大城市里の小女人 提交于 2021-02-20 14:50:27
刚刚写的因为网断了就丢了,不想写了。 关于组播通信失败,大概率因为多网卡,通过 ipconfig 可以查看具体网卡情况。 C:\WINDOWS\system32>ipconfig 无线局域网适配器 WLAN: 连接特定的 DNS 后缀 . . . . . . . : 本地链接 IPv6 地址. . . . . . . . : fe80::--------78%18 IPv4 地址 . . . . . . . . . . . . : 192.168.3.165 子网掩码 . . . . . . . . . . . . : 255.255.255.0 默认网关. . . . . . . . . . . . . : 192.168.3.1 以太网适配器 本地连接* 12: 连接特定的 DNS 后缀 . . . . . . . : 本地链接 IPv6 地址. . . . . . . . : fe80::---------620%3 IPv4 地址 . . . . . . . . . . . . : 3.3.0.154 子网掩码 . . . . . . . . . . . . : 255.255.0.0 通过 wireshark 抓包发现,走组播的数据包是通过 3.3.0.154 接口发出。因此,查询相关知识,window系统,网络路由是自动选择,因此最后通过修改路由表解决此问题。 C:

【Qt开发】StyleSheet使用总结

人盡茶涼 提交于 2021-02-19 08:26:17
概述 转眼七年过去了,我是一个彻底拥抱过MFC的人,记得老大的一个需求要把按钮做成圆角,并添加背景颜色,做前端html的可能认为很简单,然而放到MFC上那可真的是很...很麻烦的,自定义类继承Button ,新手估计还搞不定,怎么也有上百行代码,实在不友好,Qt诞生大大简化了这些工作,只需要使用QSS(Qt Style Sheet)就可以轻松做到,最近详细了解了QSS,做了个百度网盘的登录界面,整理好我会把源码放出来,供大家参考。 QSS语法 background-color:rgb(6, 168, 255);    背景色 color:red;                字体颜色 border-radius:5px;            边框圆角半径 border:2px solid green;         边框2像素,实现,绿色 font:10pt;               字体大小10 设置QSS方法 方法一:UI界面设置 鼠标到按钮上右键,"改变样式表",在编辑样式表对话框中添加QSS样式。 方法二:程序添加 每一个控件都有 setStyleSheet (const QString &styleSheet)方法,样式字符串直接传参即可,例: ui.pushButton1->setStyleSheet("QPushButton{background-color

Qt project include subprojects build in qmake

微笑、不失礼 提交于 2021-02-19 08:18:13
问题 I have a cross-platform project written in Qt/C++, this project uses a static library that is written in Go as a dependency. Go project generates two files ( .a and .h as expected) using GNU Make. I am trying to automate builds for which I am using qmake to generate Makefile and then calling default target of this Makefile as simple $ make . Right now my build first explicitly does git clone go-subproject && cd go-subproject && make , then it copies over resulting library and headers file and

Qt Virtual Keyboard in QQuickWidget

夙愿已清 提交于 2021-02-19 06:23:08
问题 It is possible to show Virtual Keyboard in QQuickWidget or in QWidget? I have QWidget application and I need to have better control where VirtualKeyboard is shown. Today I spend all my day to find a solution, unfortunately without success. 回答1: The following code shows that it is valid to use virtualkeyboard in QQuickWidget. main.cpp #include <QApplication> #include <QQmlApplicationEngine> #include <QQuickWidget> int main(int argc, char *argv[]) { qputenv("QT_IM_MODULE", QByteArray(

Cannot get QWindow::fromWinId to work properly

被刻印的时光 ゝ 提交于 2021-02-19 06:20:28
问题 My Qt 5.9 program (on X11 Linux) launches other applications, using QProcess . I would like to have control over windows these applications spawn, so I obtain their winId value and use QWindow::fromWinId to get a QWindow instance. The problem is these instances are invalid and do not represent the window they are supposed to. If I check the winId values using xwininfo , the correct information is returned, so I know they are good. What am I doing wrong? Edit: An example won't help much, but

FileDialog in Qml not working in Release

ⅰ亾dé卋堺 提交于 2021-02-19 06:16:29
问题 I am working on project with Qt Quick Control 2 . When I try to run my software in debug mode FileDialog.qml opens perfectly but when I deploy it as release mode it doesn't work. Here is my code: import QtQuick 2.4 import QtQuick.Window 2.2 import QtQuick.Controls 1.3 import QtQuick.Dialogs 1.0 // File Dialog to browse FileDialog { id: openDialog title: "Please Select An Image" folder: shortcuts.pictures nameFilters: ["Image files (*.BMP)"] modality: Qt.NonModal selectExisting: true /* * do

Error bar in QT

霸气de小男生 提交于 2021-02-19 06:10:20
问题 I am trying to create Error bar in QT using Box and Whiskers. I get the following plot: But desired is something like this Code for box i used is: QBoxSet *box = new QBoxSet(0); box->setValue(QBoxSet::LowerExtreme, min); box->setValue(QBoxSet::UpperExtreme, max); box->setValue(QBoxSet::LowerQuartile,fres); The QBoxSet::LowerExtreme is behind the box, how I can move it on top of the box? or is there any other method to do this? 来源: https://stackoverflow.com/questions/46276086/error-bar-in-qt

Reducing WAV sound file size, without losing quality

*爱你&永不变心* 提交于 2021-02-19 05:32:59
问题 My application needs to play sound files. The only cross-platform file format I can use is WAVE (I'm using QSound of the Qt framework). The file sizes of these sounds are quite large and I'd like to know if there is a way to reduce it, without losing (too much) quality. I need the file to be stereo. 回答1: You can zip them (using zlib or similar), then uncompress them on demand. If you've got many minutes of continuous wav it may be worth looking into audio-specific lossless compression