Remove some QRect madness.
This commit is contained in:
parent
b9f8aeadec
commit
7f8901a9e0
1 changed files with 11 additions and 23 deletions
12
Playlist.cpp
12
Playlist.cpp
|
@ -462,7 +462,6 @@ PlaylistWidget::paintEvent (QPaintEvent *event)
|
||||||
{
|
{
|
||||||
QPainter paint;
|
QPainter paint;
|
||||||
QRect r;
|
QRect r;
|
||||||
QRect er = event->rect ();
|
|
||||||
|
|
||||||
paint.begin (this);
|
paint.begin (this);
|
||||||
|
|
||||||
|
@ -470,18 +469,15 @@ PlaylistWidget::paintEvent (QPaintEvent *event)
|
||||||
r.setRect (0, 0,
|
r.setRect (0, 0,
|
||||||
m_corner1.width(),
|
m_corner1.width(),
|
||||||
m_corner1.height());
|
m_corner1.height());
|
||||||
if (er.contains (r))
|
|
||||||
paint.drawPixmap (r, m_corner1, m_corner1.rect ());
|
paint.drawPixmap (r, m_corner1, m_corner1.rect ());
|
||||||
|
|
||||||
/* drawing the upper right corner */
|
/* drawing the upper right corner */
|
||||||
r.setRect (width()-m_corner2.width(), 0, m_corner2.width(), m_corner2.height());
|
r.setRect (width()-m_corner2.width(), 0, m_corner2.width(), m_corner2.height());
|
||||||
if (er.contains (r))
|
|
||||||
paint.drawPixmap (r, m_corner2, m_corner2.rect());
|
paint.drawPixmap (r, m_corner2, m_corner2.rect());
|
||||||
|
|
||||||
/* Drawing the lower left corner */
|
/* Drawing the lower left corner */
|
||||||
r.setRect (0, size().height()-m_corner3.height(),
|
r.setRect (0, size().height()-m_corner3.height(),
|
||||||
m_corner3.width(), m_corner3.height());
|
m_corner3.width(), m_corner3.height());
|
||||||
if (er.contains (r))
|
|
||||||
paint.drawPixmap (r, m_corner3, m_corner3.rect());
|
paint.drawPixmap (r, m_corner3, m_corner3.rect());
|
||||||
|
|
||||||
/* drawing the lower right corner */
|
/* drawing the lower right corner */
|
||||||
|
@ -489,7 +485,6 @@ PlaylistWidget::paintEvent (QPaintEvent *event)
|
||||||
size().height()-m_corner4.height(),
|
size().height()-m_corner4.height(),
|
||||||
m_corner4.width(),
|
m_corner4.width(),
|
||||||
m_corner4.height());
|
m_corner4.height());
|
||||||
if (er.contains (r))
|
|
||||||
paint.drawPixmap (r, m_corner4, m_corner4.rect());
|
paint.drawPixmap (r, m_corner4, m_corner4.rect());
|
||||||
|
|
||||||
/* calculate middle of the bar */
|
/* calculate middle of the bar */
|
||||||
|
@ -497,12 +492,10 @@ PlaylistWidget::paintEvent (QPaintEvent *event)
|
||||||
|
|
||||||
/* Add the titlebar */
|
/* Add the titlebar */
|
||||||
r.setRect (midx, 0, m_titlebar.width(), m_titlebar.height());
|
r.setRect (midx, 0, m_titlebar.width(), m_titlebar.height());
|
||||||
if (er.contains (r))
|
|
||||||
paint.drawPixmap (r, m_titlebar, m_titlebar.rect());
|
paint.drawPixmap (r, m_titlebar, m_titlebar.rect());
|
||||||
|
|
||||||
/* left fill */
|
/* left fill */
|
||||||
r.setRect (m_corner1.width(), 0, midx - m_corner1.width(), m_tfill.height());
|
r.setRect (m_corner1.width(), 0, midx - m_corner1.width(), m_tfill.height());
|
||||||
if (er.contains (r))
|
|
||||||
paint.drawPixmap (r, m_tfill, m_tfill.rect());
|
paint.drawPixmap (r, m_tfill, m_tfill.rect());
|
||||||
|
|
||||||
/* Calculate middle pixel to the right side of the titlebar */
|
/* Calculate middle pixel to the right side of the titlebar */
|
||||||
|
@ -510,7 +503,6 @@ PlaylistWidget::paintEvent (QPaintEvent *event)
|
||||||
|
|
||||||
/* right fill */
|
/* right fill */
|
||||||
r.setRect (midx2, 0, width()-midx2-m_corner2.width(), m_tfill.height());
|
r.setRect (midx2, 0, width()-midx2-m_corner2.width(), m_tfill.height());
|
||||||
if (er.contains (r))
|
|
||||||
paint.drawPixmap (r, m_tfill, m_tfill.rect());
|
paint.drawPixmap (r, m_tfill, m_tfill.rect());
|
||||||
|
|
||||||
/* calculate the size of the bottom side */
|
/* calculate the size of the bottom side */
|
||||||
|
@ -525,7 +517,6 @@ PlaylistWidget::paintEvent (QPaintEvent *event)
|
||||||
/* Draw the bottom filling */
|
/* Draw the bottom filling */
|
||||||
r.setRect (m_corner3.width(), size().height()-m_bfill.height(),
|
r.setRect (m_corner3.width(), size().height()-m_bfill.height(),
|
||||||
pad_to, m_bfill.height());
|
pad_to, m_bfill.height());
|
||||||
if (er.contains (r))
|
|
||||||
paint.drawPixmap (r, m_bfill, m_bfill.rect());
|
paint.drawPixmap (r, m_bfill, m_bfill.rect());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,12 +525,10 @@ PlaylistWidget::paintEvent (QPaintEvent *event)
|
||||||
*/
|
*/
|
||||||
r.setRect (0, m_corner1.height(), m_lfill.width(),
|
r.setRect (0, m_corner1.height(), m_lfill.width(),
|
||||||
size().height()-m_corner3.height()-m_corner1.height());
|
size().height()-m_corner3.height()-m_corner1.height());
|
||||||
if (er.contains (r))
|
|
||||||
paint.drawPixmap (r,m_lfill, m_lfill.rect());
|
paint.drawPixmap (r,m_lfill, m_lfill.rect());
|
||||||
|
|
||||||
r.setRect (size().width()-m_rfill3.width(), m_corner2.height(), m_rfill3.width(),
|
r.setRect (size().width()-m_rfill3.width(), m_corner2.height(), m_rfill3.width(),
|
||||||
size().height()-m_corner2.height()-m_corner3.height());
|
size().height()-m_corner2.height()-m_corner3.height());
|
||||||
if (er.contains (r))
|
|
||||||
paint.drawPixmap (r, m_rfill3, m_rfill3.rect());
|
paint.drawPixmap (r, m_rfill3, m_rfill3.rect());
|
||||||
|
|
||||||
/* figure out where to place the last padding */
|
/* figure out where to place the last padding */
|
||||||
|
@ -550,7 +539,6 @@ PlaylistWidget::paintEvent (QPaintEvent *event)
|
||||||
|
|
||||||
r.setRect (x, m_corner2.height(), m_rfill.width(),
|
r.setRect (x, m_corner2.height(), m_rfill.width(),
|
||||||
size().height()-m_corner2.height()-m_corner3.height());
|
size().height()-m_corner2.height()-m_corner3.height());
|
||||||
if (er.contains (r))
|
|
||||||
paint.drawPixmap (r, m_rfill, m_rfill.rect());
|
paint.drawPixmap (r, m_rfill, m_rfill.rect());
|
||||||
|
|
||||||
paint.end ();
|
paint.end ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue