A couple of QT beginner questions, do I need to differentiate between QT for Python and PyQT?
Hi guys, relatively new to Python, and been sitting on the sidelines really with GUI development for python, some of the frameworks looked a little well not very modern, I have made something basic in Tkinter before. QT for python looks really cool after watching a freecodecamp course I'm pretty excited about the possibilites. QT for Python and PyQT seem to be fairly intermingled, I kind of like Qt for pythons licensing better, but how do I avoid getting the frameworks mixed up?
Also I dont seem to be able to find much in the way of tutorials on how to inter mingle python code with QT to make a personalised app, maybe I'm looking at it from the wrong angle?
​
Appreciate any help ;)
​
Brett
https://redd.it/18sry51
@qt_reddit
Setting TextField text with model data outside delegate
​
https://preview.redd.it/mpntzunv639c1.png?width=199&format=png&auto=webp&s=f8b2d135aec6dc4b609ef10c38e900509d05cefc
I have a QML UI element where I want to the user to be able to select an item from a combo box (connected to a subclassed QAbstractListModel) and have a series of TextFields and ComboBox populate with data from that item in the model. The user should be edit the data via the fields and update the entry in the model by pressing the "Update" button.
​
I've come up with 2 potential methods so far:
​
1. Using onCurrentIndexChanged(), set the text for each TextField by calling data(currentIndex, "RoleToDisplay"). When "Update" is pressed, either call setData() for each role we want to update, or implement a setPlanetData() method in my class which takes all the TextField's data as parameters and is responsible for calling dataChanged()
2. Have my Planet objects subclass from Q_OBJECT and expose the data via properties. However, I would think this would require me to have a binding of text: getPlanet(currentIndex).Gravity. This may prevent the user from modifying the values in the TextField as what ever is entered will be overwritten by the binding.
It's important to note that there will be a read-only instance of the above elsewhere in the application. In which case, any changes made via the form need to be reflected in the other display. Using the first method I suggested, that would probably require connecting to onDataChanged() and then repopulating the fields. It would be nice if there was a more automatic or declarative way to do this.
​
Open to any other ideas/suggestions. Thanks!
https://redd.it/18t2iz9
@qt_reddit
How to read PDFs in QtQuick? QtQuick.Pdf is not included in Qt 6?
When I try to import QtQuick.Pdf it says:
"qrc:/test/main.qml:3:1: module "QtQuick.Pdf" is not installed"
What can I do? Is it not on Qt 6 anymore?
https://redd.it/18tc21a
@qt_reddit
Deploying Qt application on different platforms
Let's say that I created a Qt Widgets application on Windows. I need to deploy it for macOS and Linux as well. Is it necessary to build the the application again on other OSs? Will I have to install Qt on the other OSs and then rebuild for that OS? Is it not possible to do that while staying on Windows?
https://redd.it/18tt5nt
@qt_reddit
I've just release the v1.0.0 of my vector icon library for Qt apps (MIT)! Enjoy, and happy new year!
https://github.com/oclero/qlementine-icons
https://redd.it/18vvycn
@qt_reddit
I appeared for an internship interview today, they asked me to learn some basic qgroundcontrol, Ardupilot and Qt. I have decided to start with Qt. I'm a total beginner to QT. Pls suggest the possible interview questions and how should I learn it?
https://redd.it/18uea2y
@qt_reddit
Best way to implement a popout text editor for my first application
My first QT aooolication is a little sys admin tool for linux, ading users and groups etc. I would like to have a pop out text editor on the right hand side so notes can be taken as a person gets bthrough their tasks. There seems to be maqny ways to do things in QT, could anyone suggest a good way to do this, I cant find any examples in the documentation and have a couple of ideas but they might not be the most effectivive, thank you!
https://redd.it/18uwhdn
@qt_reddit
How do I use the `QPushButton{ background: url(<path>)};` statement in PySide6? I tried the way below and was unable to cause the error:.
https://redd.it/18vlhvc
@qt_reddit
Unable To Use cmake for building /JKQtPlotter-4.0.0 on a Linux platform
I am on Ubuntu Linux:
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
​
I wish to use cmake to build the JKQtPlotter-4.0.0
​
I have read that QT's intentions are to move to cmake and get off of qtmake.
​
I downloaded project JKQtPlotter-4.0.0
​
I am using qt 5.15.3
​
Home director for the project is /home/maallyn/plotter/JKQtPlotter-4.0.0
​
I then create sub directory build; build is at
/home/maallyn/plotter/JKQtPlotter-4.0.0/build
​
I then try the following command based on instructions:
cmake .. -G "MinGW Makefiles" "-DCMAKE_PREFIX_PATH=/home/maallyn/plotter/JKQtPlotter-4.0.0"
​
But I get the following error:
​
CMake Error: Could not create named generator MinGW Makefiles
​
Generators
Green Hills MULTI = Generates Green Hills MULTI files
(experimental, work-in-progress).
* Unix Makefiles = Generates standard UNIX makefiles.
Ninja = Generates build.ninja files.
Ninja Multi-Config = Generates build-<Config>.ninja files.
Watcom WMake = Generates Watcom WMake makefiles.
CodeBlocks - Ninja = Generates CodeBlocks project files.
CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
CodeLite - Ninja = Generates CodeLite project files.
CodeLite - Unix Makefiles = Generates CodeLite project files.
Eclipse CDT4 - Ninja = Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
Kate - Ninja = Generates Kate project files.
Kate - Unix Makefiles = Generates Kate project files.
Sublime Text 2 - Ninja = Generates Sublime Text 2 project files.
Sublime Text 2 - Unix Makefiles
= Generates Sublime Text 2 project files.
​
Is this because JKQtPlotter-4.0.0 has not been set up to use cmake on a Linux platform?
​
I notice the MinGW may have something to do with Windows, what is the equivalent for Linux?
​
https://redd.it/18r0dux
@qt_reddit
How can I include all Que dlls in my application?
I'm completely new to using Qt, and I don't know a lot of things.
As a test, I created a simple application using VS19 and Qt 5.14.0.
Everything worked normally within the development environment, but when I tried to run the application (.exe) in the project directory, I encountered errors related to missing files both in debug and release versions.libEGL.dll
Qt5Core.dll
Qt5Gui.dll
Qt5Widgets.dll
After some research, I found that I had to take the respective DLLs and place them alongside the executable. When creating a final version and sending it to another Windows system, do I always have to include the executable with the DLLs and other folders? Could you explain this to me? Is it a common practice that every application build needs to be delivered this way?
Note: I came across many questions on Stack Overflow, Reddit, and Qt forums, but I couldn't find anything that could help me.
https://redd.it/18r8wkz
@qt_reddit
Are Qt Design Studio packages available in Debian/Ubuntu?
I've found packages for Qt Designer and Qt Creator, but those aren't the same thing.
<eom, can't think of anything else useful to add to the question!>
https://redd.it/18qhihx
@qt_reddit
QML ListView delegate color change on hover and selection
It is an almost ubiquitous feature of modern GUI lists that when the cursor is hovered over an item, its background color changes to reflect this. Likewise, when an item is selected by clicking, the background color changes to indicate that the item is the currently selected item. Implementing the latter is fairy straightforwards and well documented:
color: ListView.isCurrentIndex ? "red" : "blue"
But what if we want to also have a third color for when the cursor is hovered over the item? Well strangely enough I wasn't able to find any examples or solutions to this problem online, which is surprising considering I can't be the first person to want to have a "hover over" color for my delegate. I ended up going with the following:
ListView{
id: myListView
width: parent.width
height: 100
highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
focus: true
model: myModel
spacing: 10
delegate: Rectangle {
id: container
width: myListView.width
height: 40
color: {
if (ListView.isCurrentItem) {
"red"
} else if (mouseArea.hovered) {
"green"
} else {
"blue"
}
}
Text {
text: name + ": " + age
color: "white"
}
MouseArea {
id: mouseArea
hoverEnabled: true
property bool hovered
anchors.fill: parent
onEntered: {hovered = true}
onExited: {hovered = false}
onClicked: {myListView.currentIndex = index}
}
}
}
It works as intended, but doesn't look like the cleanest solution to the problem. Is there a more established way, or am I on the right track? Surely I can't be the first person to have this problem?
https://redd.it/18q61oh
@qt_reddit
How to add children on trigger for a UI element in QML
As the question says, I see that in QML u add children by just declaring them inside the parent, ex: Pane{
Text{"something"}
Text{"something"}
}
is there some way to instead compile them in a list and then display all the children in the list itself, cause then u can set events that will change the list of objects... I'm literally 3 days old to Qt, I'm sorry if im slow
https://redd.it/18p3sqn
@qt_reddit
Android development with VS Code
Hello there, recently I got into QT development and I'm enjoying it so far.
I've seen that it's possible to build Android apps using it, but I'm stuck on trying to set it up with VS Code. How can I go around setting it up with qmake/cmake, and without QtCreator (as I don't have a license)?
I'm also a bit confused with the licensing, I know QT has both a commercial and open source license, but when it comes to releasing an app made with QT, how do you go around including it in the app, if it's closed or open source? Do you still need to pay for a license, even if your not using any of QT's commericial products like QtCreator?
Thanks in advance and have a great day!
https://redd.it/18ojcag
@qt_reddit
How to install QtCreator and setup project on Windows. (OpenSource Licensce)
Hi, I want to install QtCreator on Windows and build simply project. Online installer had a problem "Network error while downloading(...) Connection closed." So I used offline installer but in QtCreator I got that message.
https://preview.redd.it/ircyqq8px29c1.png?width=1375&format=png&auto=webp&s=98f4a9d950114ebc4236b5c955030b121ade94f3
What directory should I point here?
https://preview.redd.it/w2d2bbnwx29c1.png?width=1207&format=png&auto=webp&s=98cdf2c3329b22bd76bd3291cf945cb628832a44
https://redd.it/18t11j9
@qt_reddit
Driver not loaded error on my application
Hello,
I have created an application using Qt framework, which is using QMYSQL as database. While I am in the release build, the application runs well, but the thing is when I am running the .exe one alone (I used windeployqt.exe to get all of the necessary files for it to run properly), I am getting QSqlDatabase: QMYSQL driver not loaded. QSqlDatabase: available drivers: QSQLITE QODBC QPSQL. The thing is that I have all of the DLLs for mysql in the same folder as the application. I used mingw_64 as compiler.
https://redd.it/18t3u6j
@qt_reddit
How to use video as a Texture
Hi
Basing on Qt's examples I managed to create an `Item` which allows to view 360⁰ equirectangular pictures.
I simply create `View3D` with properly setup `environment`: environment: SceneEnvironment {
antialiasingMode: SceneEnvironment.MSAA
antialiasingQuality: SceneEnvironment.VeryHigh
lightProbe: Texture {
id: sourceTexture
}
backgroundMode: SceneEnvironment.SkyBox
}
and then I set `source` property of `sourceTexture` to url of an image.
Now I'd like to experiment with 360⁰ videos but I'm not sure how to do it.
My idea was to use `Texture`'s sourceItem which would be set to an item used as video sink of `MediaPlayer` but I'm not sure how exactly do it.
https://redd.it/18w30xo
@qt_reddit
Why doesn't my QScrollArea scroll?
Qt newbe here.
I tried to create a QScrollArea and put some pushbuttons in it. Instead of scrolling the buttons Qt compresses them to fit the viewport no matter how may buttons I put there. The code is here. No one can explain what I'm doing wrong and how to fix it?
#include <QtCore>
#include <QtGui>
#include <QApplication>
#include <QScrollArea>
#include <QGridLAyout>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QScrollArea scrollArea;
// scrollArea.setFixedSize(300, 400);
QWidget *widget = new QWidget();
scrollArea.setWidget(widget);
scrollArea.setWidgetResizable(true);
QGridLayout *layout = new QGridLayout;
scrollArea.setLayout(layout);
for(int n=0; n<17; n++) {
for(int m=0; m<3; m++) {
layout->addWidget(new QPushButton("Hubba Bubba"), n, m);
}
}
scrollArea.show();
return app.exec();
}
https://redd.it/18vzt6q
@qt_reddit
Building a QT app for Android using QMake, without QtCreator
Hello there, as the title says, I'm looking for a way to build QT apps for Android (and maybe iOS) without QtCreator. How can I setup QMake to build for Android and iOS?
Thanks in advance and have a happy new year!
https://redd.it/18tvd9p
@qt_reddit
How do I use QVariantAnimation().interpolated() in PySide6?
I'm keen on creating a button interpolation animation in PySide6 using QVariantAnimation, how can I do that?"
https://redd.it/18u5zcn
@qt_reddit
QT Design Studio - No Qt design studio installation found
https://redd.it/18una5l
@qt_reddit
How likely are you to use raw pointers in Qt Quick ?
I have the following situation, I have a QObject managing a list of QObjects which needs to be exposed to Qml as a QProperty.
Now, QObjects are not copy-able and QList append uses the copy constructor of the object to add it the list so pointers is the way to go.
Problem now, smart pointers are not accessible through QML (only raw pointers can be exposed to Qml via QProperty) so I started using raw pointers and managing them by myself, no problems so far and the feature was completed.
Did I miss something in my logic ?
​
https://redd.it/18v3q97
@qt_reddit
Unable To Use cmake for building /JKQtPlotter-4.0.0 on a Linux platform
I am on Ubuntu Linux:
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
​
I wish to use cmake to build the JKQtPlotter-4.0.0
​
I have read that QT's intentions are to move to cmake and get off of qtmake.
​
I downloaded project JKQtPlotter-4.0.0
​
I am using qt 5.15.3
​
Home director for the project is /home/maallyn/plotter/JKQtPlotter-4.0.0
​
I then create sub directory build; build is at
/home/maallyn/plotter/JKQtPlotter-4.0.0/build
​
I then try the following command based on instructions:
cmake .. -G "MinGW Makefiles" "-DCMAKE_PREFIX_PATH=/home/maallyn/plotter/JKQtPlotter-4.0.0"
​
But I get the following error:
​
CMake Error: Could not create named generator MinGW Makefiles
​
Generators
Green Hills MULTI = Generates Green Hills MULTI files
(experimental, work-in-progress).
* Unix Makefiles = Generates standard UNIX makefiles.
Ninja = Generates build.ninja files.
Ninja Multi-Config = Generates build-<Config>.ninja files.
Watcom WMake = Generates Watcom WMake makefiles.
CodeBlocks - Ninja = Generates CodeBlocks project files.
CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
CodeLite - Ninja = Generates CodeLite project files.
CodeLite - Unix Makefiles = Generates CodeLite project files.
Eclipse CDT4 - Ninja = Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
Kate - Ninja = Generates Kate project files.
Kate - Unix Makefiles = Generates Kate project files.
Sublime Text 2 - Ninja = Generates Sublime Text 2 project files.
Sublime Text 2 - Unix Makefiles
= Generates Sublime Text 2 project files.
​
Is this because JKQtPlotter-4.0.0 has not been set up to use cmake on a Linux platform?
​
I notice the MinGW may have something to do with Windows, what is the equivalent for Linux?
​
https://redd.it/18r0d3k
@qt_reddit
Do I need to learn HTML/CSS/JS before making web apps in QT/C++
I am currently learning C++ for Game development in Unreal as a hobby. I am also learning Web Development HTML/CSS/JS so that I may transition to a new job next year. I recently discovered the QT framework and all the other cool stuff you can do with C++
Would it be beneficial to continue learning HTML/CSS/JS or should I just go full steam ahead with C++ for web and app development? or would learning HTML/CSS/JS first be a better path
https://redd.it/18r6tnc
@qt_reddit
Having troubles building static QML app
I have a relatively simple qml app which I want to build statically for windows from Linux. For that I use MXE ( mxe.cc ) environment which works well for normal widget apps. Now I have a rather default CMakeLists.txt file. On the internet I found, that I need qt_import_qml_plugins() to import plugins for QML. Adding this CMake command creates a new file in the build directory with following content:
// This file is autogenerated by CMake. It imports static plugin classes for
// static plugins used by QML imports.
#include <QtPlugin>
QIMPORTPLUGIN(QtQuick2Plugin)
QIMPORTPLUGIN(QtQuick2WindowPlugin)
QIMPORTPLUGIN(QtQuickControls2Plugin)
QIMPORTPLUGIN(QtQmlPlugin)
QIMPORTPLUGIN(QtQuickTemplates2Plugin)
QIMPORTPLUGIN(QtQmlModelsPlugin)
QIMPORTPLUGIN(QtQmlWorkerScriptPlugin)
QIMPORTPLUGIN(QMultimediaDeclarativeModule)
QIMPORTPLUGIN(QtQuickControls2ImagineStylePlugin)
QIMPORTPLUGIN(QtGraphicalEffectsPlugin)
QIMPORTPLUGIN(QtGraphicalEffectsPrivatePlugin)
QIMPORTPLUGIN(QtQuickControls2MaterialStylePlugin)
QIMPORTPLUGIN(QtQuickControls2FusionStylePlugin)
QIMPORTPLUGIN(QtQuickControls2UniversalStylePlugin)
But when I run make
I get a lot of undefined reference
errors. All of them seem to arise from Q_IMPORT_PLUGIN Macro (or whatever it is). What am I doing wrong? Any help much appreciated.
​
https://redd.it/18rf3mc
@qt_reddit
Using Qt for Mobile in 2023
https://camg.me/qt-mobile-2023/
https://redd.it/18q5sn3
@qt_reddit
Qt app as a chrome add-on
Is it theoretically possible to port an Qt App (originally designed for windows) to chrome (the browser, not the OS), so it would be available on the market platform for chrome add-ons? I'm relatively new to Qt and trying to learn more about it in my free time.
https://redd.it/18q351v
@qt_reddit
[Announce] Qt 5.15.12 Opensource released
https://lists.qt-project.org/pipermail/announce/2023-December/000464.html
https://redd.it/18oh844
@qt_reddit