Qt - Reddit
15 subscribers
302 photos
52 videos
4.3K links
News and discussion for the Qt Framework.

Subreddit: https://www.reddit.com/r/QtFramework

Powered by : @r_channels & @reddit2telegram
Download Telegram
QVideoSink in Qt6.7

Hi... I was just wondering if it was possible to play a video using QVideoSink in Qt without using the concepts of multimedia concepts in qml i.e Video and VideoOutput because my target device is not supporting multimedia concepts in qml

https://redd.it/1cnwzzl
@qt_reddit
Unable to build my project, ui header not found (Qt6, Clion, Windows)

Hello, recently tried to convert my shell app into a GUI app with Qt, but had some problems at build time.

Currently I get this error:

C:/Users/Albert/Documents/COALAs/monkey-model-kit/src/gui/MonkeyWindow.cpp:9:10: fatal error: uiMonkeyWindow.h: No such file or directory
9 |
#include "uiMonkeyWindow.h"
| ^~~~~~~~~~~~~~~~~~~

Here's what my project directory tree looks like more or less (only kept the code files and removed resources):

https://preview.redd.it/smwzwqcbfgzc1.png?width=972&format=png&auto=webp&s=88c54d1e93fa168501ca30d396f26413ecef8e6a

The Cmakelists looks like this:

cmakeminimumrequired(VERSION 3.28)
project(MonkeyModelKit LANGUAGES CXX)

set(CMAKEPREFIXPATH "C:/Qt/6.6.0/mingw64")
set(CMAKE
AUTOMOC ON)
set(CMAKEAUTORCC ON)
set(CMAKE
AUTOUIC ON)
set(CMAKEAUTOUICSEARCHPATHS ${CMAKECURRENTSOURCEDIR}/gui)
findpackage(Qt6 COMPONENTS
Core
Gui
Widgets
REQUIRED)

set(SOURCES
src/main.cpp
src/StringManipulation.cpp
src/run/MonkeyShell.cpp
src/run/MonkeyManager.cpp
src/run/MonkeyFile.cpp
src/col/MonkeyModel.cpp
src/col/MonkeySession.cpp
src/col/MonkeyCollection.cpp
src/gui/MonkeyWindow.cpp
# Add more source files as needed
)

set(UI
FILES
src/gui/MonkeyWindow.ui
# Add more UI files as needed
)

qt6wrapui(UIHEADERS ${UIFILES})

includedirectories(
include/
include/col
include/run
include/gui
/gui
)

add
executable(MonkeyModelKit WIN32
${SOURCES}
${UIFILES}
${UI
HEADERS}
)
targetincludedirectories(MonkeyModelKit
PRIVATE ${CMAKECURRENTSOURCEDIR}/gui
)

target
linklibraries(MonkeyModelKit PRIVATE Qt6::Widgets)

And the .cpp class:

#include "MonkeyWindow.hpp"
#include "uiMonkeyWindow.h"
MonkeyWindow::MonkeyWindow(QWidget parent) :
QMainWindow(parent), ui(new Ui::MonkeyWindow) {
ui->setupUi(this);
}
MonkeyWindow::~MonkeyWindow() {
delete ui;
}
#include "MonkeyWindow.hpp"
#include "ui_MonkeyWindow.h"

MonkeyWindow::MonkeyWindow(QWidget
parent) :
QMainWindow(parent), ui(new Ui::MonkeyWindow) {
ui->setupUi(this);
}

MonkeyWindow::~MonkeyWindow() {
delete ui;
}


I don't really know what to do right now, its been a few weeks that I simply can not build my project and can not start learning how Qt works at all...

The only way to make it work is to have all the MonkeyWindow files (.cpp, .hpp and .ui) in the same subdirectory and then everything works all fine. I saw somewhere that the new cpp standard says to not separate header files and source files but I find this super messy, is this right (technically would fix my problem but would make working on the proj so hard) ?


Thanks for the help ...

https://redd.it/1co661u
@qt_reddit
Process inside process in cmd?

It’s possible to use the same cmd for a process A and for a process B started inside the process A?

I mean, I want to do programA.exe on a cmd
Program A is a gui Qt app, no console
But inside process A I want to start a process B, a Qt console app, no gui

Is it posible to use the terminal used to start processA to interact with process B?

Kinda messy but is a requirement for work, thanks

https://redd.it/1co8zy0
@qt_reddit
How I can I install the Qt6 text to speech dev packages on Ubuntu 22.04?

I think I could use libqt6texttospeech or qt6-speech-dev on Ubuntu 23+. I've found all the other required dev packages but this one.

https://redd.it/1cobg4e
@qt_reddit
i've done an ASAN build of Qt5.15.13 itself and my example got a leak - but how?

