• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • KDevelop Property Editing Library
 

KDevelop Property Editing Library

  • lib
  • widgets
  • propeditor
propertywidgetproxy.cpp
1/***************************************************************************
2 * Copyright (C) 2004 by Alexander Dymo *
3 * cloudtemple@mskat.net *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU Library General Public License as *
7 * published by the Free Software Foundation; either version 2 of the *
8 * License, or (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU Library General Public *
16 * License along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
20#include "propertywidgetproxy.h"
21
22#include <tqlayout.h>
23
24#include "propertywidget.h"
25#include "propertymachinefactory.h"
26
27namespace PropertyLib{
28
29PropertyWidgetProxy::PropertyWidgetProxy(TQWidget *parent, const char *name)
30 :TQWidget(parent, name), mp(0), m_propertyType(Property::Invalid), m_editor(0)
31{
32 p = new Property();
33 m_layout = new TQHBoxLayout(this, 0, 0);
34}
35
36PropertyWidgetProxy::~PropertyWidgetProxy()
37{
38 delete mp;
39 delete p;
40}
41
42void PropertyWidgetProxy::setPropertyType(int propertyType)
43{
44 m_propertyType = static_cast<PropertyType>(propertyType);
45 setWidget();
46}
47
48void PropertyWidgetProxy::setPropertyType2(PropertyType propertyType)
49{
50 m_propertyType = propertyType;
51 setWidget();
52}
53
54void PropertyWidgetProxy::setWidget()
55{
56 if (m_editor)
57 delete m_editor;
58 p->setType(m_propertyType);
59 mp = new MultiProperty(p);
60 m_editor = PropertyMachineFactory::getInstance()->machineForProperty(mp)->propertyEditor;
61 if (m_editor)
62 {
63 m_editor->reparent(this, TQPoint(0,0), true);
64 m_layout->addWidget(m_editor);
65 }
66}
67
68TQVariant PropertyWidgetProxy::value() const
69{
70 if (m_editor)
71 return m_editor->value();
72 else
73 return TQVariant();
74}
75
76void PropertyWidgetProxy::setValue(const TQVariant &value)
77{
78 if (m_editor)
79 m_editor->setValue(value, false);
80}
81
82bool PropertyWidgetProxy::setProperty( const char * name, const TQVariant & value )
83{
84 if( strcmp( name, "value") == 0 )
85 {
86 setPropertyType((int) value.type() );
87 setValue( value );
88 return true;
89 }
90 else
91 return TQWidget::setProperty(name, value);
92}
93
94TQVariant PropertyWidgetProxy::property( const char * name ) const
95{
96 if( strcmp( name, "value") == 0 )
97 return value( );
98 else
99 return TQWidget::property(name);
100}
101
102}
103
104#ifndef PURE_QT
105#include "propertywidgetproxy.moc"
106#endif
PropertyLib::MultiProperty
Holds a list of properties with the same name and type.
Definition multiproperty.h:50
PropertyLib
Namespace which contain property editing classes.
Definition childproperty.cpp:29
propertymachinefactory.h
Contains PropertyLib::PropertyMachineFactory class and PropertyLib::Machine structure.
propertywidget.h
Contains PropertyLib::PropertyWidget class.

KDevelop Property Editing Library

Skip menu "KDevelop Property Editing Library"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

KDevelop Property Editing Library

Skip menu "KDevelop Property Editing Library"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for KDevelop Property Editing Library by doxygen 1.9.8
This website is maintained by Timothy Pearson.