Qt GUI in C
I created a Qt Quick Application which shows a button. Is it possible to use show the window GUI in a C program? Maybe like export the Qt project into a .dll or .so and use it in C?
https://redd.it/1g3vxpr
@qt_reddit
What is the standard way to connect mysql database from QT? How to fix missing driver errors for mysql?
I'm trying to connect to mysql database from QT. I got an error while doing so
```
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMIMER QODBC QPSQL
Failed to connect to the database
```
I tried searching for different resources, but the guides are not so easy. Why these things aren't kept simple? Somewhere, they're asking to copy the mysql dlls (libmysql.dll) to the build dir where the exe files are there..
Somewhere, I'm seeing complex discussions in stackoverflow and qt formus What are the exact procedures to be done in order to work with mysql database with QT?
Please help me with this. I'm an innocent guy, learning QT for my school project.
I'm in windows with qt version 6.7.2
https://redd.it/1g2md9a
@qt_reddit
QML Help
How do you rotate each character in a text for specific a degree?
Need to animate the said rotation too
https://redd.it/1g1a2s5
@qt_reddit
Collapsable accordion like widget in standard Qt6?
Based on this StackOverflow question I know that there are a lot of user defined solutions for this. But I do ask my self if these days with Qt6, doesn't Qt has a widget by its own to achieve something like this?
Example
https://redd.it/1g16q4g
@qt_reddit
Is this displaced transition possible in Qt?
Hi, I just wonder if it's possible to create this with QtWidgets as I'm using PySide2/PySide6 in Maya.
Or would I need to go into QML for this?
Thanks
https://miro.medium.com/v2/resize:fit:828/format:webp/1*gIi7WhbrCc8_laL7GVzUrQ.gif
https://redd.it/1g0ylrl
@qt_reddit
Passing QString from MainWindow to NextWindow
Hey everyone so im creating a simple project where I just want to pass a QString from my MainWindow to the NexWindow, I kinda get the concept of signals and connect but im still iffy on the full concept, if possible could someone show me a simple way to send a string over so I can fully understand the concept?
https://redd.it/1fzy9zy
@qt_reddit
KDE Stack training
KDE Stack Training with Kevin Ottens. Learn Qt, KDE Frameworks and Plasma. October 20th at 14:00 UTC.
# Explore the KDE Stack at our in-depth training session. Follow Kevin Ottens on a deep dive into KDE Frameworks and how Plasma uses them, and learn how to build Qt and KDE apps.
# Date: October 20th at 14:00 UTC.
# Online at: https://meet.kde.org/b/far-lb5-yjy-xar
https://redd.it/1fzpfjl
@qt_reddit
Qt 6.8 LTS Released!
https://www.qt.io/blog/qt-6.8-released
https://redd.it/1fyy68b
@qt_reddit
Trying Qt Quick for the first time, but the default project Qt Creator gives me is broken. What can I do? Everything is installed and updated, and Qt Widget projects work fine.
https://redd.it/1fxqr3i
@qt_reddit
I am trying to install qt opensource 5.12.12 but failed and now giving the above error. What should I do?
https://redd.it/1fxiuqu
@qt_reddit
{
"#": "2",
"cover": "images/img.jpg",
"title": "Leyla",
"artist": "Salman Khan",
"album": "Leyla"
},
{
"#": "3",
"cover": "images/img.jpg",
"title": "Jumka",
"artist": "Muza",
"album": "Jumka"
}
]
}
delegate: DelegateChooser
{
// #
DelegateChoice {
column: 0
delegate: Rectangle {
required property bool selected
required property bool current
color: current ? "green" : (selected ? "blue" : "lightblue")
// onCurrentChanged: if (current) console.log(model.row, "is current")
// onSelectedChanged: if (selected) console.log(model.row, "is selected")
implicitHeight: 50
implicitWidth: 40
Text {
text: display
anchors {
fill: parent
margins: 5
}
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
ColMouseArea {
anchors.fill: parent
}
}
}
// Cover
DelegateChoice {
column: 1
delegate: Rectangle {
required property bool selected
required property bool current
color: current ? "green" : (selected ? "blue" : "lightblue")
implicitHeight: 50
implicitWidth: 50
Rectangle {
anchors {
fill: parent
margins: 3
}
radius: 5
}
ColMouseArea {
anchors.fill: parent
}
}
}
// Title
DelegateChoice {
column: 2
delegate: Rectangle {
required property bool selected
required property bool current
color: current ? "green" : (selected ? "blue" : "lightblue")
implicitHeight: 50
implicitWidth: 50
Text {
text: display
anchors {
fill: parent
margins: 7
}
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
ColMouseArea {
anchors.fill: parent
}
}
}
// Artist
DelegateChoice {
column: 3
delegate: Rectangle {
required property bool selected
required property bool current
color: current ? "green" : (selected ? "blue" : "lightblue")
implicitHeight: 50
implicitWidth: 50
Text {
text: display
How to Create an Image with Rounded Corners in Qt Quick 6?
Hello,
I'm currently working with Qt Quick 6, and I'm trying to create an image with rounded corners. However, I haven't been able to find a solution that works.
Would you have an idea ?
Thank you!
https://redd.it/1fxe8r1
@qt_reddit
.txt file not found in an app exported to desktop using windeploy
Hello everyone, I'm an absolute noob. I've started a code along project, a simple todo app which retains data in a .txt file and exported to desktop.
I followed the exporting method described in this video: https://www.youtube.com/watch?v=cXojtB8vS2E&t=1642s&ab\_channel=Sciber
From 18:04 to 22.18
The exported app successfully worked, however the txt.file is that of the original app in Qt and doesn't save changes. Infact, in the exported app only .ddl files are present. Any solutions?
https://redd.it/1fwrnqr
@qt_reddit
QT6 desktop docker image
Hi all,
I want to use VScode for building a QT desktop application. Yet, I want my build system to be easily movable as a docker so I can later share the same build tools between developers or to the cloud. I would test the application on either VM or my windows os.
How can I do so? I can't find any QT docker images.
https://redd.it/1fw01xi
@qt_reddit
Showcase of my project released : Scheduled PC Tasks
First official release of my tool for PC!
I invite you to test it, it could be useful to you
It allows you to schedule tasks by simulating them as if you would do them yourself. For example:
Schedule the shutdown of your PC
Simulate repetitive copy/paste as well as keyboard/mouse key presses
Schedule the sending of messages via any software
and much more...
Available for free on the Microsoft Store: Scheduled PC Tasks
https://apps.microsoft.com/detail/xp9cjlhwvxs49p
Video of presentation : https://www.youtube.com/watch?v=ue6FPNrjD4c
It is open source \^\^ (C++ using Qt6) : https://github.com/AmirHammouteneEI/ScheduledPasteAndKeys
And don't hesitate to give me your feedback (in fact I need people to explore it, I had too few feedback for the moment)
https://preview.redd.it/tfckq9x7yjsd1.png?width=200&format=png&auto=webp&s=ce7811961ab943914d7826ef67f71408c4f110fe
https://reddit.com/link/1fv973l/video/z2a0psz8yjsd1/player
https://redd.it/1fv973l
@qt_reddit
QodeAssist Update: Introducing AI Chat in QtCreator!
Hey Qt developers! I am excited to share about an update to QodeAssist, AI-powered plugin for QtCreator.
# What's New?
* **Integrated AI Chat**: Communicate with AI directly within QtCreator in side panels and bottom tab
* **Add support chat models like:** Qwen, Deepseek, Codellama
* **Just the Beginning:** This update lays the foundation for our ultimate goal - full AI integration with QtCreator!
https://preview.redd.it/l17o37ca6mud1.png?width=2950&format=png&auto=webp&s=db7ea97fdfd463c7ae416621316dd1ed9acaeb17
https://redd.it/1g33l22
@qt_reddit
Qt Creator & KDE Plasma Modules
I'm new to Qt Creator, and I'm attempting to use it for KDE Plasma work. I'm getting a 'QML module not found' error on an import statement (import org.kde.plasma.plasmoid specifically). The other modules seem to be found. According to Qt Creator, I need to use an import path env variable, but the other modules import fine. I'm lost... here's a screenshot:
https://preview.redd.it/deis2y6vucud1.png?width=1315&format=png&auto=webp&s=5e63202f904e23e5831557f6e015363340584ab0
Any feedback is greatly appreciated!
https://redd.it/1g24fy2
@qt_reddit
Modify background color in nested QGroupBox
To my understanding Qt does modify the background color when you nest one QGroupBox into another. Makes totally sense. But I have a case where I would like to not having it that way. I would like to have for the inner group box the same background color as the outer/parent group box.
In the following picture, for debug reasons, I tried to modified the background color with a stylesheet. But as you can see in the inner border the blue is a little bit more dark. So there is something else I don't know about.
https://preview.redd.it/h45mpby374ud1.png?width=656&format=png&auto=webp&s=fcc51f76a5ff40a4deb3cc33f304af632e8de8d0
Let's remove the debug blue color and let me show you the whole parent and inner group box.
https://preview.redd.it/ome5j8t384ud1.png?width=658&format=png&auto=webp&s=d47dda4906bea91dbe9de023f362c9c215070746
So what do I miss here? Is there a hidden widget inside the inner GroupBox? Or do I have to catch a special event?
https://redd.it/1g17wcd
@qt_reddit
Getting started for Linux unattended terminal
Hi. Can anyone help me get started with developing for Linux terminals? I have installed Qt but I’m not sure which project template I should choose to start with. The project says it is only compatible with Desktop. My goal is to use Qt GUI in a C program that will be packaged and installed into the Linux device. I find the documentation quite confusing.
https://redd.it/1g11753
@qt_reddit
Qt6 and libefence
I am having an issue where electric fence always crashes any qt6 application including the simple examples from qtcreator. I was wondering if anyone else is experiencing this?
https://redd.it/1g0ng7y
@qt_reddit
QToolBox seamless tab and widget?
Hey all. I am trying to style my QToolBox similar to one like Blenders:
https://preview.redd.it/tpidq05x7rtd1.png?width=290&format=png&auto=webp&s=2ac2bc203b6b24c6d6b77967dae194726d14ee24
Notice how the tab title and widget are seamlessly connected? Well I tried this with QSS stylesheets, and heres the result
https://preview.redd.it/hebdhbv68rtd1.png?width=296&format=png&auto=webp&s=dcbc039ffb47c295f5223b5e0ea545bcbc789bae
As you can see, I pretty much have it dialed, except for the internal QWidget. I am getting a natural gap between tab title and widget, how can I remove it? Any help is appreciated, and heres my stylesheet:
QToolBox
{
background-color: #303030;
padding: 10px 10px 10px 10px;
}
QToolBox::tab {
background-color: #3d3d3d;
border: 1px solid #3d3d3d;
border-radius: 5px;
font-weight: bold;
color: #c2c2c2;
image: url('mpsoftwarestylesheets/assets/triangle-right.svg');
image-position: left;
}
QToolBox::tab:hover
{
background-color: #606060;
color: white;
}
QToolBox::tab:selected
{
image: url('mpsoftwarestylesheets/assets/triangle-down.svg');
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
}
https://redd.it/1fzv36c
@qt_reddit
(PySIde) Why are the properties width, height, and border-radius not working? The checkbox remains the same size and the corner roundness doesn't change
https://redd.it/1fzl55u
@qt_reddit
why readAll method return empty byte array
Recently, I've been writing some programs about TCP network communication, using the QTcpSocket class, I connected the QTcpSocket::readyRead signal, as this:
connect(socket,&QTcpSocket::readyRead,this,Foo::readFromSocket);
void Foo::readFromSocket() {
auto socket=qObjectCast<QTcpSocket*>(sender());
QByteArray readBuffer=socket.readAll();
... // handle read buffer
}
Qt UART disconnects
Hey everyone, hopes your weekend is great.
Quick question here im using UART with a microcontroller and when I open the GUI its connected problem is I have to constantly re open the app for connection, how can I keep it connected even if I go back one window?
https://redd.it/1fxmtcm
@qt_reddit
anchors {
fill: parent
margins: 7
}
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
ColMouseArea {
anchors.fill: parent
}
}
}
// Album
DelegateChoice {
column: 4
delegate: Rectangle {
required property bool selected
required property bool current
color: current ? "green" : (selected ? "blue" : "lightblue")
implicitHeight: 50
implicitWidth: 50
Text {
text: display
anchors {
fill: parent
margins: 7
}
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
ColMouseArea {
anchors.fill: parent
}
}
}
}
}
component ColMouseArea : MouseArea {
onClicked: {
tableview.selectionModel.select(tableview.model.index(row, 0),
ItemSelectionModel.ClearAndSelect |
ItemSelectionModel.Current |
ItemSelectionModel.Rows)
}
onDoubleClicked: {
tableview.selectionModel.setCurrentIndex(tableview.model.index(row, 0),
ItemSelectionModel.ClearAndSelect |
ItemSelectionModel.Current |
ItemSelectionModel.Rows); // Set the current index on double-click
}
}
}
https://redd.it/1fxg7q4
@qt_reddit
Resizable TableView whole Row selection
Hello,
I'm trying to make a Resizable TableView, where I can select a single row at a time. The selection works perfectly. The problem is only the first column is set to current, I want the TableView to set all the columns' current in the row being double clicked. There's a \`QItemSelection\`, but that can't be used in QML. I could use a for loop to set all the columns, but is there any other way?
import QtQuick
import Qt.labs.qmlmodels
import QtQuick.Controls
Rectangle {
color: "gray"
width: 500
height: 400
TableView {
id: tableview
anchors.fill: parent
columnSpacing: 0
rowSpacing: 2
boundsBehavior: Flickable.StopAtBounds
clip: true
// Num(3), Cover(2), Title(1), Artist(4), Album(5)
property var preWidths: [40, 50, 50, 50, 50] // Different initial widths for columns
property var hideAtWidth: [300, 0, 0, 500, 640]
property var resizableCols: [false, false, true, true, true] // Whether a column is resizable
property var visibleCols: new Array(preWidths.length).fill(true)
property var postWidths: new Array(preWidths.length).fill(0)
onWidthChanged: {
var totalPreWidth = 0;
var remainingWidth = width;
// Calculate the total preWidth of non-resizable columns that are visible
for (var i = 0; i < visibleCols.length; ++i) {
if (remainingWidth <= hideAtWidth[i] + columnSpacing * (visibleCols.length - 1)) {
visibleCols[i] = false; // Hide this column
postWidths[i] = 0;
} else {
visibleCols[i] = true; // Keep this column visible
// If column is not resizable, keep its preWidth fixed
if (!resizableCols[i]) {
postWidths[i] = preWidths[i];
remainingWidth -= (preWidths[i] + columnSpacing); // Subtract fixed width and spacing
} else {
totalPreWidth += preWidths[i]; // Accumulate total width for resizable columns
}
}
}
// Redistribute remaining width among the resizable columns proportionally
var visibleCount = visibleCols.filter(col => col).length;
var totalSpacing = (visibleCount - 1) * columnSpacing;
remainingWidth = width - totalSpacing; // Subtract total spacing from available width
for (var j = 0; j < visibleCols.length; ++j) {
if (visibleCols[j] && resizableCols[j]) {
var proportion = preWidths[j] / totalPreWidth;
postWidths[j] = remainingWidth * proportion; // Proportional width distribution for resizable columns
}
}
// console.log("Visible columns: ", visibleCols);
// console.log("Column widths: ", postWidths);
}
columnWidthProvider: function (col) {
return postWidths[col];
}
selectionBehavior: TableView.SelectRows
selectionModel: ItemSelectionModel {}
model: TableModel {
TableModelColumn { display: "#" }
TableModelColumn { display: "cover" }
TableModelColumn { display: "title" }
TableModelColumn { display: "artist" }
TableModelColumn { display: "album" }
rows: [
{
"#": "1",
"cover": "images/img.jpg",
"title": "Kahani Meri",
"artist": "Kaifi Khalil",
"album": "Kahani Meri"
},
Qt Creator debugger keeps sending me to the dissassembler files instead of the regular code
I am genuinely tweaking
https://preview.redd.it/kjst7fpgpysd1.png?width=1133&format=png&auto=webp&s=549b5a43e3319310709fb1b242d931ec850f133c
https://preview.redd.it/k47e82sipysd1.png?width=1389&format=png&auto=webp&s=6960b5f1ab10be1355b5402c516a6e2ae7a9c59c
https://redd.it/1fwtwu0
@qt_reddit
Qt6 JSON Debugger Visualizers for Windows (NatVis)
Even though it might not be the fastest, Qt's JSON support is pretty convenient. Debugging code that uses these types, however, is a bad experience, as you can only see pointers to private containers that store the actual values. Aleksey Nikolaev made a QJson.natvis for Qt 5 to visualize JSON types on Windows. Since then, some parts have changed, so I updated this to Qt 6 and fixed a few issues I found.
You can find Qt6Json.natvis on my GitHub (permalink). Since the JSON containers use some private types, the debug symbols for Qt6Core need to be loaded by the debugger. I provide a bit more info in the documentation.
Unfortunately, I don't think it's possible to integrate these visualizers into the existing generic ones provided by qt-vstools and the VS Code extension, because my visualizers rely on the name of Qt's Qt6Cored.dll (it would probably require some preprocessing - but I'd love to be proven wrong).
I hope this helps other developers when debugging!
https://redd.it/1fwn7lh
@qt_reddit
Help setting up QT Creator on VSCode
I am trying to setup the new VSCode plugin for Qt
I managed to setup the QML language server and debugging but I am not able to get my application to run.
It builds correctly but the GUI does not launch and from the debugger I am getting an error 0xc0000135 which means that there is a missing DLL. I have added the Qt bin folder to path but it is still not working
Path Variables: https://imgur.com/a/o5x906x
https://redd.it/1fvhvxu
@qt_reddit
Multithreading
Dear Community!
I come from a background in C# with Xamarin Forms and netMaui and started with a course with QT recently. I am a bit confused, however, as the teacher stated that QT out of the box calculates everything on the Main Ui Thread. Is this true? Doesn't it automatically create working threats for calculations or the code behind and stuff? I simply cannot believe that in a Framework i actually have to pay money to use it i have to create and handly my threads by hand on my own for everything when all other Frameworks in different languages do that themselves out of the box. Can you clarify this for me please?
https://redd.it/1fv8nui
@qt_reddit