> Sent: Monday, May 10, 2021 at 3:08 AM
> From: "Ulf Hermann"
> To: interest@qt-project.org
> Subject: Re: [Interest] QML Singleton and QTimer?
>
> Hi,
>
> > GuiApplication::GuiApplication(int argc, char*argv[]):
> >
Hi,
GuiApplication::GuiApplication(int argc, char*argv[]):
QGuiApplication::QGuiApplication(argc, argv)
{
m_hardwareInterface = new HardwareInterface;
qmlRegisterSingletonInstance("com.company", 1, 0, "HardwareInterface",
m_hardwareInterface);
}
ate: Friday, May 7, 2021 at 10:10 AM
To: Jérôme Godbout
Cc: interestqt-project.org
Subject: Re: [Interest] QML Singleton and QTimer?
Well, the documentation gives the example of the singleton being instantiated
at the main.cpp:main() level.
It felt a little wrong, but I subclassed QGui
rom: "Jérôme Godbout"
To: "Jason H" , "interestqt-project.org"
Subject: Re: [Interest] QML Singleton and QTimer?
You can check the thread affinity of an object and the current thread that will display the problem you encounter. Use a queued signal into the QTimer
e
From: Interest on behalf of Jason H
Date: Thursday, May 6, 2021 at 5:34 PM
To: interestqt-project.org
Subject: [Interest] QML Singleton and QTimer?
I'm trying to have a simple singleton class, but it doesn't appear that I can
use timers?
HardwareInterface::HardwareInterface(QObject *parent
I'm trying to have a simple singleton class, but it doesn't appear that I can
use timers?
HardwareInterface::HardwareInterface(QObject *parent) : QObject(parent)
{
m_timer = new QTimer(this);
connect(m_timer, ::timeout, this, [=](){
qDebug() << Q_FUNC_INFO;