summaryrefslogtreecommitdiff
path: root/libopie
Unidiff
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofontselector.cpp51
-rw-r--r--libopie/ofontselector.h5
2 files changed, 47 insertions, 9 deletions
diff --git a/libopie/ofontselector.cpp b/libopie/ofontselector.cpp
index e1090b5..b905474 100644
--- a/libopie/ofontselector.cpp
+++ b/libopie/ofontselector.cpp
@@ -33,2 +33,3 @@
33#include <qfont.h> 33#include <qfont.h>
34#include <qmultilineedit.h>
34 35
@@ -39,10 +40,11 @@
39class OFontSelectorPrivate { 40class OFontSelectorPrivate {
40public: 41public:
41 QListBox * m_font_family_list; 42 QListBox * m_font_family_list;
42 QComboBox * m_font_style_list; 43 QComboBox * m_font_style_list;
43 QComboBox * m_font_size_list; 44 QComboBox * m_font_size_list;
45 QMultiLineEdit *m_preview;
44 46
45 bool m_pointbug; 47 bool m_pointbug;
46 48
47 FontDatabase m_fdb; 49 FontDatabase m_fdb;
48}; 50};
@@ -103,3 +105,3 @@ static int qt_version ( )
103 105
104OFontSelector::OFontSelector ( QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) 106OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl )
105{ 107{
@@ -131,2 +133,15 @@ OFontSelector::OFontSelector ( QWidget *parent, const char *name, WFlags fl ) :
131 133
134 if ( withpreview ) {
135 d-> m_preview = new QMultiLineEdit ( this, "Preview" );
136 d-> m_preview-> setAlignment ( AlignCenter );
137 d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth );
138 d-> m_preview-> setMargin ( 3 );
139 d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ));
140 gridLayout-> addRowSpacing ( 5, 4 );
141 gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 );
142 gridLayout-> setRowStretch ( 6, 5 );
143 }
144 else
145 d-> m_preview = 0;
146
132 loadFonts ( d-> m_font_family_list ); 147 loadFonts ( d-> m_font_family_list );
@@ -306,3 +321,8 @@ void OFontSelector::changeFont ( )
306{ 321{
307 emit fontSelected ( selectedFont ( )); 322 QFont f = selectedFont ( );
323
324 if ( d-> m_preview )
325 d-> m_preview-> setFont ( f );
326
327 emit fontSelected ( f );
308} 328}
@@ -327 +347,16 @@ QFont OFontSelector::selectedFont ( )
327} 347}
348
349
350void OFontSelector::resizeEvent ( QResizeEvent *re )
351{
352 if ( d-> m_preview ) {
353 d-> m_preview-> setMinimumHeight ( 1 );
354 d-> m_preview-> setMaximumHeight ( 32767 );
355 }
356
357 QWidget::resizeEvent ( re );
358
359 if ( d-> m_preview )
360 d-> m_preview-> setFixedHeight ( d-> m_preview-> height ( ));
361
362}
diff --git a/libopie/ofontselector.h b/libopie/ofontselector.h
index a9c8a72..10d16f0 100644
--- a/libopie/ofontselector.h
+++ b/libopie/ofontselector.h
@@ -42,3 +42,3 @@ class OFontSelector : public QWidget
42public: 42public:
43 OFontSelector ( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 43 OFontSelector ( bool withpreview, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
44 virtual ~OFontSelector ( ); 44 virtual ~OFontSelector ( );
@@ -66,2 +66,5 @@ protected slots:
66 66
67protected:
68 virtual void resizeEvent ( QResizeEvent *re );
69
67private: 70private: