414 questions
Score of 1
1 answer
75 views
What's the cause of "double free" when I pass a QObject* to QML code?
With this C++ code:
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
class Returned : public QObject {
Q_OBJECT
public:
...
Score of 2
2 answers
171 views
std::visit for QObject's
I have the following code that does not compile with Qt 6.7.2 on Debian :
#include <QCoreApplication>
#include <iostream>
#include <variant>
class Foo : public QObject
{
...
Score of 0
1 answer
42 views
Assigning property to a particular instance created dynamically in qml
I want to instantiate an image in 'sample.qml' multiple times dynamically depending on the count. I am able to create multiple qml instances in run time as below,
Item {
id: container
width: ...
Score of 3
1 answer
66 views
Why is there no crash when assigning a member widget as the central widget in QMainWindow?
I wrote the following code, which doesn't provoke any error:
main.cpp
#include "main_window.hpp"
#include <QtWidgets/QApplication>
int main(int argc, char *argv[])
{
QApplication ...
Score of 2
1 answer
114 views
How can a class be defined in such way that it inherits from QObject as well within a QObject-derived class?
In class A, I define a class B. I want to hide the implementation of class B. The class B inherits from QObject.
// a.h
class A : public QObject
{
Q_OBJECT
public:
explicit A(QObjcet* parent=...
Score of 0
0 answers
112 views
How to pass custom class (subclass of QDialog) to other custom class (subclass of QObject) in Qt5?
I am making a Qt project. To make it simplier, i decided to make a class JsonPostSender, it subclasses QObject. I have my login dialog, subclassing QDialog. I can't pass login dialog to JsonPostSender ...
Score of 0
0 answers
71 views
Can't use connect on a class that inherits from QObject [duplicate]
I've been trying to create a timer that every time it runs out it will add something to a list. To do this i need to add a slot to the signal of the timer running out.
#ifndef GAMEMODEL_H
#define ...
Score of 1
2 answers
1483 views
matplotlib | QObject::moveToThread: Current thread (0x831f000) is not the object's thread (0x95b40e0). Cannot move to target thread (0x831f000)
There were existing posts regarding this error, but not in conjunction with using matplotlib.
QObject::moveToThread: Current thread (0x831f000) is not the object's thread (0x95b40e0).
Cannot move to ...
Score of 0
1 answer
63 views
Why does pyqt subthread freezes GUI when doing heavy repetitive work?
In this simulated example I am repeating a task every 1 second using QTimer by implementing a QObject, then move it to a QThead. The simulated task takes 0.5 second. The task runs in a new thread, ...
Score of 1
1 answer
135 views
Top 10 Sold Products with Django queryset order_by "external value"
I am trying to get top 10 sold products from my models.
Models are (they are in diferent apps):
Products:
class Product(models.Model):
user = models.ForeignKey(Vendor, on_delete=models.CASCADE)
...
Score of 0
1 answer
87 views
Django Q object - Is it possible to put those two queries together even if one depends from another?
Does anyone knows if is possible to put together two Q object queries in only one.
Is the first time I need to use it and I am quite lost.
First query:
vendors = Vendor.objects.filter(Q(is_approved=...
Score of 0
0 answers
94 views
Destructor not called but program terminates with code 0. Is everything fine?
#include <QApplication>
#include <QWidget>
#include <QVBoxLayout>
#include <QPushButton>
#include <QDebug>
#include <QThread>
class Worker : public QObject
{
...
Score of 0
1 answer
90 views
Complex constraint in Django with Q Objects
Two players can register for a tennis tournament which offers the doubles discipline (2 players compete against 2 other players).
But there are some constraints:
The same player may not register as ...
Score of 1
1 answer
412 views
Difference between QObject::connect() and connect()
I am new to Qt and I want to try to understand it better.
I know from an inheritance perspective that a QMainWindow is derived from QObject. (Directly/Indirectly)
This allows for us to connect signals ...
Score of -1
1 answer
232 views
Qt - QThread Signal&Slot No Error Just not Working
I updated my question. My project is so simple. I want to create 3 thread. Each thread have different operations. Finally, they should communicate using signal&slot.
I got errors:
-debug/main.o:...