20#include "pfontbutton.h"
24#include <tqpushbutton.h>
26#include <tdefontrequester.h>
31#include "compat_tools.h"
36PFontButton::PFontButton(MultiProperty* property, TQWidget* parent,
const char* name)
37 :PropertyWidget(property, parent, name)
39 TQHBoxLayout *l =
new TQHBoxLayout(
this, 0, 0);
40 m_edit =
new TDEFontRequester(
this);
41 m_edit->setSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding);
43 m_edit->button()->setText(i18n(
"..."));
47 connect(m_edit, TQ_SIGNAL(fontSelected(
const TQFont& )),
this, TQ_SLOT(updateProperty(
const TQFont& )));
50TQVariant PFontButton::value()
const
52 return TQVariant(m_edit->font());
55void PFontButton::drawViewer(TQPainter* p,
const TQColorGroup& cg,
const TQRect& r,
const TQVariant& value)
57 p->setPen(TQt::NoPen);
58 p->setBrush(cg.background());
60 TQFontInfo fi(value.toFont());
61 p->drawText(r, TQt::AlignLeft | TQt::AlignVCenter | TQt::SingleLine,
62 fi.family() + (fi.bold() ? i18n(
" Bold") : TQString(
"")) +
63 (fi.italic() ? i18n(
" Italic") : TQString(
"")) +
64 " " + TQString(
"%1").arg(fi.pointSize()) );
67void PFontButton::setValue(
const TQVariant& value,
bool emitChange)
69 disconnect(m_edit, TQ_SIGNAL(fontSelected(
const TQFont&)),
this, TQ_SLOT(updateProperty(
const TQFont&)));
70 m_edit->setFont(value.toFont());
71 connect(m_edit, TQ_SIGNAL(fontSelected(
const TQFont& )),
this, TQ_SLOT(updateProperty(
const TQFont& )));
73 emit propertyChanged(m_property, value);
76void PFontButton::updateProperty(
const TQFont &
79 emit propertyChanged(m_property, value());
85#include "pfontbutton.moc"
Namespace which contain property editing classes.