[PATCH] MarbleDebug: don't use a class extending QIODevice as a null device

Stefan Fuchs sfuchs at gmx.de
Tue Apr 18 09:23:12 PDT 2017


Hello Lubomir,


Am 18.04.2017 um 16:00 schrieb Lubomir I. Ivanov:
> i must admit i followed Thiago's suggestions blindly.
> Thiago, do you have an idea why this happens?
>
> the macro:
> #define mDebug qCDebug(Marble::loggingCategory)
>
> expands calls like this one:
> mDebug() << "innerRing: size" << p()->inner.size();
>
> to:
> qCDebug(Marble::loggingCategory)() << "innerRing: size" <<
> p()->inner.size();
>
> is it complaining about the extra()?
>
> Yes! Yes! Thats it ;-)
>
> Changed to:
> #define mDebug() qCDebug(Marble::loggingCategory)
>
> and it compiles.
Good news: Some parts work if I comment out what still gives an error
(see below). Logging works but is always on for marble.

Bad news:
The function
void MarbleDebug::setEnabled(bool enabled)
{
    loggingCategory().setEnabled(QtDebugMsg, enabled);
}
still doesn' compile. Error:
/home/stefan/Entwicklung/Subsurface/marble-source/src/lib/marble/MarbleDebug.cpp:27:53:
error: passing 'const QLoggingCategory' as 'this' argument of 'void
QLoggingCategory::setEnabled(QtMsgType, bool)' discards qualifiers
[-fpermissive]
     loggingCategory().setEnabled(QtDebugMsg, enabled);

Also this version:
void MarbleDebug::setEnabled(bool enabled)
{
    loggingCategory.setEnabled(QtDebugMsg, enabled);
}
doesn't compile. Error:
/home/stefan/Entwicklung/Subsurface/marble-source/src/lib/marble/MarbleDebug.cpp:
In static member function 'static void
Marble::MarbleDebug::setEnabled(bool)':
/home/stefan/Entwicklung/Subsurface/marble-source/src/lib/marble/MarbleDebug.cpp:27:21:
error: request for member 'setEnabled' in 'Marble::loggingCategory',
which is of non-class type 'const QLoggingCategory&()'
     loggingCategory.setEnabled(QtDebugMsg, enabled);


Stefan

-- 

Stefan Fuchs
E-Mail: sfuchs at gmx.de <mailto:sfuchs at gmx.de>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20170418/36096a4d/attachment.html>


More information about the subsurface mailing list