-rw-r--r-- | microkde/kfontdialog.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/microkde/kfontdialog.cpp b/microkde/kfontdialog.cpp new file mode 100644 index 0000000..174123c --- a/dev/null +++ b/microkde/kfontdialog.cpp | |||
@@ -0,0 +1,32 @@ | |||
1 | #include "kfontdialog.h" | ||
2 | #ifndef DESKTOP_VERSION | ||
3 | #include "ofontselector.h" | ||
4 | #else | ||
5 | #include <qfontdialog.h> | ||
6 | #endif | ||
7 | #include <qdialog.h> | ||
8 | #include <qlayout.h> | ||
9 | #include <qpushbutton.h> | ||
10 | QFont KFontDialog::getFont( const QFont & f, bool & ok ) | ||
11 | { | ||
12 | #ifndef DESKTOP_VERSION | ||
13 | QDialog d( 0, "fd", true );; | ||
14 | OFontSelector s ( true, &d, "fontsel"); | ||
15 | QVBoxLayout l ( &d ); | ||
16 | l.addWidget( &s ); | ||
17 | s.setSelectedFont ( f ); | ||
18 | QPushButton b ( "OK", &d ); | ||
19 | l.addWidget( &b ); | ||
20 | qDebug("size %d ", f.bold()); | ||
21 | QObject::connect( &b, SIGNAL( clicked () ), &d, SLOT ( accept () ) ); | ||
22 | d.show(); | ||
23 | ok = false; | ||
24 | if ( d.exec () ) { | ||
25 | ok = true; | ||
26 | return s.selectedFont ( ); | ||
27 | } | ||
28 | return f; | ||
29 | #else | ||
30 | return QFontDialog::getFont ( &ok, f, 0, "fontdialog" ); | ||
31 | #endif | ||
32 | } | ||