OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkListWidget.h" | 10 #include "SkListWidget.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } | 54 } |
55 | 55 |
56 QIcon breakpointIcon = | 56 QIcon breakpointIcon = |
57 QIcon(qvariant_cast<QPixmap>(index.data(Qt::DecorationRole))); | 57 QIcon(qvariant_cast<QPixmap>(index.data(Qt::DecorationRole))); |
58 QIcon deleteIcon = | 58 QIcon deleteIcon = |
59 QIcon(qvariant_cast<QPixmap>(index.data(Qt::UserRole + 2))); | 59 QIcon(qvariant_cast<QPixmap>(index.data(Qt::UserRole + 2))); |
60 int indent = index.data(Qt::UserRole + 3).toInt(); | 60 int indent = index.data(Qt::UserRole + 3).toInt(); |
61 | 61 |
62 QString drawCommandText = index.data(Qt::DisplayRole).toString(); | 62 QString drawCommandText = index.data(Qt::DisplayRole).toString(); |
63 QString drawCommandNumber; | 63 QString drawCommandNumber; |
64 if (kIndex_IndexStyle == fIndexStyle) { | 64 drawCommandNumber = index.data(Qt::UserRole + 1).toString(); |
65 drawCommandNumber = index.data(Qt::UserRole + 1).toString(); | |
66 } else { | |
67 drawCommandNumber = index.data(Qt::UserRole + 5).toString(); | |
68 } | |
69 float time = index.data(Qt::UserRole + 4).toFloat(); | 65 float time = index.data(Qt::UserRole + 4).toFloat(); |
70 QString drawTime; | 66 QString drawTime; |
71 drawTime.setNum(time, 'f', 2); | 67 drawTime.setNum(time, 'f', 2); |
72 drawTime += "%"; | 68 drawTime += "%"; |
73 | 69 |
74 /* option.rect is a struct that Qt uses as a target to draw into. Following | 70 /* option.rect is a struct that Qt uses as a target to draw into. Following |
75 * the format (x1,y1,x2,y2) x1 and y1 represent where the painter can start | 71 * the format (x1,y1,x2,y2) x1 and y1 represent where the painter can start |
76 * drawing. x2 and y2 represent where the drawing area has to terminate | 72 * drawing. x2 and y2 represent where the drawing area has to terminate |
77 * counting from the bottom right corner of each list item styled with this | 73 * counting from the bottom right corner of each list item styled with this |
78 * widget. A (x1,y1,0,0) rect would mean that the item being drawn would | 74 * widget. A (x1,y1,0,0) rect would mean that the item being drawn would |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 r = option.rect.adjusted(kImageSpace+kCommandNumberSpace, 0, -10, -7); | 108 r = option.rect.adjusted(kImageSpace+kCommandNumberSpace, 0, -10, -7); |
113 painter->drawText(r.left(), r.top(), r.width(), r.height(), | 109 painter->drawText(r.left(), r.top(), r.width(), r.height(), |
114 Qt::AlignBottom|Qt::AlignLeft, drawTime, &r); | 110 Qt::AlignBottom|Qt::AlignLeft, drawTime, &r); |
115 } | 111 } |
116 } | 112 } |
117 | 113 |
118 QSize SkListWidget::sizeHint (const QStyleOptionViewItem& option, | 114 QSize SkListWidget::sizeHint (const QStyleOptionViewItem& option, |
119 const QModelIndex& index) const{ | 115 const QModelIndex& index) const{ |
120 return QSize(200, 30); | 116 return QSize(200, 30); |
121 } | 117 } |
OLD | NEW |