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


C++ QTreeWidgetItem::isSelected方法代码示例

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


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

示例1: itemSelectionChangedSlot

void WdgGatewayTree::itemSelectionChangedSlot() {

	if (guard)
		return;

	wg->Db().DeselectAll();
	registry->ClearSelection();

	if (mode == mwmTree) {

		for (int i = 0; i < topLevelItemCount(); ++i) {

			QTreeWidgetItem *serviceItem = topLevelItem(i);

			unsigned serviceId = serviceItem->data(0, Qt::UserRole + 2).toUInt();

			if (serviceItem->isSelected()) {
				if (serviceId % 100 == REPO_TB_IDX)
					registry->Select(serviceId);
				else
					wg->Db().InvertRowSelection(serviceId);
			}

			for (int j = 0; j < serviceItem->childCount(); ++j) {

				QTreeWidgetItem *endpointItem = serviceItem->child(j);

				unsigned endpointId = endpointItem->data(0, Qt::UserRole + 2).toUInt();

				if (endpointItem->isSelected()) {
					if (endpointId % 100 == REPO_TB_IDX)
						registry->SelectEndpoint(serviceId, endpointId);
					else
						wg->Db().InvertRowSelection(endpointId);
				}
			}
		}
	}
	else {

		for (int i = 0; i < topLevelItemCount(); ++i) {

			QTreeWidgetItem *endpointItem = topLevelItem(i);

			unsigned endpointId = endpointItem->data(0, Qt::UserRole + 2).toUInt();

			if (endpointItem->isSelected()) {
				if (endpointId % 100 == REPO_TB_IDX)
					registry->SelectEndpoint(endpointId);
				else
					wg->Db().InvertRowSelection(endpointId);
			}
		}
	}

	wg->RefreshViews();
}
开发者ID:bcace,项目名称:soabrowser,代码行数:57,代码来源:wdggatewaytree.cpp

示例2: onRefresh

/*! \brief Called when the Refresh button has been pressed */
bool ApplicationViewWidget::onRefresh()
{
    if(manager.busy()){
        return false;
    }

    std::vector<int> modulesIDs;
    std::vector<int> connectionsIDs;
    std::vector<int> resourcesIDs;

    for(int i=0;i<ui->moduleList->topLevelItemCount();i++){
        QTreeWidgetItem *it = ui->moduleList->topLevelItem(i);
        if(it->isSelected()){
            modulesIDs.push_back(it->text(1).toInt());
            it->setText(2,"waiting");
            it->setIcon(0,QIcon(":/images/progress_ico.png"));
            it->setTextColor(2,QColor("#000000"));
        }
    }


    for(int i=0;i<ui->connectionList->topLevelItemCount();i++){
        QTreeWidgetItem *it = ui->connectionList->topLevelItem(i);
        if(it->isSelected()){
            connectionsIDs.push_back(it->text(1).toInt());
            it->setText(2,"waiting");
            it->setIcon(0,QIcon(":/images/progress_ico.png"));
            it->setTextColor(2,QColor("#000000"));
        }
    }

    for(int i=0;i<ui->resourcesList->topLevelItemCount();i++){
        QTreeWidgetItem *it = ui->resourcesList->topLevelItem(i);
        if(it->isSelected()){
            resourcesIDs.push_back(it->text(1).toInt());
            it->setText(3,"waiting");
            it->setIcon(0,QIcon(":/images/progress_ico.png"));
            it->setTextColor(3,QColor("#000000"));
        }
    }

    manager.safeRefresh(modulesIDs,
                        connectionsIDs,
                        resourcesIDs);
    yarp::os::Time::delay(0.1);
    selectAllConnections(false);
    selectAllModule(false);
    selectAllResources(false);
}
开发者ID:JoErNanO,项目名称:qtyarp,代码行数:50,代码来源:applicationviewwidget.cpp

示例3: slotFunctionRemoved

void FunctionManager::slotFunctionRemoved(t_function_id id)
{
	QTreeWidgetItem* item;

	// The function manager has its own routines for functions that are
	// removed with it.
	if (m_blockRemoveFunctionSignal == true)
		return;

	item = getItem(id, m_functionTree);
	if (item != NULL)
	{
		if (item->isSelected() == true)
		{
			QTreeWidgetItem* nextItem;

			// Try to select the closest neighbour
			if (m_functionTree->itemAbove(item) != NULL)
				nextItem = m_functionTree->itemAbove(item);
			else
				nextItem = m_functionTree->itemBelow(item);
	  
			if (nextItem != NULL)
				nextItem->setSelected(true);
		}

		delete item;
	}
}
开发者ID:speakman,项目名称:qlc,代码行数:29,代码来源:functionmanager.cpp

