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

Why their are less tutorials around qt or qt-qml?

I want to develop some software for realtime data, but I could not find any good resources and guide for qt. I want to create prototype projects with qt and map where rider location is realtime track by desktop app. But issue is the I could not find the resources. I find few examples code by qt and documentation around it but not a comprehensive tutorial around?

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

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

Qt - Reddit

Is there a better way to insert units in my form?

I wonder if there is a better way to insert the unit of my form while someone is entering a number.

TBH if I would know how to do this I would allow the user to enter its Value in inch as well as in mm.

I have no clue how this is done 'the Qt way'


Thanks in advance for any hint.

TextField{
id: innerDia
text: ""
placeholderText: "Innendurchmesser in mm"
onTextChanged: {
if (!innerDia.text.endsWith("mm"))
innerDia.text = innerDia.text + " mm"
// place curser before "mm"
innerDia.cursorPosition = innerDia.text.length - 3
}
}

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

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

Qt - Reddit

bottom, right or bottom right edge/corner. I have tested the same code on pop os and it resizes and moves correctly.
What can I do to ensure the same behaviour on kwin and non kwin environments?

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

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

Qt - Reddit

Qt on lemmy?

Is there any Qt framework related community on lemmy? I can't find just by typing 'qt'. It didn't have auto suggestion like reddit.

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

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

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

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

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

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

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

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

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

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

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

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

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 - 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

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

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

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

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

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

Qt - Reddit

Why is the QT open source-> commercial license rules so strange?

What end user will want to, or even know how to replace the QT libraries? It seems weird to me that this is a requirement to use QT free license for a commercial app.

https://redd.it/18wysnc
@qt_reddit

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

Qt - Reddit

[Announce] Qt 6.2.7 Opensource released
https://lists.qt-project.org/pipermail/announce/2024-January/000466.html

https://redd.it/18wophn
@qt_reddit

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

Qt - Reddit

Dynamic QML component

It is better use C++ for dynamic QML component or Javascript Dynamic QML compinent.

In C++:
Q_INVOKABLE void createComponent(const QString &qmlCode, QObject *parent = nullptr);

In Javascript:
const newObject = Qt.createQmlObject('some string');

Which is better and why ?
I feel easier in JS, but I want to utilize C++, I want experts suggestion on which one to take when and why.

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

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

Qt - Reddit

Cannot register namespace enum

