当前位置: 首页>>代码示例>>C++>>正文


C++ QListViewItem::setSelected方法代码示例

本文整理汇总了C++中QListViewItem::setSelected方法的典型用法代码示例。如果您正苦于以下问题:C++ QListViewItem::setSelected方法的具体用法?C++ QListViewItem::setSelected怎么用?C++ QListViewItem::setSelected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QListViewItem的用法示例。


在下文中一共展示了QListViewItem::setSelected方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ManagedFileInfo

void
FileManager::addFile(const KURL& url, const KURL& newURL)
{
    if (getMFI(newURL) == 0)
    {
        // Add new file to list of managed files.
        ManagedFileInfo* mfi = new ManagedFileInfo(this, url);
        files.push_back(mfi);
        // First show the file with the old name so it get's loaded.
        showInEditor(url);
        mfi->saveAs(newURL);

        // Insert the file into the browser and update the directory hierachy if
        // necessary.
        updateFileBrowser();
        QListViewItem* lvi = mfi->getBrowserEntry();
        browser->clearSelection();
        browser->setCurrentItem(lvi);
        lvi->setSelected(true);
        browser->ensureItemVisible(lvi);
    }

    // Open new file in editor.
    showInEditor(newURL);
}
开发者ID:taskjuggler,项目名称:TaskJuggler2,代码行数:25,代码来源:FileManager.cpp

示例2: read_set_events

void oprof_start::read_set_events()
{
	string name = get_config_filename(".oprofile/daemonrc");

	ifstream in(name.c_str());

	if (!in) {
		setup_default_event();
		return;
	}

	string str;

	bool one_enabled = false;

	while (getline(in, str)) {
		string const val = split(str, '=');
		string const name = str;

		if (!is_prefix(name, "CHOSEN_EVENTS_"))
			continue;

		one_enabled = true;

		// CHOSEN_EVENTS_#nr=CPU_CLK_UNHALTED:10000:0:1:1
		vector<string> parts = separate_token(val, ':');

		if (parts.size() != 5 && parts.size() != 2) {
			cerr << "invalid configuration file\n";
			// FIXME
			exit(EXIT_FAILURE);
		}

		string ev_name = parts[0];
		event_cfgs[ev_name].count =
			op_lexical_cast<unsigned int>(parts[1]);

		// CPU_CLK_UNHALTED:10000 is also valid
		if (parts.size() == 5) {
			event_cfgs[ev_name].umask =
				op_lexical_cast<unsigned int>(parts[2]);
			event_cfgs[ev_name].user_ring_count =
				op_lexical_cast<unsigned int>(parts[3]);
			event_cfgs[ev_name].os_ring_count =
				op_lexical_cast<unsigned int>(parts[4]);
		} else {
			event_cfgs[ev_name].umask = 0;
			event_cfgs[ev_name].user_ring_count = 1;
			event_cfgs[ev_name].os_ring_count = 1;
		}

		QListViewItem * item = findItem(events_list, ev_name.c_str());
		if (item)
			item->setSelected(true);
	}

	// use default event if none set
	if (!one_enabled)
		setup_default_event();
}
开发者ID:OPSF,项目名称:uClinux,代码行数:60,代码来源:oprof_start.cpp

示例3: slotInsertFilesAfterCopying

void ProjectNewLocal::slotInsertFilesAfterCopying(const KURL::List& a_urlList)
{
  KURL::List::ConstIterator it;
  KURL u;
  progressBar->setTotalSteps(a_urlList.count() - 1);
  progressBar->setTextEnabled(true);
  for (it = a_urlList.begin(); it != a_urlList.end(); ++it)
  {
    u = QExtFileInfo::toRelative(*it, baseURL, false);
    if ( !fileList.contains(u))
    {
      fileList.append(u);
      QListViewItem *it = listView->addItem(u, KFileItem(KFileItem::Unknown, KFileItem::Unknown, KURL()));
      if (it)
      {
         it->setSelected(true);
         listView->slotSelectFile(it);
      }
      progressBar->advance(1);
    }
  }
  progressBar->setTotalSteps(1);
  progressBar->setValue(0);
  progressBar->setTextEnabled(false);
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:25,代码来源:projectnewlocal.cpp

示例4: selectViewItem

void TeQtViewsListView::selectViewItem(TeView *view)
{
	if (view == 0)
		return;

	QListViewItem *child = firstChild();
    while (child)
	{
		TeQtViewItem *viewItem = (TeQtViewItem*)child;
		if (viewItem->getView() == view)
		{
			if (viewItem == currentViewItem_)
				break;
			else
			{
				unselectAllItems();
				child->setSelected(true);
				child->repaint();
				currentViewItem_ = viewItem;
				currentThemeItem_ = 0;
				emit itemChanged(child);
				return;
			}
		}
        child = child->nextSibling();
	}
}
开发者ID:Universefei,项目名称:Terralib-analysis,代码行数:27,代码来源:TeQtViewsListView.cpp

示例5: slotInsertFolderAfterCopying

void ProjectNewLocal::slotInsertFolderAfterCopying(const KURL::List& a_urlList)
{
  KURL::List::ConstIterator it;
  KURL dirURL;
  for (it = a_urlList.begin(); it != a_urlList.end(); ++it)
  {
    dirURL = *it;
   // dirURL.adjustPath(1);
    KURL::List files = QExtFileInfo::allFilesRelative(dirURL, "*", this, false);
    progressBar->setTotalSteps(files.count() - 1);
    progressBar->setTextEnabled(true);
    KURL u;
    for (uint i = 0; i < files.count(); i++)
    {
      u = files[i];
      if ( !fileList.contains(u) && u.path() != "." && u.path() != ".." )
      {
        fileList.append(u);
        listView->addItem(u, KFileItem(KFileItem::Unknown, KFileItem::Unknown, KURL()));
        QListViewItem *it = listView->itemByUrl(u);
        if (it)
        {
          it->setSelected(true);
          listView->slotSelectFile(it);
        }
        progressBar->setValue(i);
      }
    }
    //listView->selectAll(false);
    progressBar->setTotalSteps(1);
    progressBar->setValue(0);
    progressBar->setTextEnabled(false);
  }
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:34,代码来源:projectnewlocal.cpp

示例6: slotAddFiles

/** No descriptions */
void ProjectNewLocal::slotAddFiles()
{
  QExtFileInfo::createDir(baseURL, this);
  KURL::List list = KFileDialog::getOpenURLs(
    baseURL.url(),  i18n("*"), this, i18n("Insert Files in Project"));

  if ( !list.isEmpty() )
  {
    KURL u = list.first();

    u = QExtFileInfo::toRelative( u, baseURL, false );

    if ( u.path().startsWith("..") || u.path().startsWith("/"))
    {
      KURLRequesterDlg *urlRequesterDlg = new KURLRequesterDlg( baseURL.prettyURL(), this, "");
      urlRequesterDlg->setCaption(i18n("Files: Copy to Project"));
      urlRequesterDlg->urlRequester()->setMode( KFile::Directory | KFile::ExistingOnly);
      urlRequesterDlg->exec();
      KURL destination = urlRequesterDlg->selectedURL();
      delete urlRequesterDlg;

      if ( !destination.isEmpty())
      {
        CopyTo *dlg = new CopyTo( baseURL);
        connect(dlg, SIGNAL(addFilesToProject(const KURL::List&)),
                     SLOT  (slotInsertFilesAfterCopying(const KURL::List&)));
        connect(dlg, SIGNAL(deleteDialog(CopyTo *)),
                     SLOT  (slotDeleteCopyToDialog(CopyTo *)));
        list = dlg->copy( list, destination );
        return;
      } else
      {
        return;
      }
    }

    progressBar->setTotalSteps(list.count() - 1);
    progressBar->setTextEnabled(true);
    for (uint i = 0; i < list.count(); i++)
    {
       list[i] = QExtFileInfo::toRelative(list[i], baseURL, false);
       if (!fileList.contains(list[i]))
       {
         fileList.append(list[i]);
         QListViewItem *it = listView->addItem(list[i], KFileItem(KFileItem::Unknown, KFileItem::Unknown, KURL()));
         if (it)  it->setSelected(true);
         progressBar->setValue(i);
       }
    }
    progressBar->setTotalSteps(1);
    progressBar->setValue(0);
    progressBar->setTextEnabled(false);
  }
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:55,代码来源:projectnewlocal.cpp

示例7: sort

void popupPublic::sort()
{
        bool reselect=false;
        QListViewItem *current = keysList->firstChild();
        if (current==NULL)
                return;

	if ((untrustedList.find(current->text(2))!=untrustedList.end()) && (!current->text(2).isEmpty())){
                if (current->isSelected()) {
                        current->setSelected(false);
                        reselect=true;
                }
                current->setVisible(false);
		}

        while ( current->nextSibling() ) {
                current = current->nextSibling();
                if ((untrustedList.find(current->text(2))!=untrustedList.end()) && (!current->text(2).isEmpty())) {
                if (current->isSelected()) {
                        current->setSelected(false);
                        reselect=true;
                }
                current->setVisible(false);
		}
        }

	if (reselect || !keysList->currentItem()->isVisible()) {
                QListViewItem *firstvisible;
                firstvisible=keysList->firstChild();
                while (firstvisible->isVisible()!=true) {
                        firstvisible=firstvisible->nextSibling();
                        if (firstvisible==NULL)
                                return;
                }
                keysList->setSelected(firstvisible,true);
		keysList->setCurrentItem(firstvisible);
		keysList->ensureItemVisible(firstvisible);
        }
}
开发者ID:serghei,项目名称:kde3-kdeutils,代码行数:39,代码来源:popuppublic.cpp

示例8: setup_default_event

void oprof_start::setup_default_event()
{
	struct op_default_event_descr descr;
	op_default_event(cpu_type, &descr);

	event_cfgs[descr.name].umask = descr.um;
	event_cfgs[descr.name].count = descr.count;
	event_cfgs[descr.name].user_ring_count = 1;
	event_cfgs[descr.name].os_ring_count = 1;

	QListViewItem * item = findItem(events_list, descr.name);
	if (item)
		item->setSelected(true);
}
开发者ID:OPSF,项目名称:uClinux,代码行数:14,代码来源:oprof_start.cpp

示例9: slotAddAnswer

/** Button insert */
void KControlAddEdit::slotAddAnswer()
{
    if( !_answerText->text().isEmpty() )
    {
        // add new listview item
        QListViewItem *newItem = _currentAnswerItem
                                 ? _currentAnswerItem
                                 : new QListViewItem(_listAnswers,_listAnswers->lastItem());
        newItem->setText(0,_answerText->text());
        newItem->setText(1,_answerValue->currentItem() == 1 ?i18n("True"):i18n("False"));
        newItem->setText(2,QString::number(_answerPoints->value()));

        // reset values
        newItem->setSelected(false);
        resetAnswerValues();
    }
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例10: slotSetFiles

void ProjectNewLocal::slotSetFiles(bool)
{
  if ( checkInsert->isChecked() )
  {
    KURL::List files = projectFiles();
    progressBar->setTotalSteps(files.count() - 1);
    progressBar->setTextEnabled(true);
    for (uint i = 0; i < files.count(); i++)
    {
       if ( !fileList.contains(files[i]))
       {
         fileList.append(files[i]);
         QListViewItem *it = listView->addItem(files[i], KFileItem(KFileItem::Unknown, KFileItem::Unknown, KURL()));
         if (it)  it->setSelected(true);
         progressBar->setValue(i);
       }
    }
    progressBar->setTotalSteps(1);
    progressBar->setValue(0);
    progressBar->setTextEnabled(false);
    listView->checkboxTree();
  }
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:23,代码来源:projectnewlocal.cpp

示例11: eventFilter


//.........这里部分代码省略.........
            case Key_Return:
            case Key_Enter:
                item = *It( pl, It::Visible );
                m_lineEdit->clear();
                pl->m_filtertimer->stop(); //HACK HACK HACK
                if( e->state() & ControlButton )
                {
                    PLItemList in, out;
                    if( e->state() & ShiftButton )
                        for( It it( pl, It::Visible ); PlaylistItem *x = static_cast<PlaylistItem*>( *it ); ++it )
                        {
                            pl->queue( x, true );
                            ( pl->m_nextTracks.contains( x ) ? in : out ).append( x );
                        }
                    else
                    {
                        It it( pl, It::Visible );
                        pl->activate( *it );
                        ++it;
                        for( int i = 0; PlaylistItem *x = static_cast<PlaylistItem*>( *it ); ++i, ++it )
                        {
                            in.append( x );
                            pl->m_nextTracks.insert( i, x );
                        }
                    }
                    if( !in.isEmpty() || !out.isEmpty() )
                        emit pl->queueChanged( in, out );
                    pl->setFilter( "" );
                    pl->ensureItemCentered( ( e->state() & ShiftButton ) ? item : pl->currentTrack() );
                }
                else
                {
                    pl->setFilter( "" );
                    if( ( e->state() & ShiftButton ) && item )
                    {
                        pl->queue( item );
                        pl->ensureItemCentered( item );
                    }
                    else
                    {
                        pl->activate( item );
                        pl->showCurrentTrack();
                    }
                }
                return true;

            case Key_Escape:
                m_lineEdit->clear();
                return true;

            default:
                return false;
            }
        }

        //following are for Playlist::instance() only
        //we don't handle these in the playlist because often we manipulate the lineEdit too

        if( o == pl )
        {
            if( pl->currentItem() && ( e->key() == Key_Up && pl->currentItem()->itemAbove() == 0 ) )
            {
                QListViewItem *lastitem = *It( pl, It::Visible );
                while( lastitem && lastitem->itemBelow() )
                    lastitem = lastitem->itemBelow();
                pl->currentItem()->setSelected( false );
                pl->setCurrentItem( lastitem );
                lastitem->setSelected( true );
                pl->ensureItemVisible( lastitem );
                return true;
            }
            if( pl->currentItem() && ( e->key() == Key_Down && pl->currentItem()->itemBelow() == 0 ) )
            {
                pl->currentItem()->setSelected( false );
                pl->setCurrentItem( *It( pl, It::Visible ) );
                (*It( pl, It::Visible ))->setSelected( true );
                pl->ensureItemVisible( *It( pl, It::Visible ) );
                return true;
            }
            if( e->key() == Key_Delete )
            {
                pl->removeSelectedItems();
                return true;
            }
            if( ( e->key() >= Key_0 && e->key() <= Key_Z ) || e->key() == Key_Backspace || e->key() == Key_Escape )
            {
                m_lineEdit->setFocus();
                QApplication::sendEvent( m_lineEdit, e );
                return true;
            }
        }
        #undef e
        break;

    default:
        break;
    }

    return QWidget::eventFilter( o, e );
}
开发者ID:tmarques,项目名称:waheela,代码行数:101,代码来源:playlistwindow.cpp

示例12: connect

void
FileManager::showInEditor(const KURL& url)
{
    for (std::list<ManagedFileInfo*>::iterator mfi = files.begin();
         mfi != files.end(); ++mfi)
        if ((*mfi)->getFileURL() == url)
        {
            if (!(*mfi)->getEditor())
            {
                // The file has not yet been loaded, so we create an editor for
                // it.
                KTextEditor::Document* document;
                if (!(document = KTextEditor::EditorChooser::createDocument
                      (viewStack, "KTextEditor::Document", "Editor")))
                {
                    KMessageBox::error
                        (viewStack,
                         i18n("A KDE text-editor component could not "
                              "be found; please check your KDE "
                              "installation."));
                    return;
                }
                if (!editorConfigured)
                {
                    if (!KTextEditor::configInterface(document))
                    {
                        KMessageBox::error
                            (viewStack,
                             i18n("You have selected a KDE Editor component "
                                  "that is not powerful enough for "
                                  "TaskJuggler. "
                                  "Please select the 'Embedded Advanced Text "
                                  "Editor' component in the KDE Control "
                                  "Panel."));
                        return;
                    }
                    KTextEditor::configInterface(document)->readConfig(config);
                    editorConfigured = true;
                }

                KTextEditor::View* editor =
                    document->createView(viewStack);
                viewStack->addWidget(editor);
                (*mfi)->setEditor(editor);
                editor->setMinimumSize(400, 200);
                editor->setSizePolicy(QSizePolicy(QSizePolicy::Maximum,
                                                  QSizePolicy::Maximum, 0, 85,
                                                  editor->sizePolicy()
                                                  .hasHeightForWidth()));
                document->openURL(url);
                document->setReadWrite(true);
                document->setModified(false);

                // Signal to update the file-modified status
                connect(document, SIGNAL(textChanged()),
                        *mfi, SLOT(setModified()));

                connect(document,
                        SIGNAL(modifiedOnDisc(Kate::Document*, bool,
                                              unsigned char)),
                        *mfi,
                        SLOT(setModifiedOnDisc(Kate::Document*, bool,
                                               unsigned char)));

                /* Remove some actions of the editor that we don't want to
                 * show in the menu/toolbars */
                KActionCollection* ac = editor->actionCollection();
                if (ac->action("file_print"))
                    ac->remove(ac->action("file_print"));
                if (ac->action("view_folding_markers"))
                    ac->action("view_folding_markers")->
                        setShortcut(KShortcut());
                if (ac->action("view_border"))
                    ac->action("view_border")->setShortcut(KShortcut());
                if (ac->action("view_line_numbers"))
                    ac->action("view_line_numbers")->setShortcut(KShortcut());
                if (ac->action("view_dynamic_word_wrap"))
                    ac->action("view_dynamic_word_wrap")->
                        setShortcut(KShortcut());

/*                KActionPtrList actionList =
                    editor->actionCollection()->actions();
                for (KActionPtrList::iterator it = actionList.begin();
                     it != actionList.end(); ++it)
                {
                    printf("** Action found: %s\n", (*it)->name());
                }*/
            }
            viewStack->raiseWidget((*mfi)->getEditor());

            browser->clearSelection();
            QListViewItem* lvi = (*mfi)->getBrowserEntry();
            if (lvi)
            {
                browser->setCurrentItem(lvi);
                lvi->setSelected(true);
            }

            break;
        }
开发者ID:taskjuggler,项目名称:TaskJuggler2,代码行数:100,代码来源:FileManager.cpp


注:本文中的QListViewItem::setSelected方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。