Compare commits

...

2 commits

Author SHA1 Message Date
xiaoyifang 081cba6b23 opt: Group struct default constructor only invoked with empty string 2024-11-08 20:49:55 +08:00
shenleban tongying f6434f4219 fix a mistake of https://github.com/xiaoyifang/goldendict-ng/pull/1912
Some checks are pending
SonarCloud / Build and analyze (push) Waiting to run
2024-11-08 01:36:29 -05:00
5 changed files with 7 additions and 8 deletions

View file

@ -111,7 +111,7 @@ HotKey::HotKey( QKeySequence const & seq ):
QKeySequence HotKey::toKeySequence() const
{
if ( key2 != 0 || key2 != Qt::Key::Key_unknown ) {
if ( key2 != 0 && key2 != Qt::Key::Key_unknown ) {
return { QKeyCombination( modifiers, static_cast< Qt::Key >( key1 ) ),
QKeyCombination( modifiers, static_cast< Qt::Key >( key2 ) ) };
}

View file

@ -53,9 +53,8 @@ Group::Group( Config::Group const & cfgGroup,
}
}
Group::Group( QString name_ ):
id( 0 ),
name( std::move( name_ ) )
Group::Group():
id( 0 )
{
}

View file

@ -32,7 +32,7 @@ struct Group
Config::Group const & inactiveGroup );
/// Creates an empty group.
explicit Group( QString name_ );
explicit Group();
Group( unsigned id, QString name_ );

View file

@ -122,7 +122,7 @@ void DictGroupWidget::groupIconActivated( int index )
Config::Group DictGroupWidget::makeGroup() const
{
Instances::Group g( "" );
Instances::Group g;
g.id = groupId;

View file

@ -135,7 +135,7 @@ OrderAndProps::OrderAndProps( QWidget * parent,
Config::Group OrderAndProps::getCurrentDictionaryOrder() const
{
Instances::Group g( "" );
Instances::Group g;
g.dictionaries = ui.dictionaryOrder->getCurrentDictionaries();
@ -144,7 +144,7 @@ Config::Group OrderAndProps::getCurrentDictionaryOrder() const
Config::Group OrderAndProps::getCurrentInactiveDictionaries() const
{
Instances::Group g( "" );
Instances::Group g;
g.dictionaries = ui.inactiveDictionaries->getCurrentDictionaries();