From 9141a8f7800af11860de35b9a4fe06885a0af348 Mon Sep 17 00:00:00 2001 From: Xiao Yi Fang Date: Fri, 14 Jun 2024 08:31:02 +0800 Subject: [PATCH] opt: remove currentGroup qt style property --- src/ui/mainwindow.cc | 22 ---------------------- src/ui/mainwindow.hh | 2 -- 2 files changed, 24 deletions(-) diff --git a/src/ui/mainwindow.cc b/src/ui/mainwindow.cc index f3700256..6ba6b8b0 100644 --- a/src/ui/mainwindow.cc +++ b/src/ui/mainwindow.cc @@ -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 ); diff --git a/src/ui/mainwindow.hh b/src/ui/mainwindow.hh index 5439dc63..c9994215 100644 --- a/src/ui/mainwindow.hh +++ b/src/ui/mainwindow.hh @@ -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.