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


C++ QStringListModel类代码示例

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


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

示例1: QWidget

SearchForm::SearchForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SearchForm)
{
    ui->setupUi(this);

    table_name = "tabla";

    c = new QCompleter(this);
    QStringList list;
    list<<"hola"<<"haber"<<"hay"<<"ha"<<"tambien"<<"tambor"<<"tata"
          <<"hola"<<"haber"<<"hay"<<"ha"<<"tambien"<<"tambor"<<"tata";
    list.sort();
    QStringListModel * model = new QStringListModel();
    model->setStringList(list);

    c->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
    c->setCaseSensitivity(Qt::CaseInsensitive);
    c->setWrapAround(false);
    c->setModel(model);


    ui->le_nombre->setCompleter(c);


     table_model = new QSqlRelationalTableModel();
     table_model->setTable("e_marca");

    table_model->select();

    ui->tableView->setModel(table_model);

}
开发者ID:Darklink159,项目名称:Juanes,代码行数:33,代码来源:searchform.cpp

示例2: fInfo

void AnimationList::addNewFile()
{
  //// For some unknown reason passing "this" locks up the OSX qavimator window. Possibly a QT4 bug, needs investigation
#ifdef __APPLE__
  QStringList files=QFileDialog::getOpenFileNames(NULL, "Choose an animation file", Settings::Instance()->lastPath(), ANIM_FILTER);
#else
  QStringList files=QFileDialog::getOpenFileNames(this, "Choose an animation file", Settings::Instance()->lastPath(), ANIM_FILTER);
#endif

  if(files.isEmpty())
    return;
  else
  {
    QFileInfo fInfo(files.last());
    Settings::Instance()->setLastPath(fInfo.absoluteDir().absolutePath());
  }

  foreach(QString file, files)
  {
    if(file.isEmpty() || availableAnimations.contains(file))
      continue;
    else
    {
      if(file.endsWith(".avm", Qt::CaseInsensitive) || file.endsWith(".bvh", Qt::CaseInsensitive))
        availableAnimations.append(files);
    }
  }
  QStringListModel* model =  dynamic_cast<QStringListModel*>(ui->availableAnimsListView->model());
  model->setStringList(availableAnimations);                //TODO: this is sooo lame. Find a dignified way
  onSelectionChanged();
}
开发者ID:hudakm,项目名称:animik,代码行数:31,代码来源:AnimationList.cpp

示例3: Q_ASSERT

void MRichTextEditDialogsManager::setTextStyleValues(const QString &fontfamily, int fontPointSize,
                                                     const QColor &fontColor)
{

    Q_ASSERT(fontFamilyCombo);

    int familyIndex = -1;
    QStringListModel *fontFamilyModel = dynamic_cast<QStringListModel *>(fontFamilyCombo->itemModel());
    if (fontFamilyModel) {
        QStringList fontFamilies = fontFamilyModel->stringList();
        familyIndex = fontFamilies.indexOf(fontfamily);
    }

    fontFamilyCombo->setCurrentIndex(familyIndex);

    Q_ASSERT(fontSizeCombo);

    QStringList fontSizeValues = generateFontSizeComboValues();
    QStringListModel *fontSizeModel = dynamic_cast<QStringListModel *>(fontSizeCombo->itemModel());
    if (fontSizeModel) {
        fontSizeModel->setStringList(fontSizeValues);
    }

    //% "%L1 points"
    QString fontSize(qtTrId("qtn_comm_font_size_value").arg(fontPointSize));
    int sizeIndex = fontSizeValues.indexOf(fontSize);
    fontSizeCombo->setCurrentIndex(sizeIndex);

    Q_ASSERT(fontColorCombo);

    fontColorCombo->setPickedColor(fontColor);
}
开发者ID:arcean,项目名称:libmeegotouch-framework,代码行数:32,代码来源:mrichtexteditdialogsmanager.cpp

示例4: bouchotSettingsDialog

