• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ currentItem函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: clearSelection

void JobListWidget::selectJob(JobPtr job)
{
    if(!job)
    {
        DEBUG << "Null JobPtr passed.";
        return;
    }

    for(int i = 0; i < count(); ++i)
    {
        JobListWidgetItem *jobItem = static_cast<JobListWidgetItem *>(item(i));
        if(jobItem && (jobItem->job()->objectKey() == job->objectKey()))
        {
            clearSelection();
            setCurrentItem(jobItem);
            scrollToItem(currentItem(), QAbstractItemView::EnsureVisible);
            break;
        }
    }
}
开发者ID:Tarsnap,项目名称:tarsnap-gui,代码行数:20,代码来源:joblistwidget.cpp


示例17: menu

void QDoubleListWidget::contextMenuEvent(QContextMenuEvent* evt)
{
    QMenu menu(this);
    QAction* addObjItem = menu.addAction(tr("Add Item"));
    QAction* delObjItem = menu.addAction(tr("Remove Item"));

    if (currentItem() == NULL)
        delObjItem->setEnabled(false);

    QAction* sel = menu.exec(evt->globalPos());
    if (sel == addObjItem) {
        bool ok;
        double val = QInputDialog::getDouble(this, tr("Add Item"),
                            tr("Enter a value"), 0.0, 0.0, 2147483647.0,
                            3, &ok);
        if (ok) addValue(val);
    } else if (sel == delObjItem) {
        delValue(currentRow());
    }
}
开发者ID:Deledrius,项目名称:PlasmaShop,代码行数:20,代码来源:QKeyList.cpp


示例18: keyPressEvent

void BreakpointListView::keyPressEvent(QKeyEvent* e)
{
  if(e->key() == Qt::Key_Delete)
  {

    BreakpointListViewItem* item =
      dynamic_cast<BreakpointListViewItem*>(currentItem());

    if(item)
    {
      takeItem(item);
      emit sigBreakpointRemoved(item->breakpoint());
      delete item;
    }
  }
  else
  {
    KListView::keyPressEvent(e);
  }
}
开发者ID:BackupTheBerlios,项目名称:gpt-svn,代码行数:20,代码来源:breakpointlistview.cpp


示例19: currentItem

void VDirectoryTree::newSubDirectory()
{
    if (!m_notebook) {
        return;
    }

    QTreeWidgetItem *curItem = currentItem();
    if (!curItem) {
        return;
    }

    VDirectory *curDir = getVDirectory(curItem);

    QString info = tr("Create a subfolder in <span style=\"%1\">%2</span>.")
                     .arg(g_config->c_dataTextStyle)
                     .arg(curDir->getName());
    QString defaultName("new_folder");
    defaultName = VUtils::getDirNameWithSequence(curDir->fetchPath(), defaultName);
    VNewDirDialog dialog(tr("Create Folder"), info, defaultName, curDir, this);
    if (dialog.exec() == QDialog::Accepted) {
        QString name = dialog.getNameInput();
        QString msg;
        VDirectory *subDir = curDir->createSubDirectory(name, &msg);
        if (!subDir) {
            VUtils::showMessage(QMessageBox::Warning,
                                tr("Warning"),
                                tr("Fail to create subfolder <span style=\"%1\">%2</span>.")
                                  .arg(g_config->c_dataTextStyle)
                                  .arg(name),
                                msg,
                                QMessageBox::Ok,
                                QMessageBox::Ok,
                                this);
            return;
        }

        updateItemDirectChildren(curItem);

        locateDirectory(subDir);
    }
}
开发者ID:vscanf,项目名称:vnote,代码行数:41,代码来源:vdirectorytree.cpp


示例20: currentItem

void ResourceView::removeResource()
{
  ResourceItem *item = currentItem();
  if ( !item ) {
    return;
  }

  int km =
    KMessageBox::warningContinueCancel(
      this,
      i18n( "<qt>Do you really want to remove the calendar <b>%1</b>?</qt>",
            item->text( 0 ) ), "", KStandardGuiItem::remove() );
  if ( km == KMessageBox::Cancel ) {
    return;
  }

// Don't be so restricitve
#if 1
  if ( item->resource() == mCalendar->resourceManager()->standardResource() ) {
    KMessageBox::sorry( this, i18n( "You cannot remove your standard calendar." ) );
    return;
  }
#endif

  if ( item->isSubresource() ) {
    if ( !item->resource()->removeSubresource( item->resourceIdentifier() ) ) {
      KMessageBox::sorry(
        this,
        i18n ( "<qt>Failed to remove the calendar folder <b>%1</b>. "
               "Perhaps it is a built-in folder which cannot be removed, or "
               "maybe the removal of the underlying storage folder failed.</qt>",
               item->text( 0 ) ) );
    }
    return;
  } else {
    mCalendar->resourceManager()->remove( item->resource() );
    delete item;
  }
  updateResourceList();
  emit resourcesChanged();
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:41,代码来源:resourceview.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ currentRow函数代码示例发布时间:2022-05-30
下一篇:
C++ currentIndexChanged函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap