From 2b187ed1ab6918130effd53a36e95d9ad660b0ce Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Thu, 20 Nov 2008 21:50:17 +0000 Subject: assure that the meta information labels get not clipped vertically when using larger fonts BUG: 168505 svn path=/trunk/KDE/kdebase/apps/; revision=887030 --- src/metatextlabel.h | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'src/metatextlabel.h') diff --git a/src/metatextlabel.h b/src/metatextlabel.h index f4b4ee8e1..f70d29d8e 100644 --- a/src/metatextlabel.h +++ b/src/metatextlabel.h @@ -22,9 +22,6 @@ #include -class KVBox; -class QHBoxLayout; - /** * @brief Displays general meta in several lines. * @@ -35,15 +32,33 @@ class MetaTextLabel : public QWidget Q_OBJECT public: - MetaTextLabel(QWidget* parent = 0); + explicit MetaTextLabel(QWidget* parent = 0); virtual ~MetaTextLabel(); void clear(); void add(const QString& labelText, const QString& infoText); + +protected: + virtual void paintEvent(QPaintEvent* event); + virtual void resizeEvent(QResizeEvent* event); private: - KVBox* m_lines; - QHBoxLayout* m_layout; + enum { Spacing = 2 }; + + struct MetaInfo + { + QString label; + QString info; + }; + + int m_minimumHeight; + QList m_metaInfos; + + /** + * Returns the required height in pixels for \a metaInfo to + * fit into the available width of the widget. + */ + int requiredHeight(const MetaInfo& metaInfo) const; }; #endif -- cgit v1.3