本文整理汇总了C++中QStringListModel::setStringList方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringListModel::setStringList方法的具体用法?C++ QStringListModel::setStringList怎么用?C++ QStringListModel::setStringList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringListModel
的用法示例。
在下文中一共展示了QStringListModel::setStringList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stringListModel
void tst_ModelTest::stringListModel()
{
QStringListModel model;
QSortFilterProxyModel proxy;
ModelTest t1(&model);
ModelTest t2(&proxy);
proxy.setSourceModel(&model);
model.setStringList(QStringList() << "2" << "3" << "1");
model.setStringList(QStringList() << "a" << "e" << "plop" << "b" << "c" );
proxy.setDynamicSortFilter(true);
proxy.setFilterRegExp(QRegExp("[^b]"));
}
示例2: retranslateStrings
void EffectsScrollArea::retranslateStrings() {
retranslateUi(this);
filterGradientWidget->retranslateStrings();
QStringListModel *model = 0;
model = static_cast<QStringListModel*>(filterColorModel);
model->setStringList(colorFilterStringList());
model = static_cast<QStringListModel*>(filterGradientModel);
model->setStringList(gradientFilterStringList());
if (filterColorRadioButton->isChecked())
filterTypeComboBox->setCurrentIndex(filterColorModelIndex);
else
filterTypeComboBox->setCurrentIndex(filterGradientModelIndex);
}
示例3: parseModelFUN
void PluginGame5GenerateSituationDialog::onPluginAction()
{
QStringList funList = parseModelFUN();
QStringListModel* stringModel = (QStringListModel*)lineEditCustom->completer()->model();
stringModel->setStringList(funList);
exec();
}
示例4: setTextStyleValues
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);
}
示例5: themeChanged
void AppearanceSettings::themeChanged(int index)
{
Theme *theme = m_themes.value(index, 0);
if (!theme)
return;
QStringListModel *model;
model = qobject_cast<QStringListModel *>(m_colorCombo->model());
model->setStringList(theme->colorSchemeNames());
m_colorCombo->setCurrentIndex(theme->currentColorIndex());
model = qobject_cast<QStringListModel *>(m_backgroundCombo->model());
model->setStringList(theme->backgrounds());
m_backgroundCombo->setCurrentIndex(theme->currentBackgroundIndex());
}
示例6: DirectionDelegateSetup
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);
}
示例7: openAttachmentOpenDialog
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 &)));
}
示例8: addNewFile
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();
}
示例9: PrefixDelegateSetup
void QuickEdit::PrefixDelegateSetup()
{
GenericDelegate* delegate = new GenericDelegate(ui->tvEditor, false);
delegate->widgetCreator = [&](QWidget * parent)
{
QStringList list;
list << " " << "const " << "volatile ";
QCompleter *completer = new QCompleter(list, parent);
completer->setCaseSensitivity(Qt::CaseSensitive);
QComboBox* box = new QComboBox(parent);
QStringListModel* model = new QStringListModel;
model->setStringList(list);
box->setModel(model);
box->setEditable(true);
box->setCompleter(completer);
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("prefix"), delegate);
}
示例10: loadCompleter
//***********************************************************
//* 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();
}
示例11: VisibilityDelegateSetup
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);
}
示例12: 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);
}
示例13: 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();
}
示例14: 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(¤tLine, ¤tIndex);
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);
}
示例15: initializePage
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);
}