Changeset ffd878f for src/mvc


Ignore:
Timestamp:
01/18/10 14:49:08 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
5842349
Parents:
151983f
Message:

added GrayScale? versions (inactive/OFF) of the icons

Location:
src/mvc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/delegate.cpp

    r151983f rffd878f  
    208208{
    209209    Control *control;
     210    QPoint p(0,0);
    210211    // FAVOURITE ICONs
    211212    // on
    212213    control = new Control(FavouriteControlOn,QString(":icons/favourite-on.png"));
    213     control->setDrawPoint(QPoint(-control->image()->width()-SPACER,SPACER));
     214    p = QPoint(0,0);
     215    p.setX(p.x()-control->image()->width()-SPACER);
     216    control->setDrawPoint(p);
    214217    mControls.insert(FavouriteControlOn,control);
    215218    // off
    216219    control = new Control(FavouriteControlOff,QString(":icons/favourite-off.png"));
    217     control->setDrawPoint(QPoint(-control->image()->width()-SPACER,SPACER));
     220    p = QPoint(0,0);
     221    p.setX(p.x()-control->image()->width()-SPACER);
     222    control->setDrawPoint(p);
    218223    mControls.insert(FavouriteControlOff,control);
    219224
    220225    // ALARM ICONs
    221226    // on
    222     control = new Control(AlarmControlOn,QString(":icons/alarm-on.png"));
    223     control->setDrawPoint(QPoint(-mControls[FavouriteControlOn]->image()->width()-control->image()->width()-2*SPACER,SPACER));
     227    control = new Control(AlarmControlOn,QString(":icons/alarm-off.png"));
     228    p = mControls[FavouriteControlOn]->drawPoint();
     229    p.setX(p.x()-control->image()->width()-SPACER);
     230    control->setDrawPoint(p);
    224231    mControls.insert(AlarmControlOn,control);
    225232    // off
    226233    control = new Control(AlarmControlOff,QString(":icons/alarm-off.png"));
    227     control->setDrawPoint(QPoint(-mControls[FavouriteControlOff]->image()->width()-control->image()->width()-2*SPACER,SPACER));
     234    p = mControls[FavouriteControlOff]->drawPoint();
     235    p.setX(p.x()-control->image()->width()-SPACER);
     236    control->setDrawPoint(p);
    228237    mControls.insert(AlarmControlOff,control);
    229238
    230239    // MAP ICON
    231240    control = new Control(MapControl,QString(":icons/compass.png"));
    232     control->setDrawPoint(QPoint(-mControls[AlarmControlOn]->image()->width()-control->image()->width()
    233                                  -mControls[FavouriteControlOn]->image()->width()-3*SPACER,SPACER));
     241    p = mControls[AlarmControlOn]->drawPoint();
     242    p.setX(p.x()-control->image()->width()-SPACER);
     243    control->setDrawPoint(p);
    234244    mControls.insert(MapControl,control);
    235245}
  • src/mvc/delegate.h

    r151983f rffd878f  
    3232                inline QImage *image() const { return mImage; }
    3333                inline void setDrawPoint(const QPoint &aPoint) { mDrawPoint = aPoint; }
    34                 inline QPoint drawPoint(const QRect &aRect) const // for painter to draw Control
     34                inline QPoint drawPoint(const QRect &aRect = QRect()) const // for painter to draw Control
    3535                {
    36                     return QPoint(aRect.x()+aRect.width(),aRect.y()) + mDrawPoint;
     36                    if(aRect == QRect()) // null rectangle
     37                        return mDrawPoint; // returns relative drawing point
     38                    else
     39                        return QPoint(aRect.x()+aRect.width(),aRect.y()) + mDrawPoint; // returns absolute drawing point
    3740                }
    3841                inline QRect drawRect(const QRect &aRect) const // helper for determining if Control was clicked
Note: See TracChangeset for help on using the changeset viewer.