Changeset 6bc425e
- Timestamp:
- 01/27/10 09:34:34 (13 years ago)
- Branches:
- master, qt5
- Children:
- ce59092
- Parents:
- 001c8cf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gui/tabwidget.cpp
r001c8cf r6bc425e 3 3 #include <QMouseEvent> 4 4 #include <QPainter> 5 6 #include <QDebug> 7 8 const int SPACER = 5; 5 #include <QTabBar> 9 6 10 7 TabWidget::TabWidget(QWidget *aParent) … … 17 14 void TabWidget::paintEvent(QPaintEvent *event) 18 15 { 16 int height = tabBar()->tabRect(currentIndex()).height(); 17 QImage image = mInfoImage.scaled(QSize(height,height),Qt::KeepAspectRatioByExpanding,Qt::SmoothTransformation); 19 18 QPainter painter(this); 20 painter.drawImage(rect().topRight()-QPoint( mInfoImage.width()+SPACER,-SPACER),mInfoImage);19 painter.drawImage(rect().topRight()-QPoint(image.width(),0),image); 21 20 } 22 21 … … 28 27 void TabWidget::mouseReleaseEvent(QMouseEvent *event) 29 28 { 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())); 32 33 if( (infoRect.contains(event->pos())) && (infoRect.contains(mPressPoint)) ) 33 34 {
Note: See TracChangeset
for help on using the changeset viewer.