mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +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
16
scanpopup.cc
16
scanpopup.cc
|
@ -847,7 +847,9 @@ void ScanPopup::typingEvent( QString const & t )
|
|||
|
||||
bool ScanPopup::eventFilter( QObject * watched, QEvent * event )
|
||||
{
|
||||
if ( event->type() == QEvent::FocusIn && watched == ui.translateBox->translateLine() )
|
||||
if ( watched == ui.translateBox->translateLine() )
|
||||
{
|
||||
if ( event->type() == QEvent::FocusIn )
|
||||
{
|
||||
QFocusEvent * focusEvent = static_cast< QFocusEvent * >( event );
|
||||
|
||||
|
@ -858,6 +860,18 @@ bool ScanPopup::eventFilter( QObject * watched, QEvent * event )
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if ( mouseIntercepted )
|
||||
{
|
||||
// We're only interested in our events
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
<item>
|
||||
<widget class="TranslateBox" name="translateBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
|
Loading…
Reference in a new issue