I have an enum that I need to use both in QML and C++, so I followed a reddit post here and documentation:
[https://www.reddit.com/r/QtFramework/comments/18d1o5t/how\_can\_i\_expose\_an\_c\_enum\_to\_qml/](https://www.reddit.com/r/QtFramework/comments/18d1o5t/how_can_i_expose_an_c_enum_to_qml/)
[https://doc.qt.io/qt-6/qqmlengine.html#qmlRegisterUncreatableMetaObject](https://doc.qt.io/qt-6/qqmlengine.html#qmlRegisterUncreatableMetaObject)

so I have this code:

#include <QObject>

namespace AuthStatus
{
Q_NAMESPACE
enum class Status {
LoggedIn,
TokensPresent,
None
};
Q_ENUM_NS(Status)
}

qmlRegisterUncreatableMetaObject(AuthStatus::staticMetaObject, "socialhub", 1, 0, "AuthStatus", QStringLiteral("Access to enums only"));

but when I compile it with make, I get this error:

main.cpp:(.text+0xbbe): undefined reference to `AuthStatus::staticMetaObject'

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

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

Qt - Reddit

Qt frameless window does not resize or move as expected on KDE

I have created a QMainWindow with the following window flags Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint | Qt::BypassWindowManagerHint like so
BrowserWindow::BrowserWindow(QWidget parent, double width, double height): QMainWindow(parent), resizing(false){
this->resize(width, height);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint | Qt::BypassWindowManagerHint);
this->setAttribute(Qt::WA_TranslucentBackground);
this->setMouseTracking(true);

//Implement Outer UI
QWidget
centralWidget = new QWidget(this);

//...widgets
centralWidget->setMouseTracking(true);


this->setCentralWidget(centralWidget);
}
Here is the code I've written to implement resizing
void BrowserWindow::mousePressEvent(QMouseEvent event){
if(event->button() == Qt::LeftButton && this->isEdgePosition(event->position())){
this->showNormal();
this->resizing = true;
this->maximized = false;
this->originalGeometry = this->geometry();
this->lastMousePosition = event->globalPosition();
this->currentEdgePosition = this->edgePosition(event->position());
}
QMainWindow::mousePressEvent(event);
}

void BrowserWindow::mouseMoveEvent(QMouseEvent
event){
switch(this->edgePosition(event->position())){
case WindowBoundary::TOP:
case WindowBoundary::BOTTOM:
this->setCursor(Qt::SizeVerCursor);
break;
//...the same for the other edges and corners
default:
this->setCursor(Qt::ArrowCursor);
}

if(this->resizing){
QPointF delta = event->globalPosition() - lastMousePosition;
QRect newGeometry = originalGeometry;

switch(this->currentEdgePosition){
case WindowBoundary::TOP:
newGeometry.setTop(originalGeometry.top() + delta.y());
break;
case WindowBoundary::BOTTOM:
newGeometry.setBottom(originalGeometry.bottom() + delta.y());
break;
case WindowBoundary::LEFT:
newGeometry.setLeft(originalGeometry.left() + delta.x());
break;
case WindowBoundary::RIGHT:
newGeometry.setRight(originalGeometry.right() + delta.x());
break;
case WindowBoundary::TOPLEFT:
newGeometry.setTop(
originalGeometry.top() + delta.y());
newGeometry.setLeft(originalGeometry.left() + delta.x());
break;
case WindowBoundary::TOP
RIGHT:
newGeometry.setTop(originalGeometry.top() + delta.y());
newGeometry.setRight(originalGeometry.right() + delta.x());
break;
case WindowBoundary::BOTTOMLEFT:
newGeometry.setBottom(originalGeometry.bottom() + delta.y());
newGeometry.setLeft(originalGeometry.left() + delta.x());
break;
case WindowBoundary::BOTTOM
RIGHT:
newGeometry.setBottom(originalGeometry.bottom() + delta.y());
newGeometry.setRight(originalGeometry.right() + delta.x());
break;
}

this->setGeometry(newGeometry);
}
QMainWindow::mouseMoveEvent(event);
}
Here is the code I use to move the window.
void TitleBar::mousePressEvent(QMouseEvent event){
this->moving = true;
this->originalPosition = event->globalPosition();
this->originalGeometry = this->window->geometry();
QWidget::mousePressEvent(event);
}

void TitleBar::mouseMoveEvent(QMouseEvent
event){
if(this->moving){
QPointF delta = event->globalPosition() - this->originalPosition;
QRect newGeometry = this->originalGeometry;

newGeometry.moveTopLeft(this->originalGeometry.topLeft() + delta.toPoint());

this->window->setGeometry(newGeometry);
}
}
Here is the issue: The window does not move when clicking and dragging on the titlebar on kde, and only the bottom, right and bottom right edges resize correctly. When resizing from the top, left or top left edges/corner, it resizes from the

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

Qt - Reddit

What's the easiest way to distribute a PyQt6 app for multiple OS?

Hi, I made a PyQt6 onefile app with PyInstaller and want to distribute it for Windows and MacOS. Is making a virtual machine for each OS and building it on them the best way, or are there better alternatives?

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

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

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&amp;format=png&amp;auto=webp&amp;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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Qt - Reddit

QT UI Design Responsive without empty when we change the display resolution

Not able to auto adjust screen on different size screen resolution . Is there any way to achieve the responsive UI contents ??

Right side and bottom side space is keep on increasing when we change the resolution but UI have to resize and fit it into different screen resolution

https://redd.it/18y4igs
@qt_reddit

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

Qt - Reddit

CMake for Qt tutorial. Write CMakeLists.txt from scratch
https://www.youtube.com/watch?v=xs-b_bQIrtU

https://redd.it/18wrn4o
@qt_reddit

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

Qt - Reddit

Border around GridLayout (QML)

I have a GridLayout containing several Labels and TextFields. I want to put a border around the grid with equal spacing around the edges so I've placed the grid inside a Rectangle and set the border I want. The problem is, by setting the grid's anchors to fill the parent, we end up with a gap at the top and the bottom. I can get by this by scaling the owning Rectangle to the grid's minimum size, but this has some undesired effects:


Rectangle {
Layout.preferredHeight: grid22.height
Layout.preferredWidth: 200
color: "transparent"
border.width: 1
border.color: "#3d3d3d"
radius: 5

GridLayout {
id: grid22
anchors.top: parent.top
anchors.margins: 15
columns: 2
rowSpacing: 15

Is there another way to set the Rectangle's size to match the grid's size, or perhaps a way to remove the spacing at the top and bottom?

https://redd.it/18sfqet
@qt_reddit

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