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

Lubomir I. Ivanov neolit123 at gmail.com
Mon Apr 17 14:10:28 PDT 2017


On 18 April 2017 at 00:02, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
> On 17 April 2017 at 23:46, Thiago Macieira <thiago at macieira.org> wrote:
>> This disables the debug output for the default category, that is, every user
>> of qDebug().
>>
>
> yep, i later figured that might happen.
>
>> I was suggesting turning mDebug() into qCDebug(...).
>>
>> // in a header
>> namespace Marble {
>>     Q_DECLARE_LOGGING_CATEGORY(loggingCategory)
>> }
>> #define mDebug          qCDebug(Marble::loggingCategory)
>>
>> // in one source file
>> namespace Marble {
>>     Q_LOGGING_CATEGORY(loggingCategory, "marble", QtWarningMsg)
>> }
>>
>
> i've tried returning a qCDebug() from mDebug, but it cannot be done.
> so how can the flag MarbleDebug::isEnabled() be used then to
> conditionally show debug output in Marble?
>

i guess we could just do a:
void MarbleDebug::setEnabled(bool enabled)
{
    Marble::loggingCategory.setEnabled(enabled);
    MarbleDebug::m_enabled = enabled;
}

lubomir
--


More information about the subsurface mailing list