mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
Allow shrinking scan popup's toolbar height
Before this commit, when group combobox was visible, the Alt+- shortcut reduced the heights of group combobox and translate line in the main window, but not in scan popup. These UI elements in scan popup did not become lower than at the time scan popup was constructed. Applying the solution from the main window fixes this bug (#1108).
This commit is contained in:
parent
c88774151c
commit
ec96d6ac5a
26
scanpopup.cc
26
scanpopup.cc
|
@ -847,15 +847,29 @@ void ScanPopup::typingEvent( QString const & t )
|
||||||
|
|
||||||
bool ScanPopup::eventFilter( QObject * watched, QEvent * event )
|
bool ScanPopup::eventFilter( QObject * watched, QEvent * event )
|
||||||
{
|
{
|
||||||
if ( event->type() == QEvent::FocusIn && watched == ui.translateBox->translateLine() )
|
if ( watched == ui.translateBox->translateLine() )
|
||||||
{
|
{
|
||||||
QFocusEvent * focusEvent = static_cast< QFocusEvent * >( event );
|
if ( event->type() == QEvent::FocusIn )
|
||||||
|
{
|
||||||
|
QFocusEvent * focusEvent = static_cast< QFocusEvent * >( event );
|
||||||
|
|
||||||
// select all on mouse click
|
// select all on mouse click
|
||||||
if ( focusEvent->reason() == Qt::MouseFocusReason ) {
|
if ( focusEvent->reason() == Qt::MouseFocusReason ) {
|
||||||
QTimer::singleShot(0, this, SLOT(focusTranslateLine()));
|
QTimer::singleShot(0, this, SLOT(focusTranslateLine()));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( event->type() == QEvent::Resize )
|
||||||
|
{
|
||||||
|
// The UI looks ugly when group combobox is higher than translate line.
|
||||||
|
// Make the height of the combobox the same as the line edit's height.
|
||||||
|
// The fonts of these UI items should be kept in sync by applyWordsZoomLevel()
|
||||||
|
// so that text in the combobox is not clipped.
|
||||||
|
const QResizeEvent * const resizeEvent = static_cast< const QResizeEvent * >( event );
|
||||||
|
ui.groupList->setFixedHeight( resizeEvent->size().height() );
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mouseIntercepted )
|
if ( mouseIntercepted )
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="TranslateBox" name="translateBox">
|
<widget class="TranslateBox" name="translateBox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
|
Loading…
Reference in a new issue