Commit 0ed7dd2b authored by Ragnar Thomsen's avatar Ragnar Thomsen Committed by Michael Reeves

Improve font config page

# Conflicts:
#	src/optiondialog.h
parent 4f41aa24
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <QLayout> #include <QLayout>
#include <QLineEdit> #include <QLineEdit>
#include <QToolTip> #include <QToolTip>
#include <QPlainTextEdit>
#include <QRadioButton> #include <QRadioButton>
#include <QGroupBox> #include <QGroupBox>
#include <QTextCodec> #include <QTextCodec>
...@@ -192,20 +193,24 @@ typedef OptionT<QStringList> OptionStringList; ...@@ -192,20 +193,24 @@ typedef OptionT<QStringList> OptionStringList;
FontChooser::FontChooser( QWidget* pParent ) FontChooser::FontChooser( QWidget* pParent )
: QGroupBox(pParent) : QGroupBox(pParent)
{ {
QVBoxLayout* pLayout = new QVBoxLayout( this ); QVBoxLayout* pLayout = new QVBoxLayout(this);
m_pSelectFont = new QPushButton(i18n("Select Font"), this ); m_pLabel = new QLabel(QString(), this);
connect(m_pSelectFont, SIGNAL(clicked()), this, SLOT(slotSelectFont())); pLayout->addWidget(m_pLabel);
pLayout->addWidget(m_pSelectFont);
m_pLabel = new QLabel( "", this );
m_pLabel->setFont( m_font );
m_pLabel->setMinimumWidth(200);
QChar visualTab(0x2192); QChar visualTab(0x2192);
QChar visualSpace((ushort)0xb7); QChar visualSpace((ushort)0xb7);
m_pLabel->setText( QString("The quick brown fox jumps over the river\n" m_pExampleTextEdit = new QPlainTextEdit(QString("The quick brown fox jumps over the river\n"
"but the little red hen escapes with a shiver.\n" "but the little red hen escapes with a shiver.\n"
":-)")+visualTab+visualSpace); ":-)")+visualTab+visualSpace, this);
pLayout->addWidget(m_pLabel); m_pExampleTextEdit->setFont(m_font);
m_pExampleTextEdit->setReadOnly(true);
pLayout->addWidget(m_pExampleTextEdit);
m_pSelectFont = new QPushButton(i18n("Change Font"), this);
m_pSelectFont->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
connect(m_pSelectFont, SIGNAL(clicked()), this, SLOT(slotSelectFont()));
pLayout->addWidget(m_pSelectFont);
pLayout->setAlignment(m_pSelectFont, Qt::AlignRight);
} }
QFont FontChooser::font() QFont FontChooser::font()
...@@ -216,7 +221,9 @@ QFont FontChooser::font() ...@@ -216,7 +221,9 @@ QFont FontChooser::font()
void FontChooser::setFont( const QFont& font, bool ) void FontChooser::setFont( const QFont& font, bool )
{ {
m_font = font; m_font = font;
m_pLabel->setFont( m_font ); m_pExampleTextEdit->setFont( m_font );
m_pLabel->setText(i18n("Font: %1, %2, %3\n\nExample:", m_font.family(), m_font.styleName(), m_font.pointSize()));
//update(); //update();
} }
...@@ -224,7 +231,8 @@ void FontChooser::slotSelectFont() ...@@ -224,7 +231,8 @@ void FontChooser::slotSelectFont()
{ {
bool bOk; bool bOk;
m_font = QFontDialog::getFont(&bOk, m_font ); m_font = QFontDialog::getFont(&bOk, m_font );
m_pLabel->setFont( m_font ); m_pExampleTextEdit->setFont( m_font );
m_pLabel->setText(i18n("Font: %1, %2, %3\n\nExample:", m_font.family(), m_font.styleName(), m_font.pointSize()));
} }
......
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
#include "options.h" #include "options.h"
class QLabel;
class QPlainTextEdit;
class OptionItem; class OptionItem;
class OptionCheckBox; class OptionCheckBox;
class OptionEncodingComboBox; class OptionEncodingComboBox;
...@@ -111,6 +114,7 @@ class FontChooser : public QGroupBox ...@@ -111,6 +114,7 @@ class FontChooser : public QGroupBox
Q_OBJECT Q_OBJECT
QFont m_font; QFont m_font;
QPushButton* m_pSelectFont; QPushButton* m_pSelectFont;
QPlainTextEdit* m_pExampleTextEdit;
QLabel* m_pLabel; QLabel* m_pLabel;
public: public:
FontChooser( QWidget* pParent ); FontChooser( QWidget* pParent );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment