[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Patch for KFontRequester.
From: Ian Reinhart Geiser <ian () geiseri ! com>
Date: 2004-12-08 16:06:00
Message-ID: 200412081106.00704.ian () geiseri ! com
[Download RAW message or body]
Greetings,
This is a small patch for KFontRequester. Its an awesome widget for picking
fonts but the font preview sometimes gets in the way when you are doing some
special fonts aka 128+ point fonts. (Yes its completely possible to get this
when working on things like banners) So I added the ability to turn the
preview off. Is this cool to add? AFAIK there is no break in BC, and by
default the behavior is unchanged.
cheers
-ian reinhart geiser
--
------(Ian Reinhart Geiser)-----<geiseri@yahoo.com>-----
Forget that once we where just dust forged in heavens fire. As we where
forged we perhaps shall return someday...
-VNV Nation, Further
["kfontrequester.patch" (text/x-diff)]
Index: kfontrequester.h
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kfontrequester.h,v
retrieving revision 1.10
diff -u -u -r1.10 kfontrequester.h
--- kfontrequester.h 9 Sep 2004 15:23:53 -0000 1.10
+++ kfontrequester.h 8 Dec 2004 15:51:39 -0000
@@ -48,7 +48,8 @@
Q_PROPERTY( QString title READ title WRITE setTitle )
Q_PROPERTY( QString sampleText READ sampleText WRITE setSampleText )
Q_PROPERTY( QFont font READ font WRITE setFont )
-
+ Q_PROPERTY( bool isFixedOnly READ isFixedOnly)
+ Q_PROPERTY( bool preview READ preview WRITE setPreview )
public:
/**
@@ -62,6 +63,17 @@
KFontRequester( QWidget *parent=0L, const char *name=0L,
bool onlyFixed=false );
+ ~KFontRequester();
+ /**
+ * @return If the requester should show the label in the currently selected \
font. + */
+ bool preview() const;
+
+ /**
+ * Tells the requester if it should or should not preview the currently selected \
font in the preview window. + */
+ void setPreview( bool prev );
+
/**
* @return The currently selected font in the requester.
*/
Index: kfontrequester.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kfontrequester.cpp,v
retrieving revision 1.4
diff -u -u -r1.4 kfontrequester.cpp
--- kfontrequester.cpp 8 Jun 2003 00:54:00 -0000 1.4
+++ kfontrequester.cpp 8 Dec 2004 15:51:39 -0000
@@ -28,10 +28,19 @@
#include <kfontdialog.h>
#include <klocale.h>
+class KFontRequester::KFontRequesterPrivate
+{
+ public:
+ bool m_preview;
+};
+
KFontRequester::KFontRequester( QWidget *parent, const char *name,
bool onlyFixed ) : QWidget( parent, name ),
m_onlyFixed( onlyFixed )
{
+ d = new KFontRequesterPrivate();
+ d->m_preview = true;
+
QHBoxLayout *layout = new QHBoxLayout( this, 0, KDialog::spacingHint() );
m_sampleLabel = new QLabel( this, "m_sampleLabel" );
@@ -82,7 +91,8 @@
void KFontRequester::displaySampleText()
{
- m_sampleLabel->setFont( m_selFont );
+ if( d->m_preview )
+ m_sampleLabel->setFont( m_selFont );
int size = m_selFont.pointSize();
if(size == -1)
@@ -120,6 +130,22 @@
}
}
+bool KFontRequester::preview() const
+{
+ return d->m_preview;
+}
+
+void KFontRequester::setPreview( bool prev )
+{
+ d->m_preview = prev;
+}
+
+KFontRequester::~KFontRequester()
+{
+ delete d;
+}
+
+
#include "kfontrequester.moc"
/* vim: et sw=2 ts=2
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic