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


C++ QListWidget::clear方法代码示例

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


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

示例1: update

void ListBoxControl::update (int pId)
{
  uicontrol::properties& up = properties<uicontrol> ();
  QListWidget* list = qWidget<QListWidget> ();

  switch (pId)
    {
    case uicontrol::properties::ID_STRING:
      m_blockCallback = true;
      list->clear ();
      list->addItems (Utils::fromStringVector (up.get_string_vector ()));
      updateSelection (list, up.get_value ().matrix_value ());
      m_blockCallback = false;
      break;
    case uicontrol::properties::ID_MIN:
    case uicontrol::properties::ID_MAX:
      if ((up.get_max () - up.get_min ()) > 1)
	list->setSelectionMode (QAbstractItemView::ExtendedSelection);
      else
	list->setSelectionMode (QAbstractItemView::SingleSelection);
      break;
    case uicontrol::properties::ID_VALUE:
      m_blockCallback = true;
      updateSelection (list, up.get_value ().matrix_value ());
      m_blockCallback = false;
      break;
    default:
      BaseControl::update (pId);
      break;
    }
}
开发者ID:Htallon,项目名称:QtHandles,代码行数:31,代码来源:ListBoxControl.cpp

示例2: fillLists

void MainWindow::fillLists(DisplayData *display)
{
    QListWidget* list;

    unsigned char rowsCount = display->getRowCount();
    if(font != nullptr)
    for(int i=1;i<=4;i++)
    {
        switch(i)
        {
            case 1:list = listOfRows1;break;
            case 2:list = listOfRows2;break;
            case 3:list = listOfRows3;break;
            case 4:list = listOfRows4;break;
        }
        if(rowsCount>=i)
        {
            list->clear();
            for(int j=0;j<display->getCountOfLinesInRow(i-1);j++)
            {
                QString text = QString::number(j) + ")" + display->getLine(i-1,j)->getAsString(font);
                list->addItem(text);
            }
        }
        quint16 num = lcd->getCurrentLineNumber(i-1);
        if(num<list->count()) list->setCurrentRow(num,QItemSelectionModel::SelectCurrent);
    }
}
开发者ID:hermixy,项目名称:QtModbusLcd,代码行数:28,代码来源:mainwindow.cpp

示例3: filter

void AddPluginDialog::filter()
{
    QListWidget* pluginList = ui->pluginList;

    const int curr_item = 0 < pluginList->count() ? pluginList->currentRow() : 0;
    pluginList->clear();

    static QIcon fallIco = XdgIcon::fromTheme("preferences-plugin");

    int pluginCount = mPlugins.length();
    for (int i = 0; i < pluginCount; ++i)
    {
        const LxQt::PluginInfo &plugin = mPlugins.at(i);

        QString s = QString("%1 %2 %3 %4").arg(plugin.name(),
                                               plugin.comment(),
                                               plugin.value("Name").toString(),
                                               plugin.value("Comment").toString());
        if (!s.contains(ui->searchEdit->text(), Qt::CaseInsensitive))
            continue;

        QListWidgetItem* item = new QListWidgetItem(ui->pluginList);
        item->setText(QString("<b>%1</b><br>\n%2\n").arg(plugin.name(), plugin.comment()));
        item->setIcon(plugin.icon(fallIco));
        item->setData(INDEX_ROLE, i);
    }

    if (pluginCount > 0)
        ui->pluginList->setCurrentRow(curr_item < pluginCount ? curr_item : pluginCount - 1);
}
开发者ID:limitimil,项目名称:lxqt-panel,代码行数:30,代码来源:addplugindialog.cpp

示例4: load

/** Loads the settings for this page */
void DirectoriesDialog::load()
{

	/* get the shared directories */
        rsiface->lockData(); /* Lock Interface */
	
	std::list<std::string>::const_iterator it;
	const std::list<std::string> &dirs = rsiface->getConfig().sharedDirList;
	
	/* get a link to the table */
	QListWidget *listWidget = ui.dirList;
	
	/* remove old items ??? */
	listWidget->clear();
	
	for(it = dirs.begin(); it != dirs.end(); it++)
	{
		/* (0) Dir Name */
		listWidget->addItem(QString::fromStdString(*it));
	}

	ui.incomingDir->setText(QString::fromStdString(rsiface->getConfig().incomingDir));
	
	rsiface->unlockData(); /* UnLock Interface */
	
	listWidget->update(); /* update display */


}
开发者ID:autoscatto,项目名称:retroshare,代码行数:30,代码来源:DirectoriesDialog.cpp

示例5: update_waveform_list

void FireTrackWidgetPrivate::update_waveform_list()
{
	m_waveform_list->clear();
	int N=m_waveforms.N3();
	for (int i=0; i<N; i++) {
		QListWidgetItem *it=new QListWidgetItem();
		it->setText(QString("Neuron %1").arg(i+1));
		it->setData(Qt::UserRole,i);
		m_waveform_list->addItem(it);
	}
}
开发者ID:magland,项目名称:firetrack,代码行数:11,代码来源:firetrackwidget.cpp

示例6: displayList

void Assessment::displayList(QWidget* wgtNav)
{
    stringstream outString;
    QListWidget* listWidget = wgtNav->findChild<QListWidget*>("lwgtAssess");
    QListWidget* listPercent = wgtNav->findChild<QListWidget*>("lwgtPercent");

    listWidget->clear();
    listPercent->clear();
    listWidget->addItem(QString::fromStdString(name));
    outString << fixed << setprecision(2) << getPercentage() << "%";
    listPercent->addItem(QString::fromStdString(outString.str()));
    listWidget->addItem("------------------------");
    listPercent->addItem("---");
    for (iter = opps.begin(); iter != opps.end(); iter++)
    {
        listWidget->addItem(QString::fromStdString((*iter)->getAssessName()));
        outString.str("");
        outString << fixed << setprecision(2) << (*iter)->getPercentage() << "%";
        listPercent->addItem(QString::fromStdString(outString.str()));
    }
}
开发者ID:RavenBlood7,项目名称:Module-Planner,代码行数:21,代码来源:Assessment.cpp

示例7: listDetail

void Assessment::listDetail(QWidget* wgtDetail)
{
    QListWidget* listTitles = wgtDetail->findChild<QListWidget*>("lwgtTitles");
    QListWidget* listValues = wgtDetail->findChild<QListWidget*>("lwgtValues");
    wgtDetail->findChild<QDoubleSpinBox*>("sedMark")->hide();
    wgtDetail->findChild<QLabel*>("lblName")->show();
    wgtDetail->findChild<QLabel*>("lblMark")->hide();
    wgtDetail->findChild<QLabel*>("lblTotal")->hide();
    wgtDetail->findChild<QLabel*>("lblName")->setText(QString::fromStdString(getAssessName()));
    stringstream outString;
    listTitles->clear();
    listValues->clear();

    listTitles->addItem(QString::fromStdString("Current Mark:"));
            outString << fixed << setprecision(2) << getPercentage() << "%";
    listValues->addItem(QString::fromStdString(outString.str()));

    listTitles->addItem(QString::fromStdString("Weighted:"));
            outString.str("");
            outString << fixed << setprecision(2) << getWeightedMark() << "/" << getWeight();
    listValues->addItem(QString::fromStdString(outString.str()));
}
开发者ID:RavenBlood7,项目名称:Module-Planner,代码行数:22,代码来源:Assessment.cpp

示例8: buildList

void ACLController::buildList() {
	QListWidget *lw = m_ui->listWidget;
	lw->clear();
	m_hash.clear();
	VersionControl::UserAccessSeq *users = m_model->getUsers();
	for (unsigned int i = 0; i < users->length(); i++) {
		VersionControl::UserAccess user = (*users)[i];
		QString name = QString::fromUtf8(user.grantee->getName());
		QListWidgetItem *lwi = new QListWidgetItem(name);
		lwi->setCheckState(user.level == VersionControl::ReadWrite ? Qt::Checked : Qt::Unchecked);
		lw->addItem(lwi);
		m_hash[lwi] = user;
	}
}
开发者ID:vmiklos,项目名称:szar,代码行数:14,代码来源:ACL.cpp

示例9: ListTarget

void LSQFitDialog::ListTarget()
{
    if (m_target)
    {
        Residue *res = m_target->residuesBegin();
        QListWidget *list = targetListWidget;
        list->clear();
        while (res != NULL)
        {
            list->addItem(resid(res).c_str());
            res = res->next();
        }
    }
}
开发者ID:SpiritsThief,项目名称:mifit,代码行数:14,代码来源:LSQFitDialog.cpp

示例10: rebuildMeshList

void SceneDockWidget::rebuildMeshList()
{
    SceneData* data = controller->getSceneData();

    QListWidget* meshList = ui->listWidgetMeshes;
    meshList->clear();

    for(unsigned int i = 0; i < data->meshes.size(); ++i)
    {
        //Mesh* mesh = data->meshes.at(i).get();

        meshList->addItem(QString("Mesh%1").arg(i));
    }
}
开发者ID:madrenegade,项目名称:PGameStudio,代码行数:14,代码来源:scenedockwidget.cpp

示例11: rebuildMaterialList

void SceneDockWidget::rebuildMaterialList()
{
    SceneData* data = controller->getSceneData();

    QListWidget* materialList = ui->listWidgetMaterials;
    materialList->clear();

    for(unsigned int i = 0; i < data->materials.size(); ++i)
    {
        Material* mat = data->materials.at(i).get();

        materialList->addItem(QString::fromStdString(mat->name));
    }
}
开发者ID:madrenegade,项目名称:PGameStudio,代码行数:14,代码来源:scenedockwidget.cpp

