[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/raptormenu/plugins/bg/classic
From: Sacha Minet Refshauge <xsacha () gmail ! com>
Date: 2008-05-09 8:58:53
Message-ID: 1210323533.189773.15813.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 805706 by srefshauge:
Scaling of background elements (9) correctly.
M +15 -9 backdrop.cpp
--- trunk/playground/base/raptormenu/plugins/bg/classic/backdrop.cpp #805705:805706
@@ -34,19 +34,25 @@
{
QSvgRenderer *bgImage = NULL;
bgImage = new QSvgRenderer(RAPTORPREFIX+QString("/desktoptheme/default/raptor-menu/nonaccell.svg"));
- QSizeF naturalSize = bgImage->defaultSize();
+ QSize naturalSize = bgImage->defaultSize();
+ qreal elementWide = r.size().width();
+ qreal elementLong = r.size().height();
QLinkedList<QString> ids;
- ids.append(QString("topleft")); ids.append(QString("top")); \
ids.append(QString("topright"));
- ids.append(QString("left")); ids.append(QString("center")); \
ids.append(QString("right"));
- ids.append(QString("bottomleft")); ids.append(QString("bottom")); \
ids.append(QString("bottomright")); + ids << "topleft" << "top" << "topright" <<
+ "left" << "center" << "right" <<
+ "bottomleft" << "bottom" << "bottomright";
foreach (QString id, ids)
{
QRectF elementRect = bgImage->boundsOnElement(id);
- qreal dx = r.size().width() / naturalSize.width();
- qreal dy = r.size().height() / naturalSize.height();
- QRectF renderRect = QRectF(elementRect.x() * dx, elementRect.y() * dy,
- elementRect.width() * dx, elementRect.height() * \
dy);
- bgImage->render(p, id, renderRect);
+ if (id=="topright" || id=="right" || id=="bottomright")
+ elementRect.setX(r.width() - elementRect.width());
+ if (id=="bottomleft" || id=="bottom" || id=="bottomright")
+ elementRect.setY(r.height() - elementRect.height());
+ if (id=="top" || id=="bottom" || id=="center")
+ elementRect.setWidth(elementWide - 2 * elementRect.width());
+ if (id=="left" || id=="right" || id=="center")
+ elementRect.setHeight(elementLong - 2 * elementRect.height());
+ bgImage->render(p, id, elementRect);
}
// p->fillRect(r,QColor(0,0,0));
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic