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


C++ currentItem函数代码示例

本文整理汇总了C++中currentItem函数的典型用法代码示例。如果您正苦于以下问题:C++ currentItem函数的具体用法?C++ currentItem怎么用?C++ currentItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: currentItem

void VSCDeviceTree::SiteRefreshClick()
{
    QTreeWidgetItem *item = NULL;
    item = currentItem();

    VDC_DEBUG( "%s \n",__FUNCTION__);
    if(item != NULL)
    {
        VSCVmsZb *pVms = dynamic_cast<VSCVmsZb * >(item);
        if (pVms)
        {
            VDC_DEBUG( "%s \n",__FUNCTION__);
            pVms->Refresh();
        }
    }

    return;
}
开发者ID:bshawk,项目名称:vdc,代码行数:18,代码来源:vscdevicetree.cpp

示例2: currentItem

/**
 * Create new attribute.
 */
void RefactoringAssistant::createAttribute()
{
    QTreeWidgetItem *item = currentItem();
    if (!item) {
        uWarning() << "Called with no item selected.";
        return;
    }
    UMLClassifier *c = dynamic_cast<UMLClassifier*>(findUMLObject(item));
    if (!c) {  // find parent
        QTreeWidgetItem *parent = item->parent();
        c = dynamic_cast<UMLClassifier*>(findUMLObject(parent));
        if (!c) {
            uWarning() << "No classifier - cannot create!";
            return;
        }
    }
    c->createAttribute();
}
开发者ID:Salmista-94,项目名称:umbrello,代码行数:21,代码来源:refactoringassistant.cpp

示例3: appendItem

