Ignore:
Timestamp:
01/27/10 09:34:34 (13 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
ce59092
Parents:
001c8cf
Message:

'info' icon scaled to height of tabBar

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gui/tabwidget.cpp

    r001c8cf r6bc425e  
    33#include <QMouseEvent>
    44#include <QPainter>
    5 
    6 #include <QDebug>
    7 
    8 const int SPACER = 5;
     5#include <QTabBar>
    96
    107TabWidget::TabWidget(QWidget *aParent)
     
    1714void TabWidget::paintEvent(QPaintEvent *event)
    1815{
     16    int height = tabBar()->tabRect(currentIndex()).height();
     17    QImage image = mInfoImage.scaled(QSize(height,height),Qt::KeepAspectRatioByExpanding,Qt::SmoothTransformation);
    1918    QPainter painter(this);
    20     painter.drawImage(rect().topRight()-QPoint(mInfoImage.width()+SPACER,-SPACER),mInfoImage);
     19    painter.drawImage(rect().topRight()-QPoint(image.width(),0),image);
    2120}
    2221
     
    2827void TabWidget::mouseReleaseEvent(QMouseEvent *event)
    2928{
    30     QPoint topLeft = rect().topRight()-QPoint(mInfoImage.width()+SPACER,-SPACER);
    31     QRect infoRect = QRect(topLeft, topLeft+QPoint(mInfoImage.width(),mInfoImage.height()));
     29    int height = tabBar()->tabRect(currentIndex()).height();
     30    QImage image = mInfoImage.scaled(QSize(height,height),Qt::KeepAspectRatioByExpanding,Qt::SmoothTransformation);
     31    QPoint topLeft = rect().topRight()-QPoint(image.width(),0);
     32    QRect infoRect = QRect(topLeft, topLeft+QPoint(image.width(),image.height()));
    3233    if( (infoRect.contains(event->pos())) && (infoRect.contains(mPressPoint)) )
    3334    {
Note: See TracChangeset for help on using the changeset viewer.