CEDRIC  Revision_backup-2009-02
MDSItem.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Copyright (C) 2008 Boris Iven, Max Hermann
4  *
5  * This file is part of the "CEDRIC Event Display" application.
6  *
7  *****************************************************************************/
8 
9 #ifndef MDSITEM_H
10 #define MDSITEM_H
11 
12 #include <QtGui/QColor>
13 #include <QtGui/QGraphicsEllipseItem>
14 
15 class MDSItem : public QGraphicsEllipseItem
16 {
17 public:
19  static void setPointSize( qreal size );
21  static qreal pointSize() { return s_pointSize; }
22 
24  static void setPivotIndex( int index ) { s_pivotIndex = index; }
26  static int pivotIndex() { return s_pivotIndex; }
27 
28 protected:
29  static qreal s_pointSize;
30  static int s_pivotIndex;
31 
32 
33 public:
34  MDSItem( int index, const QColor& color );
35 
36  int index() const { return m_index; }
37 
39  void adjustSize();
40 
41 protected:
42  void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget );
43 
44 /*
45 protected:
46  void mousePressEvent ( QGraphicsSceneMouseEvent *event );
47  void mouseMoveEvent ( QGraphicsSceneMouseEvent *event );
48  void mouseReleaseEvent( QGraphicsSceneMouseEvent *event );
49 */
50 
51 private:
52  int m_index;
53  QColor m_color;
54  qreal m_pointSize;
55 };
56 
57 #endif // MDSITEM_H
static qreal pointSize()
Get pixel size of points.
Definition: MDSItem.h:21
static int s_pivotIndex
Definition: MDSItem.h:30
int index() const
Definition: MDSItem.h:36
static qreal s_pointSize
Definition: MDSItem.h:29
MDSItem(int index, const QColor &color)
Definition: MDSItem.cpp:28
static void setPivotIndex(int index)
Specify which item to draw as "pivot element", set index to -1 to deselect current one...
Definition: MDSItem.h:24
static void setPointSize(qreal size)
Set pixel size of points.
Definition: MDSItem.cpp:20
static int pivotIndex()
Get event index of item currently drawn as "pivot element".
Definition: MDSItem.h:26
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: MDSItem.cpp:41
void adjustSize()
Call this after changing the static point size via MDSItem::setPointSize()
Definition: MDSItem.cpp:66
Definition: MDSItem.h:15