VirtualBox

Changeset 70679 in vbox


Ignore:
Timestamp:
Jan 22, 2018 3:41:42 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt bugref:9072 Rotate the background text 45 degrees

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerTextEdit.cpp

    r70673 r70679  
    277277        /* For 100% scale PM_LargeIconSize is 32px, and since we want ~300x~100 pixmap we take it 9x3: */
    278278        const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize);
    279         QImage image(9 * iIconMetric, 3 * iIconMetric, QImage::Format_ARGB32_Premultiplied);
     279        int imageW = 8 * iIconMetric;
     280        int imageH = 8 * iIconMetric;
     281        QImage image(imageW, imageH, QImage::Format_ARGB32_Premultiplied);
    280282        QColor fillColor(QPalette::Light);
    281283        fillColor.setAlpha(0);
    282284        image.fill(fillColor);
    283285        QPainter painter(&image);
     286        painter.translate(0.5 * imageW, 0.5 * imageH);
     287        painter.rotate(-45);
    284288
    285289        /* Configure the font size and color: */
     
    289293        painter.setPen(fontColor);
    290294        pfont.setBold(true);
    291         pfont.setPixelSize(46);
     295        pfont.setPixelSize(48);
    292296        painter.setFont(pfont);
    293 
    294         painter.drawText(image.rect(), Qt::AlignCenter | Qt::AlignVCenter, m_strBackgroungText);
     297        QRect textRect(- 0.5 * imageW, - 0.5 * imageH, imageW, imageH);
     298        painter.drawText(textRect, Qt::AlignCenter | Qt::AlignVCenter, m_strBackgroungText);
    295299
    296300        mPalette.setBrush(QPalette::Base, QBrush(image));
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