so im working with ASAN, valgrind for some years now and newly with BugInsight - but i recently tested a ASAN built of Qt itself the first time with my current project (15 devs, >1Mio LOC, just nothing trivial)

ASAN is telling me (and BugInsight also) that there is something leaking when using QIcon features

normaly with Qt that means that some owner is missing - and i've already found serveral places were the owner weren't set correctly but this Action is owned and the QIcon seems to be un-owned (found nothing in the docs about owning)

here is the code example

void Mainwindow::createactions()
{
// ASAN said something in the underlaying QIcon::addFile allocated and leaked at end
const QIcon openIcon = QIcon::fromTheme( "document-open", QIcon( ":/images/folderopen" ) );
m
openaction = new QAction( openIcon, tr( "&Open..." ), this );
...
}

and the ASAN finding

Indirect leak of 16 byte(s) in 1 object(s) allocated from:
#0 0x7f58344b01d8 in operator new(unsigned long) (/lib64/libasan.so.8+0xfc1d8) (BuildId: 183f53e480d86b3f4e532dc084c6a3c77ec09062)
#1 0x7f58312399ba in QIcon::addFile(QString const&, QSize const&, QIcon::Mode, QIcon::State) /home/linux/dev/3rdparty-linux-gcc/qt5
dev/qt5/qtbase/src/gui/image/qicon.cpp:1099
#2 0x7f5831239b3a in QIcon::QIcon(QString const&) /home/linux/dev/3rdparty-linux-gcc/qt5dev/qt5/qtbase/src/gui/image/qicon.cpp:728
#3 0x1214470 in Main
window::createactions() /home/test/example/Mainwindow.cpp:491
#4 0x120e438 in Mainwindow::Mainwindow(htl::Interfacemanager&) /home/test/example/Mainwindow.cpp:99
#5 0x1234f24 in main /home/test/example/main.cpp:76
#6 0x7f582f5731ef in libcstartcallmain (/lib64/libc.so.6+0x2a1ef) (BuildId: 96b8eb5a4407af753cc31c18e7c116279f2eab1f)

the MainWindow is a QMainWindows directly created in main()

and no - the possibility of an false positive is with ASAN near to impossible by design (or i found a bug - different to the valgrind concept that can have false positives by design) - but false negatives (unfound leaks) - thats why im using an ASAN qt built to find more, hopefully most memory related problems

the qt simple application example got not this (but other) leaks: [
https://doc.qt.io/qt-5/qtwidgets-mainwindows-application-example.html](https://doc.qt.io/qt-5/qtwidgets-mainwindows-application-example.html) - so it needs to be somthing with the usage

another idea: i've ported that project (\~1Mio LOCs) from Windows to Linux and it could be that the resources are maybe not available like on windows - but should that produce an leak?

\home\linux\dev\3rdparty-linux-gcc\qt5
dev\qt5\qtbase\src\gui\image\qicon.cpp

void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State state)
{
if (fileName.isEmpty())
return;
detach();
if (!d) {

QFileInfo info(fileName);
QString suffix = info.suffix();
#if QTCONFIG(mimetype)
if (suffix.isEmpty())
suffix = QMimeDatabase().mimeTypeForFile(info).preferredSuffix(); // determination from contents
#endif // mimetype
QIconEngine *engine = iconEngineFromSuffix(fileName, suffix);
d = new QIconPrivate(engine ? engine : new QPixmapIconEngine); !!!!!! ASAN tells me that something in this line leaks
}

d->engine->addFile(fileName, size, mode, state);

// Check if a "@Nx" file exists and add it.
QString atNxFileName = qt
findAtNxFile(fileName, qApp->devicePixelRatio());
if (atNxFileName != fileName)
d->engine->addFile(atNxFileName, size, mode, state);
}

https://redd.it/1cokqeg
@qt_reddit
[HELP] Problem when trying to use mapbox with Qt 5.15

Hello.

I have been trying all kinds of different stuff with implementing mapbox plugin in my mobile application. I registered on mapbox, and have an access token, but whenever I try to load the map I get a bunch of these errors:
W libAppName\_x86\_64.so: tile request error "Problem with tile image"

W libAppName\_x86\_64.so: tile request error "Problem with tile image"

W libAppName\_x86\_64.so: tile request error "Problem with tile image"

I am building and running on a simulator. I tried a very simmilar code with osm plugin and I had no issues with the map.

Plugin {
id: mapPlugin
name: "mapbox"

PluginParameter {
name: "mapbox.access_token";
value: "<valid token>"
}
}

