Merge pull request #1574 from xiaoyifang/opt/remove-custom-qt-style

opt: remove currentGroup  qt style property
This commit is contained in:
xiaoyifang 2024-06-14 10:10:07 +08:00 committed by GitHub
commit 7b7c40271c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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.