aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-12-04 23:53:53 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-04 19:41:29 -0800
commit441838def098267aa2c7c81f22eba7c16b58d2ca (patch)
tree2214d8147f0174c3aeecc7aa74f3ad1e7778e285 /qt-ui
parentd3a56c137be5cb8fb49e9d7b4ae4568759946e26 (diff)
downloadsubsurface-441838def098267aa2c7c81f22eba7c16b58d2ca.tar.gz
Different Icon for a Bookmark Event.
This patch adds a different icon for a Bookmark Event, and it also cleaned a lot of code. :) See #300 [Dirk Hohndel: made the two icons slightly bigger] Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profilegraphics.cpp36
-rw-r--r--qt-ui/profilegraphics.h3
2 files changed, 7 insertions, 32 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index bdbc00346..a1085ab76 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -1626,37 +1626,13 @@ QColor EventItem::getColor(const color_indice_t i)
return profile_color[i].at((isGrayscale) ? 1 : 0);
}
-EventItem::EventItem(struct event *ev, QGraphicsItem* parent, bool grayscale): QGraphicsPolygonItem(parent), ev(ev), isGrayscale(grayscale)
+EventItem::EventItem(struct event *ev, QGraphicsItem* parent, bool grayscale): QGraphicsPixmapItem(parent), ev(ev), isGrayscale(grayscale)
{
- setFlag(ItemIgnoresTransformations);
- setFlag(ItemIsFocusable);
- setAcceptHoverEvents(true);
-
- QPolygonF poly;
- poly.push_back(QPointF(-8, 16));
- poly.push_back(QPointF(8, 16));
- poly.push_back(QPointF(0, 0));
- poly.push_back(QPointF(-8, 16));
-
- QPen defaultPen ;
- defaultPen.setJoinStyle(Qt::RoundJoin);
- defaultPen.setCapStyle(Qt::RoundCap);
- defaultPen.setWidth(2);
- defaultPen.setCosmetic(true);
-
- QPen pen = defaultPen;
- pen.setBrush(QBrush(getColor(ALERT_BG)));
-
- setPolygon(poly);
- setBrush(QBrush(getColor(ALERT_BG)));
- setPen(pen);
-
- QGraphicsLineItem *line = new QGraphicsLineItem(0, 5, 0, 10, this);
- line->setPen(QPen(getColor(ALERT_FG), 2));
-
- QGraphicsEllipseItem *ball = new QGraphicsEllipseItem(-1, 12, 2, 2, this);
- ball->setBrush(QBrush(getColor(ALERT_FG)));
- ball->setPen(QPen(getColor(ALERT_FG)));
+ if(ev->name && strcmp(ev->name, "bookmark") == 0) {
+ setPixmap( QPixmap(QString(":flag")).scaled(20, 20, Qt::KeepAspectRatio, Qt::SmoothTransformation));
+ } else {
+ setPixmap( QPixmap(QString(":warning")).scaled(20, 20, Qt::KeepAspectRatio, Qt::SmoothTransformation));
+ }
}
RulerNodeItem::RulerNodeItem(QGraphicsItem *parent, graphics_context context) : QGraphicsEllipseItem(parent), gc(context), entry(NULL) , ruler(NULL)
diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h
index 2cd5b44d2..be9c707ba 100644
--- a/qt-ui/profilegraphics.h
+++ b/qt-ui/profilegraphics.h
@@ -97,7 +97,7 @@ private:
int paint_direction;
};
-class EventItem : public QGraphicsPolygonItem
+class EventItem : public QGraphicsPixmapItem
{
public:
explicit EventItem(struct event *ev, QGraphicsItem* parent = 0, bool grayscale = FALSE);
@@ -106,7 +106,6 @@ public:
private:
ToolTipItem *controller;
QString text;
- QIcon icon;
bool isGrayscale;
QColor getColor(const color_indice_t i);