qobject

Nothing helped to solve “Undefined reference to vtable” in Qt

送分小仙女□ 提交于 2021-01-28 02:57:25
问题 I can't build this with error "undefined reference to vtable for CustomUndoStack" Here's the code: class CustomUndoStack : public QObject { Q_OBJECT public: }; int main(int argc, char *argv[]) { QCoreApplication qCoreApplication(argc, argv); CustomUndoStack uStack; return qCoreApplication.exec(); } Here's .pro file: QT += widgets CONFIG += c++14 console CONFIG -= app_bundle DEFINES += QT_DEPRECATED_WARNINGS SOURCES += main.cpp I've deleted manually the build directory, I've tried "Clean All"

Do I have to delete these QObject* when I reset QVector<QObject*>

主宰稳场 提交于 2020-07-23 06:53:05
问题 Here's one of my ViewModels: class MainVM : public QObject { Q_OBJECT PROPERTY(QVector<View*>, views) // Created with new operator from database PROPERTY(QVector<Plot*>, plots) PROPERTY(QVector<Space*>, spaces) PROPERTY(QVector<Tenant*>, tenants) PROPERTY(QVector<ControlHead*>, controlHeads) PROPERTY(QVector<Head*>, heads) PROPERTY(QVector<Lease*>, leases) PROPERTY(QVector<Receivable*>, receivables) PROPERTY(QVector<Space*>, filteredSpaces) // adds few pointers from PROPERTY(QVector<Space*>,

Do I have to delete these QObject* when I reset QVector<QObject*>

烂漫一生 提交于 2020-07-23 06:52:26
问题 Here's one of my ViewModels: class MainVM : public QObject { Q_OBJECT PROPERTY(QVector<View*>, views) // Created with new operator from database PROPERTY(QVector<Plot*>, plots) PROPERTY(QVector<Space*>, spaces) PROPERTY(QVector<Tenant*>, tenants) PROPERTY(QVector<ControlHead*>, controlHeads) PROPERTY(QVector<Head*>, heads) PROPERTY(QVector<Lease*>, leases) PROPERTY(QVector<Receivable*>, receivables) PROPERTY(QVector<Space*>, filteredSpaces) // adds few pointers from PROPERTY(QVector<Space*>,

Do I have to delete these QObject* when I reset QVector<QObject*>

╄→尐↘猪︶ㄣ 提交于 2020-07-23 06:51:52
问题 Here's one of my ViewModels: class MainVM : public QObject { Q_OBJECT PROPERTY(QVector<View*>, views) // Created with new operator from database PROPERTY(QVector<Plot*>, plots) PROPERTY(QVector<Space*>, spaces) PROPERTY(QVector<Tenant*>, tenants) PROPERTY(QVector<ControlHead*>, controlHeads) PROPERTY(QVector<Head*>, heads) PROPERTY(QVector<Lease*>, leases) PROPERTY(QVector<Receivable*>, receivables) PROPERTY(QVector<Space*>, filteredSpaces) // adds few pointers from PROPERTY(QVector<Space*>,

Do I have to delete these QObject* when I reset QVector<QObject*>

假装没事ソ 提交于 2020-07-23 06:51:01
问题 Here's one of my ViewModels: class MainVM : public QObject { Q_OBJECT PROPERTY(QVector<View*>, views) // Created with new operator from database PROPERTY(QVector<Plot*>, plots) PROPERTY(QVector<Space*>, spaces) PROPERTY(QVector<Tenant*>, tenants) PROPERTY(QVector<ControlHead*>, controlHeads) PROPERTY(QVector<Head*>, heads) PROPERTY(QVector<Lease*>, leases) PROPERTY(QVector<Receivable*>, receivables) PROPERTY(QVector<Space*>, filteredSpaces) // adds few pointers from PROPERTY(QVector<Space*>,

No matching function for QObject::connect

不打扰是莪最后的温柔 提交于 2020-05-26 11:12:17
问题 I'm writing a program that send an UDP frame every 10 mS. Here's how my program is supposed to work : I've got a client class : //Constructor clientSupervision::clientSupervision() { } void clientSupervision::sendDataUDP(){ //Create a frame and send it ... } void clientSupervision::sendDataUDPTimer(int timer){ QTimer *tempsEnvoieTrameSupervision = new QTimer();//Create a timer tempsEnvoieTrameSupervision->setInterval(timer);//Set the interval //Mise en place des connections QObject::connect

No matching function for QObject::connect

大城市里の小女人 提交于 2020-05-26 11:12:16
问题 I'm writing a program that send an UDP frame every 10 mS. Here's how my program is supposed to work : I've got a client class : //Constructor clientSupervision::clientSupervision() { } void clientSupervision::sendDataUDP(){ //Create a frame and send it ... } void clientSupervision::sendDataUDPTimer(int timer){ QTimer *tempsEnvoieTrameSupervision = new QTimer();//Create a timer tempsEnvoieTrameSupervision->setInterval(timer);//Set the interval //Mise en place des connections QObject::connect

Qt - How a QObject with a parent on the stack might get deleted twice?

你。 提交于 2020-05-14 02:38:31
问题 Can someone explain the following please? Stack or Heap? In general, a QObject without a parent should be created on the stack or defined as an subobject of another class. A QObject with a parent should not be on the stack because then it might get deleted twice accidentally. All QObjects created on the heap should either have a parent, or be managed somehow by another object. Source: LINK 回答1: Sorry, downvoting the accepted answer. Both versions as currently explained are wrong, and

Qt - How a QObject with a parent on the stack might get deleted twice?

梦想的初衷 提交于 2020-05-14 02:38:27
问题 Can someone explain the following please? Stack or Heap? In general, a QObject without a parent should be created on the stack or defined as an subobject of another class. A QObject with a parent should not be on the stack because then it might get deleted twice accidentally. All QObjects created on the heap should either have a parent, or be managed somehow by another object. Source: LINK 回答1: Sorry, downvoting the accepted answer. Both versions as currently explained are wrong, and

How to bind C++ property to QML property?

浪尽此生 提交于 2020-05-12 20:03:23
问题 So I know how to bind QML property to C++ property, so when C++ one calls notify signal, QML updates the view. Is there any way to make C++ property update when user changes something using UI? For example, I have a Combobox, and I want some C++ property to be updated when user changes value of combobox. EDIT: By C++ properties I mean Q_PROPERTY macro in QObject -derived classes. 回答1: To bind a property from an object you didn't create in QML (or was created in another context), you have to