mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
articleSizeLimit option: minor code cleanup
When an integral value is converted to a signed integer type, if the result is not representable, the resulting value is implementation defined (until C++20). Convert the string value from configuration file to the target type (int) to avoid the redundant type conversion. Use the more direct and efficient QSpinBox::value() instead of QAbstractSpinBox::text().toInt().
This commit is contained in:
parent
63aeb0ef6d
commit
0b7c65023c
|
@ -907,7 +907,7 @@ Class load() THROW_SPEC( exError )
|
|||
c.preferences.collapseBigArticles = ( preferences.namedItem( "collapseBigArticles" ).toElement().text() == "1" );
|
||||
|
||||
if ( !preferences.namedItem( "articleSizeLimit" ).isNull() )
|
||||
c.preferences.articleSizeLimit = preferences.namedItem( "articleSizeLimit" ).toElement().text().toUInt() ;
|
||||
c.preferences.articleSizeLimit = preferences.namedItem( "articleSizeLimit" ).toElement().text().toInt();
|
||||
|
||||
if ( !preferences.namedItem( "maxDictionaryRefsInContextMenu" ).isNull() )
|
||||
c.preferences.maxDictionaryRefsInContextMenu = preferences.namedItem( "maxDictionaryRefsInContextMenu" ).toElement().text().toUShort();
|
||||
|
|
|
@ -417,7 +417,7 @@ Config::Preferences Preferences::getPreferences()
|
|||
p.confirmFavoritesDeletion = ui.confirmFavoritesDeletion->isChecked();
|
||||
|
||||
p.collapseBigArticles = ui.collapseBigArticles->isChecked();
|
||||
p.articleSizeLimit = ui.articleSizeLimit->text().toInt();
|
||||
p.articleSizeLimit = ui.articleSizeLimit->value();
|
||||
p.ignoreDiacritics = ui.ignoreDiacritics->isChecked();
|
||||
|
||||
p.synonymSearchEnabled = ui.synonymSearchEnabled->isChecked();
|
||||
|
|
Loading…
Reference in a new issue