示例4: onYARPRead

/*! \brief Launch YARPRead Inspection modality*/
void ApplicationViewWidget::onYARPRead()
{
    if(manager.busy()){
        return;
    }
    yarp::manager::ErrorLogger* logger  = yarp::manager::ErrorLogger::Instance();

    for(int i=0;i<ui->connectionList->topLevelItemCount();i++){
        QTreeWidgetItem *it = ui->connectionList->topLevelItem(i);
        if(it->isSelected()){
            QString from = it->text(3);
            QString to = QString("/inspect/read%1").arg(from);

#if defined(WIN32)
            QString cmd = "cmd.exe";
            QString param;
            param = QString("/C yarp read %1").arg(to);

#else
            QString cmd = "xterm";
            QString param;
            param = QString("-hold -title %1 -e yarp read %2").arg(from).arg(to);
#endif

            yarp::manager::LocalBroker launcher;
            launcher.showConsole(true);
            if(launcher.init(cmd.toLatin1().data(), param.toLatin1().data(), NULL, NULL, NULL, NULL))
            {
                if(!launcher.start() && strlen(launcher.error()))
                {
                    QString msg;
                    msg = QString("Error while launching yarpread. %1").arg(launcher.error());
                    logger->addError(msg.toLatin1().data());
                    reportErrors();
                }
                else
                {
                    // waiting for the port to get open
                    double base = yarp::os::Time::now();
                    while(!timeout(base, 3.0)){
                        if(launcher.exists(to.toLatin1().data())){
                            break;
                        }
                    }
                    if(!launcher.connect(from.toLatin1().data(), to.toLatin1().data(), "udp")){
                        QString msg;
                        msg = QString("Cannot inspect '%1' : %2").arg(from).arg(launcher.error());
                        logger->addError(msg.toLatin1().data());
                        launcher.stop();
                        reportErrors();
                    }
                }
            }
        }
    }


    yarp::os::Time::delay(0.1);

}
开发者ID:JoErNanO,项目名称:qtyarp,代码行数:61,代码来源:applicationviewwidget.cpp

示例5: deleteNodes

void DOMTreeView::deleteNodes()
{
// kDebug(90180) ;

  DOM::Node last;
  MultiCommand *cmd = new MultiCommand(i18n("Delete Nodes"));
  QTreeWidgetItemIterator it(m_listView, QTreeWidgetItemIterator::Selected);
  for (; *it; ++it) {
    DOMListViewItem *item = static_cast<DOMListViewItem *>(*it);
//     kDebug(90180) << " item->node " << item->node().nodeName().string() << " clos " << item->isClosing();
    if (item->isClosing()) continue;

    // don't regard node more than once
    if (item->node() == last) continue;

    // check for selected parent
    bool has_selected_parent = false;
    for (QTreeWidgetItem *p = item->parent(); p; p = p->parent()) {
      if (p->isSelected()) { has_selected_parent = true; break; }
    }
    if (has_selected_parent) continue;

//     kDebug(90180) << " item->node " << item->node().nodeName().string() << ": schedule for removal";
    // remove this node if it isn't already recursively removed by its parent
    cmd->addCommand(new RemoveNodeCommand(item->node(), item->node().parentNode(), item->node().nextSibling()));
    last = item->node();
  }
  mainWindow()->executeAndAddCommand(cmd);
}
开发者ID:blue-shell,项目名称:folderview,代码行数:29,代码来源:domtreeview.cpp

示例6: onDisconnect

/*! \brief Called when the Disconnect button has been pressed */
bool ApplicationViewWidget::onDisconnect()
{
    if(manager.busy()){
        return false;
    }


    std::vector<int> MIDs;
    for(int i=0;i<ui->connectionList->topLevelItemCount();i++){
        QTreeWidgetItem *it = ui->connectionList->topLevelItem(i);
        if(it->isSelected()){
            MIDs.push_back(it->text(1).toInt());
            manager.updateConnection(it->text(1).toInt(),
                                     it->text(3).toLatin1().data(),
                                     it->text(4).toLatin1().data(),
                                     it->text(5).toLatin1().data());

            it->setText(2,"waiting");
            it->setIcon(0,QIcon(":/images/progress_ico.png"));
            it->setTextColor(2,QColor("#000000"));

        }
    }


    manager.safeDisconnect(MIDs);
    yarp::os::Time::delay(0.1);
    selectAllConnections(false);
    return true;
}
开发者ID:JoErNanO,项目名称:qtyarp,代码行数:31,代码来源:applicationviewwidget.cpp