Map {
id: mapview
anchors.fill: parent
plugin: mapPlugin
center: QtPositioning.coordinate(41.943243, 21.576327)
zoomLevel: 14
activeMapType: mapview.supportedMapTypes[10]

MapItemView{
model: markerModel
delegate: mapcomponent
}
}

ComboBox{
model:mapview.supportedMapTypes
textRole:"description"
onCurrentIndexChanged: mapview.activeMapType = mapview.supportedMapTypes[currentIndex]
}

Also keep in mind that I get all available map types in the combobox (model from mapview.supportedMapTypes) from mapbox.

I have also tried with a desktop (QML) application only with the map in it and I get the same errors.

https://redd.it/1comzzo
@qt_reddit
Context menu created by QWidget::addAction()

Hello colleagues

I wonder if there is way to actually get context QMenu object created from using QWidget::addAction(someAction) and set Qt::ActionsContextMenu.

I need it to connect a button to close it on click, and for that I need some slot, ideally QMenu::close().

Any hints mates?

https://redd.it/1coq16d
@qt_reddit
is there an available jobs for QtFramwork in job market?

I'm really not an expert but I've learn first pyqt5 for my project in university and it was great and helped me a lot (created a desktop application) ... after that I've switched to pyside6 and still have the same opinion that's it's Great and helpful (this I've created an access controller for cameras ..) amd I've heard about QML and I'm not quite sure what is it and if i have to learn it because when I've searched for job didn't find job for Qt framework developer ... I'll really appreciate any help and thanks in advance

https://redd.it/1cozlhz
@qt_reddit
QComboBox using QDarkStyle with PyQt

I am using QDarkStyle (3.2.3) for my GUI and I am trying to use a QComboBox. The combo box has these blank squares to the left, which are apparently supposed to be where the indicator would go. Is there any way to straight up remove these squares, so the contents of the drop-down menu is just the text and nothing else?

https://redd.it/1cp4594
@qt_reddit
QSystemTrayIcon doesn't receive wheel events on X11

Hello, my little qt tray icon does not receive any wheel event on X11, despite the documentation telling otherwise. I'm trying to make a generic tray icon that can handle user actions like clicks and mouse wheel event.

I tried reimplementing "bool event(QEvent *event)", even installing an event filter, but I'm not receiving any event. Is there something I'm missing? Qt versions I tried are 5.15 and 6.6

https://redd.it/1cpfy28
@qt_reddit
Closed source application on iOS and Android

I'm evaluating using Qt for developing a closed source application for iOS and Android. My revenue is nowhere near justifying buying the commercial license for Qt. However, since my desktop application is developed using Qt, I'd like to stick to it to develop the mobile application.

I've read online that we can comply with the LGPL license of Qt easily on Android, but that on iOS the situation is more difficult since this platform requires static linking. But even if more dificult, we would be able to comply with LGPL by providing the object files to the end user, who would then be able to relink to a modified version of the Qt framework.

This seems a reasonable way to comply with the licensing, but was this already tested in courts? Is there jurisprudence regarding that? Do you know any successful apps that follow this model?

https://redd.it/1cpgtwq
@qt_reddit
QT Business License

Hi
I plan on opening my own small Business with Software development within the next 2-3 years., I already have some customers in different branches which are interested in my knowledge and I would code Softwares for them only. So just my computer and me.

So it is necessary to get a license of QT in the future.

Does anyone have QT Business license? Is it worth it?
Are there differences to the free QT Software?

Rgds and thank you
Kevin




https://redd.it/1cphs8i
@qt_reddit
Is it currently possible to cross compile Qt 6 for Raspberry Pi 5?

This official page describes the steps for Raspberry Pi 4 and when it didn't work on pi 5. Later I found this forum post and only suggestion was to compile the Qt on the pi itself.




https://redd.it/1cpfpoj
@qt_reddit
Anyone here work at Qt Company?

Disclaimer: I want to acknowledge the rules of r/QtFramework. While my question may not perfectly align with the subreddit's guidelines, I hope that the community will still find it valuable. If my post does not fit within the rules, I completely understand if the mods decide to remove it. Now, onto my question:

Hey everyone,

I'm considering a career move and have been eyeing opportunities at Qt Company. I'm particularly interested in hearing from those who currently work or have worked at Qt Company to get a better understanding of what it's like to be work there.

Are there any current or former Qt Company employees in here? If so, I'd love to hear about your experiences and perspectives on working for the company. Do you mainly focus on developing and improving the Qt framework, or are there other projects you work on as well? Are the people at Qt Company predominantly engineers with degrees in computer science, or do you also have colleagues with diverse backgrounds?

