summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie/ofontselector.cpp39
-rw-r--r--libopie/ofontselector.h5
2 files changed, 41 insertions, 3 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 @@
#include <qfont.h>
+#include <qmultilineedit.h>
@@ -43,2 +44,3 @@ public:
QComboBox * m_font_size_list;
+ QMultiLineEdit *m_preview;
@@ -103,3 +105,3 @@ static int qt_version ( )
-OFontSelector::OFontSelector ( QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl )
+OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl )
{
@@ -131,2 +133,15 @@ OFontSelector::OFontSelector ( QWidget *parent, const char *name, WFlags fl ) :
+ if ( withpreview ) {
+ d-> m_preview = new QMultiLineEdit ( this, "Preview" );
+ d-> m_preview-> setAlignment ( AlignCenter );
+ d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth );
+ d-> m_preview-> setMargin ( 3 );
+ d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ));
+ gridLayout-> addRowSpacing ( 5, 4 );
+ gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 );
+ gridLayout-> setRowStretch ( 6, 5 );
+ }
+ else
+ d-> m_preview = 0;
+
loadFonts ( d-> m_font_family_list );
@@ -306,3 +321,8 @@ void OFontSelector::changeFont ( )
{
- emit fontSelected ( selectedFont ( ));
+ QFont f = selectedFont ( );
+
+ if ( d-> m_preview )
+ d-> m_preview-> setFont ( f );
+
+ emit fontSelected ( f );
}
@@ -327 +347,16 @@ QFont OFontSelector::selectedFont ( )
}
+
+
+void OFontSelector::resizeEvent ( QResizeEvent *re )
+{
+ if ( d-> m_preview ) {
+ d-> m_preview-> setMinimumHeight ( 1 );
+ d-> m_preview-> setMaximumHeight ( 32767 );
+ }
+
+ QWidget::resizeEvent ( re );
+
+ if ( d-> m_preview )
+ d-> m_preview-> setFixedHeight ( d-> m_preview-> height ( ));
+
+}
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
public:
- OFontSelector ( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ OFontSelector ( bool withpreview, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
virtual ~OFontSelector ( );
@@ -66,2 +66,5 @@ protected slots:
+protected:
+ virtual void resizeEvent ( QResizeEvent *re );
+
private: