Fix behavior while words list font resizing (issue #1109)

This commit is contained in:
Abs62 2019-01-26 22:11:27 +03:00
parent 04d9dc43f6
commit 92e8c85eec
4 changed files with 54 additions and 5 deletions

View file

@ -316,6 +316,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
wordListDefaultFont = wordList->font();
translateLineDefaultFont = translateLine->font();
groupListDefaultFont = groupList->font();
// Make the dictionaries pane's titlebar
foundInDictsLabel.setText( tr( "Found in Dictionaries:" ) );
@ -3651,7 +3652,32 @@ void MainWindow::applyWordsZoomLevel()
if ( translateLine->font().pointSize() != ps )
translateLine->setFont( font );
groupList->setFont(font);
font = groupListDefaultFont;
ps = font.pointSize();
if ( cfg.preferences.wordsZoomLevel != 0 )
{
ps += cfg.preferences.wordsZoomLevel;
if ( ps < 1 )
ps = 1;
font.setPointSize( ps );
}
if ( groupList->font().pointSize() != ps )
{
disconnect( groupList, SIGNAL( currentIndexChanged( QString const & ) ),
this, SLOT( currentGroupChanged( QString const & ) ) );
int n = groupList->currentIndex();
groupList->clear();
groupList->setFont( font );
groupList->fill( groupInstances );
groupList->setCurrentIndex( n );
connect( groupList, SIGNAL( currentIndexChanged( QString const & ) ),
this, SLOT( currentGroupChanged( QString const & ) ) );
}
wordsZoomBase->setEnabled( cfg.preferences.wordsZoomLevel != 0 );
// groupList->setFixedHeight(translateLine->height());

View file

@ -116,7 +116,7 @@ private:
TranslateBox * translateBox;
/// Fonts saved before words zooming is in effect, so it could be reset back.
QFont wordListDefaultFont, translateLineDefaultFont;
QFont wordListDefaultFont, translateLineDefaultFont, groupListDefaultFont;
QAction escAction, focusTranslateLineAction, addTabAction, closeCurrentTabAction,
closeAllTabAction, closeRestTabAction,

View file

@ -115,6 +115,7 @@ ScanPopup::ScanPopup( QWidget * parent,
wordListDefaultFont = ui.translateBox->wordList()->font();
translateLineDefaultFont = ui.translateBox->font();
groupListDefaultFont = ui.groupList->font();
applyZoomFactor();
applyWordsZoomLevel();
@ -406,9 +407,31 @@ void ScanPopup::applyWordsZoomLevel()
if ( ui.translateBox->translateLine()->font().pointSize() != ps )
ui.translateBox->translateLine()->setFont( font );
ui.groupList->setFont(font);
font = groupListDefaultFont;
ps = font.pointSize();
ui.groupList->parentWidget()->layout()->activate();
if ( cfg.preferences.wordsZoomLevel != 0 )
{
ps += cfg.preferences.wordsZoomLevel;
if ( ps < 1 )
ps = 1;
font.setPointSize( ps );
}
if ( ui.groupList->font().pointSize() != ps )
{
disconnect( ui.groupList, SIGNAL( currentIndexChanged( QString const & ) ),
this, SLOT( currentGroupChanged( QString const & ) ) );
int n = ui.groupList->currentIndex();
ui.groupList->clear();
ui.groupList->setFont( font );
ui.groupList->fill( groups );
ui.groupList->setCurrentIndex( n );
connect( ui.groupList, SIGNAL( currentIndexChanged( QString const & ) ),
this, SLOT( currentGroupChanged( QString const & ) ) );
}
ui.outerFrame->layout()->activate();
}
Qt::WindowFlags ScanPopup::unpinnedWindowFlags() const

View file

@ -139,7 +139,7 @@ private:
DictionaryBar dictionaryBar;
MainStatusBar * mainStatusBar;
/// Fonts saved before words zooming is in effect, so it could be reset back.
QFont wordListDefaultFont, translateLineDefaultFont;
QFont wordListDefaultFont, translateLineDefaultFont, groupListDefaultFont;
#ifdef HAVE_X11
ScanFlag * scanFlag;