21#include "kexipropertyeditorview.h"
22#include "keximainwindow.h"
23#include <koproperty/set.h>
24#include <koproperty/editor.h>
25#include <koproperty/property.h>
28#include <kiconloader.h>
33KexiObjectInfoLabel::KexiObjectInfoLabel(TQWidget* parent,
const char* name)
34 : TQWidget(parent, name)
36 TQHBoxLayout *hlyr =
new TQHBoxLayout(
this);
37 m_objectIconLabel =
new TQLabel(
this);
38 m_objectIconLabel->setMargin(2);
39 setFixedHeight( IconSize(TDEIcon::Small) + 2 + 2 );
40 hlyr->addWidget(m_objectIconLabel);
41 m_objectNameLabel =
new TQLabel(
this);
42 m_objectNameLabel->setMargin(2);
43 m_objectNameLabel->setSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::Preferred);
44 hlyr->addWidget(m_objectNameLabel);
47KexiObjectInfoLabel::~KexiObjectInfoLabel()
51void KexiObjectInfoLabel::setObjectClassIcon(
const TQString& name)
54 if (m_classIcon.isEmpty())
55 m_objectIconLabel->setFixedWidth( 0 );
57 m_objectIconLabel->setFixedWidth( IconSize(TDEIcon::Small) + 2 + 2 );
58 m_objectIconLabel->setPixmap( SmallIcon(name) );
61void KexiObjectInfoLabel::setObjectClassName(
const TQString& name)
67void KexiObjectInfoLabel::setObjectName(
const TQString& name)
73void KexiObjectInfoLabel::updateName()
75 TQString txt( m_className );
78 else if (!m_objectName.isEmpty())
79 txt += TQString(
" \"%1\"").arg(m_objectName);
80 m_objectNameLabel->setText(txt);
83void KexiObjectInfoLabel::setBuddy( TQWidget * buddy )
85 m_objectNameLabel->setBuddy(buddy);
91class KexiPropertyEditorView::Private
97 KoProperty::Editor *editor;
101 KexiObjectInfoLabel *objectInfoLabel;
106KexiPropertyEditorView::KexiPropertyEditorView(
KexiMainWindow *mainWin, TQWidget* parent)
107 : TQWidget(parent,
"KexiPropertyEditorView")
110 setCaption(i18n(
"Properties"));
112 setIcon(*mainWin->icon());
114 TQVBoxLayout *lyr =
new TQVBoxLayout(
this);
118 lyr->addWidget(d->objectInfoLabel);
131 d->editor =
new KoProperty::Editor(
this,
true ,
"propeditor");
132 lyr->addWidget(d->editor);
133 setFocusProxy(d->editor);
134 d->objectInfoLabel->setBuddy(d->editor);
135 setFocusPolicy(TQWidget::WheelFocus);
137 connect(d->editor, TQ_SIGNAL(propertySetChanged(KoProperty::Set*)),
138 this, TQ_SLOT(slotPropertySetChanged(KoProperty::Set*)));
141 slotPropertySetChanged(0);
144KexiPropertyEditorView::~KexiPropertyEditorView()
149TQSize KexiPropertyEditorView::sizeHint()
const
151 return TQSize(200,200);
154TQSize KexiPropertyEditorView::minimumSizeHint()
const
156 return TQSize(200,200);
169KoProperty::Editor *KexiPropertyEditorView::editor()
const
182 KoProperty::Set* set,
const TQString& textToDisplayForNullSet)
184 TQString className, iconName, objectName;
186 if (set->contains(
"this:classString"))
187 className = (*set)[
"this:classString"].value().toString();
188 if (set->contains(
"this:iconName"))
189 iconName = (*set)[
"this:iconName"].value().toString();
190 const bool useCaptionAsObjectName = set->contains(
"this:useCaptionAsObjectName")
191 && (*set)[
"this:useCaptionAsObjectName"].value().toBool();
192 if (set->contains(useCaptionAsObjectName ?
"caption" :
"name"))
193 objectName = (*set)[useCaptionAsObjectName ?
"caption" :
"name"].value().toString();
195 if (!set || objectName.isEmpty()) {
196 objectName = textToDisplayForNullSet;
197 className = TQString();
198 iconName = TQString();
201 if (className.isEmpty() && objectName.isEmpty())
206 if (infoLabel->objectClassName() == className
207 && infoLabel->objectClassIcon() == iconName
208 && infoLabel->objectName() == objectName)
211 infoLabel->setObjectClassIcon(iconName);
212 infoLabel->setObjectClassName(className);
213 infoLabel->setObjectName(objectName);
216void KexiPropertyEditorView::slotPropertySetChanged(KoProperty::Set* set)
220 d->editor->setEnabled(set);
223#include "kexipropertyeditorview.moc"
Kexi's main window interface This interface is implemented by KexiMainWindowImpl class.
Helper class displaying small icon with class name and object name.
static void updateInfoLabelForPropertySet(KexiObjectInfoLabel *infoLabel, KoProperty::Set *set, const TQString &textToDisplayForNullSet=TQString())