KProperty

KPropertyEditorView.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2008-2018 Jarosław Staniek <staniek@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include "KPropertyEditorView.h"
21#include "KPropertyEditorDataModel_p.h"
22#include "KProperty.h"
23#include "KPropertySet.h"
24#include "KPropertyWidgetsFactory.h"
25#include "KPropertyWidgetsPluginManager.h"
26#include "kproperty_debug.h"
27#include "KPropertyUtils.h"
28#include "KPropertyUtils_p.h"
29
30#include <QIcon>
31#include <QPointer>
32#include <QItemDelegate>
33#include <QPainter>
34#include <QMouseEvent>
35#include <QToolTip>
36#include <QApplication>
37#include <QHeaderView>
38#include <QLineEdit>
39
40#if 0 // not sure if we should use it, better to fix Oxygen?
41#include <kexiutils/styleproxy.h>
42
43//! Used to alter the widget's style at design time
44class EditorViewStyle : public KexiUtils::StyleProxy
45{
46public:
47 explicit EditorViewStyle(QStyle* parentStyle) : KexiUtils::StyleProxy(parentStyle)
48 {
49 }
50
51 virtual void drawPrimitive(PrimitiveElement elem, const QStyleOption* option,
52 QPainter* painter, const QWidget* widget) const
53 {
54/* if (elem == PE_PanelLineEdit) {
55 const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame*>(option);
56 if (panel) {
57 QStyleOptionFrame alteredOption(*panel);
58 alteredOption.lineWidth = 0;
59 KexiUtils::StyleProxy::drawPrimitive(elem, &alteredOption,
60 painter, widget);
61 return;
62 }
63 }*/
64 KexiUtils::StyleProxy::drawPrimitive(elem, option,
65 painter, widget);
66 }
67};
68#endif
69
70static bool effectiveValueSyncPolicy(const KProperty *property, bool defaultValue)
71{
73 return defaultValue;
74 }
75 return property->valueSyncPolicy() == KProperty::ValueSyncPolicy::Auto;
76}
77
78//----------
79
80class ItemDelegate : public QItemDelegate
81{
82public:
84 ~ItemDelegate() override;
85 void paint(QPainter *painter,
86 const QStyleOptionViewItem &option, const QModelIndex &index) const override;
87 QSize sizeHint(const QStyleOptionViewItem &option,
88 const QModelIndex &index) const override;
89 QWidget * createEditor(QWidget *parent,
90 const QStyleOptionViewItem &option, const QModelIndex &index) const override;
91 mutable QPointer<QWidget> m_currentEditor;
92};
93
94ItemDelegate::ItemDelegate(KPropertyEditorView *parent)
95: QItemDelegate(parent)
96{
97}
98
99ItemDelegate::~ItemDelegate()
100{
101}
102
103static int getIconSize(int fontPixelSize)
104{
105 return fontPixelSize * 0.85;
106}
107
108static int typeForProperty(const KProperty* prop)
109{
110 if (prop->listData())
112 else
113 return prop->type();
114}
115
116void ItemDelegate::paint(QPainter *painter,
117 const QStyleOptionViewItem &option,
118 const QModelIndex &index) const
119{
120 QStyleOptionViewItem alteredOption(option);
121 const KPropertyUtilsPrivate::PainterSaver saver(painter);
122 const KPropertyEditorDataModel *editorModel = qobject_cast<const KPropertyEditorDataModel*>(index.model());
123 if (!editorModel) {
124 return;
125 }
126
127 QRect r(option.rect);
128 bool modified = false;
129 const QColor gridLineColor(qobject_cast<KPropertyEditorView*>(parent())->gridLineColor());
130 if (gridLineColor.isValid()) {
131 alteredOption.rect.setTop(alteredOption.rect.top() + 1);
132 }
133 if (index.column()==0) {
134 r.setWidth(r.width() - 1);
135 r.setLeft(-1); // to avoid displaying double left border
136
137 QVariant modifiedVariant( editorModel->data(index, KPropertyEditorDataModel::PropertyModifiedRole) );
138 if (modifiedVariant.isValid() && modifiedVariant.toBool()) {
139 modified = true;
140 QFont font(alteredOption.font);
141 font.setBold(true);
142 alteredOption.font = font;
143 }
144 }
145 else {
146 r.setLeft(r.left()-1);
147 }
148 const int x2 = alteredOption.rect.right();
149 const int y2 = alteredOption.rect.bottom();
150 const int iconSize = getIconSize( alteredOption.font.pixelSize() );
151 if (modified) {
152 alteredOption.rect.setRight( alteredOption.rect.right() - iconSize * 1 );
153 }
154
155 const bool isGroupHeader(editorModel->data(index, KPropertyEditorDataModel::PropertyGroupRole).toBool());
156 if (!isGroupHeader) {
157 KProperty *property = editorModel->propertyForIndex(index);
158 const int t = typeForProperty( property );
159 bool useQItemDelegatePaint = true; // ValueDisplayInterface is used by default
160 if (index.column() == 1 && KPropertyWidgetsPluginManager::self()->paint(t, painter, alteredOption, index)) {
161 useQItemDelegatePaint = false;
162 }
163 if (useQItemDelegatePaint) {
164 QItemDelegate::paint(painter, alteredOption, index);
165 }
166
167 if (modified) {
168 alteredOption.rect.setRight( alteredOption.rect.right() - iconSize * 3 / 2 );
169 int y1 = alteredOption.rect.top();
170 QLinearGradient grad(x2 - iconSize * 2, y1, x2 - iconSize / 2, y1);
171 QColor color(
172 alteredOption.palette.color(
173 (alteredOption.state & QStyle::State_Selected) ? QPalette::Highlight : QPalette::Base ));
174 color.setAlpha(0);
175 grad.setColorAt(0.0, color);
176 color.setAlpha(255);
177 grad.setColorAt(0.5, color);
178 QBrush gradBrush(grad);
179 painter->fillRect(x2 - iconSize * 2, y1, iconSize * 2, y2 - y1 + 1, gradBrush);
180
181 //!TODO
182 //QPixmap revertIcon(QIcon::fromTheme(QLatin1String("edit-undo")).pixmap(iconSize, iconSize));
183 //revertIcon = KIconEffect().apply(revertIcon, KIconEffect::Colorize, 1.0,
184 // alteredOption.palette.color(
185 // (alteredOption.state & QStyle::State_Selected) ? QPalette::HighlightedText : QPalette::Text ), false);
186 //painter->drawPixmap( x2 - iconSize - 2,
187 // y1 + 1 + (alteredOption.rect.height() - revertIcon.height()) / 2, revertIcon);
188 }
189 }
190
191 if (gridLineColor.isValid()) {
192 QPen pen(gridLineColor);
193 painter->setPen(pen);
194 painter->drawLine(r.topLeft(), r.topRight() + QPoint(1, 0));
195 painter->drawLine(r.bottomLeft() + QPoint(0, 1), r.bottomRight() + QPoint(1, 1));
196 if (!isGroupHeader) {
197 painter->drawLine(r.topRight() + QPoint(1, 0), r.bottomRight() + QPoint(1, 1));
198 painter->drawLine(r.topLeft(), r.bottomLeft() + QPoint(0, 1));
199 }
200 }
201 else {
202 QPen pen(alteredOption.palette.color(QPalette::AlternateBase));
203 painter->setPen(pen);
204 painter->drawLine(r.topLeft(), r.topRight());
205 }
206 //kprDebug()<<"rect:" << r << "viewport:" << painter->viewport() << "window:"<<painter->window();
207}
208
209QSize ItemDelegate::sizeHint(const QStyleOptionViewItem &option,
210 const QModelIndex &index) const
211{
212 QStyleOptionViewItem realOption(option);
213 if (index.column() == 0) {
214 // Measure for bold font because it might be used at any time if the property value is modified
215 realOption.font.setBold(true);
216 }
217 return QItemDelegate::sizeHint(realOption, index) + QSize(0, 2);
218}
219
220QWidget * ItemDelegate::createEditor(QWidget * parent,
221 const QStyleOptionViewItem & option, const QModelIndex & index ) const
222{
223 if (!index.isValid())
224 return nullptr;
225 const KProperty *property = KPropertyUtils::propertyForIndex(index);
226 if (property && property->isReadOnly()) {
227 return nullptr;
228 }
229 const int t = property ? typeForProperty(property) : KProperty::String;
230 QStyleOptionViewItem alteredOption(option);
231 alteredOption.rect.setHeight(alteredOption.rect.height()+3);
232 QWidget *w = KPropertyWidgetsPluginManager::self()->createEditor(t, parent, alteredOption, index);
233 if (!w) {
234 // fall back to String type
235 w = KPropertyWidgetsPluginManager::self()->createEditor(KProperty::String, parent, alteredOption, index);
236 }
237 if (w) {
238 if (-1 != w->metaObject()->indexOfSignal(QMetaObject::normalizedSignature("commitData(QWidget*)").constData())
239 && property && !property->children())
240 {
241 }
242 }
243 else {
244 w = QItemDelegate::createEditor(parent, alteredOption, index);
245 }
247 this, SIGNAL(commitData(QWidget*)));
248 if (property && effectiveValueSyncPolicy(property,
249 qobject_cast<KPropertyEditorView*>(this->parent())->isValueSyncEnabled()))
250 {
252 this, SIGNAL(commitData(QWidget*)), Qt::UniqueConnection);
253 }
254 m_currentEditor = w;
255 return w;
256}
257
258//----------
259
260class Q_DECL_HIDDEN KPropertyEditorView::Private
261{
262public:
263 explicit Private(KPropertyEditorView *view)
264 : model(nullptr)
265 , gridLineColor( KPropertyEditorView::defaultGridLineColor() )
266 , valueSync(true)
267 , slotPropertyChangedEnabled(true)
268 , q(view)
269 {
270 }
271
272 //! Expands group and parent property items if needed (based on settings)
273 void expandIfNeeded() {
274 if (!model) {
275 return;
276 }
277 const int rowCount = model->rowCount();
278 for (int row = 0; row < rowCount; row++) {
279 expandChildItemsIfNeeded(model->index(row, 0));
280 }
281 }
282
283 //! Expands property child items in a subtree recursively if needed (based on settings)
284 void expandChildItemsIfNeeded(const QModelIndex &parent) {
285 if (!model) {
286 return;
287 }
288 const bool isGroupHeader(model->data(parent, KPropertyEditorDataModel::PropertyGroupRole).toBool());
289 if (isGroupHeader) {
290 if (groupItemsExpanded) {
291 q->expand(parent);
292 }
293 } else {
294 if (childPropertyItemsExpanded) {
295 q->expand(parent);
296 }
297 }
298 const int rowCount = model->rowCount(parent);
299 for (int row = 0; row < rowCount; row++) {
300 const QModelIndex child(model->index(row, 0, parent));
301 expandChildItemsIfNeeded(child);
302 }
303 }
304
306 KPropertyEditorDataModel *model;
307 ItemDelegate *itemDelegate;
308 QColor gridLineColor;
309 bool valueSync;
310 bool slotPropertyChangedEnabled;
311 bool childPropertyItemsExpanded = true;
312 bool groupItemsExpanded = true;
313 bool groupsVisible = true;
314 bool toolTipsVisible = false;
315
316private:
317 KPropertyEditorView * const q;
318};
319
342
343KPropertyEditorView::~KPropertyEditorView()
344{
345 delete d;
346}
347
349{
350 changeSetInternal(set, options, QByteArray());
351}
352
353void KPropertyEditorView::changeSet(KPropertySet *set, const QByteArray& propertyToSelect, SetOptions options)
354{
355 changeSetInternal(set, options, propertyToSelect);
356}
357
358void KPropertyEditorView::changeSetInternal(KPropertySet *set, SetOptions options,
359 const QByteArray& propertyToSelect)
360{
361//! @todo port??
362#if 0
363 if (d->insideSlotValueChanged) {
364 //changeSet() called from inside of slotValueChanged()
365 //this is dangerous, because there can be pending events,
366 //especially for the GUI stuff, so let's do delayed work
367 d->setListLater_list = set;
368 d->preservePrevSelection_preservePrevSelection = preservePrevSelection;
369 d->preservePrevSelection_propertyToSelect = propertyToSelect;
370 qApp->processEvents(QEventLoop::AllEvents);
371 if (d->set) {
372 //store prev. selection for this prop set
373 if (d->currentItem)
374 d->set->setPrevSelection(d->currentItem->property()->name());
375 kprDebug() << d->set->prevSelection();
376 }
377 if (!d->setListLater_set) {
378 d->setListLater_set = true;
379 d->changeSetLaterTimer.setSingleShot(true);
380 d->changeSetLaterTimer.start(10);
381 }
382 return;
383 }
384#endif
385
386 const bool setChanged = d->set != set;
387 if (d->set) {
388 acceptInput();
389 //store prev. selection for this prop set
390 QModelIndex index = currentIndex();
391 if (index.isValid()) {
392//! @todo This crashes when changing the interpreter type in the script plugin
393#if 0
394 KProperty *property = d->model->propertyForIndex(index);
395 //if (property->isNull())
396 // kprDebug() << "WTF? a NULL property?";
397 //else
398 //d->set->setPreviousSelection(property->name());
399#endif
400 }
401 else {
402 d->set->setPreviousSelection(QByteArray());
403 }
404 if (setChanged) {
405 d->set->disconnect(this);
406 }
407 }
408
409 QByteArray selectedPropertyName1 = propertyToSelect;
410 QByteArray selectedPropertyName2 = propertyToSelect;
412 //try to find prev. selection:
413 //1. in new list's prev. selection
414 if (set)
415 selectedPropertyName1 = set->previousSelection();
416 //2. in prev. list's current selection
417 if (d->set)
418 selectedPropertyName2 = d->set->previousSelection();
419 }
420
421 if (setChanged) {
422 d->set = set;
423 }
424 if (d->set && setChanged) {
425 //receive property changes
426 connect(d->set, SIGNAL(propertyChangedInternal(KPropertySet&,KProperty&)),
428 connect(d->set, SIGNAL(propertyReset(KPropertySet&,KProperty&)),
430 connect(d->set, SIGNAL(aboutToBeCleared()), this, SLOT(slotSetWillBeCleared()));
431 connect(d->set, SIGNAL(aboutToBeDeleted()), this, SLOT(slotSetWillBeDeleted()));
434 }
435
436 KPropertyEditorDataModel *oldModel = d->model;
437 const KPropertySetIterator::Order setOrder
438 = (options & SetOption::AlphabeticalOrder)
440 : KPropertySetIterator::Order::Insertion;
441 d->model = d->set ? new KPropertyEditorDataModel(this, setOrder) : nullptr;
442 setModel( d->model );
443 delete oldModel;
444
445 if (d->model && d->set && !d->set->isEmpty()) {
446 d->expandIfNeeded();
447 }
448
449 emit propertySetChanged(d->set);
450
451 if (d->set) {
452 //select prev. selected item
453 QModelIndex index;
454 if (!selectedPropertyName2.isEmpty()) //try other one for old prop set
455 index = d->model->indexForPropertyName( selectedPropertyName2 );
456 if (!index.isValid() && !selectedPropertyName1.isEmpty()) //try old one for current prop set
457 index = d->model->indexForPropertyName( selectedPropertyName1 );
458
459 if (index.isValid()) {
460 setCurrentIndex(index);
461 scrollTo(index);
462 }
463 }
464}
465
470
475
485
487{
488 d->valueSync = set;
489}
490
492{
493 return d->valueSync;
494}
495
497{
498 d->childPropertyItemsExpanded = set;
499}
500
502{
503 return d->childPropertyItemsExpanded;
504}
505
507{
508 d->groupItemsExpanded = set;
509}
510
512{
513 return d->groupItemsExpanded;
514}
515
517{
518 return d->groupsVisible;
519}
520
522{
523 if (d->groupsVisible == set) {
524 return;
525 }
526 if (d->model) {
527 d->model->updateGroupsVisibility();
528 d->expandIfNeeded();
529 }
530 viewport()->update();
531}
532
533void KPropertyEditorView::currentChanged( const QModelIndex & current, const QModelIndex & previous )
534{
535 QTreeView::currentChanged( current, previous );
536}
537
538bool KPropertyEditorView::edit( const QModelIndex & index, EditTrigger trigger, QEvent * event )
539{
540 bool result;
541 if (!d->set || d->set->isReadOnly()) {
542 result = false;
543 } else {
544 result = QTreeView::edit(index, trigger, event);
545 }
546 if (result) {
547 QLineEdit *lineEditEditor = qobject_cast<QLineEdit*>(d->itemDelegate->m_currentEditor.data());
548 if (lineEditEditor) {
549 lineEditEditor->deselect();
550 lineEditEditor->end(false);
551 }
552 }
553 return result;
554}
555
556void KPropertyEditorView::drawBranches( QPainter * painter, const QRect & rect, const QModelIndex & index ) const
557{
558 QTreeView::drawBranches( painter, rect, index );
559}
560
561void KPropertyEditorView::drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
562{
563 if (!d->model) {
564 return;
565 }
566 const KPropertyUtilsPrivate::PainterSaver saver(painter);
567 const bool isGroupHeader(d->model->data(index, KPropertyEditorDataModel::PropertyGroupRole).toBool());
568 QStyleOptionViewItem alteredOption(option);
569 QTreeView::drawRow(painter, alteredOption, index);
570 if (isGroupHeader) {
571 // Special case: group header should be displayed over both columns. There's an issue with
572 // alternate background which is painted over text in the 2nd column, so draw the text here
573 // by hand.
574 QFont font(alteredOption.font);
575 font.setBold(true);
576 alteredOption.font = font;
577 painter->setFont(font);
578 painter->drawText(
579 alteredOption.rect.adjusted(style()->pixelMetric(QStyle::PM_TreeViewIndentation), 0, 0, 0),
581 }
582}
583
584QRect KPropertyEditorView::revertButtonArea( const QModelIndex& index ) const
585{
586 if (index.column() != 0 || !d->model)
587 return QRect();
588 QVariant modifiedVariant( d->model->data(index, KPropertyEditorDataModel::PropertyModifiedRole) );
589 if (!modifiedVariant.isValid() || !modifiedVariant.toBool())
590 return QRect();
591 const int iconSize = getIconSize( fontInfo().pixelSize() );
592 int x2 = columnWidth(0);
593 int x1 = x2 - iconSize - 2;
594 QRect r(visualRect(index));
595 r.setLeft(x1);
596 r.setRight(x2);
597 return r;
598}
599
600bool KPropertyEditorView::withinRevertButtonArea( int x, const QModelIndex& index ) const
601{
602 QRect r(revertButtonArea( index ));
603 if (!r.isValid())
604 return false;
605 return r.left() < x && x < r.right();
606}
607
608void KPropertyEditorView::mousePressEvent ( QMouseEvent * event )
609{
611 QModelIndex index = indexAt( event->pos() );
612 setCurrentIndex(index);
613 if (withinRevertButtonArea( event->x(), index )) {
614 undo();
615 }
616}
617
618void KPropertyEditorView::undo()
619{
620 if (!d->set || d->set->isReadOnly() || !d->model)
621 return;
622
623 KProperty *property = d->model->propertyForIndex(currentIndex());
624 if (effectiveValueSyncPolicy(property, d->valueSync)) {
625 property->resetValue();
626 }
627}
628
630{
631//! @todo
632}
633
634void KPropertyEditorView::commitData( QWidget * editor )
635{
637}
638
639bool KPropertyEditorView::viewportEvent( QEvent * event )
640{
641 if (event->type() == QEvent::ToolTip) {
642 QHelpEvent *hevent = static_cast<QHelpEvent*>(event);
643 const QModelIndex index = indexAt(hevent->pos());
644 if (index.column() == 0 && withinRevertButtonArea( hevent->x(), index )) {
645 QRect r(revertButtonArea( index ));
646 QToolTip::showText(hevent->globalPos(), tr("Undo changes"), this, r);
647 }
648 else {
650 }
651 }
653}
654
659
661{
662 return d->set;
663}
664
666{
667 return d->gridLineColor;
668}
669
671{
672 d->gridLineColor = color;
673 viewport()->update();
674}
675
676static QModelIndex findChildItem(const KProperty& property, const QModelIndex &parent)
677{
678 if (parent.model() && KPropertyUtils::propertyForIndex(parent) == &property) {
679 return parent;
680 }
681 int row = 0;
682 while (true) {
683 QModelIndex childItem = parent.child(row, 0);
684 if (childItem.isValid()) {
685 QModelIndex subchild = findChildItem(property, childItem);
686 if (subchild.isValid()) {
687 return subchild;
688 }
689 }
690 else {
691 return QModelIndex();
692 }
693 row++;
694 }
695}
696
698{
699 Q_UNUSED(set);
700 if (!d->slotPropertyChangedEnabled || !d->model)
701 return;
702 d->slotPropertyChangedEnabled = false;
703 KProperty *realProperty = &property;
704 while (realProperty->parent()) { // find top-level property
705 realProperty = realProperty->parent();
706 }
707 const QModelIndex parentIndex( d->model->indexForPropertyName(realProperty->name()) );
708 if (parentIndex.isValid()) {
709 QModelIndex index = findChildItem(property, parentIndex);
710 updateSubtree(index);
711 }
712 d->slotPropertyChangedEnabled = true;
713}
714
715void KPropertyEditorView::updateSubtree(const QModelIndex &index)
716{
717 if (!index.isValid() || !d->model) {
718 return;
719 }
720 update(index);
721 update(index.parent());
722 update(d->model->indexForColumn(index, 1));
723 update(d->model->indexForColumn(index.parent(), 1));
724
725 KProperty *property = static_cast<KProperty*>(index.internalPointer());
726 if (property->children()) {
727 int row = 0;
728 foreach (KProperty* p, *property->children()) {
729 updateSubtree(d->model->createIndex(row, 0, p));
730 ++row;
731 }
732 }
733}
734
736{
737//! @todo OK?
739}
740
741
743{
744 return d->toolTipsVisible;
745}
746
748{
749 d->toolTipsVisible = set;
750}
A widget for editing properties.
void setValueSyncEnabled(bool set)
void setGridLineColor(const QColor &color)
Sets color of grid lines. Use invalid color QColor() to hide grid lines.
void propertySetChanged(KPropertySet *set)
KPropertyEditorView(QWidget *parent=nullptr)
bool childPropertyItemsExpanded() const
QSize sizeHint() const override
Reimplemented to suggest widget size that is based on number of property items.
void slotPropertyChanged(KPropertySet &set, KProperty &property)
void setToolTipsVisible(bool set)
If set is true tooltips are visible for property editor items.
void slotPropertyReset(KPropertySet &set, KProperty &property)
void setChildPropertyItemsExpanded(bool set)
bool toolTipsVisible() const
Returns true if the property editor widget has enabled visibility of tooltips.
void setGroupItemsExpanded(bool set)
@ PreservePreviousSelection
If used, previously selected editor item will be kept selected.
@ AlphabeticalOrder
Alphabetical order of properties. The default is order of insertion.
KPropertySet * propertySet() const
void changeSet(KPropertySet *set, SetOptions options=SetOption::None)
A class to iterate over a KPropertySet.
Order
Ordering options for properties.
@ Alphabetical
alphabetical order (case-insensitively by captions)
Set of properties.
QByteArray previousSelection() const
void readOnlyFlagChanged()
The base class representing a single property.
Definition KProperty.h:96
int type() const
@ Auto
Synchronize automatically as soon as the editor widget for this property signals (using commitData) t...
@ Editor
Allow to synchronize by the property editor using its valueSync setting (default)
QByteArray name() const
KPropertyListData * listData() const
@ ValueFromList
string value from a list
Definition KProperty.h:151
ValueSyncPolicy valueSyncPolicy() const
KProperty * parent() const
qreal pixelSize(qreal scale)
void commitData(QWidget *editor)
void setAlternatingRowColors(bool enable)
virtual void commitData(QWidget *editor)
QModelIndex currentIndex() const const
virtual bool edit(const QModelIndex &index, EditTrigger trigger, QEvent *event)
void setEditTriggers(EditTriggers triggers)
virtual bool event(QEvent *event) override
void setHorizontalScrollMode(ScrollMode mode)
void setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior)
void setSelectionMode(QAbstractItemView::SelectionMode mode)
QItemSelectionModel * selectionModel() const const
void setCurrentIndex(const QModelIndex &index)
void setItemDelegate(QAbstractItemDelegate *delegate)
QWidget * viewport() const const
const char * constData() const const
bool isEmpty() const const
void setSectionsMovable(bool movable)
const QPoint & globalPos() const const
const QPoint & pos() const const
int x() const const
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const const override
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const const override
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const const override
virtual void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command)
void deselect()
void end(bool mark)
int indexOfSignal(const char *signal) const const
QByteArray normalizedSignature(const char *method)
int column() const const
QVariant data(int role) const const
void * internalPointer() const const
bool isValid() const const
const QAbstractItemModel * model() const const
QModelIndex parent() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect(const QMetaObject::Connection &connection)
virtual const QMetaObject * metaObject() const const
QObject * parent() const const
QVariant property(const char *name) const const
T qobject_cast(QObject *object)
void setObjectName(QAnyStringView name)
QString tr(const char *sourceText, const char *disambiguation, int n)
void drawLine(const QLine &line)
void drawText(const QPoint &position, const QString &text)
void fillRect(const QRect &rectangle, QGradient::Preset preset)
void setFont(const QFont &font)
void setPen(Qt::PenStyle style)
T * data() const const
PM_TreeViewIndentation
AlignLeft
UniqueConnection
DisplayRole
void hideText()
void showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect, int msecDisplayTime)
void setAllColumnsShowFocus(bool enable)
void setAnimated(bool enable)
int columnWidth(int column) const const
virtual void currentChanged(const QModelIndex &current, const QModelIndex &previous) override
virtual void drawBranches(QPainter *painter, const QRect &rect, const QModelIndex &index) const const
virtual void drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const const
QHeaderView * header() const const
virtual QModelIndex indexAt(const QPoint &point) const const override
virtual void mousePressEvent(QMouseEvent *event) override
virtual void scrollTo(const QModelIndex &index, ScrollHint hint) override
virtual void setModel(QAbstractItemModel *model) override
virtual bool viewportEvent(QEvent *event) override
virtual QSize viewportSizeHint() const const override
virtual QRect visualRect(const QModelIndex &index) const const override
QString toString() const const
QFontInfo fontInfo() const const
QStyle * style() const const
void update()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:09 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.