qt_reddit | Unsorted

Telegram-канал qt_reddit - Qt - Reddit

-

News and discussion for the Qt Framework. Subreddit: https://www.reddit.com/r/QtFramework Powered by : @r_channels & @reddit2telegram

Subscribe to a channel

Qt - Reddit

Animted tray icon with PyQt6, pretty cool
https://redd.it/1llv3ds
@qt_reddit

Читать полностью…

Qt - Reddit

Qt Creator 17 how to upgrade and use tutorial
https://www.youtube.com/watch?v=orENCrm0LwI

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

Читать полностью…

Qt - Reddit

Is Qt risking developers by degrading its CLI tools? My VS Code experience
https://redd.it/1ljeh7r
@qt_reddit

Читать полностью…

Qt - Reddit

Load QWebEngineView in a seperate thread?

Hello, I have a program that is basically an overlay for a desktop. Kind of similiar to the steam one. I have a QWebEngineView that is running in this overlay. However when i press a button to setup my class (it runs the method load_state), and in this load state i have (init for reference):
```python
def __init__(self, url=QUrl("https://www.google.com/")):
super().__init__()
self.url = url
self.web_view = None
self.main_layout = QVBoxLayout(self)

def load_state(self):
self.web_view = QWebEngineView(self)
self.main_layout.addWidget(self.web_view)
self.web_view.setUrl(self.url)
```

The self.web_view takes a bit of time (like 0.5 seconds) to load so I get a small lag while pressing this button. Now I technically know that all widgets should be ran and initialized on the main thread but is there a way to load it on a seperate thread and the somehow connect it to the main one? I tried Signals and it didn't work for me.

```python
class ModLoader(QObject):
finished = Signal()
mod_loaded = Signal(object)

def __init__(self, mod):
super().__init__()
self.mod = mod

def run(self):
self.mod.load_state()
self.mod_loaded.emit(self.mod)
self.finished.emit()
```
error:
QObject::setParent: Cannot set parent, new parent is in a different thread
QObject::setParent: Cannot set parent, new parent is in a different thread

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

Читать полностью…

Qt - Reddit

I made a beginner tutorial on structuring QT projects. What do you think about this for the beginner's ?!

Even I am not a pro or consider to be one, but this is how I have learned to manage my code base for qt projects. If you know better ways, please comment down I am looking for better alternatives from the actual pros.

kastuvpokharel/how-to-structure-projects-in-c-or-qt-cmake-and-directories-c03012e521bd">kastuvpokharel/how-to-structure-projects-in-c-or-qt-cmake-and-directories-c03012e521bd" rel="nofollow">https://medium.com/@kastuvpokharel/how-to-structure-projects-in-c-or-qt-cmake-and-directories-c03012e521bd


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

Читать полностью…

Qt - Reddit

QT Quick 6.9.0 Keyboard Android and Textarea Placeholder

I'm experiencing two strange issues while developing an Android app with QT Quick.

The first is that under 6.8.2, I have a simple login screen with a username and password, which works perfectly. However, when I upgrade the build to 6.9.0, this handwriting feature message appears when I start it, which you can decline, however. But no matter what you choose, I can no longer type anything with the keyboard. It no longer responds to any keys. (Android Emulator)

The second issue (under 6.8.2) is that I have a placeholder text in a text area. When I click in the field, the placeholder moves into the frame. However, the cursor now moves into the frame, which means I'm typing over the placeholder and not in the actual field.

Definition of the text area:
TextArea {
id: montageResultField
Layout.fillWidth: true
Layout.preferredHeight: 100
font.pixelSize: 16
placeholderText: qsTr("Test Placeholder...")
background: Rectangle {
radius: 8
border.color: montageResultField.activeFocus ? "#0078D7" : "#CCCCCC"
border.width: 1
}
text: montageResult
onTextChanged: montageResult = text
}



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

Читать полностью…

Qt - Reddit

Qt license for solo developer?

I contacted Qt Company via email about this but they never replied. Does anyone know whether a solo developer who does not work for others and hasn't found a company yet can obtain a Small Business License and what they require in terms of documentation if so? Starting a business just to get a license had high running costs where I live, but I can't develop under LGPL either. Is my only option to pay 4k per year?

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

Читать полностью…

Qt - Reddit

[Qt Quick3d] Water (Not finished yet)

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

Читать полностью…

Qt - Reddit

Set up Qtcreator for cross-compiling Linux host to Windows 10 and 11 targets

Hi,

I am trying to set up Qtcreator to facilitate Windows development using a Linux, i.e. Ubuntu 22.04 or Ubuntu 24.04 host. I do have Qt6 development environment (Qtcreator etc...) set up and working on my Windows 10 target, but the compilation and linking steps are painfully slow on Windows and I think (from past experience) would be much faster on Linux due to Linux's faster file IO (as I am told).

I have tried downloading the Qt 6.9 source code and have installed mingw-w64 cross-compiler for Win32 Win64.

I followed the procedure of:

vladadgad/cross-compile-qt-for-windows-on-linux-platform-57e4b71ed1aa">vladadgad/cross-compile-qt-for-windows-on-linux-platform-57e4b71ed1aa" rel="nofollow">https://medium.com/@vladadgad/cross-compile-qt-for-windows-on-linux-platform-57e4b71ed1aa

However, I get the following fatal error:



Building CXX object CMakeFiles/cmTC_5bc10.dir/src.cxx.o

/usr/bin/c++ -DHAVE_ntddmodm -fPIE -std=gnu++17 -o CMakeFiles/cmTC_5bc10.dir/src.cxx.o -c /opt/Qtsource/qt5/CMakeFiles/CMakeTmp/src.cxx

/opt/Qtsource/qt5/CMakeFiles/CMakeTmp/src.cxx:2:10: fatal error: windows.h: No such file or directory

2 | #include <windows.h>

| \^\~\~\~\~\~\~\~\~\~\~

compilation terminated.



It appears that the cross-compiler cannot find windows.h but locate finds it in:

/usr/share/mingw-w64/include/windows.h
Any ideas welcome and thanks!

Phil



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

Читать полностью…

Qt - Reddit

QML Combobox does not change selection when item deleted

I'm using a QML combo box with a list model which is also used by a list view elsewhere. When a selected item is deleted via the model, the list view changes the selection to the previous item, as I would expect. However, in the case of the combo box, the selection remains unchanged. Is this expected behaviour, and how should I handle this?

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

Читать полностью…

Qt - Reddit

I'm brand new to Qt. I'm joining a project where my job is to style an app, and I need it to look the same across all the platforms (win/mac/linux/etc). What are my best options, how can I do that?

Can you please explain this in a way that's accessible to a complete novice? Apparently Qt styles are not consistent across the platforms, so I can't just write QSS and make sure it's reliable/predictable.

We're just building a prototype of an app, but in the future its UI will be complex. So we need a quick/easy way to get started and make it look non-horrible, but then be able to fine-tune and customize the details as the UI grows in complexity.

Can you please help me find the best way to do that?

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

Читать полностью…

Qt - Reddit

How can I cross compile to android with qt?

I wanna cross compile a simple qml hello world application into android, I haven't been able to find a solution with resources on the internet.

I'm not using the IDE, I'm using CMake and Clang for win/linux and CMake and sdk provided toolchain(qt-cmake) for android and wasm.

I'm looking for a tutorial for retards, I just wanna follow along someone and compile a hello world to android.

Do not recommend me to use the IDE, I'm not gonna use it.

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

Читать полностью…

Qt - Reddit

Ecliptica Game Development log 7
https://www.youtube.com/watch?v=Kva9UvD_kng

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

Читать полностью…

Qt - Reddit

Added Qt (mobile-only) detection to my app framework scanner tool
https://redd.it/1l704uh
@qt_reddit

Читать полностью…

Qt - Reddit

QT License is very bad....

seriously what this crazy enforcement with GPL not 2 but 3? and all my private code include "art" that be used should be gpl3 this is so greedy lmao? (Unelss I wasted my time with re-struct the files and put my images outside).

the funny they says your code in interrupted language is your data and dont need to be open but when you visit this QT website and read their thing it sounds they want your whole pc unless you pay 9999$ lmao

glad pyside6 exited,

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

Читать полностью…

Qt - Reddit

QThreads not quitting

Hello , I recently started using Qt for a C++ project and I'm struggling to make the program shut down.
The QThreads used are not quitting even after 1min wait and I don't know why.
code Example :


https://preview.redd.it/kt7hiofw3a9f1.png?width=818&amp;format=png&amp;auto=webp&amp;s=166782ebe350f4d2b4102c003979e28528f69d50

only "yolo 1" is printed on the console which lead me to believe that worker_controllerInput is the problem:
worker_controllerInput code :

https://preview.redd.it/xt1hvmka4a9f1.png?width=574&amp;format=png&amp;auto=webp&amp;s=caa1cfabe9c3b6717f08bada677600db68bdbd0e




After adding a lot of print debugging statements
"running" stops getting printed and "finished checking :::::" gets printed on the console , so the program is not stuck in the while loop.

The worker thread is not doing anything but doesn't want to quit. why?

I appreciate your help and your advice in advance.

Have a good day.



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

Читать полностью…

Qt - Reddit

What's New in QML formatting
https://www.qt.io/blog/whats-new-in-qml-formatting

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

Читать полностью…

Qt - Reddit

Qt Creator extension registry

I've pushed my "adopted" Qt Creator plugins to the Qt Creator extension registry. Now the installation and discoverability is just a few clicks away! 🎉

https://reddit.com/link/1lj6cdg/video/97ghiswadu8f1/player

If you have a Qt Creator plugin that you want to be part of the registry, just fork it, and do a pull request!

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

Читать полностью…

Qt - Reddit

How to make a central shortcut manager in Qt C++?

