Missing add definition in cpp
Since the latest update (17.0.0) I've been missing the option to generate a function in the cpp file, only the option to generate Outside or Inside class are showing, and it's driving me kinda crazy, I rolled back to 16.0.2 but it still happens
https://preview.redd.it/u9htik5idrcf1.png?width=274&format=png&auto=webp&s=82882e700575782c07137274b39fd8b095ddc221
https://redd.it/1lzby8f
@qt_reddit
Since the latest update (17.0.0) I've been missing the option to generate a function in the cpp file, only the option to generate Outside or Inside class are showing, and it's driving me kinda crazy, I rolled back to 16.0.2 but it still happens
https://preview.redd.it/u9htik5idrcf1.png?width=274&format=png&auto=webp&s=82882e700575782c07137274b39fd8b095ddc221
https://redd.it/1lzby8f
@qt_reddit
QtFinCharts: Financial charting library for Qt6
https://github.com/h2337/QtFinCharts
https://redd.it/1syerpy
@qt_reddit
https://github.com/h2337/QtFinCharts
https://redd.it/1syerpy
@qt_reddit
GitHub
GitHub - h2337/QtFinCharts: Financial charting library for Qt6
Financial charting library for Qt6. Contribute to h2337/QtFinCharts development by creating an account on GitHub.
Qt Contributors Summit 2026: Oslo in October!
https://www.qt.io/blog/qt-contributors-summit-2026-oslo-in-october
https://redd.it/1szqxhh
@qt_reddit
https://www.qt.io/blog/qt-contributors-summit-2026-oslo-in-october
https://redd.it/1szqxhh
@qt_reddit
www.qt.io
Qt Contributors Summit 2026: Oslo in October!
Join us in Oslo from October 27-30 for the Qt Contributors Summit 2026, featuring discussions, workshops, and a hackathon. Engage with the Qt community.
The current state of QT3D and whether it's worth using
It's still included in the package—it's very useful, but it's marked as deprecated. I'd like to use it for a game built with QT; it's convenient because I'd also like to use it within a widget in my level editor, and that can be done in Python rather than QML.
https://redd.it/1t1f2iy
@qt_reddit
It's still included in the package—it's very useful, but it's marked as deprecated. I'd like to use it for a game built with QT; it's convenient because I'd also like to use it within a widget in my level editor, and that can be done in Python rather than QML.
https://redd.it/1t1f2iy
@qt_reddit
Reddit
From the QtFramework community on Reddit
Explore this post and more from the QtFramework community
Questions about client-server app idea
I have an idea for an client-server app that consist of:
1 .A "client" for a touch screen device (e.g. tablet) that shows a bunch of "widgets" written in qml that interfaces with so called "modules", consisting of C++ code that send messages to the host
2. A "host app" that manages the client UI and receives messages from client that also has "modules" that interface with host's apps.
An example is a media controls "module" on both host and client and its respecting "widget" that is the UI on the client.
I have a few goals for this idea:
1. There can be different "widgets" that interface with a client module. A single widget can be full screen and can interface with multiple client modules.
2. Host modules expose a preferences menu to the host app to configure .
I have some questions about implementing this idea.
1. Should I separate the backend and frontend (ui) for the host app, where the backend does not use qt? This approach allows multiple frontends using different toolkits, but since i am going to use qml for the client ui anyway and client modules have to use qt specifics, i was thinking otherwise.
2. Should I have host modules not rely on qt specific stuff (slots, properties) for the logic, or use it? This helps with achieving the idea from question 1.
3. Boost.asio or qt network for communication between both host and client?
4. Client modules using c++ or qml based interface that interfaces with both widgets and the client code (especially sending messages to host)?
https://redd.it/1t1ol0a
@qt_reddit
I have an idea for an client-server app that consist of:
1 .A "client" for a touch screen device (e.g. tablet) that shows a bunch of "widgets" written in qml that interfaces with so called "modules", consisting of C++ code that send messages to the host
2. A "host app" that manages the client UI and receives messages from client that also has "modules" that interface with host's apps.
An example is a media controls "module" on both host and client and its respecting "widget" that is the UI on the client.
I have a few goals for this idea:
1. There can be different "widgets" that interface with a client module. A single widget can be full screen and can interface with multiple client modules.
2. Host modules expose a preferences menu to the host app to configure .
I have some questions about implementing this idea.
1. Should I separate the backend and frontend (ui) for the host app, where the backend does not use qt? This approach allows multiple frontends using different toolkits, but since i am going to use qml for the client ui anyway and client modules have to use qt specifics, i was thinking otherwise.
2. Should I have host modules not rely on qt specific stuff (slots, properties) for the logic, or use it? This helps with achieving the idea from question 1.
3. Boost.asio or qt network for communication between both host and client?
4. Client modules using c++ or qml based interface that interfaces with both widgets and the client code (especially sending messages to host)?
https://redd.it/1t1ol0a
@qt_reddit
Reddit
From the QtFramework community on Reddit
Explore this post and more from the QtFramework community
CodePointer version 0.1.4 - new C++ IDE/editor
May release (named Fist my bump) is released. While the changelog is not large, a new huge feature was used: tree-sitter support. This means that C++ completion is "kinda" usable, with semantic support. It will fail in many edge cases (as the code is just parsed not evaluated), only for your code (not system libraries) - but it is very helpful.
One useful feature of this IDE is its low memory footprint, currently I see its using bellow 300 MB while 2 projects are loaded on Linux (Windows has similar memory footprint):
CodePointer editing its own main.cpp
Binary packages are in https://github.com/codepointerapp/codepointer/releases/tag/v0.1.4
Code is available at:
https://github.com/codepointerapp/codepointer
https://gitlab.com/codepointer/codepointer/
https://redd.it/1t2tkel
@qt_reddit
May release (named Fist my bump) is released. While the changelog is not large, a new huge feature was used: tree-sitter support. This means that C++ completion is "kinda" usable, with semantic support. It will fail in many edge cases (as the code is just parsed not evaluated), only for your code (not system libraries) - but it is very helpful.
One useful feature of this IDE is its low memory footprint, currently I see its using bellow 300 MB while 2 projects are loaded on Linux (Windows has similar memory footprint):
364884 AppRun /home/diego/Downloads/codepointer-v0.1.4-x86_64.AppImage 5 diego 269M ⣀⣀⣀⣀⣀ 0.0 CodePointer editing its own main.cpp
Binary packages are in https://github.com/codepointerapp/codepointer/releases/tag/v0.1.4
Code is available at:
https://github.com/codepointerapp/codepointer
https://gitlab.com/codepointer/codepointer/
https://redd.it/1t2tkel
@qt_reddit
This media is not supported in your browser
VIEW IN TELEGRAM
Glitchy/shaky movement of text/items when rendered on a display with fractional scaling
https://redd.it/1t37zoz
@qt_reddit
https://redd.it/1t37zoz
@qt_reddit
Need advices on beginning programming on Qt
Hello, I intend to create GUI apps and improve myself on QT
I'm an "self-taught" C++ programmer ... I mean, I followed and watched a lot of videos on C++ programming to understand class, OOP, variables, pointers, namespaces, functions, pointers, heritage...
Problem is that I'm not a student from computer or programming universities... and so, now, I'm stuck because I don't know which way I need to follow to become autonomous on QT ...
Also, english is not my native langage, it's also another issue I have to face in my learning projects...
Question is, what should I do ?
Is there a free formation to follow ? Is there a path I should respect to progress ?
I mean, I have difficulties in the simple fact of creating by myself a QPushbutton in mywindow.cpp because I want to try without using the .ui file...
I feel so lost, and incompetent even in simple C++ ...
Thanks in advance for your feedbacks ;)
https://redd.it/1t3yku6
@qt_reddit
Hello, I intend to create GUI apps and improve myself on QT
I'm an "self-taught" C++ programmer ... I mean, I followed and watched a lot of videos on C++ programming to understand class, OOP, variables, pointers, namespaces, functions, pointers, heritage...
Problem is that I'm not a student from computer or programming universities... and so, now, I'm stuck because I don't know which way I need to follow to become autonomous on QT ...
Also, english is not my native langage, it's also another issue I have to face in my learning projects...
Question is, what should I do ?
Is there a free formation to follow ? Is there a path I should respect to progress ?
I mean, I have difficulties in the simple fact of creating by myself a QPushbutton in mywindow.cpp because I want to try without using the .ui file...
I feel so lost, and incompetent even in simple C++ ...
Thanks in advance for your feedbacks ;)
https://redd.it/1t3yku6
@qt_reddit
Reddit
From the QtFramework community on Reddit
Explore this post and more from the QtFramework community
How to apply dark fusion on Linux ?
Hello,
I'd like to have the native dark fusion but it's not seem to even exist. Is somebody have an code example to have the dark fusion on linux ?
thanks!
https://redd.it/1t4bh5x
@qt_reddit
Hello,
I'd like to have the native dark fusion but it's not seem to even exist. Is somebody have an code example to have the dark fusion on linux ?
thanks!
https://redd.it/1t4bh5x
@qt_reddit
Reddit
From the QtFramework community on Reddit
Explore this post and more from the QtFramework community
Self promotion A WIP PySide6 Book
I have gathered a fair amount of PySide6 examples and last year decided to turn them into a book. The book is intended cover basic Qt widgets usage, as well as general Qt topics like timers, properties, events and object trees, and some intermediate topics like model-view programming and multithreading, and some special topics like databases, networking, processes and state machines. Currently I have \~470 pages of code and text that still need quite a bit of polish.
All the material I have written so far is available as a free pdf sample and you can download it from here:
https://leanpub.com/pyside6blueprints/
The code itself is available on Github:
https://github.com/JoeAnonimist/pyside6-blueprints-code/tree/master/code
Since the last time I posted in this subreddit, I have added several new chapters to the book:
Ch 10. Tree Widgets
Ch 13. Dialogs
Ch 21. Properties
Ch 24. QAbstractItemModel (model/view)
Ch 25. Delagates (model/view)
Ch 26. Sorting, Filtering and Selection (model/view)
Ch 33. Databases
Ch 34. Processes
I would be grateful for any reviews and comments. Tia.
(addressing the sub guidelines)
1. Your content is high-quality: The book covers a range of Qt Widgets topics. All examples are self-contained, each followed with step-by-step instructions and code walkthroughs.
2. Your content is reasonably complete: The book has \~470 pages with five or six chapters yet to be added.
3. Your content is specifically about helping beginners learn programming: Most of the book is beginner-friendly with introductory units for
Qt Widgets
QMainWindow
Model/view programming
Multithreading
https://redd.it/1t57ubv
@qt_reddit
I have gathered a fair amount of PySide6 examples and last year decided to turn them into a book. The book is intended cover basic Qt widgets usage, as well as general Qt topics like timers, properties, events and object trees, and some intermediate topics like model-view programming and multithreading, and some special topics like databases, networking, processes and state machines. Currently I have \~470 pages of code and text that still need quite a bit of polish.
All the material I have written so far is available as a free pdf sample and you can download it from here:
https://leanpub.com/pyside6blueprints/
The code itself is available on Github:
https://github.com/JoeAnonimist/pyside6-blueprints-code/tree/master/code
Since the last time I posted in this subreddit, I have added several new chapters to the book:
Ch 10. Tree Widgets
Ch 13. Dialogs
Ch 21. Properties
Ch 24. QAbstractItemModel (model/view)
Ch 25. Delagates (model/view)
Ch 26. Sorting, Filtering and Selection (model/view)
Ch 33. Databases
Ch 34. Processes
I would be grateful for any reviews and comments. Tia.
(addressing the sub guidelines)
1. Your content is high-quality: The book covers a range of Qt Widgets topics. All examples are self-contained, each followed with step-by-step instructions and code walkthroughs.
2. Your content is reasonably complete: The book has \~470 pages with five or six chapters yet to be added.
3. Your content is specifically about helping beginners learn programming: Most of the book is beginner-friendly with introductory units for
Qt Widgets
QMainWindow
Model/view programming
Multithreading
https://redd.it/1t57ubv
@qt_reddit
Self promotion A WIP PySide6 Book
I have gathered a fair amount of PySide6 examples and last year decided to turn them into a book. The book is intended to cover basic Qt widgets usage, as well as general Qt topics like timers, properties, events and object trees, some intermediate topics like model-view programming and multithreading, and some special topics like databases and processes. Currently I have \~470 pages of code and text that still need quite a bit of polish.
All the material I have written so far is available as a free pdf sample that you can download from here:
https://leanpub.com/pyside6blueprints/
The code itself is available on Github:
https://github.com/JoeAnonimist/pyside6-blueprints-code/tree/master/code
Since the last time I posted in this subreddit, I have added several new chapters to the book:
10. Tree Widgets
13. Dialogs
21. Properties
24. QAbstractItemModel (model/view)
25. Delagates (model/view)
26. Sorting, Filtering and Selection (model/view)
33. Databases
34. Processes
I would be grateful for any reviews and comments. Tia.
(addressing the sub guidelines)
1. Your content is high-quality: The book covers a range of Qt Widgets topics. All examples are self-contained, each followed with step-by-step instructions and code walkthroughs.
2. Your content is reasonably complete: The book has \~470 pages with five or six chapters yet to be added.
3. Your content is specifically about helping beginners learn programming: Most of the book is beginner-friendly with introductory units for
Qt Widgets
QMainWindow
Model/view programming
Multithreading
https://redd.it/1t57ubv
@qt_reddit
I have gathered a fair amount of PySide6 examples and last year decided to turn them into a book. The book is intended to cover basic Qt widgets usage, as well as general Qt topics like timers, properties, events and object trees, some intermediate topics like model-view programming and multithreading, and some special topics like databases and processes. Currently I have \~470 pages of code and text that still need quite a bit of polish.
All the material I have written so far is available as a free pdf sample that you can download from here:
https://leanpub.com/pyside6blueprints/
The code itself is available on Github:
https://github.com/JoeAnonimist/pyside6-blueprints-code/tree/master/code
Since the last time I posted in this subreddit, I have added several new chapters to the book:
10. Tree Widgets
13. Dialogs
21. Properties
24. QAbstractItemModel (model/view)
25. Delagates (model/view)
26. Sorting, Filtering and Selection (model/view)
33. Databases
34. Processes
I would be grateful for any reviews and comments. Tia.
(addressing the sub guidelines)
1. Your content is high-quality: The book covers a range of Qt Widgets topics. All examples are self-contained, each followed with step-by-step instructions and code walkthroughs.
2. Your content is reasonably complete: The book has \~470 pages with five or six chapters yet to be added.
3. Your content is specifically about helping beginners learn programming: Most of the book is beginner-friendly with introductory units for
Qt Widgets
QMainWindow
Model/view programming
Multithreading
https://redd.it/1t57ubv
@qt_reddit
GitHub
pyside6-blueprints-code/code at master · JoeAnonimist/pyside6-blueprints-code
Code repository for PySide6 Blueprints: ready-to-run Python GUI examples and blueprints using PySide6 (Qt6 for Python). Build professional desktop apps fast. - JoeAnonimist/pyside6-blueprints-code
How to get the color value from a specific point of a gradient?
I have column elements with multiple rectangle child's inside of it, and i want to rectangle to have color such that the column as a whole when viewed gets a gradient effect. For this i though of creating a gradient element but the how would i get the color value from a specific point on the gradient and assign it to the rectangle.
i can answer your question if i failed to describe my problem accurately.
https://redd.it/1t724rj
@qt_reddit
I have column elements with multiple rectangle child's inside of it, and i want to rectangle to have color such that the column as a whole when viewed gets a gradient effect. For this i though of creating a gradient element but the how would i get the color value from a specific point on the gradient and assign it to the rectangle.
ColumnLayout{property double gradientPosition: (say 0.75; but is a variable)Repeater{model: 10delegate: Reactangle{color: gradient color of the value at 0.75 }Gradient{gradientStop: {position: 0.0; color: "green"}gradientStop: {position: 0.5; color: "yellow"}gradientStop: {position: 1; color: "red"}}i can answer your question if i failed to describe my problem accurately.
https://redd.it/1t724rj
@qt_reddit
Reddit
From the QtFramework community on Reddit
Explore this post and more from the QtFramework community
Ecliptica — Devlog 13: Procedural Quests and Gyroscopic Controls. While I'm working on a major gameplay update, I decided to show how the dialogue and quest sections are implemented.
I also tried out voice acting this time; please leave feedback for English dubbing.
https://www.youtube.com/watch?v=u03tlZWMlg0
https://redd.it/1t73r0t
@qt_reddit
I also tried out voice acting this time; please leave feedback for English dubbing.
https://www.youtube.com/watch?v=u03tlZWMlg0
https://redd.it/1t73r0t
@qt_reddit
YouTube
Ecliptica — Devlog 13: Procedural Quests and Gyroscopic Controls
Steam page : https://store.steampowered.com/app/3723390/Ecliptica/
Engine: Qt Quick 3D https://doc.qt.io/qt-6/qtquick3d-index.html
A Living World: Procedural Quest System
The headline feature of this update is our brand-new system of procedurally generated…
Engine: Qt Quick 3D https://doc.qt.io/qt-6/qtquick3d-index.html
A Living World: Procedural Quest System
The headline feature of this update is our brand-new system of procedurally generated…
Efficiently using QFileSystemModel for watching several subfolders
I'm writing a program, and for many features, the user can save presets. Those presets are written to individual files in appropriate subfolders inside the application's local storage path. So on macos it might look like:
-
-
-
For the user to select existing presets, I want to list the contents of the appropriate subfolder in a
So I can do this if I create a QFileSystemModel for every combo box and set its root path to each subfolder and set each combo box root index to the index of that model. But that seems inefficient, especially since on some platforms, file watchers are limited.
So I tried making a QSortFilterProxyModel, and for
The user may have many multiple instances of the main window open, so the number of combo boxes needed to show preset selections can grow pretty large. So I want to approach this with SOME sort of attempt at optimization.
Am I approaching things the wrong way here?
https://redd.it/1t7gv2w
@qt_reddit
I'm writing a program, and for many features, the user can save presets. Those presets are written to individual files in appropriate subfolders inside the application's local storage path. So on macos it might look like:
-
~/Library/Application Support/MyOrg/MyProgram/themes-
~/Library/Application Support/MyOrg/MyProgram/filters-
~/Library/Application Support/MyOrg/MyProgram/soundsFor the user to select existing presets, I want to list the contents of the appropriate subfolder in a
QComboBox. I want the combo boxes to update live.So I can do this if I create a QFileSystemModel for every combo box and set its root path to each subfolder and set each combo box root index to the index of that model. But that seems inefficient, especially since on some platforms, file watchers are limited.
So I tried making a QSortFilterProxyModel, and for
filterAcceptsRow, I tried taking the source parent index, getting the Roles.FilePathRole, and comparing it to the path of the subfolder I want to watch for each QComboBox. But the way the file system model populates data is apparently async, so I'm hitting all kinds of invalid index issues getting this to work.The user may have many multiple instances of the main window open, so the number of combo boxes needed to show preset selections can grow pretty large. So I want to approach this with SOME sort of attempt at optimization.
Am I approaching things the wrong way here?
https://redd.it/1t7gv2w
@qt_reddit
Reddit
From the QtFramework community on Reddit
Explore this post and more from the QtFramework community
I built a completely offline desktop app that clusters photos by face
Hey everyone,
Over the past few months, I’ve been building a local face-clustering app using C++, Qt, dlib, and OpenBLAS. It scans a directory and groups photos of the same person together—completely on-device without any cloud dependencies.
I built it for myself because manual sorting is a pain and I didn't want to rely on cloud services. It currently runs on Linux and Windows and currently available in itch.io
Link: https://sam824.itch.io/ai-photocluster
https://redd.it/1t804eq
@qt_reddit
Hey everyone,
Over the past few months, I’ve been building a local face-clustering app using C++, Qt, dlib, and OpenBLAS. It scans a directory and groups photos of the same person together—completely on-device without any cloud dependencies.
I built it for myself because manual sorting is a pain and I didn't want to rely on cloud services. It currently runs on Linux and Windows and currently available in itch.io
Link: https://sam824.itch.io/ai-photocluster
https://redd.it/1t804eq
@qt_reddit
itch.io
itch.io is a simple way to find, download and distribute indie games online. Whether you're a developer looking to upload your game or just someone looking for something new to play itch.io has you covered.
debian13, cmake 3.31, find qt6 core/gui/widgets ok, but cannot find quick (qt5 ok)
hi. does someone know what package has to be installed ?
thanks in advance, andi
https://redd.it/1t9i4th
@qt_reddit
hi. does someone know what package has to be installed ?
thanks in advance, andi
https://redd.it/1t9i4th
@qt_reddit
Reddit
From the QtFramework community on Reddit
Explore this post and more from the QtFramework community
Cleaner QML Controller Wiring with Singleton Instances in Qt 6.12
https://www.kdab.com/singleton-controllers-in-times-of-declarative-qml/
https://redd.it/1t9wq5c
@qt_reddit
https://www.kdab.com/singleton-controllers-in-times-of-declarative-qml/
https://redd.it/1t9wq5c
@qt_reddit
KDAB
Cleaner QML Controller Wiring with Singleton Instances in Qt 6.12 | KDAB
André Somers contributed a new approach to providing QML controller objects in Qt 6.12: declarative registration now supports externally supplied singleton instances via QQmlEngine::setExternalSingletonInstance.
An Unknown Segfault
Hello,
I'm creating an application that is used to scan MTG Cards in real-time from 4 or more cameras, and output the nameplate list of each camera to a per-camera-window. It is in early stage and the actual detection/processing is not yet implemented, partially because of this segfault. It uses Qt, tbb queues and `tbb::flow::graph.`
[https://github.com/ahsanullah-8bit/MTGScanner.git](https://github.com/ahsanullah-8bit/MTGScanner.git)
At first made it work (with the integrated camera), a few problems occurred with QtMultimedia that I didn't know of (or partially known):
* You can't have any QtMultimedia in any other thread than the main thread.
* You can't use a camera device twice, at the same time.
The project uses a custom `ChannelWizard` dialog component that involves 3 steps. Step 1 lets you select a camera, it has a combo box and a live preview below that. First thought would be, to just use `VideoOutput`, `MediaCaptureSession`, `MediaDevices` and `Camera` QML types for the wizard camera selection. But when the wizard closes, we have to add the channel to the `Engine` and now you've to destroy the `Camera` and `MediaCaptureSession`, because they still hold the camera handle. Back then, I would initialize the `QCamera` and `QMediaCaptureSession` in a per-camera capture thread, called `CameraMetrics` (which lived in the main thread) functions from the `tbb::flow::graph` nodes and lot more synchronizarion problems. Now, we ask the engine (from QML) to provide us a `Channel` (custom type holding per-camera half-architecture, including `QCamera` and `QMediaCaptureSession`) object, owned by C++ and use it to display the preview, pass it back to C++ if channel is to be created or destroy it, if canceled. `Channel` is used for the main thread and `ChannelRaw` is used by the EngineWorker thread, as it holds the supposedly thread safe code. Both are connected by main thread giving frames, and worker thread giving metrics `QAtomicInt`s.
The segfault occurred in the previous ([commit 37913a9](https://github.com/ahsanullah-8bit/MTGScanner/tree/37913a944f757cfdea4e7e19dd681ae252f030ed)) and the current ([commit 806aeba](https://github.com/ahsanullah-8bit/MTGScanner/tree/806aebad9acd4c3e08a71e8da245cae86247a1ae)) architecture.
Before, if there were no channels, you add one, and launch the wizard again, it would not show anything in the preview (`Camera` probably fails silently) for the same camera. You close the app, let it save the channel configurations, launch it again, a simple click on the `Add Channel` button causes a segfault.
Now, with the QtMultimedia moved to the main thread, I sometimes, get it at the start, or clicking a channel, or Add Channel. I can't debug it. It produces this call stack almost always:
`1 QV4::Heap::Base::mark qv4heap_p.h 147 0x7ffff6cda402`
`2 QV4::Managed::mark qv4managed_p.h 178 0x7ffff6cda402`
`3 QV4::MemoryManager::collectFromJSStack qv4mm.cpp 1474 0x7ffff6cda402`
`4 QV4::(anonymous namespace)::markJSStack unique_ptr.h 173 0x7ffff6cda51b`
`5 QV4::GCStateMachine::transition qv4mm.cpp 1567 0x7ffff6cdacb7`
`6 QV4::GCStateMachine::step
Hello,
I'm creating an application that is used to scan MTG Cards in real-time from 4 or more cameras, and output the nameplate list of each camera to a per-camera-window. It is in early stage and the actual detection/processing is not yet implemented, partially because of this segfault. It uses Qt, tbb queues and `tbb::flow::graph.`
[https://github.com/ahsanullah-8bit/MTGScanner.git](https://github.com/ahsanullah-8bit/MTGScanner.git)
At first made it work (with the integrated camera), a few problems occurred with QtMultimedia that I didn't know of (or partially known):
* You can't have any QtMultimedia in any other thread than the main thread.
* You can't use a camera device twice, at the same time.
The project uses a custom `ChannelWizard` dialog component that involves 3 steps. Step 1 lets you select a camera, it has a combo box and a live preview below that. First thought would be, to just use `VideoOutput`, `MediaCaptureSession`, `MediaDevices` and `Camera` QML types for the wizard camera selection. But when the wizard closes, we have to add the channel to the `Engine` and now you've to destroy the `Camera` and `MediaCaptureSession`, because they still hold the camera handle. Back then, I would initialize the `QCamera` and `QMediaCaptureSession` in a per-camera capture thread, called `CameraMetrics` (which lived in the main thread) functions from the `tbb::flow::graph` nodes and lot more synchronizarion problems. Now, we ask the engine (from QML) to provide us a `Channel` (custom type holding per-camera half-architecture, including `QCamera` and `QMediaCaptureSession`) object, owned by C++ and use it to display the preview, pass it back to C++ if channel is to be created or destroy it, if canceled. `Channel` is used for the main thread and `ChannelRaw` is used by the EngineWorker thread, as it holds the supposedly thread safe code. Both are connected by main thread giving frames, and worker thread giving metrics `QAtomicInt`s.
The segfault occurred in the previous ([commit 37913a9](https://github.com/ahsanullah-8bit/MTGScanner/tree/37913a944f757cfdea4e7e19dd681ae252f030ed)) and the current ([commit 806aeba](https://github.com/ahsanullah-8bit/MTGScanner/tree/806aebad9acd4c3e08a71e8da245cae86247a1ae)) architecture.
Before, if there were no channels, you add one, and launch the wizard again, it would not show anything in the preview (`Camera` probably fails silently) for the same camera. You close the app, let it save the channel configurations, launch it again, a simple click on the `Add Channel` button causes a segfault.
Now, with the QtMultimedia moved to the main thread, I sometimes, get it at the start, or clicking a channel, or Add Channel. I can't debug it. It produces this call stack almost always:
`1 QV4::Heap::Base::mark qv4heap_p.h 147 0x7ffff6cda402`
`2 QV4::Managed::mark qv4managed_p.h 178 0x7ffff6cda402`
`3 QV4::MemoryManager::collectFromJSStack qv4mm.cpp 1474 0x7ffff6cda402`
`4 QV4::(anonymous namespace)::markJSStack unique_ptr.h 173 0x7ffff6cda51b`
`5 QV4::GCStateMachine::transition qv4mm.cpp 1567 0x7ffff6cdacb7`
`6 QV4::GCStateMachine::step
GitHub
GitHub - ahsanullah-8bit/MTGScanner
Contribute to ahsanullah-8bit/MTGScanner development by creating an account on GitHub.