KDevelop API Documentation

lib/widgets/propeditor/propertyeditor.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 2002 Alexander Dymo <cloudtemple@mksat.net> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 */ 00019 #ifndef PURE_QT 00020 #include <klocale.h> 00021 #include <kdebug.h> 00022 #else 00023 #include "qlocale.h" 00024 #endif 00025 00026 #include <qtable.h> 00027 #include <qlayout.h> 00028 00029 #include "propertyeditor.h" 00030 #include "property.h" 00031 00032 PropertyEditor::PropertyEditor( QWidget * parent, const char * name, WFlags f): 00033 QWidget(parent, name, f) 00034 { 00035 kdDebug() << "Creating property editor" << endl; 00036 // setCloseMode(QDockWindow::Always); 00037 // setResizeEnabled(true); 00038 00039 table = new QTable(this); 00040 table->setNumRows(0); 00041 table->setNumCols(2); 00042 table->horizontalHeader()->setLabel(0, i18n("Property")); 00043 table->horizontalHeader()->setLabel(1, i18n("Value")); 00044 table->setLeftMargin(0); 00045 table->setColumnReadOnly(0, TRUE); 00046 00047 QGridLayout *gl = new QGridLayout(this); 00048 gl->addWidget(table, 0, 0); 00049 00050 props = 0; 00051 } 00052 00053 00054 PropertyEditor::~PropertyEditor(){ 00055 } 00056 00057 void PropertyEditor::populateProperties(QMap<QString, PropPtr > *v_props) 00058 { 00059 table->hide(); 00060 props = v_props; 00061 00062 table->setNumRows(0); 00063 00064 for (QMap<QString, PropPtr >::const_iterator it = props->begin(); it != props->end(); ++it) 00065 { 00066 int row = table->numRows() + 1; 00067 table->setNumRows(row); 00068 00069 table->setText(row-1, 0, it.key()); //it.data()->description()); //it.key()); 00070 00071 QWidget *w = it.data()->editorOfType(this); 00072 table->setCellWidget(row-1, 1, w); 00073 } 00074 table->show(); 00075 } 00076 00077 void PropertyEditor::clearProperties() 00078 { 00079 props->clear(); 00080 delete props; 00081 props = 0; 00082 table->setNumRows(0); 00083 } 00084 00085 void PropertyEditor::emitPropertyChange(QString name, QVariant newValue) 00086 { 00087 qWarning("editor: assign %s to %s", name.latin1(), newValue.toString().latin1()); 00088 emit propertyChanged(name, newValue); 00089 } 00090 00091 #include "propertyeditor.moc"
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:01:49 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003