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

KDevelop Property Editing Library

  • lib
  • widgets
  • propeditor
purledit.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 "purledit.h"
21
22#ifndef PURE_QT
23#include <kurlrequester.h>
24#else
25#include <tqpushbutton.h>
26#include <tqlineedit.h>
27#endif
28#include <tqfiledialog.h>
29#include <tqlayout.h>
30
31namespace PropertyLib{
32
33PUrlEdit::PUrlEdit(Mode mode, MultiProperty* property, TQWidget* parent, const char* name)
34 :PropertyWidget(property, parent, name)
35{
36 TQHBoxLayout *l = new TQHBoxLayout(this, 0, 0);
37#ifndef PURE_QT
38 m_edit = new KURLRequester(this);
39 l->addWidget(m_edit);
40 m_edit->setMode((KFile::Mode)mode);
41 connect(m_edit, TQ_SIGNAL(textChanged(const TQString&)), this, TQ_SLOT(updateProperty(const TQString&)));
42#else
43 m_edit = new KLineEdit(this);
44 m_select = new TQPushButton("...",this);
45 l->addWidget(m_edit);
46 l->addWidget(m_select);
47 m_mode = mode;
48 connect( m_select, TQ_SIGNAL(clicked()),this,TQ_SLOT(select()));
49#endif
50 m_edit->setSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding);
51}
52
53TQVariant PUrlEdit::value() const
54{
55#ifndef PURE_QT
56 return TQVariant(m_edit->url());
57#else
58 return TQVariant(m_url);
59#endif
60}
61
62void PUrlEdit::setValue(const TQVariant& value, bool emitChange)
63{
64#ifndef PURE_QT
65 disconnect(m_edit, TQ_SIGNAL(textChanged(const TQString&)), this, TQ_SLOT(updateProperty(const TQString&)));
66 m_edit->setURL(value.toString());
67 connect(m_edit, TQ_SIGNAL(textChanged(const TQString&)), this, TQ_SLOT(updateProperty(const TQString&)));
68#else
69 m_edit->setText(value.toString());
70#endif
71 if (emitChange)
72 emit propertyChanged(m_property, value);
73}
74
75void PUrlEdit::updateProperty(const TQString &val)
76{
77 emit propertyChanged(m_property, TQVariant(val));
78}
79
80void PUrlEdit::select()
81{
82#ifdef PURE_QT
83 TQString path = m_url;
84 if( m_mode == Directory )
85 m_url = TQFileDialog::getExistingDirectory( m_url,this);
86 else
87 m_url = TQFileDialog::getOpenFileName(m_url, TQString(), this);
88 updateProperty(m_url);
89 m_edit->setText(m_url);
90#endif
91}
92
93}
94
95#ifndef PURE_QT
96#include "purledit.moc"
97#endif
PropertyLib::MultiProperty
Holds a list of properties with the same name and type.
Definition multiproperty.h:50
PropertyLib::PUrlEdit::value
virtual TQVariant value() const
Definition purledit.cpp:53
PropertyLib::PUrlEdit::setValue
virtual void setValue(const TQVariant &value, bool emitChange)
Sets the value shown in the editor widget.
Definition purledit.cpp:62
PropertyLib::PropertyWidget
An abstract base class of property viewer and editor vidget.
Definition propertywidget.h:49
PropertyLib::PropertyWidget::propertyChanged
void propertyChanged(MultiProperty *property, const TQVariant &value)
Emit this signal when property value is changed.
PropertyLib
Namespace which contain property editing classes.
Definition childproperty.cpp:29

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.15.0
This website is maintained by Timothy Pearson.