int QtTreePropertyBrowser::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QtAbstractPropertyBrowser::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: collapsed((*reinterpret_cast< QtBrowserItem*(*)>(_a[1]))); break; case 1: expanded((*reinterpret_cast< QtBrowserItem*(*)>(_a[1]))); break; case 2: d_func()->slotCollapsed((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; case 3: d_func()->slotExpanded((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; case 4: d_func()->slotCurrentBrowserItemChanged((*reinterpret_cast< QtBrowserItem*(*)>(_a[1]))); break; case 5: d_func()->slotCurrentTreeItemChanged((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< QTreeWidgetItem*(*)>(_a[2]))); break; default: ; } _id -= 6; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = indentation(); break; case 1: *reinterpret_cast< bool*>(_v) = rootIsDecorated(); break; case 2: *reinterpret_cast< bool*>(_v) = alternatingRowColors(); break; case 3: *reinterpret_cast< bool*>(_v) = isHeaderVisible(); break; case 4: *reinterpret_cast< ResizeMode*>(_v) = resizeMode(); break; case 5: *reinterpret_cast< int*>(_v) = splitterPosition(); break; case 6: *reinterpret_cast< bool*>(_v) = propertiesWithoutValueMarked(); break; } _id -= 7; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setIndentation(*reinterpret_cast< int*>(_v)); break; case 1: setRootIsDecorated(*reinterpret_cast< bool*>(_v)); break; case 2: setAlternatingRowColors(*reinterpret_cast< bool*>(_v)); break; case 3: setHeaderVisible(*reinterpret_cast< bool*>(_v)); break; case 4: setResizeMode(*reinterpret_cast< ResizeMode*>(_v)); break; case 5: setSplitterPosition(*reinterpret_cast< int*>(_v)); break; case 6: setPropertiesWithoutValueMarked(*reinterpret_cast< bool*>(_v)); break; } _id -= 7; } else if (_c == QMetaObject::ResetProperty) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 7; } #endif // QT_NO_PROPERTIES return _id; }
void TeQtViewsListView::contentsDragMoveEvent(QDragMoveEvent *e) { if(pressedThemeItem_) pressedThemeItem_->setOpen(themeOpen_); if(e->source() != viewport()) { e->ignore(); e->acceptAction(false); return; } QPoint p = contentsToViewport(((QDragMoveEvent*)e)->pos()); TeQtCheckListItem *item = (TeQtCheckListItem*)itemAt(p); if (item) { if (p.x() < treeStepSize() * (item->depth() + (rootIsDecorated() ? 1 : 0)) + itemMargin()) { e->ignore(); e->acceptAction(false); } else { if(item->getType() == TeQtCheckListItem::THEME || item->getType() == TeQtCheckListItem::VIEW) { e->accept(); e->acceptAction(); } else { e->ignore(); e->acceptAction(false); if(currentThemeItem_) { unselectAllItems(); currentThemeItem_->parent()->setSelected(true); currentThemeItem_->parent()->repaint(); currentThemeItem_->setSelected(true); repaint(); } } } } else { e->ignore(); e->acceptAction(false); } }
void toListView::editPrint(void) { #if 0 TOPrinter printer; std::map<int, int> PageColumns; std::map<int, toTreeWidgetItem *> PageItems; int column = 0; int tree = rootIsDecorated() ? treeStepSize() : 0; int page = 1; PageColumns[1] = 0; toTreeWidgetItem *item = PageItems[1] = firstChild(); printer.setCreator(tr(TOAPPNAME)); QPainter painter(&printer); while ((item = printPage(&printer, &painter, item, column, tree, page++, false))) { PageColumns[page] = column; PageItems[page] = item; } printer.setMinMax(1, page - 1); printer.setFromTo(1, page - 1); if (printer.setup()) { QList<int> pages; for (int i = printer.fromPage(); i <= printer.toPage() || (printer.toPage() == 0 && i < page); i++) pages += i; for (QList<int>::iterator pageit = pages.begin(); pageit != pages.end(); pageit++) { page = *pageit; item = PageItems[page]; column = PageColumns[page]; printPage(&printer, &painter, item, column, tree, page, true); printer.newPage(); painter.resetXForm(); qApp->processEvents(); QString str = tr("Printing page %1").arg(page); toStatusMessage(str, false, false); } painter.end(); toStatusMessage(tr("Done printing"), false, false); } #endif }
void DirectoryView::contentsMousePressEvent( QMouseEvent* e ) { QListView::contentsMousePressEvent(e); QPoint p( contentsToViewport( e->pos() ) ); QListViewItem *i = itemAt( p ); if ( i ) { // if the user clicked into the root decoration of the item, don't try to start a drag! if ( p.x() > header()->cellPos( header()->mapToActual( 0 ) ) + treeStepSize() * ( i->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() || p.x() < header()->cellPos( header()->mapToActual( 0 ) ) ) { presspos = e->pos(); mousePressed = TRUE; } } }
void K3bListView::placeEditor( K3bListViewItem* item, int col ) { ensureItemVisible( item ); QRect r = itemRect( item ); r.setX( contentsToViewport( QPoint(header()->sectionPos( col ), 0) ).x() ); r.setWidth( header()->sectionSize( col ) - 1 ); // check if the column is fully visible if( visibleWidth() < r.right() ) r.setRight(visibleWidth()); r = QRect( viewportToContents( r.topLeft() ), r.size() ); if( item->pixmap( col ) ) { r.setX( r.x() + item->pixmap(col)->width() ); } // the tree-stuff is painted in the first column if( col == 0 ) { r.setX( r.x() + item->depth() * treeStepSize() ); if( rootIsDecorated() ) r.setX( r.x() + treeStepSize() ); } if( item->needButton(col) ) { prepareButton( item, col ); m_editorButton->setFixedHeight( r.height() ); // for now we make a square button m_editorButton->setFixedWidth( m_editorButton->height() ); r.setWidth( r.width() - m_editorButton->width() ); moveChild( m_editorButton, r.right(), r.y() ); } if( QWidget* editor = prepareEditor( item, col ) ) { editor->resize( r.size() ); // editor->resize( QSize( r.width(), editor->minimumSizeHint().height() ) ); moveChild( editor, r.x(), r.y() ); } }
void TreePropView::mousePressEvent(QMouseEvent *event) { QModelIndex index = indexAt(event->pos()); if (index.isValid()&& (event->button() == Qt::LeftButton)) { if (index.parent().isValid()) { if (!index.column()==0) edit(index); } else if (!rootIsDecorated()) { setExpanded(index,!isExpanded(index)); if (isExpanded(index)) model()->setData(index,m_iconOpen,Qt::DecorationRole); else model()->setData(index,m_iconClosed,Qt::DecorationRole); } setCurrentIndex(index); return; } if (index.column()==0) return; QTreeView::mousePressEvent(event); }
void QtPropertyEditorView::mousePressEvent(QMouseEvent *event) { QTreeWidget::mousePressEvent(event); QTreeWidgetItem *item = itemAt(event->pos()); if (item) { if ((item != m_editorPrivate->editedItem()) && (event->button() == Qt::LeftButton) && (header()->logicalIndexAt(event->pos().x()) == 1) && ((item->flags() & (Qt::ItemIsEditable | Qt::ItemIsEnabled)) == (Qt::ItemIsEditable | Qt::ItemIsEnabled))) { editItem(item, 1); } else if (!m_editorPrivate->hasValue(item) && m_editorPrivate->markPropertiesWithoutValue() && !rootIsDecorated()) { if (event->pos().x() + header()->offset() < 20) item->setExpanded(!item->isExpanded()); } } }
int QTreeView::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QAbstractItemView::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: expanded((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; case 1: collapsed((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; case 2: hideColumn((*reinterpret_cast< int(*)>(_a[1]))); break; case 3: showColumn((*reinterpret_cast< int(*)>(_a[1]))); break; case 4: expand((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; case 5: collapse((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; case 6: resizeColumnToContents((*reinterpret_cast< int(*)>(_a[1]))); break; case 7: sortByColumn((*reinterpret_cast< int(*)>(_a[1]))); break; case 8: expandAll(); break; case 9: collapseAll(); break; case 10: expandToDepth((*reinterpret_cast< int(*)>(_a[1]))); break; case 11: columnResized((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 12: columnCountChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 13: columnMoved(); break; case 14: reexpand(); break; case 15: rowsRemoved((*reinterpret_cast< const QModelIndex(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 16: d_func()->_q_endAnimatedOperation(); break; case 17: d_func()->_q_modelAboutToBeReset(); break; case 18: d_func()->_q_sortIndicatorChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Qt::SortOrder(*)>(_a[2]))); break; default: ; } _id -= 19; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = autoExpandDelay(); break; case 1: *reinterpret_cast< int*>(_v) = indentation(); break; case 2: *reinterpret_cast< bool*>(_v) = rootIsDecorated(); break; case 3: *reinterpret_cast< bool*>(_v) = uniformRowHeights(); break; case 4: *reinterpret_cast< bool*>(_v) = itemsExpandable(); break; case 5: *reinterpret_cast< bool*>(_v) = isSortingEnabled(); break; case 6: *reinterpret_cast< bool*>(_v) = isAnimated(); break; case 7: *reinterpret_cast< bool*>(_v) = allColumnsShowFocus(); break; case 8: *reinterpret_cast< bool*>(_v) = wordWrap(); break; case 9: *reinterpret_cast< bool*>(_v) = isHeaderHidden(); break; case 10: *reinterpret_cast< bool*>(_v) = expandsOnDoubleClick(); break; } _id -= 11; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setAutoExpandDelay(*reinterpret_cast< int*>(_v)); break; case 1: setIndentation(*reinterpret_cast< int*>(_v)); break; case 2: setRootIsDecorated(*reinterpret_cast< bool*>(_v)); break; case 3: setUniformRowHeights(*reinterpret_cast< bool*>(_v)); break; case 4: setItemsExpandable(*reinterpret_cast< bool*>(_v)); break; case 5: setSortingEnabled(*reinterpret_cast< bool*>(_v)); break; case 6: setAnimated(*reinterpret_cast< bool*>(_v)); break; case 7: setAllColumnsShowFocus(*reinterpret_cast< bool*>(_v)); break; case 8: setWordWrap(*reinterpret_cast< bool*>(_v)); break; case 9: setHeaderHidden(*reinterpret_cast< bool*>(_v)); break; case 10: setExpandsOnDoubleClick(*reinterpret_cast< bool*>(_v)); break; } _id -= 11; } else if (_c == QMetaObject::ResetProperty) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 11; } #endif // QT_NO_PROPERTIES return _id; }
toTreeWidgetItem *toListView::printPage(TOPrinter *printer, QPainter *painter, toTreeWidgetItem *top, int &column, int &level, int pageNo, bool paint) { Q3PaintDeviceMetrics wmetr(this); Q3PaintDeviceMetrics metrics(printer); double wpscalex = (double(metrics.width()) * wmetr.widthMM() / metrics.widthMM() / wmetr.width()); double wpscaley = (double(metrics.height()) * wmetr.heightMM() / metrics.heightMM() / wmetr.height()); painter->save(); QFont font = painter->font(); font.setPointSizeFloat(font.pointSizeFloat() / std::max(wpscalex, wpscaley)); painter->setFont(font); painter->scale(wpscalex, wpscaley); double mwidth = metrics.width() / wpscalex; double mheight = metrics.height() / wpscaley; double x = 0; if (paint) { QString numPage(tr("Page: %1").arg(pageNo)); painter->drawText(0, int(metrics.height() / wpscaley) - header()->height(), int(metrics.width() / wpscalex), header()->height(), Qt::SingleLine | Qt::AlignRight | Qt::AlignVCenter, numPage); painter->drawText(0, int(metrics.height() / wpscaley) - header()->height(), int(metrics.width() / wpscalex), header()->height(), Qt::SingleLine | Qt::AlignHCenter | Qt::AlignVCenter, middleString()); painter->drawText(0, int(metrics.height() / wpscaley) - header()->height(), int(metrics.width() / wpscalex), header()->height(), Qt::SingleLine | Qt::AlignLeft | Qt::AlignVCenter, sqlName()); painter->drawLine(0, header()->height() - 1, int(mwidth), header()->height() - 1); } font = toListView::font(); font.setPointSizeFloat(font.pointSizeFloat() / std::max(wpscalex, wpscaley)); painter->setFont(font); for (int i = column; i < columns(); i++) { double width = columnWidth(i); if (width + x >= mwidth) { if (i == column) width = mwidth - x - 1; else break; } if (paint) painter->drawText(int(x), 0, int(width), header()->height(), Qt::SingleLine | Qt::AlignLeft | Qt::AlignVCenter, header()->label(i)); x += width; } if (paint) painter->translate(0, header()->height()); double y = (header()->height() + 1) + header()->height(); int curLevel = level; int tree = rootIsDecorated() ? treeStepSize() : 0; int newCol = -1; toTreeWidgetItem *item = top; while (item && (y < mheight || item == top)) { if (column == 0) x = curLevel; else x = 0; painter->translate(x, 0); for (int i = column; i < columns(); i++) { double width = columnWidth(i); if (width + x >= mwidth) { if (i == column) width = mwidth - x - 1; else { newCol = i; break; } } if (i == 0) width -= curLevel; if (paint) { item->setSelected(false); item->paintCell(painter, qApp->palette().active(), i, int(width), columnAlignment(i)); painter->translate(width, 0); } x += width; } if (paint) painter->translate(-x, item->height()); y += item->height(); if (item->firstChild()) { item = item->firstChild(); curLevel += tree; } else if (item->nextSibling()) item = item->nextSibling(); else { do { item = item->parent(); curLevel -= tree; } while (item && !item->nextSibling()); if (item) item = item->nextSibling(); } } if (paint) painter->drawLine(0, 0, int(mwidth), 0); painter->restore(); if (newCol >= 0) { column = newCol; return top; } column = 0; level = curLevel; return item; }
bool KrTreeWidget::event(QEvent * event) { switch (event->type()) { // HACK: QT 4 Context menu key isn't handled properly case QEvent::ContextMenu: { QContextMenuEvent* ce = (QContextMenuEvent*) event; if (ce->reason() == QContextMenuEvent::Mouse) { QPoint pos = viewport()->mapFromGlobal(ce->globalPos()); QTreeWidgetItem * item = itemAt(pos); int column = columnAt(pos.x()); emit itemRightClicked(item, ce->globalPos(), column); return true; } else { if (currentItem()) { QRect r = visualItemRect(currentItem()); QPoint p = viewport()->mapToGlobal(QPoint(r.x() + 5, r.y() + 5)); emit itemRightClicked(currentItem(), p, currentColumn()); return true; } } } break; case QEvent::KeyPress: { // HACK: QT 4 Ctrl+A bug fix: Ctrl+A doesn't work if QTreeWidget contains parent / child items // Insert doesn't change the selections for multi selection modes QKeyEvent* ke = (QKeyEvent*) event; switch (ke->key()) { case Qt::Key_Insert: { if (ke->modifiers() != 0) break; QAbstractItemView::SelectionMode mode = selectionMode(); if (mode != QAbstractItemView::ContiguousSelection && mode != QAbstractItemView::ExtendedSelection && mode != QAbstractItemView::MultiSelection) break; ke->accept(); if (currentItem() == 0) return true; currentItem()->setSelected(!currentItem()->isSelected()); return true; } case Qt::Key_A: if (ke->modifiers() == Qt::ControlModifier) { QAbstractItemView::SelectionMode mode = selectionMode(); if (mode == QAbstractItemView::ContiguousSelection || mode == QAbstractItemView::ExtendedSelection || mode == QAbstractItemView::MultiSelection) { selectAll(); ke->accept(); return true; } } break; default: break; } } break; case QEvent::Resize: { QResizeEvent * re = (QResizeEvent *)event; if (!_inResize && re->oldSize() != re->size()) { if (_stretchingColumn != -1 && columnCount()) { QList< int > columnsSizes; int oldSize = 0; for (int i = 0; i != header()->count(); i++) { columnsSizes.append(header()->sectionSize(i)); oldSize += header()->sectionSize(i); } bool res = QTreeWidget::event(event); int newSize = viewport()->width(); int delta = newSize - oldSize; if (delta) { _inResize = true; for (int i = 0; i != header()->count(); i++) { if (i == _stretchingColumn) { int newNs = columnsSizes[ i ] + delta; if (newNs < 8) newNs = 8; header()->resizeSection(i, newNs); } else if (header()->sectionSize(i) != columnsSizes[ i ]) { header()->resizeSection(i, columnsSizes[ i ]); } } _inResize = false; } return res; } } break; } case QEvent::ToolTip: { QHelpEvent *he = static_cast<QHelpEvent*>(event); if (viewport()) { QPoint pos = viewport()->mapFromGlobal(he->globalPos()); QTreeWidgetItem * item = itemAt(pos); int column = columnAt(pos.x()); if (item) { if (!item->toolTip(column).isEmpty()) break; QString tip = item->text(column); int textMargin = QApplication::style()->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1; int requiredWidth = QFontMetrics(font()).width(tip) + 2 * textMargin; if (column == 0 && indentation()) { int level = 0; QTreeWidgetItem *parent = item; while ((parent = parent->parent())) level++; if (rootIsDecorated()) level++; requiredWidth += level * indentation(); } QIcon icon = item->icon(column); if (!icon.isNull()) { QStyleOptionViewItem opts = viewOptions(); QSize iconSize = icon.actualSize(opts.decorationSize); requiredWidth += iconSize.width(); int pixmapMargin = QApplication::style()->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, this) + 1; requiredWidth += 2 * pixmapMargin; } if (!tip.isEmpty() && (columnWidth(column) < requiredWidth)) QToolTip::showText(he->globalPos(), tip, this); return true; } } } break; default: break; } return QTreeWidget::event(event); }
void TeQtViewsListView::contentsMousePressEvent(QMouseEvent *e) { rightMouseWasClicked_ = false;; if (e->button() == RightButton) { rightMouseWasClicked_ = true; popupMenu_->move(e->globalPos().x(), e->globalPos().y()); } else if (e->button() == LeftButton) { QPoint p( contentsToViewport( e->pos() ) ); pressedPosition_ = p; TeQtCheckListItem *item = (TeQtCheckListItem*)itemAt(p); if (item != 0) { if(item->getType() == TeQtCheckListItem::THEME) { // don?t drag, if the user clicked into the root decoration of the item int x = p.x(); int len = treeStepSize() * (item->depth() + (rootIsDecorated() ? 1 : 0)) + itemMargin(); if (x > len) // if (p.x() > treeStepSize() * (item->depth() + (rootIsDecorated() ? 1 : 0)) + itemMargin()) { pressedThemeItem_ = (TeQtThemeItem*)item; themeOpen_ = isOpen(item); } // Item was pressed inside the visibility box if (x > len && x < len + 10) { if (e->state() & Qt::ShiftButton) { if (refThemeItemForVis_ == 0) refThemeItemForVis_ = (TeQtThemeItem*)item; else { TeQtThemeItem *themeItem = (TeQtThemeItem*)item; if ((themeItem == refThemeItemForVis_) || (themeItem->parent() != refThemeItemForVis_->parent())) return; list<TeQtCheckListItem*> themeItemList; list<TeQtCheckListItem*>::iterator it; // find if the item pressed is below the reference item TeQtCheckListItem *itemBelow = (TeQtCheckListItem*)refThemeItemForVis_->itemBelow(); while((itemBelow != 0) && (itemBelow->getType() == TeQtCheckListItem::THEME)) { themeItemList.push_back(itemBelow); if (itemBelow == themeItem) { for (it = themeItemList.begin(); it != themeItemList.end(); ++it) { TeQtCheckListItem *thItem = *it; bool visible = refThemeItemForVis_->isOn(); setOn(thItem, visible); } refThemeItemForVis_ = 0; return; } itemBelow = (TeQtCheckListItem*)itemBelow->itemBelow(); } // find if the item pressed is above the reference item themeItemList.clear(); TeQtCheckListItem *itemAbove = (TeQtCheckListItem*)refThemeItemForVis_->itemAbove(); while((itemAbove != 0) && (itemAbove->getType() == TeQtCheckListItem::THEME)) { themeItemList.push_back(itemAbove); if (itemAbove == themeItem) { for (it = themeItemList.begin(); it != themeItemList.end(); ++it) { TeQtCheckListItem* thItem = *it; bool visible = refThemeItemForVis_->isOn(); setOn(thItem, visible); } refThemeItemForVis_ = 0; return; } itemAbove = (TeQtCheckListItem*)itemAbove->itemAbove(); } } } else refThemeItemForVis_ = 0; } } else { item->setSelected(false); item->repaint(); pressedThemeItem_ = 0; } leftButtonPressed_ = true; } } QListView::contentsMousePressEvent(e); }
int QtTreePropertyBrowser::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QtAbstractPropertyBrowser::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 6) qt_static_metacall(this, _c, _id, _a); _id -= 6; } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { if (_id < 6) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 6; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = indentation(); break; case 1: *reinterpret_cast< bool*>(_v) = rootIsDecorated(); break; case 2: *reinterpret_cast< bool*>(_v) = alternatingRowColors(); break; case 3: *reinterpret_cast< bool*>(_v) = isHeaderVisible(); break; case 4: *reinterpret_cast< ResizeMode*>(_v) = resizeMode(); break; case 5: *reinterpret_cast< int*>(_v) = splitterPosition(); break; case 6: *reinterpret_cast< bool*>(_v) = propertiesWithoutValueMarked(); break; default: break; } _id -= 7; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setIndentation(*reinterpret_cast< int*>(_v)); break; case 1: setRootIsDecorated(*reinterpret_cast< bool*>(_v)); break; case 2: setAlternatingRowColors(*reinterpret_cast< bool*>(_v)); break; case 3: setHeaderVisible(*reinterpret_cast< bool*>(_v)); break; case 4: setResizeMode(*reinterpret_cast< ResizeMode*>(_v)); break; case 5: setSplitterPosition(*reinterpret_cast< int*>(_v)); break; case 6: setPropertiesWithoutValueMarked(*reinterpret_cast< bool*>(_v)); break; default: break; } _id -= 7; } else if (_c == QMetaObject::ResetProperty) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 7; } else if (_c == QMetaObject::RegisterPropertyMetaType) { if (_id < 7) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 7; } #endif // QT_NO_PROPERTIES return _id; }
void QtPropertyTreeView::mousePressEvent(QMouseEvent *event) { QTreeWidget::mousePressEvent(event); QTreeWidgetItem *item = itemAt(event->pos()); if (item) { QtProperty *property = editorPrivate_->itemToProperty(item); if ((item != editorPrivate_->getEditedItem()) && (event->button() == Qt::LeftButton) && (header()->logicalIndexAt(event->pos().x()) == 1) && isItemEditable(item->flags())) { editItem(item, 1); } else if (property && !property->hasValue() && editorPrivate_->markPropertiesWithoutValue() && !rootIsDecorated()) { if (event->pos().x() + header()->offset() < 20) item->setExpanded(!item->isExpanded()); } } }