void TodoView::newTodo()
{
  QString tmpStr;
  KDPEvent *newEvent;

  newEvent = new KDPEvent;

  newEvent->setStatus(QString("NEEDS ACTION"));
  newEvent->setPriority(1);
  calendar->addTodo(newEvent);

  tmpStr.sprintf("%i\n",newEvent->getEventId());
  tmpStr += "EMPTY\n0\n \n ";
  appendItem(tmpStr.data());
  repaint();
  setCurrentItem(numRows()-1);
  updateItem(currentItem(), 3);
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:18,代码来源:todoview.cpp

示例4: qmenu

void
query_listview::context_menu(const QPoint& pos)
{
  query_lvitem* item = dynamic_cast<query_lvitem*>(itemAt(pos));

  if (item && item != currentItem())
    setCurrentItem(item);

  if (item && item->m_type==query_lvitem::user_defined) {
    // contextual menu
    QMenu qmenu(this);
    qmenu.setTitle(item->text(0));
    QAction* action_run = qmenu.addAction(tr("Run query"));
    QAction* action_edit = qmenu.addAction(tr("Edit"));
    QAction* action_remove = qmenu.addAction(tr("Remove"));
    QAction* selected=qmenu.exec(QCursor::pos());

    // user action
    if (selected==action_remove) {
      // remove this user query
      int r=QMessageBox::warning(this, tr("Please confirm"), tr("Delete user query?"), tr("OK"), tr("Cancel"), QString::null);
      if (r==0) {
	if (user_queries_repository::remove_query(item->text(0))) {
	  delete item;
	}
      }
    }
    else if (selected==action_edit) {
      // edit the user query
      extern void save_filter_query(msgs_filter*, int, const QString); // FIXME
      msgs_filter f;
      f.set_user_query(item->m_sql);
      save_filter_query(&f, 1, item->text(0));
      reload_user_queries();
    }
    else if (selected==action_run) {
      // run the query
      msgs_filter f;
      f.m_sql_stmt = item->m_sql;
      emit run_selection_filter(f);
    }
    return;
  }
}
开发者ID:AleksKots,项目名称:Manitou,代码行数:44,代码来源:query_listview.cpp

示例5: currentItem

void CFileList::Delete()
{
#ifdef QT_V4LAYOUT
	Q3ListViewItem		*pListViewItem;
#else
	QListViewItem		*pListViewItem;
#endif
	char 				szINI[FILENAME_MAX+1];
	char 				*pDataSourceName;
	QString				qsError;
	DWORD				nErrorCode;
	char				szErrorMsg[FILENAME_MAX+1];

	// GET SELECT DATA SOURCE NAME
    pListViewItem = currentItem();
	if ( pListViewItem )
	{
		pDataSourceName = (char *)pListViewItem->text( 0 ).ascii();
	}
	else
	{
		QMessageBox::information( this, "ODBC Config",  "Please select a Data Source from the list first" );
		return;
	}

    char dir[ 256 ];
    sprintf( dir, "%s/%s", cwd.ascii(), pDataSourceName );

	// DELETE ENTIRE SECTION IF IT EXISTS (given NULL entry)
    if ( unlink( dir ))
    {
        QString msg;

        msg.sprintf( "Unable to unlink %s", dir );
        QMessageBox::information( this, "ODBC Config", msg );
    }
    else
    {
        QMessageBox::information( this, "ODBC Config", "Done!" );
    }
	
	// RELOAD (slow but safe)
	Load();
}
开发者ID:ystk,项目名称:debian-unixodbc,代码行数:44,代码来源:CFileList.cpp

示例6: DBGOUT

/** Checks if the drop occured on a child of the item
 * that got dragged.
 */
bool SafeListView::isTargetChild(QDropEvent *event, SafeListViewItem *target)
{
  // prevent incest
  if(event->source() == viewport()) {
    DBGOUT("\tWarning!!");
    Q3ListViewItem *item = currentItem();

     // make sure this isn't a child of item
     Q3ListViewItem *p = target;
     for(; p != NULL; p = p->parent()) {
       if(p == item) {
	 DBGOUT("\tThe dragged item is a parent");
	 return true;
       }
     }
  }

  return false;
}
开发者ID:dylanwh,项目名称:MyPasswordSafe,代码行数:22,代码来源:safelistview.cpp

示例7: currentItem

void SummaryTree::selectionChanged()
{
    if (! isEnabled()) return;
    QTreeWidgetItem *curItem = currentItem();
    if (! curItem) {
        deleteTaskKeyAction->setEnabled(false);
        deleteTestCaseKeyAction->setEnabled(false);
        return;
    }
    
    int index = indexOfTopLevelItem(curItem);
    if (index != -1) {
        deleteTaskKeyAction->setEnabled(true);
        deleteTestCaseKeyAction->setEnabled(false);
    } else {
        deleteTaskKeyAction->setEnabled(false);
        deleteTestCaseKeyAction->setEnabled(true);
    }
}
开发者ID:DapperX,项目名称:project-lemon,代码行数:19,代码来源:summarytree.cpp

示例8: currentItem

void IPProcessList::startDrag(Qt::DropActions)
{
    QListWidgetItem* item = currentItem();
    QMimeData* mimeData = new QMimeData;
    QByteArray processID;
    processID.append(item->toolTip());
    mimeData->setData("application/x-imageplay", processID);

    QPixmap dragPixmap = item->icon().pixmap(32,32);

    QDrag *drag = new QDrag(this);
    drag->setMimeData(mimeData);
    drag->setPixmap(dragPixmap);
    drag->setHotSpot(QPoint(16,16));

    drag->exec(Qt::MoveAction);

    //QListWidget::startDrag(supportedActions);
}
开发者ID:MazharLakhani,项目名称:ImagePlay,代码行数:19,代码来源:IPProcessList.cpp

示例9: currentItem

void PopupMenuEditor::enterEditMode( QKeyEvent * e )
{
    PopupMenuEditorItem * i = currentItem();

    if ( i == &addSeparator ) {
	i = createItem( new QSeparatorAction( 0 ) );
    } else if ( i->isSeparator() ) {
	return;
    } else if ( currentField == 0 ) {
	choosePixmap();
    } else if ( currentField == 1 ) {
	showLineEdit();
	return;
    } else {// currentField == 2
	setAccelerator( e->key(), e->state() );
    }
    showSubMenu();
    return;
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:19,代码来源:popupmenueditor.cpp

示例10: currentItem

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FilterListWidget::performDrag()
{
  QListWidgetItem* item = currentItem();
  if(item)
  {
    QJsonObject obj;
    obj[item->text()] = item->data(Qt::UserRole).toString();

    QJsonDocument doc(obj);
    QByteArray jsonArray = doc.toJson();

    QMimeData* mimeData = new QMimeData;
    mimeData->setData(SIMPL::DragAndDrop::FilterItem, jsonArray);

    QDrag* drag = new QDrag(this);
    drag->setMimeData(mimeData);
    drag->exec(Qt::CopyAction);
  }
}
开发者ID:BlueQuartzSoftware,项目名称:SIMPLView,代码行数:22,代码来源:FilterListWidget.cpp

示例11: setWindowTitle

void PrinterSettings::setCurrentPrinter(Printer *printer)
{
    mPrinter = printer;

    setWindowTitle(tr("Preferences of \"%1\"").arg(mPrinter->name()));
    ui->duplexTypeComboBox->setEnabled(printer->canChangeDuplexType());


    ui->profilesList->clear();
    foreach (const PrinterProfile &profile, *(mPrinter->profiles()))
    {
        ui->profilesList->addItem(new ProfileItem(profile));
    }

    ui->profilesList->setCurrentRow(mPrinter->currentProfile());
    currentItem()->setIsCurrent(true);

    updateWidgets();
}
开发者ID:carsonip,项目名称:boomaga,代码行数:19,代码来源:printersettings.cpp

示例12: QStoredDrag

QDragObject *ActionListView::dragObject()
{
    ActionItem *i = (ActionItem*)currentItem();
    if ( !i )
	return 0;
    QStoredDrag *drag = 0;
    if ( i->action() ) {
	drag = new QStoredDrag( "application/x-designer-actions", viewport() );
	QString s = QString::number( (long)i->action() ); // #### huha, that is evil
	drag->setEncodedData( QCString( s.latin1() ) );
	drag->setPixmap( i->action()->iconSet().pixmap() );
    } else {
	drag = new QStoredDrag( "application/x-designer-actiongroup", viewport() );
	QString s = QString::number( (long)i->actionGroup() ); // #### huha, that is evil
	drag->setEncodedData( QCString( s.latin1() ) );
	drag->setPixmap( i->actionGroup()->iconSet().pixmap() );
    }
    return drag;
}
开发者ID:app,项目名称:ananas-labs,代码行数:19,代码来源:actionlistview.cpp

示例13: kdDebug

void TrackList::contentsMousePressEvent(QMouseEvent *e)
{
	Q3ListView::contentsMousePressEvent(e);

	if (e->button() == Qt::RightButton) {
		QWidget *tmpWidget = 0;
		tmpWidget = xmlGUIClient->factory()->container("tracklistpopup", xmlGUIClient);

		if (!tmpWidget || !tmpWidget->inherits("KPopupMenu")) {
			kdDebug() << "TrackList::contentsMousePressEvent => wrong container widget" << endl;
			return;
		}

		KMenu *menu(static_cast<KMenu*>(tmpWidget));
		menu->popup(QCursor::pos());
	}

	setSelected(currentItem(), TRUE);
}
开发者ID:fil4028,项目名称:TestGIT,代码行数:19,代码来源:tracklist.cpp

示例14: currentItem

void FolderNavigationWidget::contextMenuEvent(QContextMenuEvent *ev)
{
    QMenu menu;
    // Open current item
    const QModelIndex current = currentItem();
    const bool hasCurrentItem = current.isValid();
    QAction *actionOpen = menu.addAction(actionOpenText(m_fileSystemModel, current));
    actionOpen->setEnabled(hasCurrentItem);

    // we need dummy DocumentModel::Entry with absolute file path in it
    // to get EditorManager::addNativeDirAndOpenWithActions() working
    Core::DocumentModel::Entry fakeEntry;
    Core::IDocument document;
    document.setFilePath(Utils::FileName::fromString(m_fileSystemModel->filePath(current)));
    fakeEntry.document = &document;
    Core::EditorManager::addNativeDirAndOpenWithActions(&menu, &fakeEntry);

    const bool isDirectory = hasCurrentItem && m_fileSystemModel->isDir(current);
    QAction *actionOpenDirectoryAsProject = 0;
    if (isDirectory && m_fileSystemModel->fileName(current) != QLatin1String("..")) {
        actionOpenDirectoryAsProject =
            menu.addAction(tr("Open Project in \"%1\"")
                           .arg(m_fileSystemModel->fileName(current)));
    }

    // Open file dialog to choose a path starting from current
    QAction *actionChooseFolder = menu.addAction(tr("Choose Folder..."));

    QAction *action = menu.exec(ev->globalPos());
    if (!action)
        return;

    ev->accept();
    if (action == actionOpen) { // Handle open file.
        openItem(current);
    } else if (action == actionOpenDirectoryAsProject) {
        openItem(current, true);
    } else if (action == actionChooseFolder) { // Open file dialog
        const QString newPath = QFileDialog::getExistingDirectory(this, tr("Choose Folder"), currentDirectory());
        if (!newPath.isEmpty())
            setCurrentDirectory(newPath);
    }
}
开发者ID:C-sjia,项目名称:qt-creator,代码行数:43,代码来源:foldernavigationwidget.cpp

示例15: currentItem

/*!
    \fn SnippetWidget::slotEdit()
    Opens the dialog of editing the selected snippet
 */
void SnippetWidget::slotEdit()
{
  //get current data
  QListViewItem * item = currentItem();

  SnippetGroup *pGroup = dynamic_cast<SnippetGroup*>(item);
  SnippetItem *pSnippet = dynamic_cast<SnippetItem*>( item );
  if (!pSnippet || pGroup) /*selected item must be a SnippetItem but MUST not be a SnippetGroup*/
    return;

  //init the dialog
  SnippetDlg dlg(this, "SnippetDlg", true);
  dlg.snippetName->setText(pSnippet->getName());
  dlg.snippetText->setText(pSnippet->getText());
  dlg.btnAdd->setText(i18n("&Apply"));

  dlg.setCaption(i18n("Edit Snippet"));
  /*fill the combobox with the names of all SnippetGroup entries*/
  for (SnippetItem *it=_list.first(); it; it=_list.next()) {
    if (dynamic_cast<SnippetGroup*>(it)) {
      dlg.cbGroup->insertItem(it->getName());
    }
  }
  dlg.cbGroup->setCurrentText(SnippetItem::findGroupById(pSnippet->getParent(), _list)->getName());

  if (dlg.exec() == QDialog::Accepted) {
    //update the KListView and the SnippetItem
    item->setText( 0, dlg.snippetName->text() );
    pSnippet->setName( dlg.snippetName->text() );
    pSnippet->setText( dlg.snippetText->text() );

    /* if the user changed the parent we need to move the snippet */
    if ( SnippetItem::findGroupById(pSnippet->getParent(), _list)->getName() != dlg.cbGroup->currentText() ) {
      SnippetGroup * newGroup = dynamic_cast<SnippetGroup*>(SnippetItem::findItemByName(dlg.cbGroup->currentText(), _list));
      pSnippet->parent()->takeItem(pSnippet);
      newGroup->insertItem(pSnippet);
      pSnippet->resetParent();
    }

    setSelected(item, TRUE);
  }
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:46,代码来源:snippet_widget.cpp


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