78 emit closeClicked(); |
79 emit closeClicked(); |
79 event->accept(); |
80 event->accept(); |
80 return; |
81 return; |
81 } |
82 } |
82 |
83 |
83 if ((x < width() - 2 * h) && (x > width() - 3 * h)) { |
84 if ((x < width() - (h + spacing)) && (x > width() - (h * 2 + spacing))) { |
84 emit forwardClicked(); |
85 emit forwardClicked(); |
85 event->accept(); |
86 event->accept(); |
86 return; |
87 return; |
87 } |
88 } |
88 |
89 |
89 if ((x < width() - 3 * h) && (x > width() - 5 * h)) { |
90 if ((x < width() - (h * 2 + spacing * 2)) && (x > width() - (h * 3 + spacing * 2))) { |
90 emit backClicked(); |
91 emit backClicked(); |
91 event->accept(); |
92 event->accept(); |
92 return; |
93 return; |
93 } |
94 } |
94 } |
95 } |
95 |
96 |
96 void ControlStrip::paintEvent(QPaintEvent *event) |
97 void ControlStrip::paintEvent(QPaintEvent *event) |
97 { |
98 { |
98 int h = height(); |
99 int h = height(); |
99 int s = (h - menuPixmap.height()) / 2; |
100 int spacing = qMin(h, (width() - h * 4) / 3); |
|
101 int s = (height() - menuPixmap.height()) / 2; |
100 |
102 |
101 QPainter p(this); |
103 QPainter p(this); |
102 p.fillRect(event->rect(), QColor(32, 32, 32, 192)); |
104 p.fillRect(event->rect(), QColor(32, 32, 32, 192)); |
103 p.setCompositionMode(QPainter::CompositionMode_SourceOver); |
105 p.setCompositionMode(QPainter::CompositionMode_SourceOver); |
104 p.drawPixmap(s, s, menuPixmap); |
106 p.drawPixmap(s, s, menuPixmap); |
105 p.drawPixmap(width() - h + s, s, closePixmap); |
107 p.drawPixmap(width() - h + s, s, closePixmap); |
106 p.drawPixmap(width() - 3 * h + s, s, forwardPixmap); |
108 p.drawPixmap(width() - (h * 2 + spacing) + s, s, forwardPixmap); |
107 p.drawPixmap(width() - 5 * h + s, s, backPixmap); |
109 p.drawPixmap(width() - (h * 3 + spacing * 2) + s, s, backPixmap); |
108 |
110 |
109 p.end(); |
111 p.end(); |
110 } |
112 } |