[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/plasma/applets/groupphoto
From: Stephan Binner <binner () kde ! org>
Date: 2008-02-17 18:34:24
Message-ID: 1203273264.999448.5858.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 776265 by binner:
make labels more readable
M +17 -12 groupphoto.cpp
M +5 -4 groupphoto.h
--- trunk/playground/base/plasma/applets/groupphoto/groupphoto.cpp #776264:776265
@@ -52,13 +52,11 @@
HitBox::HitBox(QGraphicsItem *parent, const QString& name, int width)
: QGraphicsItem(parent)
{
+ m_name = name;
m_width = width;
m_label = new Plasma::LineEdit(this);
- m_label->setDefaultText(name);
- m_label->setTextInteractionFlags(Qt::NoTextInteraction);
m_label->setPos(0, m_width);
- m_label->setTextWidth(100);
}
HitBox::~HitBox()
@@ -74,10 +72,17 @@
{
painter->setPen(QPen(QBrush(QColor(255,255,255,200)), 1,Qt::SolidLine, \
Qt::RoundCap)); painter->drawRect(0, 0, m_width, m_width);
+ painter->setPen(QColor(0,0,0));
+ painter->drawText(0, m_width+painter->fontMetrics().height(), m_name);
+ painter->drawText(2, m_width+painter->fontMetrics().height(), m_name);
+ painter->drawText(0, m_width+painter->fontMetrics().height()+2, m_name);
+ painter->drawText(2, m_width+painter->fontMetrics().height()+2, m_name);
+ painter->setPen(QColor(255,255,255));
+ painter->drawText(1, m_width+painter->fontMetrics().height()+1, m_name);
}
Groupphoto::Groupphoto(QObject *parent, const QVariantList &args)
- : Plasma::Applet(parent, args),
+ : Plasma::Applet(parent, args),
m_dialog(0)
{
setHasConfigurationInterface(true);
@@ -178,7 +183,7 @@
}
void Groupphoto::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
-{
+{
if (m_oldPos==event->pos()) {
return;
}
@@ -346,7 +351,7 @@
int swWidth = (int) (tempPicture.width() + frameThickness*m_frame + \
swRadious) ;
int swHeight = (int) (tempPicture.height() + frameThickness * m_frame + \
swRadious); p.setBrush(QBrush(Qt::NoBrush));
- p.setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap,Qt::RoundJoin));
+ p.setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap,Qt::RoundJoin));
for (int r=1; r<=swRadious; r++) {
p.setOpacity((r/swRadious)*(r/swRadious));
if (r == swRadious) {
@@ -380,9 +385,9 @@
// picture
QBrush myBrush(tempPicture);
p.fillPath( path, myBrush);
- path.closeSubpath();
+ path.closeSubpath();
p.end();
-
+
//Draw to a pixmap
delete m_cmpPicture;
m_cmpPicture = new QPixmap(paintRecorder.boundingRect().size());
@@ -391,17 +396,17 @@
p2.begin(m_cmpPicture);
p2.drawPicture( 0 - paintRecorder.boundingRect().x(), \
0-paintRecorder.boundingRect().y(),paintRecorder); prepareGeometryChange();
- updateGeometry();
+ updateGeometry();
}
void Groupphoto::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, \
const QRect &contentsRect) {
-
+
Q_UNUSED(option);
Q_UNUSED(contentsRect);
p->setRenderHint(QPainter::SmoothPixmapTransform, true);
- //Set transform matrix (rotation)
+ //Set transform matrix (rotation)
//FIXME where do I should put this?
QTransform transformMatrix;
transformMatrix.rotate(m_rotation);
@@ -410,6 +415,6 @@
//Paint the composited pixmap
p->drawPixmap (0,0, *m_cmpPicture);
}
-
+
#include "groupphoto.moc"
--- trunk/playground/base/plasma/applets/groupphoto/groupphoto.h #776264:776265
@@ -53,6 +53,7 @@
private:
int m_width;
+ QString m_name;
Plasma::LineEdit *m_label;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, \
QWidget *widget); };
@@ -77,7 +78,7 @@
void resizeEvent( QResizeEvent * );
void configAccepted();
void choosePicture();
-
+
void search();
void autoSearch(const QString &word);
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
@@ -91,7 +92,7 @@
bool m_frame;
/// If true, the frame will have squared corners
bool m_squareCorners;
- /// If true, the frame will have round corners
+ /// If true, the frame will have round corners
bool m_roundCorners;
/// If true, the picture will have a drop shadow.
bool m_shadow;
@@ -108,7 +109,7 @@
int m_pixelSize;
/// Rotation angle & transformation matrix
int m_rotation;
-
+
/// Designer Config file
Ui::config ui;
@@ -122,7 +123,7 @@
QList<_person*> m_personList;
QList<HitBox*> m_hitboxList;
Plasma::LineEdit *m_searchEdit;
-
+
QPointF m_oldPos;
QTimer* m_timer;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic