本文整理汇总了C++中QTreeWidget::headerItem方法的典型用法代码示例。如果您正苦于以下问题:C++ QTreeWidget::headerItem方法的具体用法?C++ QTreeWidget::headerItem怎么用?C++ QTreeWidget::headerItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTreeWidget
的用法示例。
在下文中一共展示了QTreeWidget::headerItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_tree_header_labels (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) {
QTreeWidgetItem *item = tree->headerItem ();
if (Args.Length () && (Args[0]->IsArray ())) {
V8Array array = v8_to_array (Args[0]);
const int Length = array->Length ();
for (int ix = 0; ix < Length; ++ix) {
V8Value value = array->Get (v8::Integer::New (ix));
item->setText (ix, v8_to_qstring (value));
}
}
}
}
return scope.Close (result);
}
示例2: Callback_FileList
void leyrat::Callback_FileList(const char *ip, char**files, int numfiles)
{
Log("[R][%s] Listed files!\n", ip);
//you could also create it dinamically
if(numfiles==1)
return;
QTreeWidget * tree = fbrowser->treeWidget;
while(tree->topLevelItemCount())
{
tree->takeTopLevelItem(0);
}
QTreeWidgetItem* header = tree->headerItem();
const QByteArray headerbytes = header->text(0).toLatin1();
if(strcmp(files[0], "C:/*.*")!=0)
{
QTreeWidgetItem * item = new QTreeWidgetItem();
item->setText(0, "..");
tree->addTopLevelItem(item);
}
for(int i=1; i<numfiles; i++)
{
QTreeWidgetItem * item = new QTreeWidgetItem();
if(!strcmp(files[i], "..")||!strcmp(files[i], "."))
continue;
item->setText(0, files[i]);
tree->addTopLevelItem(item);
}
files[0][strlen(files[0])-3] = 0;
header->setText(0, files[0]);
}