Changeset 77087 in vbox for trunk/src/VBox
- Timestamp:
- Jan 31, 2019 7:05:53 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 128540
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/logviewer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.cpp
r77078 r77087 162 162 } 163 163 m_iSearchPosition = -1; 164 m_iMatchCount = 0; 165 emit sigSearchUpdated(); 164 166 clearHighlighting(); 165 167 } -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerTextEdit.cpp
r77078 r77087 224 224 setWrapLines(false); 225 225 setReadOnly(true); 226 setBackground();227 226 } 228 227 … … 314 313 } 315 314 316 void UIVMLogViewerTextEdit::setBackground()317 {318 /* Prepare modified standard palette: */319 QPalette pal = style() ? style()->standardPalette() : palette(); // fallback if no style exist.320 pal.setColor(QPalette::Inactive, QPalette::Highlight, pal.color(QPalette::Active, QPalette::Highlight));321 pal.setColor(QPalette::Inactive, QPalette::HighlightedText, pal.color(QPalette::Active, QPalette::HighlightedText));322 323 /* Paint a string to the background of the text edit to indicate that324 the text has been filtered */325 if (m_bShownTextIsFiltered)326 {327 /* For 100% scale PM_LargeIconSize is 32px, and since we want ~300x~100 pixmap we take it 9x3: */328 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize);329 int imageW = 8 * iIconMetric;330 int imageH = 8 * iIconMetric;331 QImage image(imageW, imageH, QImage::Format_ARGB32_Premultiplied);332 QColor fillColor(QPalette::Light);333 fillColor.setAlpha(0);334 image.fill(fillColor);335 QPainter painter(&image);336 painter.translate(0.5 * imageW, 0.5 * imageH);337 painter.rotate(-45);338 339 /* Configure the font size and color: */340 QFont pfont = painter.font();341 QColor fontColor(QPalette::Dark);342 fontColor.setAlpha(22);343 painter.setPen(fontColor);344 pfont.setBold(true);345 pfont.setPixelSize(48);346 painter.setFont(pfont);347 QRect textRect(- 0.5 * imageW, - 0.5 * imageH, imageW, imageH);348 painter.drawText(textRect, Qt::AlignCenter | Qt::AlignVCenter, m_strBackgroungText);349 350 pal.setBrush(QPalette::Base, QBrush(image));351 }352 353 /* Apply palette changes finally: */354 setPalette(pal);355 }356 357 315 void UIVMLogViewerTextEdit::contextMenuEvent(QContextMenuEvent *pEvent) 358 316 { … … 423 381 424 382 /** Draw an overlay with text in it to show the number of search matches: */ 425 if (viewport() && m_fShowSearchResultOverlay)383 if (viewport() && (m_fShowSearchResultOverlay || m_bShownTextIsFiltered)) 426 384 { 427 385 QPainter painter(viewport()); … … 430 388 rectColor.setAlpha(200); 431 389 432 QString strText = QString("%1 %2").arg(QString::number(m_iMatchCount)).arg(UIVMLogViewerWidget::tr("Matches Found")); 390 QString strText; 391 if (m_fShowSearchResultOverlay) 392 strText = QString("%1 %2").arg(QString::number(m_iMatchCount)).arg(UIVMLogViewerWidget::tr("Matches Found")); 393 if (m_bShownTextIsFiltered) 394 { 395 if (!strText.isEmpty()) 396 strText.append(" / "); 397 strText.append(UIVMLogViewerWidget::tr("Filtered")); 398 } 433 399 /** Space between the text and rectangle border. */ 434 400 QSize textMargin(5, 5); … … 563 529 return; 564 530 m_bShownTextIsFiltered = warning; 565 setBackground(); 531 if (viewport()) 532 viewport()->repaint(); 566 533 } 567 534 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerTextEdit.h
r77078 r77087 97 97 /** If bookmark exists this function removes it, if not it adds the bookmark. */ 98 98 void toggleBookmark(const QPair<int, QString>& bookmark); 99 void setBackground();100 99 101 100 /** Line number and text at the context menu position */
Note:
See TracChangeset
for help on using the changeset viewer.