本文整理汇总了C++中QTreeWidgetItem::setHidden方法的典型用法代码示例。如果您正苦于以下问题:C++ QTreeWidgetItem::setHidden方法的具体用法?C++ QTreeWidgetItem::setHidden怎么用?C++ QTreeWidgetItem::setHidden使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTreeWidgetItem
的用法示例。
在下文中一共展示了QTreeWidgetItem::setHidden方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateResultInDataPackTest
void MainWindow::updateResultInDataPackTest(struct testResult *tRes, int com)
{
QTreeWidgetItem *round = ui->treeWidget->topLevelItem(com-1)->child(0);
QTreeWidgetItem *txlen = ui->treeWidget->topLevelItem(com-1)->child(1);
QTreeWidgetItem *rxlen = ui->treeWidget->topLevelItem(com-1)->child(2);
QTreeWidgetItem *err = ui->treeWidget->topLevelItem(com-1)->child(3);
QTreeWidgetItem *ecerr = ui->treeWidget->topLevelItem(com-1)->child(4);
QTreeWidgetItem *mctrl = ui->treeWidget->topLevelItem(com-1)->child(6);
if(txlen->isHidden()){
txlen->setHidden(false);
}
if(rxlen->isHidden()){
rxlen->setHidden(false);
}
if(err->isHidden()){
err->setHidden(false);
}
if(ecerr->isHidden()){
ecerr->setHidden(false);
}
if(!mctrl->isHidden()){
mctrl->setHidden(true);
}
round->setText(1, QString::number(tRes->round));
txlen->setText(1, QString::number(tRes->txlen));
rxlen->setText(1, QString::number(tRes->rxlen));
err->setText(1, QString::number(tRes->err));
ecerr->setText(1, QString::number(tRes->ecerr));
}
示例2: filter
bool CommandMappings::filter(const QString &f, const QTreeWidgetItem *item)
{
if (QTreeWidgetItem *parent = item->parent()) {
if (parent->text(0).contains(f, Qt::CaseInsensitive))
return false;
}
if (item->childCount() == 0) {
if (f.isEmpty())
return false;
for (int i = 0; i < item->columnCount(); ++i) {
if (item->text(i).contains(f, Qt::CaseInsensitive))
return false;
}
return true;
}
bool found = false;
for (int i = 0; i < item->childCount(); ++i) {
QTreeWidgetItem *citem = item->child(i);
if (filter(f, citem)) {
citem->setHidden(true);
} else {
citem->setHidden(false);
found = true;
}
}
return !found;
}
示例3: QTreeWidgetItem
NodeCurveEditorContext::NodeCurveEditorContext(QTreeWidget* tree,
CurveWidget* curveWidget,
const boost::shared_ptr<NodeGui> &node)
: _node(node)
, _nodeElements()
, _nameItem(0)
{
QTreeWidgetItem* nameItem = new QTreeWidgetItem(tree);
nameItem->setText( 0,_node->getNode()->getName().c_str() );
QObject::connect( node->getNode().get(),SIGNAL( nameChanged(QString) ),this,SLOT( onNameChanged(QString) ) );
const std::map<boost::shared_ptr<KnobI>,KnobGui*> & knobs = node->getKnobs();
bool hasAtLeast1KnobWithACurveShown = false;
for (std::map<boost::shared_ptr<KnobI>,KnobGui*>::const_iterator it = knobs.begin(); it != knobs.end(); ++it) {
createElementsForKnob(nameItem, it->second,boost::shared_ptr<KnobI>() ,
curveWidget, tree,boost::shared_ptr<RotoContext>(), _nodeElements, &hasAtLeast1KnobWithACurveShown);
}
if (_nodeElements.size() > 0) {
NodeCurveEditorElement* elem = new NodeCurveEditorElement(tree,curveWidget,(KnobGui*)NULL,-1,
nameItem,(CurveGui*)NULL);
_nodeElements.push_back(elem);
if (!hasAtLeast1KnobWithACurveShown) {
nameItem->setHidden(true);
}
} else {
nameItem->setHidden(true);
}
_nameItem = nameItem;
}
示例4: on_removeButton_clicked
void InstrumentWizard::on_removeButton_clicked()
{
QList<QTreeWidgetItem*> wi = partiturList->selectedItems();
if (wi.isEmpty())
return;
QTreeWidgetItem* item = wi.front();
QTreeWidgetItem* parent = item->parent();
if (parent) {
if (((StaffListItem*)item)->op == ITEM_ADD) {
if (parent->childCount() == 1) {
partiturList->takeTopLevelItem(partiturList->indexOfTopLevelItem(parent));
delete parent;
}
else {
parent->takeChild(parent->indexOfChild(item));
delete item;
}
}
else {
((StaffListItem*)item)->op = ITEM_DELETE;
item->setHidden(true);
}
}
else {
if (((PartListItem*)item)->op == ITEM_ADD)
delete item;
else {
((PartListItem*)item)->op = ITEM_DELETE;
item->setHidden(true);
}
}
partiturList->clearSelection();
emit completeChanged(partiturList->topLevelItemCount() > 0);
}
示例5: filterItems
bool FileBrowser::filterItems(QTreeWidgetItem * item, const QString & filter )
{
const bool show_all = filter.isEmpty();
bool matched = false;
for( int i = 0; i < item->childCount(); ++i )
{
QTreeWidgetItem * it = item->child( i );
bool cm = false; // whether current item matched
// show all items if filter is empty
if( show_all )
{
it->setHidden( false );
if( it->childCount() )
{
filterItems( it, filter );
}
}
// is directory?
else if( it->childCount() )
{
// matches filter?
if( it->text( 0 ).
contains( filter, Qt::CaseInsensitive ) )
{
// yes, then show everything below
it->setHidden( false );
filterItems( it, QString::null );
cm = true;
}
else
{
// only show if item below matches filter
cm = filterItems( it, filter );
it->setHidden( !cm );
}
}
// a standard item (i.e. no file or directory item?)
else if( it->type() == QTreeWidgetItem::Type )
{
// hide in every case when filtering
it->setHidden( true );
}
else
{
// file matches filter?
cm = it->text( 0 ).
contains( filter, Qt::CaseInsensitive );
it->setHidden( !cm );
}
if( cm )
{
matched = true;
}
}
return matched;
}
示例6: on_pushButton_clicked
void VideoEditorWidget::on_pushButton_clicked()
{
bool flag=0,ok;
settree_show();
int time = ui->timelabel->text().toInt(&ok,10);
for(int j=0;j<videocount+imagecount;j++)
{
QTreeWidgetItem *item = ui->treeWidget->topLevelItem(j);
for (int i =0;i<item->childCount();i++)
{
QTreeWidgetItem *item_child = item->child(i);
QString list ;
bool check_time =check_item_time(item_child,time);
if (check_time==true)
{
item->setHidden(false);
flag = 1;
item_child->setHidden(false);
list = "in if";
qDebug()<<list<<"\n";
}
else
{
item_child->setHidden(true);
if (flag==0)
item->setHidden(true);
list = "in else";
qDebug()<<list<<"\n";
}
// list = item_child->toolTip(1)+item_child->toolTip(0);
// qDebug()<<list<<"\n";
}
flag = 0;
}
/* while (item->child(i)) {
//if ((*it)->toolTip(1).toInt(&ok,10) <= time)
ui->image_view->setText(ui->image_view->text()+","+(*it)->toolTip(1));
//ui->image_view->setText(ui->image_view->text()+","+(*it)->toolTip(0));
//(*it)->setHidden(false);
// else
//(*it)->setHidden(true);
// ROS_ERROR("more");
it++;
}*/
}
示例7: addError
void KateBuildView::addError(const QString &filename, const QString &line,
const QString &column, const QString &message)
{
bool isError=false;
bool isWarning=false;
QTreeWidgetItem* item = new QTreeWidgetItem(m_buildUi.errTreeWidget);
item->setBackground(1, Qt::gray);
// The strings are twice in case kate is translated but not make.
if (message.contains(QStringLiteral("error")) ||
message.contains(i18nc("The same word as 'make' uses to mark an error.","error")) ||
message.contains(QStringLiteral("undefined reference")) ||
message.contains(i18nc("The same word as 'ld' uses to mark an ...","undefined reference"))
)
{
isError=true;
item->setForeground(1, Qt::red);
m_numErrors++;
item->setHidden(false);
}
if (message.contains(QStringLiteral("warning")) ||
message.contains(i18nc("The same word as 'make' uses to mark a warning.","warning"))
)
{
isWarning=true;
item->setForeground(1, Qt::yellow);
m_numWarnings++;
item->setHidden(m_buildUi.displayModeSlider->value() > 2);
}
item->setTextAlignment(1, Qt::AlignRight);
// visible text
//remove path from visible file name
QFileInfo file(filename);
item->setText(0, file.fileName());
item->setText(1, line);
item->setText(2, message.trimmed());
// used to read from when activating an item
item->setData(0, Qt::UserRole, filename);
item->setData(1, Qt::UserRole, line);
item->setData(2, Qt::UserRole, column);
if ((isError==false) && (isWarning==false)) {
item->setHidden(m_buildUi.displayModeSlider->value() > 1);
}
item->setData(0, IsErrorRole, isError);
item->setData(0, IsWarningRole, isWarning);
// add tooltips in all columns
// The enclosing <qt>...</qt> enables word-wrap for long error messages
item->setData(0, Qt::ToolTipRole, filename);
item->setData(1, Qt::ToolTipRole, QStringLiteral("<qt>%1</qt>").arg(message));
item->setData(2, Qt::ToolTipRole, QStringLiteral("<qt>%1</qt>").arg(message));
}
示例8: filterItems
void DocListPanel::filterItems(const QString& text) {
int n = tree_->topLevelItemCount();
for (int i = 0; i < n; ++i) {
QTreeWidgetItem* item = tree_->topLevelItem(i);
if ( item->text(0).toLower().contains(text.toLower()) ) {
item->setHidden(false);
}
else {
item->setHidden(true);
}
}
}
示例9: makeEmptyTree
void MainWindow::makeEmptyTree(){
ui->treeWidget->clear();
//Set tree widget table headers
ui->treeWidget->setColumnCount(4);
ui->treeWidget->headerItem()->setText(0,"");
ui->treeWidget->headerItem()->setText(1,"Academic Year");
ui->treeWidget->headerItem()->setText(2,"Hours");
ui->treeWidget->headerItem()->setText(3,"Students");
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(1,"0");
item->setText(2,"0");
item->setText(3,"0");
//build headers
QTreeWidgetItem *pme = root2("PME", "0", "0");
pme->addChild(item);
QTreeWidgetItem *ume = root2("UME", "0","0");
QTreeWidgetItem *item2 = new QTreeWidgetItem();
item->setText(1,"0");
item->setText(2,"0");
item->setText(3,"0");
ume->addChild(item2);
QTreeWidgetItem *cme = root2("CME", "0", "0");
QTreeWidgetItem *item3 = new QTreeWidgetItem();
item->setText(1,"0");
item->setText(2,"0");
item->setText(3,"0");
cme->addChild(item3);
QTreeWidgetItem *other = root2("Other", "0", "0");
QTreeWidgetItem *item4 = new QTreeWidgetItem();
item->setText(1,"0");
item->setText(2,"0");
item->setText(3,"0");
other->addChild(item4);
//hide tree
pme->setHidden(true);
cme->setHidden(true);
ume->setHidden(true);
other->setHidden(true);
//generate date ranges
for (int x = 1975; x <= 2015; x ++)
{
ui->comboBox_start->addItem(QString::number(x));
ui->comboBox_end->addItem(QString::number(x));
}
// set default date range
ui->comboBox_start->setCurrentIndex(0);
ui->comboBox_end->setCurrentIndex(ui->comboBox_end->count()-1);
}
示例10: filterItems
bool FileBrowser::filterItems( const QString & filter, QTreeWidgetItem * item )
{
// call with item=NULL to filter the entire tree
bool anyMatched = false;
int numChildren = item ? item->childCount() : m_l->topLevelItemCount();
for( int i = 0; i < numChildren; ++i )
{
QTreeWidgetItem * it = item ? item->child( i ) : m_l->topLevelItem(i);
// is directory?
if( it->childCount() )
{
// matches filter?
if( it->text( 0 ).
contains( filter, Qt::CaseInsensitive ) )
{
// yes, then show everything below
it->setHidden( false );
filterItems( QString::null, it );
anyMatched = true;
}
else
{
// only show if item below matches filter
bool didMatch = filterItems( filter, it );
it->setHidden( !didMatch );
anyMatched = anyMatched || didMatch;
}
}
// a standard item (i.e. no file or directory item?)
else if( it->type() == QTreeWidgetItem::Type )
{
// hide if there's any filter
it->setHidden( !filter.isEmpty() );
}
else
{
// file matches filter?
bool didMatch = it->text( 0 ).
contains( filter, Qt::CaseInsensitive );
it->setHidden( !didMatch );
anyMatched = anyMatched || didMatch;
}
}
return anyMatched;
}
示例11: showPanel
void PanelStack::showPanel(QString const & name, bool show)
{
QTreeWidgetItem * item = panel_map_.value(name, 0);
LASSERT(item, return);
item->setHidden(!show);
}
示例12: filter
void MimetypeViewer::filter(const QString& pattern)
{
QMimeDatabase db;
MimeTypeData mimeData;
for (int i = 0; i < widget.mimetypeTreeWidget->topLevelItemCount(); ++i) {
widget.mimetypeTreeWidget->topLevelItem(i)->setHidden(true);
}
for(QTreeWidgetItem* it : qAsConst(mItemList)) {
mimeData = it->data(0, Qt::UserRole).value<MimeTypeData>();
if (pattern.isEmpty() || mimeData.matches(pattern)) {
const int i = mimeData.name().indexOf(QLatin1Char('/'));
const QString mediaType = mimeData.name().left(i);
QTreeWidgetItem* groupItem = mGroupItems.value(mediaType);
Q_ASSERT(groupItem);
if (groupItem) {
groupItem->setHidden(false);
it->setHidden(false);
}
} else {
it->setHidden(true);
}
}
}
示例13: onGalaGVcalcedNearest
void NearSys::onGalaGVcalcedNearest(const QList<DistanzPair> &list)
{
ui->treeWidget->clear();
mItems.clear();
QStringList l;
for (int var = 0; var < 50; ++var) {
const DistanzPair &pair = list.at(var);
int d = pair.mDistanz;
d=d/5;
int h =0;
if(d>59)
h = d/60;
QString t = QString::number(h)+"h:"+QString::number(d%60);
l << t << pair.mESystem.namen.join(",") << (pair.mESystem.isWerft?"W":"") << (pair.mESystem.isChecked?"true":"false") << pair.mESystem.id ;
QTreeWidgetItem * item = new QTreeWidgetItem(l);
item->setData(0,Qt::UserRole,pair.mESystem.planiID);
item->setData(0,Qt::UserRole+1,pair.mESystem.isChecked);
mItems.append(item);
ui->treeWidget->addTopLevelItem(item);
if(!ui->checkBox->isChecked() && pair.mESystem.isChecked)
item->setHidden(true);
l.clear();
}
for (int var = 0; var < ui->treeWidget->columnCount(); ++var) {
ui->treeWidget->resizeColumnToContents(var);
}
}
示例14: filterString
void TreeWidget::filterString(QString string)
{
expandAll();
QList<QTreeWidgetItem*> _allItems = allItems();
if (string.isEmpty()) {
foreach(QTreeWidgetItem * item, _allItems)
item->setHidden(false);
for (int i = 0; i < topLevelItemCount(); i++) {
topLevelItem(i)->setHidden(false);
}
if (m_showMode == ItemsCollapsed) {
collapseAll();
}
}
else {
foreach(QTreeWidgetItem * item, _allItems) {
item->setHidden(!item->text(0).contains(string, Qt::CaseInsensitive));
item->setExpanded(true);
}
for (int i = 0; i < topLevelItemCount(); i++) {
topLevelItem(i)->setHidden(false);
}
QTreeWidgetItem* firstItem = topLevelItem(0);
QTreeWidgetItem* belowItem = itemBelow(firstItem);
int topLvlIndex = 0;
while (firstItem) {
if (firstItem->text(0).contains(string, Qt::CaseInsensitive)) {
firstItem->setHidden(false);
}
else if (!firstItem->parent() && !belowItem) {
firstItem->setHidden(true);
}
else if (!belowItem) {
break;
}
else if (!firstItem->parent() && !belowItem->parent()) {
firstItem->setHidden(true);
}
topLvlIndex++;
firstItem = topLevelItem(topLvlIndex);
belowItem = itemBelow(firstItem);
}
}
示例15: getModel
void
NodeAnim::refreshVisibility()
{
AnimationModulePtr animModule = getModel();
QTreeWidgetItem *nodeItem = getTreeItem();
bool showNode = false;
int nChildren = nodeItem->childCount();
// Refresh children, which will recursively refresh their children
for (int i = 0; i < nChildren; ++i) {
QTreeWidgetItem* child = nodeItem->child(i);
AnimatedItemTypeEnum type;
KnobAnimPtr isKnob;
TableItemAnimPtr isTableItem;
NodeAnimPtr isNodeItem;
ViewSetSpec view;
DimSpec dim;
bool found = animModule->findItem(child, &type, &isKnob, &isTableItem, &isNodeItem, &view, &dim);
if (!found) {
continue;
}
if (isTableItem) {
isTableItem->refreshVisibilityConditional(false /*refreshParent*/);
} else if (isNodeItem) {
isNodeItem->refreshVisibility();
} else if (isKnob) {
isKnob->refreshVisibilityConditional(false /*refreshHolder*/);
}
if (!child->isHidden()) {
showNode = true;
}
}
if (!showNode) {
// If so far none of the children should be displayed, still check if the node has a range
if (isRangeDrawingEnabled()) {
showNode = true;
}
}
// If settings panel is not opened and the "Keep in Animation Module" knob is not checked, hide the node.
NodeGuiPtr nodeGui = getNodeGui();
bool keepInAnimationModule = nodeGui->getNode()->isKeepInAnimationModuleButtonDown();
if (!keepInAnimationModule && !nodeGui->isSettingsPanelVisible()) {
showNode = false;
}
refreshFrameRange();
nodeItem->setData(0, QT_ROLE_CONTEXT_IS_ANIMATED, showNode);
nodeItem->setHidden(!showNode);
} // refreshVisibility