Changeset View
Changeset View
Standalone View
Standalone View
gameselectionscene.cpp
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 53 | public: | |||
---|---|---|---|---|---|
69 | { | 69 | { | ||
70 | if ( size != m_size ) | 70 | if ( size != m_size ) | ||
71 | { | 71 | { | ||
72 | m_size = size; | 72 | m_size = size; | ||
73 | m_preview = QPixmap(); | 73 | m_preview = QPixmap(); | ||
74 | } | 74 | } | ||
75 | } | 75 | } | ||
76 | 76 | | |||
77 | QRectF boundingRect() const Q_DECL_OVERRIDE | 77 | QRectF boundingRect() const override | ||
78 | { | 78 | { | ||
79 | return QRectF( QPointF(), m_size ); | 79 | return QRectF( QPointF(), m_size ); | ||
80 | } | 80 | } | ||
81 | 81 | | |||
82 | QString label() const | 82 | QString label() const | ||
83 | { | 83 | { | ||
84 | return m_label; | 84 | return m_label; | ||
85 | } | 85 | } | ||
Show All 24 Lines | 109 | { | |||
110 | return a->m_label < b->m_label; | 110 | return a->m_label < b->m_label; | ||
111 | } | 111 | } | ||
112 | 112 | | |||
113 | signals: | 113 | signals: | ||
114 | void selected( int gameId ); | 114 | void selected( int gameId ); | ||
115 | void hoverChanged( GameSelectionBox * box, bool hovered ); | 115 | void hoverChanged( GameSelectionBox * box, bool hovered ); | ||
116 | 116 | | |||
117 | protected: | 117 | protected: | ||
118 | void mousePressEvent( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE | 118 | void mousePressEvent( QGraphicsSceneMouseEvent * event ) override | ||
119 | { | 119 | { | ||
120 | Q_UNUSED( event ) | 120 | Q_UNUSED( event ) | ||
121 | emit selected( m_gameId ); | 121 | emit selected( m_gameId ); | ||
122 | } | 122 | } | ||
123 | 123 | | |||
124 | void hoverEnterEvent( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE | 124 | void hoverEnterEvent( QGraphicsSceneHoverEvent * event ) override | ||
125 | { | 125 | { | ||
126 | Q_UNUSED( event ) | 126 | Q_UNUSED( event ) | ||
127 | emit hoverChanged( this, true ); | 127 | emit hoverChanged( this, true ); | ||
128 | } | 128 | } | ||
129 | 129 | | |||
130 | void hoverLeaveEvent( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE | 130 | void hoverLeaveEvent( QGraphicsSceneHoverEvent * event ) override | ||
131 | { | 131 | { | ||
132 | Q_UNUSED( event ) | 132 | Q_UNUSED( event ) | ||
133 | emit hoverChanged( this, false ); | 133 | emit hoverChanged( this, false ); | ||
134 | } | 134 | } | ||
135 | 135 | | |||
136 | qreal hoverFadeAmount() const | 136 | qreal hoverFadeAmount() const | ||
137 | { | 137 | { | ||
138 | return m_highlightFadeAmount; | 138 | return m_highlightFadeAmount; | ||
139 | } | 139 | } | ||
140 | 140 | | |||
141 | void setHoverFadeAmount( qreal amount ) | 141 | void setHoverFadeAmount( qreal amount ) | ||
142 | { | 142 | { | ||
143 | m_highlightFadeAmount = amount; | 143 | m_highlightFadeAmount = amount; | ||
144 | update(); | 144 | update(); | ||
145 | } | 145 | } | ||
146 | 146 | | |||
147 | void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) Q_DECL_OVERRIDE | 147 | void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override | ||
148 | { | 148 | { | ||
149 | Q_UNUSED( option ) | 149 | Q_UNUSED( option ) | ||
150 | Q_UNUSED( widget ) | 150 | Q_UNUSED( widget ) | ||
151 | 151 | | |||
152 | Renderer * r = Renderer::self(); | 152 | Renderer * r = Renderer::self(); | ||
153 | int textAreaHeight = m_size.height() * textToBoxHeightRatio; | 153 | int textAreaHeight = m_size.height() * textToBoxHeightRatio; | ||
154 | int padding = boxPaddingRatio * m_size.width(); | 154 | int padding = boxPaddingRatio * m_size.width(); | ||
155 | QSize previewSize( m_size.height() - padding * 2, m_size.height() - padding * 2 - textAreaHeight ); | 155 | QSize previewSize( m_size.height() - padding * 2, m_size.height() - padding * 2 - textAreaHeight ); | ||
▲ Show 20 Lines • Show All 237 Lines • Show Last 20 Lines |