I have an ActionManager class (defined below) which collects all of the actions from different widgets in my app and shows them in a shortcuts window. The problem is you can't add pointers of widget owned actions to a central action manager like that. It's wrong both from memory management/object lifetime perspective and usage perspective (won't see all the shortcuts until the corresponding widget is created).

Sure there will be some kind of central manager, which the shortcut window can query, but how it interacts with rest of widgets needs to be reconsidered. How can i avoid these issues?

Stackoverflow link for same question: https://stackoverflow.com/questions/79675439/how-to-make-a-central-shortcut-manager-in-qt-c

#ifndef ACTIONMANAGER_H
#define ACTIONMANAGER_H

#include <QObject>
#include <QWidget>
#include <QAction>
#include <QKeySequence>
#include <QHash>

class ActionManager : public QObject
{
Q_OBJECT

public:
static ActionManager *getInstance();

ActionManager();
~ActionManager();

void addAction(const QString &name, QAction *action, const QString &description = "");
void addAction(const QString &name, QAction *action, QKeySequence keySequence,
const QString &description = "");
void addAction(const QString &name, QAction *action, QList<QKeySequence> keySequence,
const QString &description = "");

QAction *getAction(const QString &name) const;
std::vector<QAction *> getAllActions() const;

private:
QHash<QString, QAction *> actions;

static ActionManager *instance;
};

#define Actions() (ActionManager::getInstance())

#endif // ACTIONMANAGER_H


.cpp

#include "ActionManager.h"

Q_GLOBAL_STATIC(ActionManager, uniqueInstance)

ActionManager *ActionManager::getInstance()
{
return uniqueInstance;
}

ActionManager::ActionManager() {}
ActionManager::~ActionManager() {}

void ActionManager::addAction(const QString &name, QAction *action, const QString &description)
{
action->setObjectName(name);
if (!description.isEmpty()) {
action->setText(description);
}
actions.insert(name, action);
}

void ActionManager::addAction(const QString &name, QAction *action, QKeySequence keySequence,
const QString &description)
{
if (!keySequence.isEmpty()) {
action->setShortcut(keySequence);
}
addAction(name, action, description);
}

void ActionManager::addAction(const QString &name, QAction *action, QList<QKeySequence> keySequence,
const QString &description)
{
if (!keySequence.empty()) {
action->setShortcuts(keySequence);
}
addAction(name, action, description);
}

QAction *ActionManager::getAction(const QString &name) const
{
return actions.contains(name) ? actions.value(name) : nullptr;
}

std::vector<QAction *> ActionManager::getAllActions() const
{
std::vector<QAction *> result;
result.reserve(actions.size());

for (const auto &entry : actions)
result.push_back(entry);

return result;
}


Example Usage:

QAction *seekPrevAction = new QAction(this);
seekPrevAction->setShortcut(Qt::Key_Escape);
seekPrevAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
addAction(seekPrevAction);
connect(seekPrevAction, &QAction::triggered, seekable, &CutterSeekable::seekPrev);
Actions()->addAction("Decompiler.seekPrev", seekPrevAction, tr("Seek to Previous Address"));


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

Читать полностью…

Qt - Reddit

Looking for Remote Qt-Based Embedded Role

Hi everyone,
I'm a Canadian-based Embedded Software Engineer with extensive experience in Qt/QML, C++, Embedded Linux (Yocto), QNX, and STM32/i.MX6/i.MX7 platforms. I'm currently looking for remote opportunities involving Qt development, particularly in embedded systems or medical/industrial devices.

🔧 Highlights:
Over 6 years of embedded software experience, including work on medical devices, IoT, and low-power embedded systems.

Developed applications and drivers in C++/Qt/QML for QNX and Linux systems.

Hands-on work with U-Boot, Secure Boot (HAB on i.MX7), and board bring-up.

Experience with RTOS (FreeRTOS, UCOS-II) and networking protocols (TCP/IP, I2C, SPI, USB).

Proficient in device driver development, Yocto build systems, and cross-platform debugging.

Strong history of remote contract work and cross-functional collaboration.

🛠️ Recent Projects:
Migrated QNX 6.5 software to i.MX7, including custom Qt/QML UI development for medical devices.

Brought up STM32-based portable devices and optimized power-sensitive code in C++.

Led kernel modifications (e.g., scheduler tuning) and secure boot setup for QNX/i.MX platforms.

I'm currently open to contract or full-time remote opportunities anywhere globally, as long as the role involves Qt/QML and embedded development.

If you know of any open roles or teams that could use someone with this skill set, please feel free to drop a message

Thanks in advance!


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

Читать полностью…

Qt - Reddit

Android App Camera and Gallery

Hello,

I'm currently building a small Android app with QT.

Is there an easy way to let the user take a photo with the camera or select an image from the gallery?

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

Читать полностью…

Qt - Reddit

How to build KDE apps and Kate from source on Windows using KDE Craft tutorial
https://www.youtube.com/watch?v=38QE543bnb0

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

Читать полностью…

Qt - Reddit

How to update Widgets in Tabs in QTabWidget?

I have used QTabWidget to create several tabs, some programatically. This all works fine. However, the underlying data changes. What approach and code should I use to update the tabs that have changed data?


I suspect the best approach may be to update the tab whenever it becomeas active. However, I'd also like to update my "main" tab even when active as it has a summary so its data will change also.

Can I update the entire tab? Or each widget in the tab? Can I access these programatically? (I may not know what they are named).

I have tried to manually change the data and then update but can't make it work. E.g: (Python / Pyside6)

tabwidget = QWidget()
layout = QGridLayout()
tab
widget.setLayout(layout)
layout.addWidget(QLabel('Data:\n\n'+str(vars(mydata.subdata'TEST'))), 1, 1)
mydata.subdata'TEST'.entry = {'b':8}
# None of these result in the QLabel being updated to include {}'b':8}
# tabwidget.update
# tab
widget.update()
# tabwidget.children().update
# tab
widget.children().update()

TIA for any advice





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

Читать полностью…

Qt - Reddit

Displaying rich text without QTextDocument?

Hello All,

I have a text rendering issue with my Qt Widgets application (Qt 6.7.2, latest KDE on X11).

I noticed that for some fonts my text rendered via drawing a QTextDocument with HTML looks different compared to a simple QLabel. I set a single QFont on the application level, so that all UI looks the same, but those HTML fragments sometimes look different:

https://preview.redd.it/iva466mb2q6f1.png?width=836&amp;format=png&amp;auto=webp&amp;s=35cb30a7644be4d3b3c5444a829a982668d70881

For example, on this screenshot the right string is rendered via QTextDocument, everything else are standard Qt6 widgets. Here I'm using "Source Sans Pro Light" font, which happens to be installed on my openSUSE. I get similar behavior with Noto Sans and other fonts, too.

This issue only happens with certain font variants without any obvious pattern. For example, "normal" Source Sans Pro is rendered exactly the same, up to a single pixel. Curiously, the "Extra Light" variety of the same font is rendered identically, too.

I have little hope that this can be resolved by tweaking QTextDocument object, and thought maybe there's another way of rendering basic rich text? I only have two requirements: highlight some words in bold and support word wrap.

I'll appreciate any ideas!

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

Читать полностью…

Qt - Reddit

How to Open JSON File in Qt

https://preview.redd.it/rqw3zx8s2d6f1.png?width=736&amp;format=png&amp;auto=webp&amp;s=7713080834153e06229c83179f61f426fb804ffb

https://preview.redd.it/7rgwaf2w2d6f1.png?width=3022&amp;format=png&amp;auto=webp&amp;s=a1b22933550c3aedc33c5497cd76822e1ec98822

https://preview.redd.it/7bnh0dfz2d6f1.png?width=3022&amp;format=png&amp;auto=webp&amp;s=71ea34a326988170ff203bb1b8833b52e1a69a34

https://preview.redd.it/phs02t153d6f1.png?width=2002&amp;format=png&amp;auto=webp&amp;s=84db40bdd4505c3f61c74fa132c9aa6428361cdf



These are the images of how I have placed my .json file, and on QFILE it is not able to open it. It return false for QFILE file.exists(). WHat is the right way to open json, and why is this not working.
Please can somebody help with this!!

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

Читать полностью…

Qt - Reddit

Equivalent to QGraphicsView and QGraphicsScene?

Hello people, I'm trying to create a QML desktop app based on an existing app built with Widgets. It is a dashboard-like app where you can drag and place "tiles" of different functions freely on a whiteboard. The general hierarchy was something like this: QGraphicsView<-QGraphicsScene<-QGraphicsRectItem<-QWidget
I'm new to QML and have done a little bit of searching around, but I haven't got a good idea as to how, or if it's possible, to implement this in QML. It'd be very helpful if you could point me to some specific Items that can be used here. Thanks in advance.
If it helps to visualize what I'm trying to build, here is a simple sketch:

https://preview.redd.it/haa16xpoy36f1.png?width=800&amp;format=png&amp;auto=webp&amp;s=9389973447c210f381d68518538afb2a6651ac84

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

Читать полностью…

Qt - Reddit

How to check if multiple lines are selected?

Qt newbie here
How can I check whether the user selected a single line of text or multiple using QTextCursor or something? (In cpp)
Don't need the exact line count. I just want to know whether the selected text contains a single line or not
Comparing blockNumbers for selectionStart and selectionEnd is not the right solution apparently.

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

Читать полностью…

Qt - Reddit

Am I the only one having this issue since 1 day ? My license ends next September

https://preview.redd.it/226z4u9sm26f1.png?width=485&amp;format=png&amp;auto=webp&amp;s=13fc6c9bd5f67161c6c9fbc81c2347083e534998



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

Читать полностью…

Qt - Reddit

Inconsistent themes

Some software doesn't follow my qt theme, but other does - what's the deal? (i use qt6ct on hyprland)

My env variables:

env = QT_QPA_PLATFORMTHEME,qt6ct

env = QT_QPA_PLATFORM,wayland;xcb

env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1

env = QT_AUTO_SCREEN_SCALE_FACTOR,1

https://preview.redd.it/scd1mciliq5f1.png?width=1920&amp;format=png&amp;auto=webp&amp;s=3339513010a1035479c22dee238360ff7d6632a0



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

Читать полностью…

Qt - Reddit

Qt window looks different in Qt Designer and python code

Left: Python code running same ui file, Right: Qt Designer running same ui file

I'm using Fedora KDE 42 (up to date) and pyqt6, python version 3.13.1

This is the python code

PS: I was fooling around with the Qt Designer trying to get into Qt application development and that's how I saw this

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

Читать полностью…
Subscribe to a channel