pfontcombo.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "pfontcombo.h"
00021
00022 #ifndef PURE_QT
00023 #include <kfontcombo.h>
00024 #else
00025 #include <qcombobox.h>
00026 #endif
00027
00028 #include <qlayout.h>
00029
00030 #ifdef PURE_QT
00031 #include <qfontdatabase.h>
00032 #endif
00033
00034 namespace PropertyLib{
00035
00036 PFontCombo::PFontCombo(MultiProperty *property, QWidget *parent, const char *name)
00037 :PropertyWidget(property, parent, name)
00038 {
00039 QHBoxLayout *l = new QHBoxLayout(this, 0, 0);
00040 m_edit = new KFontCombo(this);
00041 m_edit->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
00042 l->addWidget(m_edit);
00043
00044
00045
00046 #ifdef PURE_QT
00047 QFontDatabase fonts;
00048 insertStringList(fonts.families());
00049 #endif
00050 connect(m_edit, SIGNAL(textChanged(const QString&)), this, SLOT(updateProperty(const QString&)));
00051 }
00052
00053 QVariant PFontCombo::value() const
00054 {
00055 #ifndef PURE_QT
00056 return QVariant(m_edit->currentFont());
00057 #else
00058 return QVariant(m_edit->currentText());
00059 #endif
00060 }
00061
00062 void PFontCombo::setValue(const QVariant &value, bool emitChange)
00063 {
00064 disconnect(m_edit, SIGNAL(textChanged(const QString&)), this, SLOT(updateProperty(const QString&)));
00065 #ifndef PURE_QT
00066 m_edit->setCurrentFont(value.toString());
00067 #else
00068 m_edit->setCurrentText(value.toString());
00069 #endif
00070 connect(m_edit, SIGNAL(textChanged(const QString&)), this, SLOT(updateProperty(const QString&)));
00071 if (emitChange)
00072 emit propertyChanged(m_property, value);
00073 }
00074
00075 void PFontCombo::updateProperty(const QString &val)
00076 {
00077 emit propertyChanged(m_property, QVariant(val));
00078 }
00079
00080 }
00081
00082 #ifndef PURE_QT
00083 #include "pfontcombo.moc"
00084 #endif
This file is part of the documentation for KDevelop Version 3.1.2.