Changeset 525448c for src/mvc/delegate.h
- Timestamp:
- 05/05/10 15:58:56 (13 years ago)
- Branches:
- master, qt5
- Children:
- a6a9e0b
- Parents:
- 508de33
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mvc/delegate.h
r508de33 r525448c 44 44 { 45 45 public: 46 Control(ControlId aControlId, const QString &aImageName) 47 : mId(aControlId) 48 , mImage(new QImage(aImageName)) 49 , mDrawPoint(QPoint(0,0)) 50 { } 46 Control(ControlId aControlId, const QString &aImageName, const Control* prev_control); 47 51 48 inline QImage *image() const { return mImage; } 52 49 inline void setDrawPoint(const QPoint &aPoint) { mDrawPoint = aPoint; } 50 inline QRect drawRect(const QRect &aRect) const // helper for determining if Control was clicked 51 { 52 return QRect(drawPoint(aRect), drawPoint(aRect)+QPoint(mImage->size().width(),mImage->size().height())); 53 } 54 void paint(QPainter* painter, const QRect rect); 55 56 private: 53 57 inline QPoint drawPoint(const QRect &aRect = QRect()) const // for painter to draw Control 54 58 { … … 58 62 return QPoint(aRect.x()+aRect.width(),aRect.y()) + mDrawPoint; // returns absolute drawing point 59 63 } 60 inline QRect drawRect(const QRect &aRect) const // helper for determining if Control was clicked 61 { 62 return QRect(drawPoint(aRect), drawPoint(aRect)+QPoint(mImage->size().width(),mImage->size().height())); 63 } 64 private: 64 65 65 ControlId mId; 66 66 QImage *mImage;
Note: See TracChangeset
for help on using the changeset viewer.