示例7: GetItem

bool wxListCtrl::GetItem(wxListItem& info) const
{
    const long id = info.GetId();
    QTreeWidgetItem *qitem = QtGetItem(id);
    if ( qitem != NULL )
    {
        if ( !info.m_mask )
            // by default, get everything for backwards compatibility
            info.m_mask = -1;
        if ( info.m_mask & wxLIST_MASK_TEXT )
            info.SetText(wxQtConvertString(qitem->text(info.GetColumn())));
        if ( info.m_mask & wxLIST_MASK_DATA )
        {
            QVariant variant = qitem->data(0, Qt::UserRole);
            info.SetData(variant.value<long>());
        }
        if ( info.m_mask & wxLIST_MASK_STATE )
        {
            info.m_state = wxLIST_STATE_DONTCARE;
            if ( info.m_stateMask & wxLIST_STATE_FOCUSED )
            {
                if ( m_qtTreeWidget->currentIndex().row() == id )
                    info.m_state |= wxLIST_STATE_FOCUSED;
            }
            if ( info.m_stateMask & wxLIST_STATE_SELECTED )
            {
                if ( qitem->isSelected() )
                    info.m_state |= wxLIST_STATE_SELECTED;
            }
        }
        return true;
    }
    else
        return false;
}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:35,代码来源:listctrl.cpp

示例8: contextMenuEvent

void CFontFileListView::contextMenuEvent(QContextMenuEvent *ev)
{
    QTreeWidgetItem *item(itemAt(ev->pos()));

    if(item && item->parent())
    {
        if(!item->isSelected())
            item->setSelected(true);

        bool haveUnmarked(false),
             haveMarked(false);

        QList<QTreeWidgetItem *> items(selectedItems());
        QTreeWidgetItem          *item;

        foreach(item, items)
        {
            if(item->parent() && item->isSelected())
            {
                if(isMarked(item))
                    haveMarked=true;
                else
                    haveUnmarked=true;
            }

            if(haveUnmarked && haveMarked)
                break;

        }

        itsMarkAct->setEnabled(haveUnmarked);
        itsUnMarkAct->setEnabled(haveMarked);
        itsMenu->popup(ev->globalPos());
    }
}
开发者ID:walac,项目名称:kde-workspace,代码行数:35,代码来源:DuplicatesDialog.cpp

示例9: slotRightClick

void OutlinePalette::slotRightClick(QPoint point)
{
	if (!m_MainWindow || m_MainWindow->scriptIsRunning())
		return;
	QTreeWidgetItem *ite = reportDisplay->itemAt(point);
	if (ite == NULL)
		return;
	if (!ite->isSelected())
		slotMultiSelect();
	OutlineTreeItem *item = (OutlineTreeItem*)ite;
	
	if (item != NULL)
	{
		if ((item->type == 0) || (item->type == 2))
			createContextMenu(NULL, point.x(), point.y());
		else if ((item->type == 1) || (item->type == 3) || (item->type == 4))
		{
			PageItem *currItem = item->PageItemObject;
			if (currItem!=NULL)
			{
				currentObject = ite;
				createContextMenu(currItem, point.x(), point.y());
			}
		}
	}
}
开发者ID:moceap,项目名称:scribus,代码行数:26,代码来源:outlinepalette.cpp

示例10: sl_onSelectionChanged

void PWMJASPARDialogController::sl_onSelectionChanged() {
    QTreeWidgetItem* item = jasparTree->currentItem();
    if (item == 0) {
        fileName = "";
        return;
    }
    if (!item->isSelected()) {
        fileName = "";
        return;
    }
    JasparTreeItem* it = static_cast<JasparTreeItem*>(item);
    QMap<QString, QString> props = it->matrix.getProperties();
    fileName = QDir::searchPaths( PATH_PREFIX_DATA ).first() + "/position_weight_matrix/JASPAR/";
    fileName.append(it->matrix.getProperty("tax_group")).append("/");
    fileName.append(it->matrix.getProperty("id")).append(".pfm");
    propertiesTable->clear();
    propertiesTable->setRowCount(props.size());
    propertiesTable->setColumnCount(2);
    propertiesTable->verticalHeader()->setVisible(false);
    propertiesTable->horizontalHeader()->setVisible(false);

    QMapIterator<QString, QString> iter(props);
    int pos = 0;
    while (iter.hasNext()) {
        iter.next();
        propertiesTable->setItem(pos, 0, new QTableWidgetItem(iter.key()));
        propertiesTable->setItem(pos, 1, new QTableWidgetItem(iter.value()));
        pos++;
    }
}
开发者ID:ugeneunipro,项目名称:ugene-old,代码行数:30,代码来源:PWMJASPARDialogController.cpp

