From d20c9a010f25328d682eb3fc318fb070a30576e6 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Thu, 13 Sep 2007 19:33:44 +0000 Subject: [PATCH] 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 --- widgets/widget.cpp | 15 ++++++++++++++- widgets/widget.h | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/widgets/widget.cpp b/widgets/widget.cpp index e1881693c..ec177dc53 100644 --- a/widgets/widget.cpp +++ b/widgets/widget.cpp @@ -23,7 +23,8 @@ #include #include -#include +#include +#include #include #include #include @@ -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()); diff --git a/widgets/widget.h b/widgets/widget.h index ff5aa41d5..24664006b 100644 --- a/widgets/widget.h +++ b/widgets/widget.h @@ -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