void QQBoardsSettings::addBouchot()
{
	QQBouchotSettingsDialog bouchotSettingsDialog(this);
	bouchotSettingsDialog.setGroups(m_listGroups);
	bouchotSettingsDialog.setNames(m_listNames);

	if(bouchotSettingsDialog.exec() == QDialog::Accepted)
	{
		QQBouchot::QQBouchotSettings bSettings = bouchotSettingsDialog.bouchotSettings();
		QString bouchotName = bouchotSettingsDialog.bouchotName();

		if(m_listNames.contains(bouchotName))
		{
			qWarning() << "Trying to insert a bouchot with an already existing name, that's forbidden";
		}
		else
		{
			m_listNames.append(bouchotName);

			if(! m_listGroups.contains(bSettings.group()))
				m_listGroups.append(bSettings.group());

			QStringListModel *model = (QStringListModel *) ui->bouchotListView->model();
			int numRow = model->rowCount();
			model->insertRows(numRow,1);
			model->setData(model->index(numRow), QVariant(bouchotName));
			m_newBouchots.insert(bouchotName, bSettings);
			m_oldBouchots.removeAll(bouchotName);
		}
	}
}
开发者ID:claudex,项目名称:quteqoin,代码行数:31,代码来源:qqboardssettings.cpp

示例5: QStringListModel

void MainWindowMenuPlan::cleanListViewING()                 //Se borra el listview con los ingredientes mostrados en el apartado Ingredientes
{
    QStringListModel *model = new QStringListModel();
    model->removeRows(0, model->rowCount());
    ui->listView_Ingredientes->setModel(model);
    delete model;
}
开发者ID:JuanManuelRamos,项目名称:Trabajo-Fin-de-Grado,代码行数:7,代码来源:ingredientes.cpp

示例6: folderSelected

void ConversationPage::folderSelected(const QModelIndex& index)
{
    MPopupList *popupList = qobject_cast<MPopupList *>(sender());
    if (!popupList)
        return;
   
    QStringListModel *model = (QStringListModel *) popupList->itemModel();
    QStringList folders = model->stringList();

    m_downloadFolder = QDir::homePath() + "/" + folders[index.row()];

    QMailMessagePart::Location location = m_selectedAttachment.location();
    location.setContainingMessageId(m_id);

    if (m_selectedAttachment.hasBody())
    {
        // The content has already been downloaded to local device. No need to retrieve part from server.
        emit downloadCompleted();
        return;
    }

    m_retrievalAction = new QMailRetrievalAction(this);
    connect(m_retrievalAction, SIGNAL(activityChanged(QMailServiceAction::Activity)), 
                               this, SLOT(activityChanged(QMailServiceAction::Activity)));
    m_retrievalAction->retrieveMessagePart(location);
}
开发者ID:dudochkin-victor,项目名称:handset-email,代码行数:26,代码来源:conversationpage.cpp

示例7: GenericDelegate

void QuickEdit::VisibilityDelegateSetup()
{
    GenericDelegate* visibilityDelegate = new GenericDelegate(ui->tvEditor, false);
    visibilityDelegate->widgetCreator = [&](QWidget * parent)
    {
        QStringList visibilities = {"public" , "protected", "private", "package", "default"};
        QComboBox* box = new QComboBox(parent);
        QStringListModel* model = new QStringListModel;
        model->setStringList(visibilities);
        box->setModel(model);
        box->setEditable(false);
        return box;
    };
    visibilityDelegate->dataAccessor = [](QWidget * editor, const QModelIndex & index)
    {
        QString value = index.model()->data(index, Qt::EditRole).toString();
        QComboBox *box = static_cast<QComboBox*>(editor);
        box->setCurrentText(value);
    };
    visibilityDelegate->dataSetter = [](QWidget * editor,QAbstractItemModel* model, const QModelIndex &index)
    {
        QComboBox * box = static_cast<QComboBox*>(editor);
        QString value = box->currentText();
        model->setData(index, value, Qt::EditRole);
    };
    ui->tvEditor->setItemDelegateForColumn(columns.indexOf("visibility"), visibilityDelegate);
}
开发者ID:open-src,项目名称:douml,代码行数:27,代码来源:quickedit.cpp

示例8: GenericDelegate

void QuickEdit::DirectionDelegateSetup()
{
    GenericDelegate* delegate = new GenericDelegate(ui->tvEditor, false);

    delegate->widgetCreator = [](QWidget* parent)
    {
        QStringList visibilities;
        visibilities << "inout" << "in" << "out";
        QComboBox* box = new QComboBox(parent);
        QStringListModel* model = new QStringListModel;
        model->setStringList(visibilities);
        box->setModel(model);
        box->setEditable(false);
        return box;
    };
    
    delegate->dataAccessor = [](QWidget* editor, const QModelIndex& index)
    {
        QString value = index.model()->data(index, Qt::EditRole).toString();
        QComboBox* box = static_cast<QComboBox*>(editor);
        box->setCurrentText(value);
    };

    delegate->dataSetter = [](QWidget* editor, QAbstractItemModel* model, const QModelIndex& index)
    {
        QComboBox* box = static_cast<QComboBox*>(editor);
        QString value = box->currentText();
        model->setData(index, value, Qt::EditRole);
    };

    ui->tvEditor->setItemDelegateForColumn(columns.indexOf("direction"), delegate);
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:32,代码来源:quickedit.cpp

示例9: MPopupList

void ConversationPage::openAttachmentOpenDialog()
{
    MPopupList *popuplist = new MPopupList();
    QStringListModel *model = new QStringListModel(this);

    QDir homeDir = QDir::home();

    // Hack: hardcoded the list of applications for the 1.1 release
    QStringList apps = QStringList()
                          //% "Music player"
                          << qtTrId("xx_music_player")
                          //% "Photo viewer"
                          << qtTrId("xx_photo_viewer")
                          //% "Video player"
                          << qtTrId("xx_video player");


    model->setStringList(apps);
    popuplist->setItemModel(model);
    //% "Select an application"
    popuplist->setTitle(qtTrId("xx_select_an_application"));
    popuplist->appear();
    connect(popuplist, SIGNAL(clicked(const QModelIndex&)), SLOT(applicationSelected(const QModelIndex &)));

}
开发者ID:dudochkin-victor,项目名称:handset-email,代码行数:25,代码来源:conversationpage.cpp

示例10: QLOG_TRACE_IN

//***********************************************************
//* Load the completer with the list of valid tag names
//***********************************************************
void TagEditorNewTag::loadCompleter() {
    QLOG_TRACE_IN() << typeid(*this).name();
    QList<int> tagList;
    TagTable tagTable(global.db);
    QStringList tagNames;
    tagTable.getAll(tagList);
    for (qint32 i=0; i<tagList.size(); i++) {
        Tag t;
        QString guid;
        tagTable.getGuid(guid, tagList[i]);
        tagTable.get(t, guid);
        QString name = t.name;
        qint32 tagAccount = tagTable.owningAccount(tagList[i]);
        if (!currentTags.contains(name) && tagAccount == account)
            tagNames << name;
    }
    qSort(tagNames.begin(), tagNames.end(), caseInsensitiveLessThan);
    completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    setCompleter(completer);

    QStringListModel *model;
    model = (QStringListModel*)(completer->model());
    if(model==NULL)
        model = new QStringListModel();

    model->setStringList(tagNames);
    completer->setModel(model);
    QLOG_TRACE_OUT() << typeid(*this).name();
}
开发者ID:JelF,项目名称:nixnote2,代码行数:33,代码来源:tageditornewtag.cpp

示例11: showAutocompletion

    void ScriptWidget::showAutocompletion(const QStringList &list, const QString &prefix)
    {
        // do not show single autocompletion which is identical to existing prefix
        // or if it identical to prefix + '('.
        if (list.count() == 1) {
            if (list.at(0) == prefix ||
                list.at(0) == (prefix + "(")) {
                return;
            }
        }

        // update list of completions
        QStringListModel * model = static_cast<QStringListModel *>(_completer->model());
        model->setStringList(list);

        int currentLine = 0;
        int currentIndex = 0;
        _queryText->getCursorPosition(&currentLine, &currentIndex);
        int physicalLine = currentLine - _queryText->firstVisibleLine(); // "physical" line number in text editor (not logical)
        int lineIndexLeft = _currentAutoCompletionInfo.lineIndexLeft();

        QRect rect = _queryText->rect();
        rect.setWidth(550);
        rect.setHeight(editorHeight(physicalLine + 1));
        rect.moveLeft(charWidth() * lineIndexLeft + autocompletionBoxLeftPosition());

        _completer->complete(rect);
        _completer->popup()->setCurrentIndex(_completer->completionModel()->index(0, 0));
        _queryText->setIgnoreEnterKey(true);
        _queryText->setIgnoreTabKey(true);
    }
开发者ID:mirmasej,项目名称:robomongo,代码行数:31,代码来源:ScriptWidget.cpp

示例12: QWidget

QmitkLabelSetWidget::QmitkLabelSetWidget(QWidget *parent)
  : QWidget(parent), m_DataStorage(nullptr), m_Completer(nullptr), m_ToolManager(nullptr)
{
  m_Controls.setupUi(this);

  m_ColorSequenceRainbow.GoToBegin();

  m_ToolManager = mitk::ToolManagerProvider::GetInstance()->GetToolManager();
  assert(m_ToolManager);

  m_Controls.m_LabelSearchBox->setAlwaysShowClearIcon(true);
  m_Controls.m_LabelSearchBox->setShowSearchIcon(true);

  QStringList completionList;
  completionList << "";
  m_Completer = new QCompleter(completionList, this);
  m_Completer->setCaseSensitivity(Qt::CaseInsensitive);
  m_Controls.m_LabelSearchBox->setCompleter(m_Completer);

  connect(m_Controls.m_LabelSearchBox, SIGNAL(returnPressed()), this, SLOT(OnSearchLabel()));
  // connect( m_Controls.m_LabelSetTableWidget, SIGNAL(labelListModified(const QStringList&)), this, SLOT(
  // OnLabelListModified(const QStringList&)) );
  // connect( m_Controls.m_LabelSetTableWidget, SIGNAL(mergeLabel(int)), this, SLOT( OnMergeLabel(int)) );

  QStringListModel *completeModel = static_cast<QStringListModel *>(m_Completer->model());
  completeModel->setStringList(GetLabelStringList());

  m_Controls.m_LabelSearchBox->setEnabled(false);

  m_Controls.m_lblCaption->setText("");

  InitializeTableWidget();
}
开发者ID:Cdebus,项目名称:MITK,代码行数:33,代码来源:QmitkLabelSetWidget.cpp

示例13: qDeleteAll

void AppearanceSettings::loadThemes()
{
    QStringList themeNames;
    QStringList installPaths = Qtopia::installPaths();
    qDeleteAll(m_themes);
    m_themes.clear();
    for (int i=0; i<installPaths.size(); i++) {
        QString path(installPaths[i] + "etc/themes/");
        QDir dir;
        if (!dir.exists(path)) {
            qLog(UI) << "Theme style configuration path not found" << path.toLocal8Bit().data();
            continue;
        }

        // read theme.conf files
        dir.setPath(path);
        dir.setNameFilters(QStringList("*.conf")); // No tr

        for (uint j=0; j<dir.count(); j++) {
            QString name = dir[j].mid(0, dir[j].length() - 5); // cut ".conf"
            Theme *theme = Theme::create(path + dir[j], name);
            if (theme) {
                m_themes << theme;
                themeNames << theme->name();
            }
        }
    }
    themeNames << m_moreThemes;

    QStringListModel *model;
    model = qobject_cast<QStringListModel *>(m_themeCombo->model());
    model->setStringList(themeNames);
}
开发者ID:Artox,项目名称:qtmoko,代码行数:33,代码来源:appearance.cpp

示例14: wizard

void OwncloudWizardResultPage::initializePage()
{
    /*
    const QString localFolder = wizard()->property("localFolder").toString();
    QString text;
    if( _remoteFolder == QLatin1String("/") || _remoteFolder.isEmpty() ) {
        text = tr("Your entire account is synced to the local folder <i>%1</i>")
                .arg(QDir::toNativeSeparators(localFolder));
    } else {
        text = tr("%1 folder <i>%1</i> is synced to local folder <i>%2</i>")
                .arg(Theme::instance()->appNameGUI())
                .arg(_remoteFolder).arg(QDir::toNativeSeparators(localFolder));
    }
    _ui.localFolderLabel->setText( text );
    */

    QStringList folders = wizard()->property("localFolders").value<QStringList>();
    foreach (const QString &str, folders) {
        qDebug()<<"folder selected : " << str;
    }
    QListView *list=_ui.listView;
    QStringListModel *model = new QStringListModel(this);
    model->setStringList(folders);
    //list->setViewMode(QListView::IconMode);
    list->setModel(model);
}
开发者ID:jdbravo,项目名称:mirall-backup,代码行数:26,代码来源:owncloudwizardresultpage.cpp

示例15: parseModelFUN

void PluginGame5GenerateSituationDialog::onPluginAction()
{
    QStringList funList = parseModelFUN();
    QStringListModel* stringModel = (QStringListModel*)lineEditCustom->completer()->model();
    stringModel->setStringList(funList);
    exec();
}
开发者ID:aurusov,项目名称:rdo_studio,代码行数:7,代码来源:plugin_game5_dialog.cpp


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