qdesigner_internal::QPropertyEditor Class Reference

#include <qpropertyeditor.h>

Inheritance diagram for qdesigner_internal::QPropertyEditor:

Inheritance graph
[legend]
Collaboration diagram for qdesigner_internal::QPropertyEditor:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 37 of file qpropertyeditor.h.

Public Slots

void setInitialInput (IProperty *initialInput)
void setReadOnly (bool readOnly)

Signals

void propertyChanged (IProperty *property)

Public Member Functions

 QPropertyEditor (QWidget *parent=0)
 ~QPropertyEditor ()
IPropertyinitialInput () const
bool isReadOnly () const
QPropertyEditorModeleditorModel () const

Protected Member Functions

virtual void drawBranches (QPainter *painter, const QRect &rect, const QModelIndex &index) const
virtual void keyPressEvent (QKeyEvent *ev)
virtual QStyleOptionViewItem viewOptions () const
virtual void focusInEvent (QFocusEvent *event)

Private Attributes

QPropertyEditorModelm_model
QPropertyEditorDelegatem_itemDelegate
bool contentsResized


Constructor & Destructor Documentation

qdesigner_internal::QPropertyEditor::QPropertyEditor ( QWidget parent = 0  ) 

QPropertyEditor::~QPropertyEditor (  ) 

Definition at line 59 of file qpropertyeditor.cpp.

00060 {
00061 }


Member Function Documentation

IProperty * QPropertyEditor::initialInput (  )  const

Definition at line 100 of file qpropertyeditor.cpp.

References qdesigner_internal::QPropertyEditorModel::initialInput(), and m_model.

Referenced by setInitialInput(), qdesigner_internal::PropertyEditor::setObject(), and qdesigner_internal::PropertyEditor::setPropertyValue().

00101 {
00102     return m_model->initialInput();
00103 }

Here is the call graph for this function:

bool QPropertyEditor::isReadOnly (  )  const

Definition at line 63 of file qpropertyeditor.cpp.

References qdesigner_internal::QPropertyEditorDelegate::isReadOnly(), and m_itemDelegate.

Referenced by qdesigner_internal::PropertyEditor::isReadOnly().

00064 {
00065     return m_itemDelegate->isReadOnly();
00066 }

Here is the call graph for this function:

QPropertyEditorModel* qdesigner_internal::QPropertyEditor::editorModel (  )  const [inline]

Definition at line 47 of file qpropertyeditor.h.

Referenced by qdesigner_internal::PropertyEditor::PropertyEditor(), and qdesigner_internal::PropertyEditor::setPropertyValue().

00048     { return m_model; }

void qdesigner_internal::QPropertyEditor::propertyChanged ( IProperty property  )  [signal]

void QPropertyEditor::setInitialInput ( IProperty initialInput  )  [slot]

Definition at line 73 of file qpropertyeditor.cpp.

References contentsResized, QAbstractItemView::CurrentChanged, qdesigner_internal::QPropertyEditorModel::indexOf(), initialInput(), qdesigner_internal::QPropertyEditorModel::initialInput(), m_model, QTreeView::resizeColumnToContents(), QAbstractItemView::SelectedClicked, QAbstractItemView::SelectRows, QAbstractItemView::setEditTriggers(), qdesigner_internal::QPropertyEditorModel::setInitialInput(), QTreeView::setRootIndex(), QTreeView::setRootIsDecorated(), QAbstractItemView::setSelectionBehavior(), QAbstractItemView::setSelectionMode(), and QAbstractItemView::SingleSelection.

Referenced by qdesigner_internal::PropertyEditor::setObject().

00074 {
00075     bool needResize = false;
00076     if (!m_model->initialInput() || m_model->initialInput() == dummy_collection()) {
00077         if (initialInput)
00078             needResize = true;
00079     }
00080 
00081     if (!initialInput)
00082         initialInput = dummy_collection();
00083 
00084     m_model->setInitialInput(initialInput);
00085 
00086     setSelectionMode(QTreeView::SingleSelection);
00087     setSelectionBehavior(QTreeView::SelectRows);
00088     setRootIsDecorated(true);
00089 
00090     setEditTriggers(QAbstractItemView::CurrentChanged|QAbstractItemView::SelectedClicked);
00091     setRootIndex(m_model->indexOf(initialInput));
00092 
00093     if (needResize && !contentsResized) {
00094         contentsResized = true;
00095         resizeColumnToContents(0);
00096     }
00097 }

void QPropertyEditor::setReadOnly ( bool  readOnly  )  [slot]

Definition at line 68 of file qpropertyeditor.cpp.

References m_itemDelegate, and qdesigner_internal::QPropertyEditorDelegate::setReadOnly().

Referenced by qdesigner_internal::PropertyEditor::setReadOnly().

00069 {
00070     m_itemDelegate->setReadOnly(readOnly);
00071 }

void QPropertyEditor::drawBranches ( QPainter painter,
const QRect rect,
const QModelIndex index 
) const [protected, virtual]

Draws the branches in the tree view on the same row as the model item index, using the painter given. The branches are drawn in the rectangle specified by rect.

Reimplemented from QTreeView.

Definition at line 105 of file qpropertyeditor.cpp.

References QRect::bottom(), QPalette::dark(), QPainter::drawLine(), QStyle::drawPrimitive(), QPainter::fillRect(), QStyleOptionViewItem::font, QRect::height(), QTreeView::indentation(), index, QObject::inherits(), QTreeView::isExpanded(), QRect::left(), QAbstractItemView::model(), QStyleOption::palette, QStyle::PE_IndicatorBranch, QPainter::pen(), QObject::property(), QStyleOption::rect, QWidget::rect(), QRect::right(), QFont::setBold(), QPainter::setPen(), QStyle::SH_Table_GridLineColor, QStyleOption::state, QStyle::State_Children, QStyle::State_Open, QApplication::style(), QWidget::style(), QStyle::styleHint(), QRect::top(), viewOptions(), and QRect::x().

00106 {
00107     // designer figts the style it uses. :(
00108     static bool mac_style
00109                 = QApplication::style()->inherits("QMacStyle");
00110     static const int windows_deco_size = 9;
00111 
00112     QStyleOptionViewItem opt = viewOptions();
00113 
00114     IProperty *property = static_cast<const QPropertyEditorModel*>(model())->privateData(index);
00115     if (index.column() == 0 && property && property->changed()) {
00116         opt.font.setBold(true);
00117     }
00118 
00119     if (property && property->isSeparator()) {
00120         painter->fillRect(rect, opt.palette.dark());
00121     }
00122 
00123     if (model()->hasChildren(index)) {
00124         opt.state |= QStyle::State_Children;
00125 
00126         QRect primitive(rect.left(), rect.top(), indentation(), rect.height());
00127 
00128         if (!mac_style) {
00129             primitive.moveLeft(primitive.left() + (primitive.width() - windows_deco_size)/2);
00130             primitive.moveTop(primitive.top() + (primitive.height() - windows_deco_size)/2);
00131             primitive.setWidth(windows_deco_size);
00132             primitive.setHeight(windows_deco_size);
00133         }
00134 
00135         opt.rect = primitive;
00136 
00137         if (isExpanded(index))
00138             opt.state |= QStyle::State_Open;
00139         style()->drawPrimitive(QStyle::PE_IndicatorBranch, &opt, painter, this);
00140     }
00141     QPen savedPen = painter->pen();
00142     QColor color = static_cast<QRgb>(QApplication::style()->styleHint(QStyle::SH_Table_GridLineColor, &opt));
00143     painter->setPen(QPen(color));
00144     painter->drawLine(rect.x(), rect.bottom(), rect.right(), rect.bottom());
00145     painter->setPen(savedPen);
00146 }

Here is the call graph for this function:

void QPropertyEditor::keyPressEvent ( QKeyEvent ev  )  [protected, virtual]

Reimplemented from QTreeView.

Definition at line 148 of file qpropertyeditor.cpp.

References QTreeView::keyPressEvent().

00149 {
00150 /*    QApplication::syncX();*/
00151     QTreeView::keyPressEvent(ev);
00152 }

Here is the call graph for this function:

QStyleOptionViewItem QPropertyEditor::viewOptions (  )  const [protected, virtual]

Returns a QStyleOptionViewItem structure populated with the view's palette, font, state, alignments etc.

Reimplemented from QAbstractItemView.

Definition at line 154 of file qpropertyeditor.cpp.

References QStyleOptionViewItem::showDecorationSelected, and QAbstractItemView::viewOptions().

Referenced by drawBranches().

00155 {
00156     QStyleOptionViewItem option = QTreeView::viewOptions();
00157     option.showDecorationSelected = true;
00158     return option;
00159 }

Here is the call graph for this function:

void QPropertyEditor::focusInEvent ( QFocusEvent event  )  [protected, virtual]

This function is called with the given event when the widget obtains the focus. By default, the event is ignored.

See also:
setFocus(), focusOutEvent()

Reimplemented from QAbstractItemView.

Definition at line 161 of file qpropertyeditor.cpp.

References QAbstractItemView::event(), QWidget::focusInEvent(), QWidget::update(), and QAbstractScrollArea::viewport().

00162 {
00163     QAbstractScrollArea::focusInEvent(event);
00164     viewport()->update();
00165 }

Here is the call graph for this function:


Member Data Documentation

QPropertyEditorModel* qdesigner_internal::QPropertyEditor::m_model [private]

Definition at line 64 of file qpropertyeditor.h.

Referenced by initialInput(), and setInitialInput().

QPropertyEditorDelegate* qdesigner_internal::QPropertyEditor::m_itemDelegate [private]

Definition at line 65 of file qpropertyeditor.h.

Referenced by isReadOnly(), and setReadOnly().

bool qdesigner_internal::QPropertyEditor::contentsResized [private]

Definition at line 66 of file qpropertyeditor.h.

Referenced by setInitialInput().


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 20:30:36 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1