1 /* ColorCode, a free MasterMind clone with built in solver
2 * Copyright (C) 2009 Dirk Laebisch
3 * http://www.laebisch.com/
4 *
5 * ColorCode is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * ColorCode is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with ColorCode. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "timedisplaybg.h"
20
TimeDisplayBg()21 TimeDisplayBg::TimeDisplayBg()
22 {
23 setCacheMode(QGraphicsItem::DeviceCoordinateCache);
24
25 mUpdateRect = QRectF(0, 0, 220, 20);
26 mRect = QRectF(65.5, 3.5, 89, 14);
27
28 QLinearGradient solgrad(0, 1, 0, 15);
29 solgrad.setColorAt(0.0, QColor("#9fa0a2"));
30 solgrad.setColorAt(1.0, QColor("#8c8d8f"));
31 mBgBrush = QBrush(solgrad);
32
33 QLinearGradient framegrad(0, 1, 0, 15);
34 framegrad.setColorAt(0.0, QColor("#4e4f51"));
35 framegrad.setColorAt(1.0, QColor("#ebecee"));
36 mFramePen = QPen(QBrush(framegrad), 1);
37 }
38
boundingRect() const39 QRectF TimeDisplayBg::boundingRect() const
40 {
41 return mUpdateRect;
42 }
43
paint(QPainter * painter,const QStyleOptionGraphicsItem *,QWidget *)44 void TimeDisplayBg::paint(QPainter* painter, const QStyleOptionGraphicsItem* , QWidget* )
45 {
46 painter->setBrush(mBgBrush);
47 painter->setPen(mFramePen);
48 painter->drawRoundedRect(mRect, 7.5, 7.5);
49 }
50