diff options
| author | Peter Penz <[email protected]> | 2008-11-20 21:50:17 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-11-20 21:50:17 +0000 |
| commit | 2b187ed1ab6918130effd53a36e95d9ad660b0ce (patch) | |
| tree | d3ea3093117a94fea3672fcf495ff41ca571a884 /src/metatextlabel.h | |
| parent | ab9fed96187724680f19e706168b8f22d7b46609 (diff) | |
assure that the meta information labels get not clipped vertically when using larger fonts
BUG: 168505
svn path=/trunk/KDE/kdebase/apps/; revision=887030
Diffstat (limited to 'src/metatextlabel.h')
| -rw-r--r-- | src/metatextlabel.h | 27 |
1 files changed, 21 insertions, 6 deletions
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 <QWidget> -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<MetaInfo> 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 |
