本文整理汇总了C++中Language::code方法的典型用法代码示例。如果您正苦于以下问题:C++ Language::code方法的具体用法?C++ Language::code怎么用?C++ Language::code使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Language
的用法示例。
在下文中一共展示了Language::code方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getEnabledLanguages
QStringList LanguageConfig::getEnabledLanguages() const {
QStringList list;
for (int i = 0; i < mLangList.count(); ++i) {
Language lang = mLangList[i];
if(mCheckBoxList[i]->isChecked()) {
list << lang.code();
}
}
return list;
}
示例2: QWidget
LanguageConfig::LanguageConfig(QWidget *parent) :
QWidget(parent),
mSettings(new QSettings(this)),
mTableWidget(new QTableWidget(this)),
mSetButton(new QPushButton(tr("Set All"),this)),
mUnsetButton(new QPushButton(tr("Unset All"),this))
{
QHBoxLayout *buttons = new QHBoxLayout;
buttons->addWidget(mSetButton);
buttons->addWidget(mUnsetButton);
buttons->addStretch();
QVBoxLayout *main = new QVBoxLayout;
main->addWidget(mTableWidget);
main->addLayout(buttons);
this->setLayout(main);
mTableWidget->setColumnCount(2);
mTableWidget->verticalHeader()->hide();
mTableWidget->horizontalHeader()->setStretchLastSection(true);
mTableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Name")));
mTableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Enabled")));
mLangList = QP_LANGUAGE_DB->languages();
mTableWidget->resizeColumnsToContents();
mTableWidget->setRowCount(mLangList.size());
for (int i = 0; i < mLangList.count(); ++i) {
Language lang = mLangList[i];
const QIcon icon = QIcon(QString(":/flags/flags/%1.png").arg(lang.code()));
const QString name = lang.name(mNativeNames);
QTableWidgetItem *item_name = new QTableWidgetItem;
item_name->setText(name);
item_name->setIcon(icon);
item_name->setFlags(item_name->flags() & (~(Qt::ItemIsEditable | Qt::ItemIsSelectable)));
mTableWidget->setItem(i, 0, item_name);
QCheckBox *enabled = new QCheckBox(this);
mCheckBoxList << enabled;
mTableWidget->setCellWidget(i, 1, enabled);
}
mTableWidget->resizeColumnsToContents();
connect(mSetButton, SIGNAL(clicked()), this, SLOT(pickAll()));
connect(mUnsetButton, SIGNAL(clicked()), this, SLOT(unpickAll()));
mSettings->beginGroup(QP_LANGUAGE_CONFIG_GROUP);
}
示例3: updateLists
void GuiThesaurus::updateLists()
{
meaningsTV->clear();
if (entryCO->currentText().isEmpty())
return;
meaningsTV->setUpdatesEnabled(false);
QString const lang = languageCO->itemData(
languageCO->currentIndex()).toString();
Language * language = const_cast<Language*>(lyx::languages.getLanguage(fromqstr(lang)));
docstring const lang_code = from_ascii(language->code());
Thesaurus::Meanings meanings =
getMeanings(WordLangTuple(qstring_to_ucs4(entryCO->currentText()), language));
for (Thesaurus::Meanings::const_iterator cit = meanings.begin();
cit != meanings.end(); ++cit) {
QTreeWidgetItem * i = new QTreeWidgetItem(meaningsTV);
i->setText(0, toqstr(cit->first));
meaningsTV->expandItem(i);
for (vector<docstring>::const_iterator cit2 = cit->second.begin();
cit2 != cit->second.end(); ++cit2) {
QTreeWidgetItem * i2 = new QTreeWidgetItem(i);
i2->setText(0, toqstr(*cit2));
}
meaningsTV->setEnabled(true);
lookupPB->setEnabled(true);
bool const readonly = isBufferReadonly();
replaceED->setEnabled(!readonly);
replacePB->setEnabled(!readonly);
}
if (meanings.empty()) {
if (!thesaurus.thesaurusAvailable(lang_code)) {
QTreeWidgetItem * i = new QTreeWidgetItem(meaningsTV);
i->setText(0, qt_("No thesaurus available for this language!"));
meaningsTV->setEnabled(false);
lookupPB->setEnabled(false);
replaceED->setEnabled(false);
replacePB->setEnabled(false);
}
}
meaningsTV->setUpdatesEnabled(true);
meaningsTV->update();
}