本文整理汇总了C++中QtProperty::hasValue方法的典型用法代码示例。如果您正苦于以下问题:C++ QtProperty::hasValue方法的具体用法?C++ QtProperty::hasValue怎么用?C++ QtProperty::hasValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QtProperty
的用法示例。
在下文中一共展示了QtProperty::hasValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mousePressEvent
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());
}
}
}
示例2: drawRow
void QtPropertyEditorView::drawRow(QPainter *painter,
const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QStyleOptionViewItemV3 opt = option;
bool hasValue = true;
if (m_editorPrivate)
{
QtProperty *property = m_editorPrivate->indexToProperty(index);
if (property)
hasValue = property->hasValue();
}
if (!hasValue && m_editorPrivate->markPropertiesWithoutValue())
{
const QColor c = option.palette.color(QPalette::Dark);
painter->fillRect(option.rect, c);
opt.palette.setColor(QPalette::AlternateBase, c);
}
else
{
const QColor c = m_editorPrivate->calculatedBackgroundColor(
m_editorPrivate->indexToBrowserItem(index));
if (c.isValid())
{
painter->fillRect(option.rect, c);
opt.palette.setColor(QPalette::AlternateBase, c.lighter(112));
}
}
QTreeWidget::drawRow(painter, opt, index);
QColor color = static_cast<QRgb>(
QApplication::style()->styleHint(QStyle::SH_Table_GridLineColor, &opt));
painter->save();
painter->setPen(QPen(color));
painter->drawLine(opt.rect.x(), opt.rect.bottom(), opt.rect.right(),
opt.rect.bottom());
painter->restore();
}