A bit about myself: I have a background in sound engineering, and my interest in music production software led me to explore programming. I recently completed a C++ course, which introduced me to Qt Creator, and I found it very impressive.

Also I'm aware that there's another C++ framework called JUCE, which is used to make music software plug-ins/VSTs. However, my question is more focused on working at Qt Company rather than music software-related specifics.

Thanks in advance for your contributions, and I look forward to hearing from you all!

https://redd.it/1cpm7lw
@qt_reddit
help me understand how to use opengl in qt6

hello, i've been learning opengl for quite a while so now i tried to render a triangle in qt app,

but idk how to, i've searched for so long but cant find anything that could have me, and the "How to use core profile in qt" is for qt5 i believe and qt6 doesnt have the QGLWidget and the QOpenGLWidget , i cant understand its doc, like for qt5 they had a triangle example but i cant understand for this one ( or i am just dumb )

Any help is appreciated, especially an example.

https://redd.it/1cq75hm
@qt_reddit
Struggling with QLayouts

This is a python Qt issue (PySide6 specifically), though I'm not actually familiar with the C++ implementation, though I could foresee this possibly being an issue for me if I was there.

I am dynamically adding widgets to a container widget's layout. The problem is the layout and children widgets are not confined in size to the parent widget. The added widgets have a minimum size of (0,0), so I'd expect them to be resized however is needed to fit, but the layout expands beyond the visible portion of the parent widget.

Am I missing some sort of flag on the parent widget, or the layout/child widgets that should force them to be contained within the visible portion of the parent widget?

https://redd.it/1cqc63a
@qt_reddit
Using qvector in q_property and accesing each data

Hi, I would like to update weekKm and weekTime to update automatically when I change any value in m_weekKmAndTime, but I am struggling with that. I would like to acces it just like DbModel.weekKm(0) and have value, not struggle with vars in qml and trying to get value there.
Here is my code:

in .h file:
Q_PROPERTY(QVector<QPair<int, int>> weekKmAndTime READ weekKmAndTime NOTIFY weekKmAndTimeChanged)
weekKm and weekTime are Q_INVOKABLE
in .cpp
QVector<QPair<int, int>> DataBaseModel::weekKmAndTime() const
{
return m_weekKmAndTime;
}
int DataBaseModel::weekKm(int day) const
{
return m_weekKmAndTime[day].first;
}
int DataBaseModel::weekTime(int day) const
{
return m_weekKmAndTime[day].second;
}


https://redd.it/1cqgcsj
@qt_reddit
I have an existing object with data. I want to draw this data to a widget. How?

So I have an object that has some data in it. I want to draw this data onto a widget.

I've created a new RenderWidget that inherits from QWidget. I've added a QWidget to my GUI in QT Creator and promoted it to this type. Inside my RenderWidget I've updated the `paintEvent` and I can see my widget being painted when I run the application.

How do I initialize this widget in my GUI with my object, so that the RenderWidget can read from it during the paintEvent?

Or am I supposed to create a new model inheriting from QAbstractItemModel, and somehow get that to the widget?

https://redd.it/1cqwse7
@qt_reddit
How to create Resize Handles for a QGraphicsItem?

Hey everyone.

I'm looking to create resize handles for any QGraphicsItem, similar to what you'd see in Photoshop. I'm wondering how I would accomplish this in PyQt. I need it to work for any QGraphicsItem so I don't have to subclass each item and apply logic internally. I was thinking about using QTransform for this, as it works for any item for scaling.

The handles need to work for any QGraphicsItem without subclassing each item and applying logic internally. I'm considering using QTransform because it works for any item for scaling. In summary, here's what I'm trying to achieve:

A screenshot of the resize handles in Adobe Illustrator

Any help or suggestions are greatly appreciated.

https://redd.it/1cr2cji
@qt_reddit
How to create rulers on sides of QGraphicsView in PyQt5?

Good day all. I am trying to achieve this in PyQt:

https://preview.redd.it/1yf01fmdko0d1.png?width=414&format=png&auto=webp&s=11c6a050c756687cc0947a4f7255c6b8e8628fdd

I have read countless Stack Overflow threads and searched Github, but all I have found are C++ versions of the rulers. I basically need a Python version of the rulers, I don't know if anybody has done this with PyQt. Any help is appreciated.

https://redd.it/1cszxfl
@qt_reddit
Error while installing QT on my desktop

I get this error while trying to install Qt on my desktop. It usually starts at around 2% of the installation process. Anything I can do to fix this?

https://preview.redd.it/y08isju6lr0d1.jpg?width=509&format=pjpg&auto=webp&s=a1fc2fb35346502e7d6139f4311fd8108bafd11e



https://redd.it/1ct9m6v
@qt_reddit