opt: remove currentGroup qt style property

This commit is contained in:
Xiao Yi Fang 2024-06-14 08:31:02 +08:00
parent 73f525f61b
commit 9141a8f780
2 changed files with 0 additions and 24 deletions

View file

@ -1606,8 +1606,6 @@ void MainWindow::updateGroupList()
groupList->fill( groupInstances );
groupList->setCurrentGroup( cfg.lastMainGroupId );
updateCurrentGroupProperty();
updateDictionaryBar();
qDebug() << "Reloading all the tabs...";
@ -2315,30 +2313,10 @@ void MainWindow::currentGroupChanged( int )
}
}
updateCurrentGroupProperty();
if ( ftsDlg )
ftsDlg->setCurrentGroup( grg_id );
}
void MainWindow::updateCurrentGroupProperty()
{
// We maintain currentGroup property so styles could use that to change
// fonts based on group names
Instances::Group * grp = groupInstances.findGroup( groupList->getCurrentGroup() );
if ( grp && translateLine->property( "currentGroup" ).toString() != grp->name ) {
translateLine->setProperty( "currentGroup", grp->name );
ui.wordList->setProperty( "currentGroup", grp->name );
QString ss = styleSheet();
// Only update stylesheet if it mentions currentGroup, as updating the
// stylesheet is a slow operation
if ( ss.contains( "currentGroup" ) )
setStyleSheet( ss );
}
}
void MainWindow::translateInputChanged( QString const & newValue )
{
updateSuggestionList( newValue );

View file

@ -235,8 +235,6 @@ private:
void mousePressEvent( QMouseEvent * event );
void updateCurrentGroupProperty();
/// Handles backward and forward mouse buttons and
/// returns true if the event is handled.