本文整理汇总了C++中QListViewItem::setOpen方法的典型用法代码示例。如果您正苦于以下问题:C++ QListViewItem::setOpen方法的具体用法?C++ QListViewItem::setOpen怎么用?C++ QListViewItem::setOpen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListViewItem
的用法示例。
在下文中一共展示了QListViewItem::setOpen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QListViewItem
void OptionTree::
init_Applets()
{
cout << "OptionTree: initializing setup applets\n";
QListViewItem *item;
item = new QListViewItem( w_tree , i18n("File Options") );
item->sortChildItems( 0 , true );
item->setOpen(true);
(void) new QListViewItem( item , i18n("Nmap path") );
(void) new QListViewItem( item , i18n("Logging") );
item = new QListViewItem( w_tree , i18n("Scan Options") );
item->sortChildItems( 0 , true );
item->setOpen(true);
(void) new QListViewItem( item , i18n("Miscellaneous") );
(void) new QListViewItem( item , i18n("Stealth") );
(void) new QListViewItem( item , i18n("Setup decoys") );
(void) new QListViewItem( item , i18n("Setup pings") );
(void) new QListViewItem( item , i18n("Scan type") );
item = new QListViewItem( w_tree , i18n("Recent args") );
item = new QListViewItem( w_tree , i18n("Recent hosts") );
cout << "OptionTree: applet names initialized\n";
}
示例2: setDir
void DirectoryView::setDir( const QString &s )
{
QListViewItemIterator it( this );
++it;
for ( ; it.current(); ++it ) {
it.current()->setOpen( false );
}
QStringList lst( QStringList::split( "/", s ) );
QListViewItem *item = firstChild();
QStringList::Iterator it2 = lst.begin();
for ( ; it2 != lst.end(); ++it2 ) {
while ( item ) {
if ( item->text( 0 ) == *it2 ) {
item->setOpen( true );
break;
}
item = item->itemBelow();
}
}
if ( item ){
setSelected( item, true );
setCurrentItem( item );
}
}
示例3: decode
bool ListViewItemDrag::decode( QDropEvent * event, QListView * parent, QListViewItem * insertPoint, DropRelation dr )
{
QByteArray data = event->encodedData( "qt/listviewitem" );
QListViewItem* itemParent = insertPoint ? insertPoint->parent() : 0;
// Change from sibling (default) to child creation
if ( insertPoint && dr == Child ) {
itemParent = insertPoint;
insertPoint = 0;
}
if ( data.size() ) {
event->accept();
QDataStream stream( data, IO_ReadOnly );
int count = 0;
stream >> count;
for( int i = 0; i < count; i++ ) {
if ( itemParent ) {
insertPoint = new QListViewItem( itemParent, insertPoint );
itemParent->setOpen( TRUE );
} else { // No parent for insertPoint, use QListView
insertPoint = new QListViewItem( parent, insertPoint );
}
stream >> *insertPoint;
}
return TRUE;
}
示例4: formatPropertySet
void formatPropertySet( KTNEFPropertySet *pSet, QListView *lv )
{
formatProperties( pSet->properties(), lv, 0, "prop" );
QListViewItem *item = new QListViewItem( lv, i18n( "TNEF Attributes" ) );
item->setOpen( true );
formatProperties( pSet->attributes(), 0, item, "attr" );
}
示例5: formatProperties
void formatProperties( const QMap<int,KTNEFProperty*>& props, QListView *lv, QListViewItem *item, const QString& prefix )
{
for ( QMap<int,KTNEFProperty*>::ConstIterator it=props.begin(); it!=props.end(); ++it )
{
QListViewItem *newItem = 0;
if ( lv )
newItem = new QListViewItem( lv, ( *it )->keyString() );
else if ( item )
newItem = new QListViewItem( item, ( *it )->keyString() );
else
{
kdWarning() << "formatProperties() called with no listview and no item" << endl;
return;
}
QVariant value = ( *it )->value();
if ( value.type() == QVariant::List )
{
newItem->setOpen( true );
newItem->setText( 0, newItem->text( 0 ) + " [" + QString::number( value.asList().count() ) + "]" );
int i = 0;
for ( QValueList<QVariant>::ConstIterator lit=value.listBegin(); lit!=value.listEnd(); ++lit, i++ )
new QListViewItem( newItem, "[" + QString::number( i ) + "]", KTNEFProperty::formatValue( *lit ) );
}
else if ( value.type() == QVariant::DateTime )
newItem->setText( 1, value.asDateTime().toString() );
else
{
newItem->setText( 1, ( *it )->valueString() );
newItem->setText( 2, prefix + "_" + QString::number( it.key() ) );
}
}
}
示例6: refactor
void RefactoringAssistant::refactor( UMLClassifier *obj )
{
clear();
m_umlObjectMap.clear();
m_umlObject = obj;
if (! m_umlObject )
{
return;
}
addClassifier( obj, 0, true, true, true );
QListViewItem *item = firstChild();
item->setOpen(true);
for( item = item->firstChild(); item ; item = item->nextSibling() )
item->setOpen(true);
}
示例7: refresh
void USBViewer::refresh()
{
QIntDict< QListViewItem > new_items;
if(!USBDevice::parse("/proc/bus/usb/devices"))
USBDevice::parseSys("/sys/bus/usb/devices");
int level = 0;
bool found = true;
while(found)
{
found = false;
QPtrListIterator< USBDevice > it(USBDevice::devices());
for(; it.current(); ++it)
if(it.current()->level() == level)
{
Q_UINT32 k = key(*it.current());
if(level == 0)
{
QListViewItem *item = _items.find(k);
if(!item)
{
item = new QListViewItem(_devices, it.current()->product(), QString::number(k));
}
new_items.insert(k, item);
found = true;
}
else
{
QListViewItem *parent = new_items.find(key_parent(*it.current()));
if(parent)
{
QListViewItem *item = _items.find(k);
if(!item)
{
item = new QListViewItem(parent, it.current()->product(), QString::number(k));
}
new_items.insert(k, item);
parent->setOpen(true);
found = true;
}
}
}
++level;
}
// recursive delete all items not in new_items
delete_recursive(_devices->firstChild(), new_items);
_items = new_items;
if(!_devices->selectedItem())
selectionChanged(_devices->firstChild());
}
示例8: addGroup
void RosterBox::addGroup( QString name, bool open )
{
QListViewItem *group = new QListViewItem( this, name, "group", name );
if( open )
group->setPixmap( 0, takePixmap( "group_open" ) );
else
group->setPixmap( 0, takePixmap( "group_closed" ) );
openGroups[ name ] = open;
group->setOpen( open );
groupList.append( group );
}
示例9: fillTree
void NewDevice::fillTree()
{
QListViewItem* parent = NULL;
QListViewItem* newItem = NULL;
QPtrList <DeviceClass> *dl = _app->deviceClassList();
QPixmap pm(PIXMAPS + QString("/dmx.xpm"));
QString config;
bool treeOpen = false;
if (_app->settings()->get("NewDeviceTreeOpen", config) != -1 &&
config == Settings::trueValue())
{
treeOpen = true;
}
else
{
treeOpen = false;
}
m_tree->clear();
for (DeviceClass* dc = dl->first(); dc != NULL; dc = dl->next())
{
bool alreadyAdded = false;
for (QListViewItem* i = m_tree->firstChild();
i != NULL; i = i->nextSibling())
{
if (i->text(0) == dc->manufacturer())
{
alreadyAdded = true;
parent = i;
break;
}
}
if (alreadyAdded == false)
{
parent = new QListViewItem(m_tree, dc->manufacturer());
parent->setOpen(treeOpen);
}
parent->setPixmap(0, QPixmap(PIXMAPS + QString("/global.xpm")));
newItem = new QListViewItem(parent, dc->model());
newItem->setPixmap(0, pm);
newItem->setText(1,dc->type());
}
}
示例10: itemNewSubClicked
void ListViewEditor::itemNewSubClicked()
{
QListViewItem *parent = itemsPreview->currentItem();
QListViewItem *item = 0;
if ( parent ) {
item = new QListViewItem( parent );
parent->setOpen( true );
} else {
item = new QListViewItem( itemsPreview );
}
item->setText( 0, "Subitem" );
itemsPreview->setCurrentItem( item );
itemsPreview->setSelected( item, true );
}
示例11: updateChainView
void CertificateInfoWidgetImpl::updateChainView() {
pathView->clear();
if ( mChain.empty() )
return;
QListViewItem * item = 0;
QValueList<GpgME::Key>::const_iterator it = mChain.begin();
// root item:
if ( (*it).chainID() && qstrcmp( (*it).chainID(), (*it).primaryFingerprint() ) == 0 )
item = new QListViewItem( pathView, Kleo::DN( (*it++).userID(0).id() ).prettyDN() );
else {
item = new QListViewItem( pathView, i18n("Issuer certificate not found ( %1)")
.arg( Kleo::DN( (*it).issuerName() ).prettyDN() ) );
item->setOpen( true ); // Qt bug: doesn't open after setEnabled( false ) :/
item->setEnabled( false );
}
item->setOpen( true );
// subsequent items:
while ( it != mChain.end() ) {
item = new QListViewItem( item, Kleo::DN( (*it++).userID(0).id() ).prettyDN() );
item->setOpen( true );
}
}
示例12: slotEditToolbar
void ActionConfigDialog::slotEditToolbar()
{
QString toolbarName;
QString toolbarId;
QListViewItem *oldItem;
QListViewItem *item = actionTreeView->currentItem();
if (item->parent())
item = item->parent();
toolbarName = item->text(0);
if ( toolbarName != i18n("All"))
{
emit configureToolbars(toolbarName +" <quanta>");
//update the tree view
KAction *action;
KActionCollection *ac = m_mainWindow->actionCollection();
ToolbarTabWidget *tb = ToolbarTabWidget::ref();
for (int i = 0; i < tb->count(); i++)
{
toolbarName = tb->label(i);
toolbarId = tb->id(i);
ToolbarEntry *p_toolbar = m_toolbarList[toolbarId];
if (p_toolbar)
{
oldItem = actionTreeView->findItem(toolbarName, 0);
item = new KListViewItem(actionTreeView, oldItem, toolbarName);
item->setOpen(oldItem->isOpen());
delete oldItem;
QDomNode node = p_toolbar->guiClient->domDocument().firstChild().firstChild().firstChild();
while (!node.isNull())
{
if (node.nodeName() == "Action")
{
action = ac->action(node.toElement().attribute("name"));
if (action)
{
oldItem = new KListViewItem(item, oldItem, action->text().replace(QRegExp("\\&(?!\\&)"),""), action->shortcut().toString(), action->name());
oldItem->setPixmap(0, SmallIcon(action->icon()));
}
}
node = node.nextSibling();
}
}
}
actionTreeView->setCurrentItem(allActionsItem);
actionTreeView->setSelected(allActionsItem, true);
}
}
示例13: readConfig
void PageAutoConnect::readConfig()
{
KConfig *conf = kapp->config();
conf->setGroup("AutoConnect");
QStringList servers = conf->readListEntry("Servers");
servers.sort();
QStringList::ConstIterator ser = servers.begin();
for( ; ser != servers.end(); ser++){
QStringList channels = conf->readListEntry(*ser);
QString server = *ser;
QString port = "6667";
QString ssl = QString::null;
QString pass = QString::null;
QRegExp rx("(.+) \\(SSL\\)(.*)");
if(rx.search(server) >= 0){
server = rx.cap(1) + rx.cap(3);
ssl = i18n("SSL");
}
rx.setPattern("(.+) \\(pass: (\\S+)\\)(.*)");
if(rx.search(server) >= 0){
server = rx.cap(1) + rx.cap(3);
pass = rx.cap(2);
}
rx.setPattern("([^: ]+):(\\d+)");
if(rx.search(server) >= 0){
kdDebug(5008) << server << ": Has port:" << rx.cap(2) << endl;
server = rx.cap(1);
port = rx.cap(2);
}
kdDebug(5008) << server << ": Done " << port << " " << ssl << " " << pass << endl;
QListViewItem *s = new QListViewItem(KLVAutoConnect, server, port, pass, ssl);
s->setOpen(TRUE);
channels.sort();
QStringList::ConstIterator chan = channels.begin();
for(; chan != channels.end(); chan++){
QString channel = *chan;
QString key = QString::null;
QRegExp crx("(.+) \\(key: (\\S+)\\)");
if(crx.search(channel) >= 0){
channel = crx.cap(1);
key = crx.cap(2);
}
new QListViewItem(s, channel, key);
}
}
}
示例14: KListView
PlaylistSelection::PlaylistSelection( QWidget* parent, char* name )
: KListView( parent, name )
{
addColumn( i18n("Select Playlists") );
setRootIsDecorated( true );
PlaylistBrowserView* browserTree = PlaylistBrowser::instance()->getListView();
QListViewItem* browserItem = browserTree->firstChild();
//load into the tree the first two items, which is the smart playlist and the playlist
for( int i = 0; i<2; i++ )
{
QListViewItem* newItem = new QListViewItem( this, browserItem->text(0) );
newItem->setPixmap( 0, *browserItem->pixmap(0) );
loadChildren( browserItem, newItem );
newItem->setOpen( true );
browserItem = browserItem->nextSibling();
}
}
示例15: fillTree
void NewDevice::fillTree()
{
QListViewItem* parent = NULL;
QListViewItem* newItem = NULL;
QPtrList <DeviceClass> *dl = _app->deviceClassList();
QString path;
_app->settings()->get("SystemPath", path);
path += QString("/") + PIXMAPPATH;
QPixmap pm(path + QString("/dmx.xpm"));
QString tree;
_app->settings()->get("NewDeviceTreeOpen", tree);
bool treeOpen = (tree == Settings::trueValue()) ? true : false;
m_tree->clear();
for (DeviceClass* dc = dl->first(); dc != NULL; dc = dl->next())
{
bool alreadyAdded = false;
for (QListViewItem* i = m_tree->firstChild();
i != NULL; i = i->nextSibling())
{
if (i->text(0) == dc->manufacturer())
{
alreadyAdded = true;
parent = i;
break;
}
}
if (alreadyAdded == false)
{
parent = new QListViewItem(m_tree, dc->manufacturer());
parent->setOpen(treeOpen);
}
parent->setPixmap(0, QPixmap(path + QString("/global.xpm")));
newItem = new QListViewItem(parent, dc->model());
newItem->setPixmap(0, pm);
newItem->setText(1,dc->type());
}
}