growing tired of being asked about how to get at the font used in widgets, here's a cute little accessor that provides the answer for now and gives us a way to support font settings in the future much in the way qwidget itself does.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=712158
This commit is contained in:
Aaron J. Seigo 2007-09-13 19:33:44 +00:00
parent 45fe956407
commit d20c9a010f
2 changed files with 28 additions and 1 deletions

View File

@ -23,7 +23,8 @@
#include <cmath>
#include <limits>
#include <QtCore/QList>
#include <QApplication>
#include <QList>
#include <QPainter>
#include <QPixmapCache>
#include <QStyleOptionGraphicsItem>
@ -238,6 +239,18 @@ QSizeF Widget::size() const
{
return geometry().size();
}
QFont Widget::font() const
{
return QApplication::font();
}
/*
void Widget::setFont(const QFront& font)
{
}
*/
QRectF Widget::boundingRect() const
{
return QRectF(QPointF(0,0),geometry().size());

View File

@ -169,6 +169,20 @@ public:
*/
QSizeF size() const;
/**
* @return the font currently set for this widget
**/
QFont font() const;
/**
* Set the font for this widget
*
* @param font the new font
**
TODO: implement once we decide how to handle the font system
void setFont(const QFont& font);
*/
/**
* Reimplemented from QGraphicsItem
* @return the bounding rectangle for this Plasma::Widget