本文整理汇总了C++中Language::name方法的典型用法代码示例。如果您正苦于以下问题:C++ Language::name方法的具体用法?C++ Language::name怎么用?C++ Language::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Language
的用法示例。
在下文中一共展示了Language::name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}