mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
opt: use italic to indicate the no results (#1232)
* opt: use italic to indicate the no results * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
7767d42d2a
commit
0fbcdda72f
|
@ -38,17 +38,16 @@ QString Utils::Url::getSchemeAndHost( QUrl const & url )
|
|||
void Utils::Widget::setNoResultColor( QWidget * widget, bool noResult )
|
||||
{
|
||||
if ( noResult ) {
|
||||
QPalette pal( widget->palette() );
|
||||
// #febb7d
|
||||
QRgb rgb = 0xfebb7d;
|
||||
pal.setColor( QPalette::Base, QColor( rgb ) );
|
||||
widget->setAutoFillBackground( true );
|
||||
widget->setPalette( pal );
|
||||
auto font = widget->font();
|
||||
font.setItalic( true );
|
||||
|
||||
widget->setFont( font );
|
||||
}
|
||||
else {
|
||||
QPalette pal( widget->style()->standardPalette() );
|
||||
widget->setAutoFillBackground( true );
|
||||
widget->setPalette( pal );
|
||||
auto font = widget->font();
|
||||
font.setItalic( false );
|
||||
|
||||
widget->setFont( font );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -275,9 +275,6 @@ ScanPopup::ScanPopup( QWidget * parent,
|
|||
|
||||
void ScanPopup::refresh()
|
||||
{
|
||||
|
||||
// TODO: GroupCombox's update should be moved inside GroupCombox
|
||||
|
||||
// currentIndexChanged() signal is very trigger-happy. To avoid triggering
|
||||
// it, we disconnect it while we're clearing and filling back groups.
|
||||
disconnect( ui.groupList, &GroupComboBox::currentIndexChanged, this, &ScanPopup::currentGroupChanged );
|
||||
|
@ -627,13 +624,7 @@ void ScanPopup::updateSuggestionList( QString const & text )
|
|||
// An empty request always results in an empty result
|
||||
wordFinder.cancel();
|
||||
|
||||
// Reset the noResults mark if it's on right now
|
||||
if ( ui.translateBox->translateLine()->property( "noResults" ).toBool() ) {
|
||||
auto translateLine = ui.translateBox->translateLine();
|
||||
translateLine->setProperty( "noResults", false );
|
||||
|
||||
Utils::Widget::setNoResultColor( translateLine, false );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -899,6 +890,10 @@ void ScanPopup::prefixMatchFinished()
|
|||
_results << fst;
|
||||
}
|
||||
|
||||
// Reset the noResults mark if it's on right now
|
||||
auto translateLine = ui.translateBox->translateLine();
|
||||
|
||||
Utils::Widget::setNoResultColor( translateLine, _results.isEmpty() );
|
||||
ui.translateBox->setModel( _results );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue