VirtualBox

Changeset 87204 in vbox


Ignore:
Timestamp:
Jan 8, 2021 4:44:45 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Some corrections on the find in page widget

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp

    r87175 r87204  
    3030#include <QMenu>
    3131#include <QHBoxLayout>
     32#include <QScrollBar>
    3233#include <QWidgetAction>
    3334#ifdef RT_OS_SOLARIS
     
    110111
    111112    virtual bool eventFilter(QObject *pObject, QEvent *pEvent) /* override */;
     113    virtual void keyPressEvent(QKeyEvent *pEvent) /* override */;
    112114
    113115private:
     
    251253}
    252254
     255void UIFindInPageWidget::keyPressEvent(QKeyEvent *pEvent)
     256{
     257    switch (pEvent->key())
     258    {
     259        case  Qt::Key_Escape:
     260            emit sigClose();
     261            return;
     262            break;
     263        case Qt::Key_Down:
     264            emit sigSelectNextMatch();
     265            return;
     266            break;
     267        case Qt::Key_Up:
     268            emit sigSelectPreviousMatch();
     269            return;
     270            break;
     271        default:
     272            QIWithRetranslateUI<QWidget>::keyPressEvent(pEvent);
     273            break;
     274    }
     275}
     276
    253277void UIFindInPageWidget::prepare()
    254278{
     
    365389    if (!m_pFindInPageWidget)
    366390        return;
     391    /* Closing the find in page widget causes QTextBrowser to jump to the top of the document. This hack puts it back into position: */
     392    int iPosition = verticalScrollBar()->value();
    367393    /* Try to position the widget somewhere meaningful initially: */
    368394    if (!m_fFindWidgetDragged)
     
    376402        document()->undo();
    377403        m_pFindInPageWidget->clearSearchField();
     404        verticalScrollBar()->setValue(iPosition);
    378405    }
    379406    else
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette