dataform.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 "dataform.h"
00021 #include <qvariant.h>
00022
00023 DataForm::DataForm(QWidget *parent, const char *name)
00024 : QObject(parent, name), m_form(0L), m_dataMap(0L)
00025 {
00026
00027 }
00028
00029
00030 DataForm::~DataForm()
00031 {}
00032
00033 void DataForm::updateView( )
00034 {
00035
00036 if( m_form == 0L || m_dataMap == 0L ) return;
00037
00038 PropertyMap::Iterator idx = m_dataMap->begin();
00039 for( ; idx != m_dataMap->end(); ++idx )
00040 {
00041 QWidget *wid = dynamic_cast<QWidget *>( m_form->child( idx.key().widget.latin1() ) );
00042 if ( wid )
00043 wid->setProperty( idx.key().property.latin1() , idx.data() );
00044 }
00045 }
00046
00047 void DataForm::resetView( )
00048 {
00049 }
00050
00051 void DataForm::updateData( )
00052 {
00053
00054 if( m_form == 0L || m_dataMap == 0L ) return;
00055
00056 PropertyMap::Iterator idx = m_dataMap->begin();
00057 for( ; idx != m_dataMap->end(); ++idx )
00058 {
00059 QWidget *wid = dynamic_cast<QWidget *>( m_form->child( idx.key().widget.latin1() ) );
00060 if ( wid )
00061 {
00062 QVariant value = wid->property( idx.key().property.latin1() );
00063 if( value.isValid() ) idx.data() = value;
00064 }
00065 }
00066 emit mapChanged();
00067 }
00068
00069 QMap<QString,QString> DataForm::createPropertyMap( bool fullKey ) const
00070 {
00071 QMap<QString,QString> propMap;
00072 fillPropertyMap( &propMap, fullKey );
00073 return propMap;
00074 }
00075
00076 void DataForm::fillPropertyMap( QMap< QString, QString > * map, bool fullKey ) const
00077 {
00078 PropertyMap::Iterator idx = m_dataMap->begin();
00079 for( ; idx != m_dataMap->end(); ++idx )
00080 {
00081 QString key = idx.key().widget;
00082 if( fullKey ) key = key + "." + idx.key().property;
00083 QString value = idx.data().toString();
00084 map->insert( key,value );
00085 }
00086 }
00087
00088
00089 #include "dataform.moc"
This file is part of the documentation for KDevelop Version 3.1.2.