00001 /****************************************************************************** 00002 * This file is part of the Gluon Development Platform 00003 * Copyright (c) 2010 Dan Leinir Turthra Jensen <admin@leinir.dk> 00004 * Copyright (c) 2010 Arjen Hiemstra <ahiemstra@heimr.nl> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 00022 #include "qfontpropertywidgetitem.h" 00023 00024 #include <KFontRequester> 00025 00026 REGISTER_PROPERTYWIDGETITEM( GluonCreator, QFontPropertyWidgetItem ); 00027 00028 using namespace GluonCreator; 00029 00030 QFontPropertyWidgetItem::QFontPropertyWidgetItem( QWidget* parent, Qt::WindowFlags f ) 00031 : PropertyWidgetItem( parent, f ) 00032 { 00033 KFontRequester* theFontReq = new KFontRequester( this ); 00034 connect( theFontReq, SIGNAL( fontSelected( const QFont& ) ), this, SLOT( fontChanged( const QFont& ) ) ); 00035 setEditWidget( theFontReq ); 00036 } 00037 00038 QFontPropertyWidgetItem::~QFontPropertyWidgetItem() 00039 { 00040 } 00041 00042 QStringList 00043 QFontPropertyWidgetItem::supportedDataTypes() const 00044 { 00045 QStringList supportedTypes; 00046 supportedTypes.append( "QFont" ); 00047 return supportedTypes; 00048 } 00049 00050 GluonCreator::PropertyWidgetItem* 00051 QFontPropertyWidgetItem::instantiate() 00052 { 00053 return new QFontPropertyWidgetItem(); 00054 } 00055 00056 void 00057 QFontPropertyWidgetItem::setEditValue( const QVariant& value ) 00058 { 00059 editWidget()->setProperty( "font", value ); 00060 GluonCreator::PropertyWidgetItem::setEditValue( value ); 00061 } 00062 00063 void QFontPropertyWidgetItem::fontChanged( const QFont& value ) 00064 { 00065 PropertyWidgetItem::valueChanged( QVariant( value ) ); 00066 } 00067 00068 00069 // #include "qfontpropertywidgetitem.moc"