本文整理汇总了C++中PropertyItem::isSeparator方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyItem::isSeparator方法的具体用法?C++ PropertyItem::isSeparator怎么用?C++ PropertyItem::isSeparator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyItem
的用法示例。
在下文中一共展示了PropertyItem::isSeparator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paint
void PropertyItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt, const QModelIndex &index) const
{
QStyleOptionViewItem option = opt;
PropertyItem *property = static_cast<PropertyItem*>(index.internalPointer());
if (property && property->isSeparator()) {
QColor color = option.palette.color(QPalette::BrightText);
QObject* par = parent();
if (par) {
QVariant value = par->property("groupTextColor");
if (value.canConvert<QColor>())
color = value.value<QColor>();
}
option.palette.setColor(QPalette::Text, color);
option.font.setBold(true);
option.state &= ~QStyle::State_Selected;
}
if (index.column() == 1) {
option.state &= ~QStyle::State_Selected;
}
option.state &= ~QStyle::State_HasFocus;
if (property && property->isSeparator()) {
QBrush brush = option.palette.dark();
QObject* par = parent();
if (par) {
QVariant value = par->property("groupBackground");
if (value.canConvert<QBrush>())
brush = value.value<QBrush>();
}
painter->fillRect(option.rect, brush);
}
QPen savedPen = painter->pen();
QItemDelegate::paint(painter, option, index);
QColor color = static_cast<QRgb>(QApplication::style()->styleHint(QStyle::SH_Table_GridLineColor, &opt, qobject_cast<QWidget*>(parent())));
painter->setPen(QPen(color));
if (index.column() == 1 || !(property && property->isSeparator())) {
int right = (option.direction == Qt::LeftToRight) ? option.rect.right() : option.rect.left();
painter->drawLine(right, option.rect.y(), right, option.rect.bottom());
}
painter->drawLine(option.rect.x(), option.rect.bottom(),
option.rect.right(), option.rect.bottom());
painter->setPen(savedPen);
}
示例2: propertyPathFromIndex
QStringList PropertyModel::propertyPathFromIndex(const QModelIndex& index) const
{
QStringList path;
if (index.isValid()) {
PropertyItem* item = static_cast<PropertyItem*>(index.internalPointer());
if (!item->isSeparator()) {
do {
path.push_front(item->propertyName());
item = item->parent();
}
while (item != this->rootItem && item != 0);
}
}
return path;
}
示例3: drawBranches
void PropertyEditor::drawBranches(QPainter *painter, const QRect &rect, const QModelIndex &index) const
{
QTreeView::drawBranches(painter, rect, index);
QStyleOptionViewItem opt = viewOptions();
PropertyItem *property = static_cast<PropertyItem*>(index.internalPointer());
if (property && property->isSeparator()) {
painter->fillRect(rect, opt.palette.dark());
//} else if (selectionModel()->isSelected(index)) {
// painter->fillRect(rect, opt.palette.brush(QPalette::Highlight));
}
//QPen savedPen = painter->pen();
//QColor color = static_cast<QRgb>(QApplication::style()->styleHint(QStyle::SH_Table_GridLineColor, &opt));
//painter->setPen(QPen(color));
//painter->drawLine(rect.x(), rect.bottom(), rect.right(), rect.bottom());
//painter->setPen(savedPen);
}