Changeset 86816 in vbox
- Timestamp:
- Nov 6, 2020 6:50:38 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 141260
- 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 85 85 86 86 void sigDragging(const QPoint &delta); 87 void sigSearchTextChanged(const QString &strSearchText); 87 88 88 89 public: … … 123 124 void emitHistoryChangedSignal(); 124 125 void setSource(const QUrl &url, const QString &strError); 126 void toggleFindInPageWidget(bool fVisible); 125 127 126 128 public slots: … … 137 139 void sltHandleOpenInNewTab(); 138 140 void sltHandleFindWidgetDrag(const QPoint &delta); 141 void sltHandleFindInPageSearchTextChange(const QString &strSearchText); 139 142 140 143 private: … … 180 183 void sltHandleForwardAction(); 181 184 void sltHandleBackwardAction(); 185 void sltHandleFindInPageAction(bool fToggled); 182 186 void sltHandleHistoryChanged(); 183 187 void sltHandleAddressBarIndexChanged(int index); … … 287 291 { 288 292 setAutoFillBackground(true); 289 setSizePolicy(QSizePolicy:: Expanding, QSizePolicy::Maximum);293 setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum); 290 294 291 295 QHBoxLayout *pLayout = new QHBoxLayout(this); … … 293 297 AssertReturnVoid(pLayout && m_pSearchLineEdit); 294 298 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 300 308 m_pDragMoveLabel = new QLabel; 301 309 AssertReturnVoid(m_pDragMoveLabel); … … 424 432 new QAction(UIIconPool::iconSet(":/help_browser_search.png"), QString(), this); 425 433 434 AssertReturnVoid(m_pHomeAction && m_pForwardAction && 435 m_pBackwardAction && m_pAddBookmarkAction && 436 m_pFindInPageAction); 437 m_pFindInPageAction->setCheckable(true); 438 426 439 connect(m_pHomeAction, &QAction::triggered, this, &UIHelpBrowserTab::sltHandleHomeAction); 427 440 connect(m_pBackwardAction, &QAction::triggered, this, &UIHelpBrowserTab::sltHandleAddBookmarkAction); 428 441 connect(m_pForwardAction, &QAction::triggered, this, &UIHelpBrowserTab::sltHandleForwardAction); 429 442 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 431 445 m_pForwardAction->setEnabled(false); 432 446 m_pBackwardAction->setEnabled(false); … … 493 507 if (m_pContentViewer) 494 508 m_pContentViewer->backward(); 509 } 510 511 void UIHelpBrowserTab::sltHandleFindInPageAction(bool fToggled) 512 { 513 if (m_pContentViewer) 514 m_pContentViewer->toggleFindInPageWidget(fToggled); 495 515 } 496 516 … … 564 584 connect(m_pFindInPageWidget, &UIFindInPageWidget::sigDragging, 565 585 this, &UIHelpBrowserViewer::sltHandleFindWidgetDrag); 586 connect(m_pFindInPageWidget, &UIFindInPageWidget::sigSearchTextChanged, 587 this, &UIHelpBrowserViewer::sltHandleFindInPageSearchTextChange); 588 m_pFindInPageWidget->setVisible(false); 566 589 retranslateUi(); 567 590 } … … 587 610 else 588 611 QTextBrowser::setSource(url); 612 } 613 614 void UIHelpBrowserViewer::toggleFindInPageWidget(bool fVisible) 615 { 616 if (m_pFindInPageWidget) 617 { 618 m_pFindInPageWidget->setVisible(fVisible); 619 update(); 620 } 589 621 } 590 622 … … 618 650 if (!m_fFindWidgetPositioned) 619 651 { 620 m_pFindInPageWidget->move(width() - m_pFindInPageWidget->width() - 50,0);652 m_pFindInPageWidget->move(width() - m_pFindInPageWidget->width() - 10, 10); 621 653 m_fFindWidgetPositioned = true; 622 654 } … … 649 681 rect.translate(0, (height() - iMargin - rect.bottom())); 650 682 m_pFindInPageWidget->setGeometry(rect); 683 m_pFindInPageWidget->update(); 651 684 } 652 685 … … 681 714 m_pFindInPageWidget->move(m_pFindInPageWidget->pos() + delta); 682 715 update(); 716 } 717 718 void UIHelpBrowserViewer::sltHandleFindInPageSearchTextChange(const QString &strSearchText) 719 { 720 printf("%s\n", qPrintable(strSearchText)); 683 721 } 684 722 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UISearchLineEdit.cpp
r82968 r86816 30 30 , m_unmarkColor(palette().color(QPalette::Base)) 31 31 , 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())) 34 34 { 35 35 } … … 58 58 int iRightMargin = iTopMargin; 59 59 60 QColor fontColor(Qt:: darkGray);60 QColor fontColor(Qt::black); 61 61 painter.setPen(fontColor); 62 62 painter.setFont(pfont);
Note:
See TracChangeset
for help on using the changeset viewer.