本文整理汇总了C++中QStandardItem::isEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ QStandardItem::isEnabled方法的具体用法?C++ QStandardItem::isEnabled怎么用?C++ QStandardItem::isEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStandardItem
的用法示例。
在下文中一共展示了QStandardItem::isEnabled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnItemClicked
void QtPropertyEditor::OnItemClicked(const QModelIndex &index)
{
QStandardItem *item = curModel->itemFromIndex(index);
if(NULL != item && item->isEditable() && item->isEnabled())
{
edit(index, QAbstractItemView::DoubleClicked, NULL);
}
}
示例2: getEnabledCheckedIds
QString qCheckboxFilterModel::getEnabledCheckedIds() const
{
qCSString s;
for(int r = 0; r < srcModel.rowCount(); ++r)
{
QStandardItem* item = actualSrcItem(r);
if(isSrcItemChecked(r) && item->isEnabled()) s.append(getSrcId(r));
}
return s;
}
示例3: refreshState
void GrepOutputItem::refreshState()
{
if(rowCount() > 0)
{
int checked = 0;
int unchecked = 0;
int enabled = 0; //only enabled items are relevants
for(int i = 0; i < rowCount(); i++)
{
QStandardItem *item = child(i);
if(item->isEnabled())
{
enabled += 1;
switch(child(i)->checkState())
{
case Qt::Checked:
checked += 1;
break;
case Qt::Unchecked:
unchecked += 1;
break;
default: break;
}
}
}
if(enabled == 0)
{
setCheckState(Qt::Unchecked);
setEnabled(false);
}
else if(checked == enabled)
{
setCheckState(Qt::Checked);
}
else if (unchecked == enabled)
{
setCheckState(Qt::Unchecked);
}
else
{
setCheckState(Qt::PartiallyChecked);
}
}
if(GrepOutputItem *p = static_cast<GrepOutputItem *>(parent()))
{
p->refreshState();
}
}
示例4: OnConnectionTreeClick
void MainWin::OnConnectionTreeClick(const QModelIndex & index)
{
if (treeViewUILocked || !index.isValid())
return;
QStandardItem * item = connections->itemFromIndex(index);
int type = item->type();
switch (type) {
case RedisServerItem::TYPE:
{
RedisServerItem * server = dynamic_cast<RedisServerItem *>(item);
server->runDatabaseLoading();
ui.serversTreeView->setExpanded(index, true);
}
break;
case RedisServerDbItem::TYPE:
{
RedisServerDbItem * db = dynamic_cast<RedisServerDbItem *>(item);
if (db->loadKeys()) {
performanceTimer.start();
connections->blockSignals(true);
statusBar()->showMessage(QString("Loading keys ..."));
ui.serversTreeView->setExpanded(index, true);
}
}
break;
case RedisKeyItem::TYPE:
if (item->isEnabled())
ui.tabWidget->openKeyTab(dynamic_cast<RedisKeyItem *>(item));
break;
}
}
示例5: getSetFlags
void tst_QStandardItem::getSetFlags()
{
QStandardItem item;
item.setEnabled(true);
QVERIFY(item.isEnabled());
QVERIFY(item.flags() & Qt::ItemIsEnabled);
item.setEditable(true);
QVERIFY(item.isEditable());
QVERIFY(item.flags() & Qt::ItemIsEditable);
item.setSelectable(true);
QVERIFY(item.isSelectable());
QVERIFY(item.flags() & Qt::ItemIsSelectable);
item.setCheckable(true);
QVERIFY(item.isCheckable());
QCOMPARE(item.checkState(), Qt::Unchecked);
QVERIFY(item.flags() & Qt::ItemIsUserCheckable);
item.setTristate(true);
QVERIFY(item.isTristate());
QVERIFY(item.flags() & Qt::ItemIsTristate);
#ifndef QT_NO_DRAGANDDROP
item.setDragEnabled(true);
QVERIFY(item.isDragEnabled());
QVERIFY(item.flags() & Qt::ItemIsDragEnabled);
item.setDropEnabled(true);
QVERIFY(item.isDropEnabled());
QVERIFY(item.flags() & Qt::ItemIsDropEnabled);
#endif
QVERIFY(item.isEnabled());
item.setEnabled(false);
QVERIFY(!item.isEnabled());
QVERIFY(!(item.flags() & Qt::ItemIsEnabled));
QVERIFY(item.isEditable());
item.setEditable(false);
QVERIFY(!item.isEditable());
QVERIFY(!(item.flags() & Qt::ItemIsEditable));
QVERIFY(item.isSelectable());
item.setSelectable(false);
QVERIFY(!item.isSelectable());
QVERIFY(!(item.flags() & Qt::ItemIsSelectable));
QVERIFY(item.isCheckable());
item.setCheckable(false);
QVERIFY(!item.isCheckable());
QVERIFY(!(item.flags() & Qt::ItemIsUserCheckable));
QVERIFY(item.isTristate());
item.setTristate(false);
QVERIFY(!item.isTristate());
QVERIFY(!(item.flags() & Qt::ItemIsTristate));
#ifndef QT_NO_DRAGANDDROP
QVERIFY(item.isDragEnabled());
item.setDragEnabled(false);
QVERIFY(!item.isDragEnabled());
QVERIFY(!(item.flags() & Qt::ItemIsDragEnabled));
QVERIFY(item.isDropEnabled());
item.setDropEnabled(false);
QVERIFY(!item.isDropEnabled());
QVERIFY(!(item.flags() & Qt::ItemIsDropEnabled));
#endif
item.setCheckable(false);
item.setCheckState(Qt::Checked);
item.setCheckable(true);
QCOMPARE(item.checkState(), Qt::Checked);
}
示例6: populateComboBoxes
//.........这里部分代码省略.........
DataArrayPath selectedPath = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<DataArrayPath>();
// Split the path up to make sure we have a valid path separated by the "|" character
QString filtDcName = selectedPath.getDataContainerName();
QString filtAmName = selectedPath.getAttributeMatrixName();
QString filtDaName = selectedPath.getDataArrayName();
QString dcName;
QString amName;
QString daName;
// If EVERYTHING is empty, then try the default value
if(filtDcName.isEmpty() && filtAmName.isEmpty() && filtDaName.isEmpty()
&& curDcName.isEmpty() && curAmName.isEmpty() && curDaName.isEmpty() )
{
DataArrayPath daPath = getFilterParameter()->getDefaultValue().value<DataArrayPath>();
dcName = daPath.getDataContainerName();
amName = daPath.getAttributeMatrixName();
daName = daPath.getDataArrayName();
}
else
{
// Now to figure out which one of these to use. If this is the first time through then what we picked up from the
// gui will be empty strings because nothing is there. If there is something in the filter then we should use that.
// If there is something in both of them and they are NOT equal then we have a problem. Use the flag m_DidCausePreflight
// to determine if the change from the GUI should over ride the filter or vice versa. there is a potential that in future
// versions that something else is driving DREAM3D and pushing the changes to the filter and we need to reflect those
// changes in the GUI, like a testing script?
dcName = checkStringValues(curDcName, filtDcName);
if( !dca->doesDataContainerExist(dcName) ) { dcName = ""; }
amName = checkStringValues(curAmName, filtAmName);
if ( !dca->doesAttributeMatrixExist(DataArrayPath(dcName, amName, "") ) ) { amName = ""; }
daName = checkStringValues(curDaName, filtDaName);
if ( !dca->doesAttributeArrayExist(DataArrayPath(dcName, amName, daName) )) { daName = ""; }
}
bool didBlock = false;
if (!dataContainerCombo->signalsBlocked()) { didBlock = true; }
dataContainerCombo->blockSignals(true);
int dcIndex = dataContainerCombo->findText(dcName);
dataContainerCombo->setCurrentIndex(dcIndex);
FilterPararameterWidgetUtils::PopulateAttributeMatrixComboBox<DataArraySelectionFilterParameter>(getFilter(), getFilterParameter(), dataContainerCombo, attributeMatrixCombo, m_DcaProxy);
if(didBlock) { dataContainerCombo->blockSignals(false); didBlock = false; }
if(!attributeMatrixCombo->signalsBlocked()) { didBlock = true; }
attributeMatrixCombo->blockSignals(true);
int amIndex = -1;
if (dcIndex < 0)
{
attributeMatrixCombo->setCurrentIndex(-1);
attributeArrayCombo->setCurrentIndex(-1);
}
else
{
amIndex = attributeMatrixCombo->findText(amName);
attributeMatrixCombo->setCurrentIndex(amIndex);
FilterPararameterWidgetUtils::PopulateAttributeArrayComboBox<DataArraySelectionFilterParameter>(getFilter(), getFilterParameter(), dataContainerCombo, attributeMatrixCombo, attributeArrayCombo, m_DcaProxy);
}
if(didBlock) { attributeMatrixCombo->blockSignals(false); didBlock = false; }
if(!attributeArrayCombo->signalsBlocked()) { didBlock = true; }
attributeArrayCombo->blockSignals(true);
if (amIndex < 0)
{
attributeArrayCombo->setCurrentIndex(-1);
}
else
{
QStandardItemModel* model = qobject_cast<QStandardItemModel*>(attributeArrayCombo->model());
if (NULL != model)
{
int daIndex = attributeArrayCombo->findText(daName);
// The DataArray Name was empty, lets instantiate the filter and get the default value and try that
if (daIndex < 0)
{
QVariant var = getFilterParameter()->getDefaultValue();
DataArrayPath path = var.value<DataArrayPath>();
daName = path.getDataArrayName(); // Pick up the DataArray Name from a Default instantiation of the filter
daIndex = attributeArrayCombo->findText(daName);
}
QStandardItem* item = model->item(daIndex);
if (NULL != item)
{
if (item->isEnabled())
{
attributeArrayCombo->setCurrentIndex(daIndex); // we set the selection but we are NOT triggering anything so we should
}
}
}
}
if(didBlock) { attributeArrayCombo->blockSignals(false); didBlock = false; }// not be triggering an infinte recursion of preflights
}