Comments (4)
You need to set QAPPLICATION_CLASS
to QApplication
in your .pro file (not in main.cpp):
DEFINES += QAPPLICATION_CLASS=QApplication
I got this error because I defined it in main.cpp, which didn't set it in singleapplication.cpp. So even though SingleApplication
inherited QApplication
as it should in main.cpp, it inherited the default QCoreApplication
instead in singleapplication.cpp where the constructor is defined, so the QApplication
constructor was never called.
The solution to this is to define it in the .pro file instead, which defines it for the whole project.
from singleapplication.
from singleapplication.
#164 macro helps.
#165 in my Qt version 5.15.2 (or 5.15.3 in my Mint21 installed) still is error:
"QWidget: Cannot create a QWidget without QApplication"
In Qt sources in qwidget.cpp:
void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
{
Q_Q(QWidget);
Q_ASSERT_X(q != parentWidget, Q_FUNC_INFO, "Cannot parent a QWidget to itself");
if (Q_UNLIKELY(!qobject_cast<QApplication *>(QCoreApplication::instance())))
qFatal("QWidget: Cannot create a QWidget without QApplication");
But Calculator example works fine => maybe I have other invisible error.
from singleapplication.
from singleapplication.
Related Issues (20)
- Race condition (?) HOT 7
- Recording video has stuttering effect HOT 2
- ocr maybe error? HOT 1
- No primaryScreen property HOT 1
- undefined reference to `SingleApplication::SingleApplication(int&, char**, bool, QFlags<SingleApplication::Mode>, int, QString const&)' HOT 5
- Long screenshot shortcuts cannot be changed(长截图快捷键无法更改) HOT 1
- Using QSharedMemory for SingleApplication might stop working as of Qt 6.6 HOT 8
- The new license might no longer be GPL-compatible HOT 14
- Restart application failed HOT 5
- key too long on macos HOT 10
- [Proposal] Never fail to launch app HOT 6
- wrong issue to wrong repo
- Could not find advapi32_LIBRARY using the following names: advapi32 HOT 2
- Define ownership of QSharedMemory* pointer HOT 1
- Check if d->attach() is successful HOT 1
- args_for_main.join( ) puts a separator on every space HOT 3
- Consider making SingleApplication as a hook HOT 1
- Kill recovery not working HOT 11
- Randomly freeze in QSharedMemory::attach() which finally calls QSharedMemory::lock
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from singleapplication.