示例12: on_pushButtonFindUsers_clicked

void TabbedMainWindow::on_pushButtonFindUsers_clicked()
{
    for (int i = 0; i < clusterNamesF.count(); i++) {
        qDebug() << usernamePasswordsF[i];
    }
    int selectedType = ui->comboBoxQueryType->currentIndex();
    QString selectedParameter = ui->comboBoxQueryParameter->currentText();
    QString argumentData = ui->lineEditQueryData->text();
    for (int i = 0; i < myList.count(); i++) {
        // XXX: use this to update all lists, after getting their list data from getting the endusers
        QListWidget * list = myList[i];
        QListWidget * list2 = myList2[i];
        list->clear();
        list2->clear();
        findUsers(Variables::hostNamesF[i], Variables::usernamePasswordsF[i], selectedType, selectedParameter, argumentData, list, list2);
    }
}
开发者ID:xXTheAwesomerXx,项目名称:CMClusters,代码行数:17,代码来源:tabbedmainwindow.cpp

示例13: updateSuggestions

void GuiSpellchecker::updateSuggestions(docstring_list & words)
{
	QString const suggestion = toqstr(d->word_.word());
	d->ui.wordED->setText(suggestion);
	QListWidget * lw = d->ui.suggestionsLW;
	lw->clear();

	if (words.empty()) {
		on_suggestionsLW_itemClicked(new QListWidgetItem(suggestion));
		return;
	}
	for (size_t i = 0; i != words.size(); ++i)
		lw->addItem(toqstr(words[i]));

	on_suggestionsLW_itemClicked(lw->item(0));
	lw->setCurrentRow(0);
}
开发者ID:bsjung,项目名称:Lyx,代码行数:17,代码来源:GuiSpellchecker.cpp

示例14: setSpellEffects

void MainWindow::setSpellEffects(const Spell &spell)
{
    QListWidget *listArray[] = {
        ui->listEffect1,
        ui->listEffect2,
        ui->listEffect3
    };

    for (int i = 0 ; i < MAX_EFFECT_INDEX ; i++)
    {
        const SpellEffect &s        = spell.getSpellEffect(i);
        QListWidget *list         = listArray[i];

        list->clear();
        if (s.getEffect() == SPELL_EFFECT_NONE)
        {
            ui->tabWidgetEffects->setTabEnabled(i, false);
            ui->tabWidgetEffects->setTabText(i, "None");
        }
        else
        {
            ui->tabWidgetEffects->setTabEnabled(i, true);
            ui->tabWidgetEffects->setTabText(i, s.getName());
            list->addItem("Effect id: " + QString::number(s.getEffect()));
            list->addItem("Die sides: " + QString::number(s.getDieSides()));
            list->addItem("Base dice: " + QString::number(s.getBaseDice()));
            list->addItem("Dice per level: " + QString::number(s.getDicePerLevel()));
            list->addItem("Real points per level: " + QString::number(s.getRealPointsPerLevel()));
            list->addItem("Base point: " + QString::number(s.getBasePoint()));
            list->addItem("Mechanic: " + QString::number(s.getMechanic()));
            list->addItem("Implicit target A: " + QString::number(s.getImplicitTargetA()));
            list->addItem("Implicit target B: " + QString::number(s.getImplicitTargetB()));
            list->addItem("Radius index: " + QString::number(s.getRadius()));
            list->addItem("Apply aura name: " + s.getApplyAuraName());
            list->addItem("Amplitude: " + QString::number(s.getAmplitude()));
            list->addItem("Multiple value: " + QString::number(s.getMultipleValue()));
            list->addItem("Chain target: " + QString::number(s.getChainTarget()));
            list->addItem("Item type: " + QString::number(s.getItemType()));
            list->addItem("Misc value: " + QString::number(s.getMiscValueA()));
            list->addItem("Misc value B: " + QString::number(s.getMiscValueB()));
            list->addItem("Trigger spell: " + QString::number(s.getTriggerSpell()));
            list->addItem("Points per combo point: " + QString::number(s.getPointsPerComboPoint()));
            list->addItem("Damage multiplier: " + QString::number(s.getDmgMultiplier()));
        }
    }
}
开发者ID:Gagaro,项目名称:WoWdbcViewer,代码行数:46,代码来源:mainwindow.cpp

示例15: rebuildTextureList

void SceneDockWidget::rebuildTextureList()
{
    SceneData* data = controller->getSceneData();

    QListWidget* textureList = ui->listWidgetTextures;
    textureList->clear();

    for(unsigned int i = 0; i < data->materials.size(); ++i)
    {
        Material* mat = data->materials.at(i).get();

        for(unsigned int j = 0; j < mat->textures.size(); ++j)
        {
            textureList->addItem(QString::fromStdString(mat->textures.at(j)));
        }
    }
}
开发者ID:madrenegade,项目名称:PGameStudio,代码行数:17,代码来源:scenedockwidget.cpp


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