本文整理汇总了C++中QTreeWidget::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ QTreeWidget::clear方法的具体用法?C++ QTreeWidget::clear怎么用?C++ QTreeWidget::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTreeWidget
的用法示例。
在下文中一共展示了QTreeWidget::clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: INIT_KERNEL
void TREE_SECIM_KERNEL::INIT_KERNEL ( QObject * parent,ADAK_SQL * database )
{
Q_UNUSED ( parent );
m_secilen_check_box_column = -1;
if (m_is_multi_row EQ true) {
m_secilen_check_box_column = m_column_headers.size() - 1;
}
QVBoxLayout * vertical_layout = new QVBoxLayout(this);
QTreeWidget * widget = new QTreeWidget;
widget->clear();
REGISTER_TREE_WIDGET(widget);
m_tree_widget->setHeaderLabels(m_column_headers);
widget->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
setLayout(vertical_layout);
resize(p_width, p_height);
SET_ADAK_WINDOW_DEFAULTS(this);
SET_DB_CONN ( database );
FILL_TREE_TABLE();
vertical_layout->addWidget ( m_tree_widget );
vertical_layout->addLayout ( p_h_box_layout );
SET_TREE_WIDGET_DEFAULTS();
}
示例2: reloadGui
void PListEditorWidget::reloadGui(void )
{
QTreeWidget* tree = m_ui.plistTree;
tree->clear();
QTreeWidgetItem* rootNode = NULL;
if (m_currentPlist)
{
// Add information
if (m_currentPlist->GetType() == PLIST_ARRAY)
{
rootNode = generateArrayItem (m_currentPlist);
rootNode->setText (NameColumn, "Root");
}
else if (m_currentPlist->GetType() == PLIST_DICT)
{
rootNode = generateDictionaryItem (m_currentPlist);
rootNode->setText (NameColumn, "Root");
}
}
if (rootNode)
tree->addTopLevelItem(rootNode);
tree->expandAll();
for (int x=0; x < tree->columnCount(); ++x)
tree->resizeColumnToContents(x);
}
示例3: on_extractBtn_clicked
void MainWindow::on_extractBtn_clicked()
{
QString msg = ui->inputTxt->text();
if (msg.isEmpty())
return;
isoExtract->process(msg);
QTreeWidget* tree = ui->resultTree;
tree->clear();
QTreeWidgetItem *parentItem = new QTreeWidgetItem(tree,QStringList(isoExtract->msgType));
QList<QTreeWidgetItem *> items;
QMap<int, IsoField*> isoMsgMap = isoExtract->isoMessage;
QMapIterator<int, IsoField*> i(isoMsgMap);
while (i.hasNext()) {
i.next();
QStringList bitmsg;
bitmsg << QString("Bit %1").arg(i.key()) << i.value()->lengthType << i.value()->value;
items.append(new QTreeWidgetItem((QTreeWidget*)0, bitmsg));
}
parentItem->addChildren(items);
tree->expandItem(parentItem);
// tree->setSelectionMode(QAbstractItemView::ExtendedSelection);
}
示例4: loadCircle
void CreateCircleDialog::loadCircle(uint32_t token)
{
#ifdef DEBUG_CREATE_CIRCLE_DIALOG
std::cerr << "CreateCircleDialog::loadCircle(" << token << ")";
std::cerr << std::endl;
#endif
QTreeWidget *tree = ui.treeWidget_membership;
if (mClearList) tree->clear();
std::vector<RsGxsCircleGroup> groups;
if (!rsGxsCircles->getGroupData(token, groups)) {
std::cerr << "CreateCircleDialog::loadCircle() Error getting GroupData";
std::cerr << std::endl;
return;
}
if (groups.size() != 1) {
std::cerr << "CreateCircleDialog::loadCircle() Error Group.size() != 1";
std::cerr << std::endl;
return;
}
mCircleGroup = groups[0];
#ifdef DEBUG_CREATE_CIRCLE_DIALOG
std::cerr << "CreateCircleDialog::loadCircle() LoadedGroup.meta: " << mCircleGroup.mMeta << std::endl;
#endif
updateCircleGUI();
}
示例5: updateMarksTree
void VVimIndicator::updateMarksTree(QWidget *p_widget)
{
QTreeWidget *markTree = dynamic_cast<QTreeWidget *>(p_widget);
if (!m_vim) {
markTree->clear();
return;
}
const QMap<QChar, VVim::Mark> &marks = m_vim->getMarks().getMarks();
fillTreeItemsWithMarks(markTree, marks);
}
示例6: updateRegistersTree
void VVimIndicator::updateRegistersTree(QWidget *p_widget)
{
QTreeWidget *regTree = dynamic_cast<QTreeWidget *>(p_widget);
if (!m_vim) {
regTree->clear();
return;
}
const QMap<QChar, VVim::Register> ®s = m_vim->getRegisters();
fillTreeItemsWithRegisters(regTree, regs);
}
示例7: load
void ImporterWizard::load(ObjImporter::SceneInfo& si)
{
QTreeWidget* t = m_ui->tree;
t->clear();
QList<QTreeWidgetItem*> items;
m_objects = new QTreeWidgetItem(t, QStringList() << "Objects");
m_models = new QTreeWidgetItem(t, QStringList() << "Models");
m_animations = new QTreeWidgetItem(t, QStringList() << "Animations");
m_cameras = new QTreeWidgetItem(t, QStringList() << "Cameras");
m_lights = new QTreeWidgetItem(t, QStringList() << "Lights");
m_materials = new QTreeWidgetItem(t, QStringList() << "Materials");
m_textures = new QTreeWidgetItem(t, QStringList() << "Textures");
items << m_objects << m_models << m_animations << m_cameras << m_lights << m_materials << m_textures;
t->addTopLevelItems(items);
QMap<QString, QString>::const_iterator it;
for (it = si.objects.begin(); it != si.objects.end(); ++it) {
newItem(m_objects, it);
newItem(m_models, it);
}
for (it = si.animations.begin(); it != si.animations.end(); ++it) {
QTreeWidgetItem* x = newItem(m_animations, it);
x->setCheckState(0, Qt::Unchecked);
x->setDisabled(true);
}
for (it = si.cameras.begin(); it != si.cameras.end(); ++it) {
QTreeWidgetItem* x = newItem(m_animations, it);
x->setCheckState(0, Qt::Unchecked);
x->setDisabled(true);
}
for (it = si.lights.begin(); it != si.lights.end(); ++it) {
QTreeWidgetItem* x = newItem(m_lights, it);
x->setCheckState(0, Qt::Unchecked);
x->setDisabled(true);
}
for (it = si.materials.begin(); it != si.materials.end(); ++it) {
newItem(m_materials, it);
}
for (it = si.textures.begin(); it != si.textures.end(); ++it) {
newItem(m_textures, it);
}
foreach (QTreeWidgetItem* i, items) {
i->setFirstColumnSpanned(true);
i->setExpanded(true);
if (i->childCount() == 0) i->setDisabled(true);
}
示例8: sortItems
void VAttachmentList::sortItems()
{
const QVector<VAttachment> &attas = m_file->getAttachments();
if (attas.size() < 2) {
return;
}
VSortDialog dialog(tr("Sort Attachments"),
tr("Sort attachments of note <span style=\"%1\">%2</span> "
"in the configuration file.")
.arg(g_config->c_dataTextStyle)
.arg(m_file->getName()),
g_mainWin);
QTreeWidget *tree = dialog.getTreeWidget();
tree->clear();
tree->setColumnCount(1);
QStringList headers(tr("Name"));
tree->setHeaderLabels(headers);
for (int i = 0; i < attas.size(); ++i) {
QTreeWidgetItem *item = new QTreeWidgetItem(tree, QStringList(attas[i].m_name));
item->setData(0, Qt::UserRole, i);
}
dialog.treeUpdated();
if (dialog.exec()) {
QVector<QVariant> data = dialog.getSortedData();
Q_ASSERT(data.size() == attas.size());
QVector<int> sortedIdx(data.size(), -1);
for (int i = 0; i < data.size(); ++i) {
sortedIdx[i] = data[i].toInt();
}
if (!m_file->sortAttachments(sortedIdx)) {
VUtils::showMessage(QMessageBox::Warning,
tr("Warning"),
tr("Fail to sort attachments of note <span style=\"%1\">%2</span>.")
.arg(g_config->c_dataTextStyle)
.arg(m_file->getName()),
"",
QMessageBox::Ok,
QMessageBox::Ok,
this);
}
}
}
示例9:
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_tree_clear (const v8::Arguments &Args) {
v8::HandleScope scope;
V8Value result = v8::Undefined ();
JsModuleUiV8QtBasic *self = _to_self (Args);
if (self) {
QTreeWidget *tree = self->v8_to_qobject<QTreeWidget> (Args.This ());
if (tree) {
tree->clear ();
}
}
return scope.Close (result);
}
示例10: updateContainerTree
void Box::updateContainerTree(QTreeWidget & qt){
qt.clear();
QTreeWidgetItem* item=new QTreeWidgetItem();
item->setIcon(0, QIcon(QString::fromUtf8(":/ico/box.png")));
item->setText(0, (std::string("Box ")+to_string(this)).c_str());
QTreeWidgetItem* itemWidth=new QTreeWidgetItem(item);
itemWidth->setText(0, (std::string("Width : ")+to_string(getWidth())).c_str());
itemWidth->setIcon(0, QIcon(QString::fromUtf8(":/ico/axis.png")));
QTreeWidgetItem* itemHeight=new QTreeWidgetItem(item);
itemHeight->setText(0, (std::string("Height : ")+to_string(getHeight())).c_str());
itemHeight->setIcon(0, QIcon(QString::fromUtf8(":/ico/axis.png")));
QTreeWidgetItem* itemDepth=new QTreeWidgetItem(item);
itemDepth->setText(0, (std::string("Depth : ")+to_string(getDepth())).c_str());
itemDepth->setIcon(0, QIcon(QString::fromUtf8(":/ico/axis.png")));
QTreeWidgetItem* itemNCells=new QTreeWidgetItem(item);
itemNCells->setText(0, (std::string("Cells : ")+to_string(cells.size())).c_str());
itemNCells->setIcon(0, QIcon(QString::fromUtf8(":/ico/cells.gif")));
qt.insertTopLevelItem(0,item);
}
示例11: QWidget
QWidget *PluginAboutPage::createPage(QWidget *parent)
{
if (!m_Spec)
return new QWidget(parent);
QWidget *w = new QWidget(parent);
QVBoxLayout *layout = new QVBoxLayout(w);
layout->setSpacing(0);
layout->setMargin(0);
QTreeWidget *tree = new QTreeWidget(w);
tree->header()->hide();
layout->addWidget(tree);
QLabel *lbl = new QLabel(w);
lbl->setText(tkTr(Trans::Constants::DESCRIPTION));
layout->addWidget(lbl);
QTextBrowser *tb = new QTextBrowser(w);
layout->addWidget(tb);
// popuplate tree
tree->clear();
QFont f;
f.setBold(true);
QTreeWidgetItem *i = 0;
i = new QTreeWidgetItem(tree, QStringList() << tkTr(Trans::Constants::INFORMATION));
i->setFont(0,f);
new QTreeWidgetItem(i, QStringList() << tkTr(Trans::Constants::VERSION) + " " + m_Spec->version() );
if (Utils::isDebugWithoutInstallCompilation()) {
new QTreeWidgetItem( i, QStringList() << tkTr(Trans::Constants::BUILD_DEBUG) + " - no install");
} else {
new QTreeWidgetItem( i, QStringList() << tkTr(Trans::Constants::BUILD_RELEASE) );
}
new QTreeWidgetItem(i, QStringList() << "License: " + m_Spec->license());
tree->expandAll();
// populate textbrowser
tb->setPlainText(m_Spec->description());
return w;
}
示例12: item
// Slot.
void
TransitionEditorWindow::updateEquationsTree()
{
if (model_ == nullptr) return;
QTreeWidget* tree = ui_->equationsTree;
tree->clear();
for (const auto& group : model_->equationGroupList()) {
std::unique_ptr<QTreeWidgetItem> item(new QTreeWidgetItem);
item->setText(0, group.name.c_str());
item->setFlags(Qt::ItemIsEnabled);
for (const auto& equation : group.equationList) {
std::unique_ptr<QTreeWidgetItem> childItem(new QTreeWidgetItem);
childItem->setText(0, equation->name().c_str());
childItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
item->addChild(childItem.release());
}
tree->addTopLevelItem(item.release());
}
tree->expandAll();
}
示例13: insertPeers
/* get the list of peers from the RsIface. */
void PeersDialog::insertPeers()
{
std::list<std::string> peers;
std::list<std::string>::iterator it;
if (!rsPeers)
{
/* not ready yet! */
return;
}
rsPeers->getFriendList(peers);
/* get a link to the table */
QTreeWidget *peerWidget = ui.peertreeWidget;
QTreeWidgetItem *oldSelect = getCurrentPeer();
QTreeWidgetItem *newSelect = NULL;
time_t now = time(NULL);
std::string oldId;
if (oldSelect)
{
oldId = (oldSelect -> text(7)).toStdString();
}
/* remove old items ??? */
peerWidget->clear();
peerWidget->setColumnCount(3);
QList<QTreeWidgetItem *> items;
for(it = peers.begin(); it != peers.end(); it++)
{
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(*it, detail))
{
continue; /* BAD */
}
/* make a widget per friend */
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
/* add all the labels */
/* First 5 (1-5) Key Items */
/* () Status Icon */
item -> setText(0, "");
/* (0) Status */
QString status = QString::fromStdString(RsPeerStateString(detail.state));
/* Append additional status info from status service */
StatusInfo statusInfo;
if ((rsStatus) && (rsStatus->getStatus(*it, statusInfo)))
{
status.append(QString::fromStdString("/" + RsStatusString(statusInfo.status)));
}
//item -> setText(1, status);
item -> setText(1, QString::fromStdString(detail.autoconnect));
item -> setTextAlignment(1, Qt::AlignCenter | Qt::AlignVCenter );
/* (1) Person */
item -> setText(2, QString::fromStdString(detail.name));
/* (2) Auto Connect */
//item -> setText(3, QString::fromStdString(detail.autoconnect));
item -> setText(3, status);
/* (3) Trust Level */
item -> setText(4,QString::fromStdString(
RsPeerTrustString(detail.trustLvl)));
/* (4) Peer Address */
{
std::ostringstream out;
out << detail.localAddr << ":";
out << detail.localPort << "/";
out << detail.extAddr << ":";
out << detail.extPort;
item -> setText(5, QString::fromStdString(out.str()));
}
/* less important ones */
/* () Last Contact */
item -> setText(6,QString::fromStdString(
RsPeerLastConnectString(now - detail.lastConnect)));
/* () Org */
//item -> setText(7, QString::fromStdString(detail.org));
/* () Location */
//item -> setText(8, QString::fromStdString(detail.location));
/* () Email */
//item -> setText(9, QString::fromStdString(detail.email));
/* Hidden ones: RsCertId */
{
item -> setText(7, QString::fromStdString(detail.id));
if ((oldSelect) && (oldId == detail.id))
{
//.........这里部分代码省略.........
示例14: insertIdList
void IdDialog::insertIdList(uint32_t token)
{
QTreeWidget *tree = ui.treeWidget_IdList;
tree->clear();
std::list<std::string> ids;
std::list<std::string>::iterator it;
bool acceptAll = ui.radioButton_ListAll->isChecked();
bool acceptPseudo = ui.radioButton_ListPseudo->isChecked();
bool acceptYourself = ui.radioButton_ListYourself->isChecked();
bool acceptFriends = ui.radioButton_ListFriends->isChecked();
bool acceptOthers = ui.radioButton_ListOthers->isChecked();
//rsIdentity->getIdentityList(ids);
//for(it = ids.begin(); it != ids.end(); it++)
//{
RsIdGroup data;
while(rsIdentity->getGroupData(token, data))
{
/* do filtering */
bool ok = false;
if (acceptAll)
{
ok = true;
}
else if (data.mIdType & RSID_TYPE_PSEUDONYM)
{
if (acceptPseudo)
{
ok = true;
}
if ((data.mIdType & RSID_RELATION_YOURSELF) && (acceptYourself))
{
ok = true;
}
}
else
{
if (data.mIdType & RSID_RELATION_YOURSELF)
{
if (acceptYourself)
{
ok = true;
}
}
else if (data.mIdType & (RSID_RELATION_FRIEND | RSID_RELATION_FOF))
{
if (acceptFriends)
{
ok = true;
}
}
else
{
if (acceptOthers)
{
ok = true;
}
}
}
if (!ok)
{
continue;
}
QTreeWidgetItem *item = new QTreeWidgetItem();
//item->setText(RSID_COL_NICKNAME, QString::fromStdString(data.mNickname));
//item->setText(RSID_COL_KEYID, QString::fromStdString(data.mKeyId));
item->setText(RSID_COL_NICKNAME, QString::fromStdString(data.mMeta.mGroupName));
item->setText(RSID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId));
item->setText(RSID_COL_IDTYPE, QString::fromStdString(rsIdTypeToString(data.mIdType)));
tree->addTopLevelItem(item);
}
// fix up buttons.
updateSelection();
}
示例15: updateLinks
//.........这里部分代码省略.........
QString commentText;
QString peerScore;
if (cit->score > 1)
{
peerScore = "[+2] ";
child -> setIcon(0,(QIcon(IMAGE_GREAT)));
item -> setIcon(0,(QIcon(IMAGE_GREAT)));
//peerScore = "[+2 Great Link] ";
}
else if (cit->score == 1)
{
peerScore = "[+1] ";
child -> setIcon(0,(QIcon(IMAGE_GOOD)));
item -> setIcon(0,(QIcon(IMAGE_GOOD)));
//peerScore = "[+1 Good] ";
}
else if (cit->score == 0)
{
peerScore = "[+0] ";
child -> setIcon(0,(QIcon(IMAGE_OK)));
item -> setIcon(0,(QIcon(IMAGE_OK)));
//peerScore = "[+0 Okay] ";
}
else if (cit->score == -1)
{
peerScore = "[-1] ";
child -> setIcon(0,(QIcon(IMAGE_SUX)));
item -> setIcon(0,(QIcon(IMAGE_SUX)));
//peerScore = "[-1 Not Worth It] ";
}
else //if (cit->score < -1)
{
peerScore = "[-2 BAD] ";
child -> setIcon(0,(QIcon(IMAGE_BADLINK)));
item -> setIcon(0,(QIcon(IMAGE_BADLINK)));
//peerScore = "[-2 BAD Link] ";
}
/* (0) Comment */
if (cit->comment != L"")
{
commentText = peerScore + QString::fromStdWString(cit->comment);
}
else
{
commentText = peerScore + "No Comment";
}
child -> setText(0, commentText);
/* (2) Peer / Date */
{
QDateTime qtime;
qtime.setTime_t(cit->timestamp);
QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss");
QString peerLabel = QString::fromStdString(mPeers->getPeerName(cit->id));
if (peerLabel == "")
{
peerLabel = "<";
peerLabel += QString::fromStdString(cit->id);
peerLabel += ">";
}
peerLabel += " ";
peerLabel += timestamp;
child -> setText(2, peerLabel);
}
/* (4) Id */
child -> setText(4, QString::fromStdString(cit->id));
if (i % 2 == 1)
{
/* set to light gray background */
child->setBackground(0,QBrush(Qt::lightGray));
child->setBackground(1,QBrush(Qt::lightGray));
child->setBackground(2,QBrush(Qt::lightGray));
}
/* push to items */
item->addChild(child);
}
/* add to the list */
items.append(item);
}
/* remove old items */
linkWidget->clear();
linkWidget->setColumnCount(3);
/* add the items in! */
linkWidget->insertTopLevelItems(0, items);
linkWidget->update(); /* update display */
}