QSettings return QVariant Question

View: New views
3 Messages — Rating Filter:   Alert me  

QSettings return QVariant Question

by Julie S :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Everyone,

I know this was covered in an earlier discussion and the stated solution probably works (at runtime that is), but I'm concerned.  Is there something I'm missing?

Here is a snippet from src/document/io/LilyPondExporter.cpp:
***** BEGIN *********
    m_paperSize = settings.value("lilypapersize", PAPER_A4).toUInt() ;
    m_paperLandscape = qStrToBool( settings.value("lilypaperlandscape", "false" ) ) ;
    m_fontSize = settings.value("lilyfontsize", FONT_20).toUInt() ;
    m_raggedBottom = qStrToBool( settings.value("lilyraggedbottom", "false" ) ) ;
****** END ***********

The first line properly uses .toUInt() to convert the QVariant to what is needed for m_paperSize.

The second line used the new qStrToBool().  Why don't we use.toBool()?

Example:
    m_paperLandscape = settings.value("lilypaperlandscape", "false" ).toBool();

The reference to this is:
http://doc.trolltech.com/4.3/qvariant.html#toBool

Am I missing something?

Sincerely,
Julie S.



     

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@... - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Re: QSettings return QVariant Question

by Emanuel Rumpf-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/9/12 Julie S <msjulie_s@...>:

> Hello Everyone,
>
> ***** BEGIN *********
>    m_paperSize = settings.value("lilypapersize", PAPER_A4).toUInt() ;
>    m_paperLandscape = qStrToBool( settings.value("lilypaperlandscape", "false" ) ) ;
>    m_fontSize = settings.value("lilyfontsize", FONT_20).toUInt() ;
>    m_raggedBottom = qStrToBool( settings.value("lilyraggedbottom", "false" ) ) ;
> ****** END ***********
>
> The first line properly uses .toUInt() to convert the QVariant to what is needed for m_paperSize.
> The second line used the new qStrToBool().  Why don't we use.toBool()?
>
A good question!
I wrote qStrToBool() , because I thought, we would probably re-use old
config files
and I wanted the behavior of the conversion to be equal as the qt3 function.

But now I think, that won't happen.
So maybe it would be more appropriate to use .toBool().
Anyway. It's not that bad to use qStrToBool(), because I'm able
to change it's behavior, as we need it !

So for now, I would leave it as it is.
The function could be removed with a script later.

Sincerely
Emanuel

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@... - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Re: QSettings return QVariant Question

by Julie S :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear Emanuel,

Thank you for the reply.

I'll leave things alone.  I had no intent on doing anything about it.  It just looked odd.

I will add this as a task for later in the wiki.

Sincerely,
Julie S.



     

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@... - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel
LightInTheBox - Buy quality products at wholesale price!