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

KDevelop Property Editing Library

  • lib
  • widgets
  • propeditor
pfontcombo.cpp
1/***************************************************************************
2 * Copyright (C) 2002-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 "pfontcombo.h"
21
22#ifndef PURE_QT
23#include <tdefontcombo.h>
24#else
25#include <tqcombobox.h>
26#endif
27
28#include <tqlayout.h>
29
30#ifdef PURE_QT
31#include <tqfontdatabase.h>
32#endif
33
34namespace PropertyLib{
35
36PFontCombo::PFontCombo(MultiProperty *property, TQWidget *parent, const char *name)
37 :PropertyWidget(property, parent, name)
38{
39 TQHBoxLayout *l = new TQHBoxLayout(this, 0, 0);
40 m_edit = new TDEFontCombo(this);
41 m_edit->setSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding);
42 l->addWidget(m_edit);
43
44 /*adymo: TDEFontCombo seems to have a bug: when it is not editable, the signals
45 activated(int) and textChanged(const TQString &) are not emitted*/
46#ifdef PURE_QT
47 TQFontDatabase fonts;
48 m_edit->insertStringList(fonts.families());
49 connect(m_edit, TQ_SIGNAL(activated(const TQString &)), this, TQ_SLOT(updateProperty(const TQString&)));
50#else
51 connect(m_edit, TQ_SIGNAL(textChanged(const TQString&)), this, TQ_SLOT(updateProperty(const TQString&)));
52#endif
53}
54
55TQVariant PFontCombo::value() const
56{
57#ifndef PURE_QT
58 return TQVariant(m_edit->currentFont());
59#else
60 return TQVariant(m_edit->currentText());
61#endif
62}
63
64void PFontCombo::setValue(const TQVariant &value, bool emitChange)
65{
66 disconnect(m_edit, TQ_SIGNAL(textChanged(const TQString&)), this, TQ_SLOT(updateProperty(const TQString&)));
67#ifndef PURE_QT
68 m_edit->setCurrentFont(value.toString());
69#else
70 m_edit->setCurrentText(value.toString());
71#endif
72 connect(m_edit, TQ_SIGNAL(textChanged(const TQString&)), this, TQ_SLOT(updateProperty(const TQString&)));
73 if (emitChange)
74 emit propertyChanged(m_property, value);
75}
76
77void PFontCombo::updateProperty(const TQString &val)
78{
79 emit propertyChanged(m_property, TQVariant(val));
80}
81
82}
83
84#ifndef PURE_QT
85#include "pfontcombo.moc"
86#endif
PropertyLib::MultiProperty
Holds a list of properties with the same name and type.
Definition multiproperty.h:50
PropertyLib::PFontCombo::value
virtual TQVariant value() const
Definition pfontcombo.cpp:55
PropertyLib::PFontCombo::setValue
virtual void setValue(const TQVariant &value, bool emitChange=true)
Sets the value shown in the editor widget.
Definition pfontcombo.cpp:64
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.