[Interest] qApp desktop weirdness
Dom
dom at dotzteam.com
Fri Mar 1 15:14:36 CET 2013
Hey,
It seems that the compiler is right. :)
As QCoreApplication does not have a member called desktop.
But QApplication does!
http://qt-project.org/doc/qt-4.8/qcoreapplication.html
http://qt-project.org/doc/qt-4.8/qapplication.html
It was a long time ago when I was developing in Qt using C++. These days I'm using PySide, but I suppose you need to include <QApplication> instead of <QtCore> or something similar. :)
Hope it helps!
Cheers,
Tibold
-----Original Message-----
From: interest-bounces+dom=dotzteam.com at qt-project.org [mailto:interest-bounces+dom=dotzteam.com at qt-project.org] On Behalf Of Sensei
Sent: 2013 March 01, Friday 15:11
To: interest at qt-project.org
Subject: [Interest] qApp desktop weirdness
Dear all,
I am looking through this for quite some hours, I turn to you to let me see my error... it seems I can't spot that... I'm probably tired.
I have a very easy class hSettings that must store the window size, and to init that, I use
QRect desktop = qApp->desktop()->geometry();
Of course, the header includes <QtCore>, and I get an error:
/Users/sensei/Documents/Projects/htools/hTools/hTools/hSettings.cpp:23:31:
error: no member named 'desktop' in 'QCoreApplication'
QRect desktop = qApp->desktop()->geometry();
~~~~ ^
I am puzzled, because I copied the code from another (perfectly running) application.
So, I went to the main window class, and add this to the destructor:
hMainWindow::~hMainWindow()
{
qWarning("width is %d", qApp->desktop()->geometry().width());
}
And behold! It compiles! qApp for an unknown reason now has desktop()...
If you want to take a look at the source code, it's here:
https://bitbucket.org/senseiwa/htools/src
If anyone can help me dispel this curse, I'd really appreciate it: I know it must be an utterly stupid error!
Thanks & Cheers!
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list