7 TabWidget::TabWidget(QWidget *aParent)
11 mInfoImage = QImage(":/icons/info.png");
14 void TabWidget::paintEvent(QPaintEvent *event)
18 int height = tabBar()->tabRect(currentIndex()).height();
19 QImage image = mInfoImage.scaled(QSize(height,height),Qt::KeepAspectRatioByExpanding,Qt::SmoothTransformation);
20 QPainter painter(this);
21 painter.drawImage(rect().topRight()-QPoint(image.width(),0),image);
24 void TabWidget::mousePressEvent(QMouseEvent *event)
26 mPressPoint = event->pos();
29 void TabWidget::mouseReleaseEvent(QMouseEvent *event)
31 int height = tabBar()->tabRect(currentIndex()).height();
32 QImage image = mInfoImage.scaled(QSize(height,height),Qt::KeepAspectRatioByExpanding,Qt::SmoothTransformation);
33 QPoint topLeft = rect().topRight()-QPoint(image.width(),0);
34 QRect infoRect = QRect(topLeft, topLeft+QPoint(image.width(),image.height()));
35 if( (infoRect.contains(event->pos())) && (infoRect.contains(mPressPoint)) )
37 emit(infoIconClicked());