本文整理汇总了C++中QTreeWidgetItem::isDisabled方法的典型用法代码示例。如果您正苦于以下问题:C++ QTreeWidgetItem::isDisabled方法的具体用法?C++ QTreeWidgetItem::isDisabled怎么用?C++ QTreeWidgetItem::isDisabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTreeWidgetItem
的用法示例。
在下文中一共展示了QTreeWidgetItem::isDisabled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isDisabled
bool QTreeWidgetItemProto::isDisabled() const
{
QTreeWidgetItem *item = qscriptvalue_cast<QTreeWidgetItem*>(thisObject());
if (item)
return item->isDisabled();
return false;
}
示例2:
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_tree_item_disable (const v8::Arguments &Args) {
v8::HandleScope scope;
V8Value result = v8::Undefined ();
JsModuleUiV8QtBasic *self = _to_self (Args);
if (self) {
QTreeWidgetItem *item = self->_to_qtreewidgetitem (Args.This ());
if (item) {
if (Args.Length ()) { item->setDisabled (v8_to_boolean (Args[0])); }
result = v8::Boolean::New (item->isDisabled ());
}
}
return scope.Close (result);
}
示例3: _syncXCCDFItemChildrenDisabledState
/**
* This only handles changes in selection of just one tree item!
*/
void _syncXCCDFItemChildrenDisabledState(QTreeWidgetItem* treeItem, bool enabled)
{
for (int i = 0; i < treeItem->childCount(); ++i)
{
QTreeWidgetItem* childTreeItem = treeItem->child(i);
const bool childEnabled = !childTreeItem->isDisabled();
if (!enabled && childEnabled)
{
childTreeItem->setDisabled(true);
_syncXCCDFItemChildrenDisabledState(childTreeItem, false);
}
else if (enabled && !childEnabled)
{
childTreeItem->setDisabled(false);
_syncXCCDFItemChildrenDisabledState(childTreeItem, true);
}
}
}
示例4: it
QSet<QTreeWidgetItem*> TreeWidgetSearch(QTreeWidget *treeWidget, int column, const QStringList &filters,
bool exactMatch, Qt::CaseSensitivity sensitivity, bool expandItems)
{
QSet<QTreeWidgetItem *> handled;
QSet<QTreeWidgetItem *> matched;
foreach(QString filter, filters)
{
filter = filter.trimmed();
// Negation search?
const bool negation = (!filter.isEmpty() && filter[0] == '!');
if (negation)
filter = filter.mid(1);
QTreeWidgetItemIterator it(treeWidget);
while(*it)
{
QTreeWidgetItem *item = *it;
// This item has been already handled with a previous filter
// but we need to check its children matching this filter.
if (handled.contains(item))
{
if (!filter.isEmpty())
TreeWidgetSearchHelper(item, handled, matched, negation, column, filter, exactMatch, sensitivity, expandItems);
continue;
}
if (filter.isEmpty())
{
if (!item->isDisabled())
item->setHidden(false); // No filter, show everything.
}
else if ((!exactMatch && item->text(column).contains(filter, sensitivity)) ||
(exactMatch && item->text(column).compare(filter, sensitivity) == 0))
{
// Hit with filter to column text
if (!item->isDisabled())
item->setHidden(negation);
handled << item;
matched << item;
if (expandItems && !item->isHidden())
item->setExpanded(true);
// Make sure that all the parent items are visible too
QTreeWidgetItem *parent = 0, *child = item;
while((parent = child->parent()) != 0)
{
if (!item->isDisabled())
parent->setHidden(negation);
handled << parent;
if (expandItems && !parent->isHidden())
parent->setExpanded(true);
child = parent;
}
}
else // No hit
{
if (!item->isDisabled())
item->setHidden(!negation);
}
++it;
}
}