7 TabWidget::TabWidget(QWidget *aParent)
11 mInfoImage = QImage(":/icons/info.png");
14 void TabWidget::paintEvent(QPaintEvent *event)
16 int height = tabBar()->tabRect(currentIndex()).height();
17 QImage image = mInfoImage.scaled(QSize(height,height),Qt::KeepAspectRatioByExpanding,Qt::SmoothTransformation);
18 QPainter painter(this);
19 painter.drawImage(rect().topRight()-QPoint(image.width(),0),image);
22 void TabWidget::mousePressEvent(QMouseEvent *event)
24 mPressPoint = event->pos();
27 void TabWidget::mouseReleaseEvent(QMouseEvent *event)
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()));
33 if( (infoRect.contains(event->pos())) && (infoRect.contains(mPressPoint)) )
35 emit(infoIconClicked());