00001 /****************************************************************************** 00002 * This file is part of the Gluon Development Platform 00003 * Copyright (c) 2010 Dan Leinir Turthra Jensen <admin@leinir.dk> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 */ 00019 #include "nullpropertywidgetitem.h" 00020 00021 #include <QLabel> 00022 #include <KLocalizedString> 00023 00024 // This is commented out specifically to inform you that this should not be done. 00025 // As this class is not supposed to be used normally, it is a special case 00026 // and as such does not register in the normal way (the registration would be a NOOP 00027 // at any rate, as this does not support any data types. See the 00028 // ::supportedDataTypes() function below) 00029 // REGISTER_PROPERTYWIDGETITEM(GluonCreator,NullPropertyWidgetItem) 00030 00031 using namespace GluonCreator; 00032 00033 NullPropertyWidgetItem::NullPropertyWidgetItem( QWidget* parent, Qt::WindowFlags f ): PropertyWidgetItem( parent, f ) 00034 { 00035 setEditWidget( new QLabel( i18n( "Unknown Type" ) ) ); 00036 } 00037 00038 NullPropertyWidgetItem::~NullPropertyWidgetItem() 00039 { 00040 00041 } 00042 00043 QStringList 00044 NullPropertyWidgetItem::supportedDataTypes() const 00045 { 00046 QStringList supportedTypes; 00047 return supportedTypes; 00048 } 00049 00050 PropertyWidgetItem* 00051 NullPropertyWidgetItem::instantiate() 00052 { 00053 return new NullPropertyWidgetItem(); 00054 } 00055 00056 void 00057 NullPropertyWidgetItem::setEditValue( const QVariant& value ) 00058 { 00059 editWidget()->setProperty( "text", QString( "Unknown: %1(%2)" ).arg( value.typeName() ).arg( value.toString() ) ); 00060 } 00061 00062 // #include "nullpropertywidgetitem.moc"