VirtualBox

Changeset 86816 in vbox


Ignore:
Timestamp:
Nov 6, 2020 6:50:38 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
141260
Message:

FE/Qt: bugref:9831. Adding some connections

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
2 edited

Legend:

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

    r86813 r86816  
    8585
    8686    void sigDragging(const QPoint &delta);
     87    void sigSearchTextChanged(const QString &strSearchText);
    8788
    8889public:
     
    123124    void emitHistoryChangedSignal();
    124125    void setSource(const QUrl &url, const QString &strError);
     126    void toggleFindInPageWidget(bool fVisible);
    125127
    126128public slots:
     
    137139    void sltHandleOpenInNewTab();
    138140    void sltHandleFindWidgetDrag(const QPoint &delta);
     141    void sltHandleFindInPageSearchTextChange(const QString &strSearchText);
    139142
    140143private:
     
    180183    void sltHandleForwardAction();
    181184    void sltHandleBackwardAction();
     185    void sltHandleFindInPageAction(bool fToggled);
    182186    void sltHandleHistoryChanged();
    183187    void sltHandleAddressBarIndexChanged(int index);
     
    287291{
    288292    setAutoFillBackground(true);
    289     setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
     293    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
    290294
    291295    QHBoxLayout *pLayout = new QHBoxLayout(this);
     
    293297    AssertReturnVoid(pLayout && m_pSearchLineEdit);
    294298
    295     pLayout->setContentsMargins(0, 0, 0, 0);
    296     pLayout->setContentsMargins(0.5 * qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
    297                                 0.5 * qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin),
    298                                 0.5 * qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin),
    299                                 0.5 * qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
     299    QFontMetrics fontMetric(m_pSearchLineEdit->font());
     300    setMinimumSize(40 * fontMetric.width("x"),
     301                   fontMetric.height() +
     302                   qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin) +
     303                   qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin));
     304
     305    connect(m_pSearchLineEdit, &UISearchLineEdit::textChanged,
     306            this, &UIFindInPageWidget::sigSearchTextChanged);
     307
    300308    m_pDragMoveLabel = new QLabel;
    301309    AssertReturnVoid(m_pDragMoveLabel);
     
    424432        new QAction(UIIconPool::iconSet(":/help_browser_search.png"), QString(), this);
    425433
     434    AssertReturnVoid(m_pHomeAction && m_pForwardAction &&
     435                     m_pBackwardAction && m_pAddBookmarkAction &&
     436                     m_pFindInPageAction);
     437    m_pFindInPageAction->setCheckable(true);
     438
    426439    connect(m_pHomeAction, &QAction::triggered, this, &UIHelpBrowserTab::sltHandleHomeAction);
    427440    connect(m_pBackwardAction, &QAction::triggered, this, &UIHelpBrowserTab::sltHandleAddBookmarkAction);
    428441    connect(m_pForwardAction, &QAction::triggered, this, &UIHelpBrowserTab::sltHandleForwardAction);
    429442    connect(m_pBackwardAction, &QAction::triggered, this, &UIHelpBrowserTab::sltHandleBackwardAction);
    430     AssertReturnVoid(m_pHomeAction && m_pForwardAction && m_pBackwardAction && m_pAddBookmarkAction);
     443    connect(m_pFindInPageAction, &QAction::toggled, this, &UIHelpBrowserTab::sltHandleFindInPageAction);
     444
    431445    m_pForwardAction->setEnabled(false);
    432446    m_pBackwardAction->setEnabled(false);
     
    493507    if (m_pContentViewer)
    494508        m_pContentViewer->backward();
     509}
     510
     511void UIHelpBrowserTab::sltHandleFindInPageAction(bool fToggled)
     512{
     513    if (m_pContentViewer)
     514        m_pContentViewer->toggleFindInPageWidget(fToggled);
    495515}
    496516
     
    564584    connect(m_pFindInPageWidget, &UIFindInPageWidget::sigDragging,
    565585            this, &UIHelpBrowserViewer::sltHandleFindWidgetDrag);
     586    connect(m_pFindInPageWidget, &UIFindInPageWidget::sigSearchTextChanged,
     587            this, &UIHelpBrowserViewer::sltHandleFindInPageSearchTextChange);
     588    m_pFindInPageWidget->setVisible(false);
    566589    retranslateUi();
    567590}
     
    587610    else
    588611        QTextBrowser::setSource(url);
     612}
     613
     614void UIHelpBrowserViewer::toggleFindInPageWidget(bool fVisible)
     615{
     616    if (m_pFindInPageWidget)
     617    {
     618        m_pFindInPageWidget->setVisible(fVisible);
     619        update();
     620    }
    589621}
    590622
     
    618650        if (!m_fFindWidgetPositioned)
    619651        {
    620             m_pFindInPageWidget->move(width() - m_pFindInPageWidget->width() - 50, 0);
     652            m_pFindInPageWidget->move(width() - m_pFindInPageWidget->width() - 10, 10);
    621653            m_fFindWidgetPositioned = true;
    622654        }
     
    649681        rect.translate(0, (height() - iMargin - rect.bottom()));
    650682    m_pFindInPageWidget->setGeometry(rect);
     683    m_pFindInPageWidget->update();
    651684}
    652685
     
    681714        m_pFindInPageWidget->move(m_pFindInPageWidget->pos() + delta);
    682715    update();
     716}
     717
     718void UIHelpBrowserViewer::sltHandleFindInPageSearchTextChange(const QString &strSearchText)
     719{
     720    printf("%s\n", qPrintable(strSearchText));
    683721}
    684722
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UISearchLineEdit.cpp

    r82968 r86816  
    3030    , m_unmarkColor(palette().color(QPalette::Base))
    3131    , m_markColor(QColor(m_unmarkColor.red(),
    32                          0.5 * m_unmarkColor.green(),
    33                          0.5 * m_unmarkColor.blue()))
     32                         0.7 * m_unmarkColor.green(),
     33                         0.7 * m_unmarkColor.blue()))
    3434{
    3535}
     
    5858    int iRightMargin = iTopMargin;
    5959
    60     QColor fontColor(Qt::darkGray);
     60    QColor fontColor(Qt::black);
    6161    painter.setPen(fontColor);
    6262    painter.setFont(pfont);
Note: See TracChangeset for help on using the changeset viewer.

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