示例11: slotQuoteFailed

void KEquityPriceUpdateDlg::slotQuoteFailed(const QString& _id, const QString& _symbol)
{
  QList<QTreeWidgetItem*> foundItems = lvEquityList->findItems(_id, Qt::MatchExactly, ID_COL);
  QTreeWidgetItem* item = 0;

  if (! foundItems.empty())
    item = foundItems.at(0);

  // Give the user some options
  int result;
  if (_id.contains(" ")) {
    result = KMessageBox::warningContinueCancel(this, i18n("Failed to retrieve an exchange rate for %1 from %2. It will be skipped this time.", _symbol, item->text(SOURCE_COL)), i18n("Price Update Failed"));
  } else {
    result = KMessageBox::questionYesNoCancel(this, QString("<qt>%1</qt>").arg(i18n("Failed to retrieve a quote for %1 from %2.  Press <b>No</b> to remove the online price source from this security permanently, <b>Yes</b> to continue updating this security during future price updates or <b>Cancel</b> to stop the current update operation.", _symbol, item->text(SOURCE_COL))), i18n("Price Update Failed"), KStandardGuiItem::yes(), KStandardGuiItem::no());
  }

  if (result == KMessageBox::No) {
    // Disable price updates for this security

    MyMoneyFileTransaction ft;
    try {
      // Get this security (by ID)
      MyMoneySecurity security = MyMoneyFile::instance()->security(_id.toUtf8());

      // Set the quote source to blank
      security.setValue("kmm-online-source", QString());
      security.setValue("kmm-online-quote-system", QString());

      // Re-commit the security
      MyMoneyFile::instance()->modifySecurity(security);
      ft.commit();
    } catch (const MyMoneyException &e) {
      KMessageBox::error(this, QString("<qt>") + i18n("Cannot update security <b>%1</b>: %2", _symbol, e.what()) + QString("</qt>"), i18n("Price Update Failed"));
    }
  }

  // As long as the user doesn't want to cancel, move on!
  if (result != KMessageBox::Cancel) {
    QTreeWidgetItem* next = 0;
    prgOnlineProgress->setValue(prgOnlineProgress->value() + 1);
    item->setSelected(false);

    // launch the NEXT one ... in case of m_fUpdateAll == false, we
    // need to parse the list to find the next selected one
    next = lvEquityList->invisibleRootItem()->child(lvEquityList->invisibleRootItem()->indexOfChild(item) + 1);
    if (!m_fUpdateAll) {
      while (next && !next->isSelected()) {
        prgOnlineProgress->setValue(prgOnlineProgress->value() + 1);
        next = lvEquityList->invisibleRootItem()->child(lvEquityList->invisibleRootItem()->indexOfChild(next) + 1);
      }
    }
    if (next) {
      m_webQuote.launch(next->text(SYMBOL_COL), next->text(ID_COL), next->text(SOURCE_COL));
    } else {
      finishUpdate();
    }
  } else {
    finishUpdate();
  }
}
开发者ID:CGenie,项目名称:kmymoney,代码行数:60,代码来源:kequitypriceupdatedlg.cpp

示例12: printRows

void PrintTreeWidget::printRows(QPainter *p, int sItem, int eItem)
{
    QRect       rect;
    QBrush      bbrush;
    QString     tmpSt;
    int         yPos;
    int         xPos = prLeftMargin; 
    
    int         numCols;
    QTreeWidgetItem *curItem;
    
    // Now, draw the report title, centered on the page.
    p->setFont(QFont("helvetica", 8, QFont::Normal));

    numCols = myTree->columnCount();
    if (!numCols) return;
    if (numCols > 20) numCols = 20;

    yPos     = 130;
    for (int i = sItem; i < eItem; i++) {
        curItem = myTree->topLevelItem(i);

        if (curItem) {
            if (!myPrintSelectedOnly || curItem->isSelected()) {
                xPos     = prLeftMargin;
                for (int i = 0; i < numCols; i++) {
                    rect.setCoords(xPos+1, yPos, xPos + prColWidths[i] - 1, yPos+11);
                    p->drawText(rect, curItem->textAlignment(i)|Qt::AlignVCenter, curItem->text(i));
                    xPos += prColWidths[i];
                }
                yPos += 12;
            }
        }
    }
}
开发者ID:gottafixthat,项目名称:tacc,代码行数:35,代码来源:PrintTreeWidget.cpp

示例13: isSelected

bool QTreeWidgetItemProto::isSelected()	        const
{
  QTreeWidgetItem *item = qscriptvalue_cast<QTreeWidgetItem*>(thisObject());
  if (item)
    return item->isSelected();
  return false;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例14: onAttachStdout

void ApplicationViewWidget::onAttachStdout()
{
    if(manager.busy()) {
        return;
    }

    std::vector<int> MIDs;
    for(int i=0; i<ui->moduleList->topLevelItemCount(); i++) {
        QTreeWidgetItem *it = ui->moduleList->topLevelItem(i);
        if(it->isSelected()) {
            int id = it->text(1).toInt();

            StdoutWindow *stdouWin = qvariant_cast<StdoutWindow *>(it->data(0,Qt::UserRole));
            if(stdouWin && stdouWin->getId() == id) {
                // found
                continue;
            }

            MIDs.push_back(it->text(1).toInt());

            QString name = QString("%1").arg(app->getName());
            QString strTitle = name + ":" + it->text(0) + ":" + it->text(1);

            StdoutWindow *stdOutWindow = new StdoutWindow(id,strTitle);
            connect(stdOutWindow,SIGNAL(closeStdOut(int)),this,SLOT(onCloseStdOut(int)));
            //stdoutWinList.append(stdOutWindow);
            it->setData(0,Qt::UserRole,QVariant::fromValue(stdOutWindow));
            stdOutWindow->show();
        }

    }
开发者ID:saeedghsh,项目名称:yarp,代码行数:31,代码来源:applicationviewwidget.cpp

示例15: mainButtonClicked

void Multiwin::mainButtonClicked()
{
  QTreeWidgetItem* item;// = tree->topLevelItem(1);
  QString temp;
  std::string temp2;  
  int numItems = tree->topLevelItemCount(); 
  for(int i = 0; i < numItems; i++){
    item = tree->topLevelItem(i); 
    if(item->isSelected()){
      temp =  item->text(i); 
      temp2 = temp.toStdString();//temp2 contains the filename that will be displayed
      break; 
    } 
    else{
      item = tree->currentItem(); 
      temp = item->text(i); 
      temp2 = temp.toStdString();
      break;
    }  
  }
  std::map<std::string, WebPage*> allPages = engine->getPages();

  otherWin->setWindowTitle(QString::fromStdString(temp2)); //setting the title to the 
  fileContent->clear();//clear what was once there 

//outputting the words to the textbox
  std::stringstream stream;
  stream << *allPages.find(temp2)->second ;
  std::string str =  stream.str();
  fileContent->setPlainText(QString::fromStdString(str)); 
  //fileContent->setWordWrap(true);
  
  inList->clear(); 
  outList->clear(); 
  inHits.clear(); 
  outHits.clear();

  myset<WebPage*> incominLinks = allPages.find(temp2)->second->incoming_links(); 
  for (myset<WebPage*>::iterator it = incominLinks.begin(); it != incominLinks.end(); ++it) {
    QTreeWidgetItem* item = new QTreeWidgetItem;
    //0 = filename, 1 = # incoming, 2 = # outgoing 
    item->setText(0, QString::fromStdString((*it)->filename()));
    inList->addTopLevelItem(item);
    inList->setItemWidget(item, 1, new QLabel(QString::number((*it)->incoming_links().size())));//setting colunn 2 
    inList->setItemWidget(item, 2, new QLabel(QString::number((*it)->outgoing_links().size())));
    inHits.push_back((*it));
  }

    myset<WebPage*> outgoinLinks = allPages.find(temp2)->second->outgoing_links(); 
  for (myset<WebPage*>::iterator it = outgoinLinks.begin(); it != outgoinLinks.end(); ++it) {
    QTreeWidgetItem* item = new QTreeWidgetItem;
    //0 = filename, 1 = # incoming, 2 = # outgoing 
    item->setText(0, QString::fromStdString((*it)->filename()));
    outList->addTopLevelItem(item);
    outList->setItemWidget(item, 1, new QLabel(QString::number((*it)->incoming_links().size())));//setting colunn 2 
    outList->setItemWidget(item, 2, new QLabel(QString::number((*it)->outgoing_links().size())));
    outHits.push_back((*it));
  }
  otherWin->show();
}
开发者ID:jeanietwo,项目名称:GoogleTu,代码行数:60,代码来源:multiwin.cpp


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