本文整理汇总了C++中Preferences::beginGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ Preferences::beginGroup方法的具体用法?C++ Preferences::beginGroup怎么用?C++ Preferences::beginGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences::beginGroup方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: save
void search_widget::save() const {
model->save();
Preferences pref;
pref.beginGroup("SearchWidget");
pref.setValue("CheckPlus", checkPlus->isChecked());
pref.setValue("CheckOwn", checkOwn->isChecked());
pref.setValue("CurrentTab", tabSearch->currentIndex());
pref.setValue("SeachListHeader", treeResult->header()->saveState());
pref.setValue("defValue", defValue->isChecked());
pref.setValue("defKilos", defKilos->isChecked());
pref.setValue("defMegas", defMegas->isChecked());
pref.beginWriteArray("Tabs", tabSearch->count());
for (int i = 0; i < tabSearch->count(); ++i) {
pref.setArrayIndex(i);
pref.setValue("Title", tabSearch->tabText(i));
qDebug() << "save " << tabSearch->tabText(i);
}
pref.endArray();
// save comboName
pref.beginWriteArray("ComboNames", comboName->count());
for(int index = 0; index < comboName->count(); ++index) {
pref.setArrayIndex(index);
pref.setValue("CName", comboName->itemText(index));
}
pref.endArray();
pref.endGroup();
}
示例2: writeSettings
void MainWindow::writeSettings()
{
Preferences pref;
pref.beginGroup(QString::fromUtf8("MainWindow"));
pref.setValue("geometry", saveGeometry());
pref.setValue("CurrentTab", stackedWidget->currentIndex());
pref.endGroup();
}
示例3: load
void search_widget::load() {
model->load();
Preferences pref;
pref.beginGroup("SearchWidget");
checkPlus->setChecked(pref.value("CheckPlus", true).toBool());
checkOwn->setChecked(pref.value("CheckOwn", true).toBool());
if (pref.contains("SeachListHeader")) {
treeResult->header()->restoreState(pref.value("SeachListHeader").toByteArray());
}
if (pref.value("defMegas", false).toBool()) {
//defMegas->setChecked(true);
}
if (pref.value("defValue", true).toBool()) {
//defValue->setChecked(true);
}
if (pref.value("defKilos", false).toBool()) {
//defKilos->setChecked(true);
}
int size = pref.beginReadArray("Tabs");
for (int i = 0; i < size; ++i) {
pref.setArrayIndex(i);
QString title = pref.value("Title", QString()).toString();
qDebug() << "load " << title;
tabSearch->addTab(QIcon(res::searchResult()), title);
}
pref.endArray();
int currentTab = pref.value("CurrentTab", -1).toInt();
if (currentTab < tabSearch->count()) {
tabSearch->setCurrentIndex(currentTab);
}
// restore comboName
size = pref.beginReadArray("ComboNames");
for (int i = 0; i < size; ++i)
{
pref.setArrayIndex(i);
comboName->addItem(pref.value("CName", QString()).toString());
}
pref.endArray();
comboName->setCurrentIndex(-1);
pref.endGroup();
if (tabSearch->count() != 0) tabSearch->show();
}
示例4: save
void messages_widget::save() const
{
Preferences pref;
pref.beginGroup("ED2KFriends");
pref.beginWriteArray("Friends", friends.size());
int i = 0;
foreach(const USER& u, friends)
{
pref.setArrayIndex(i);
u.save(pref);
++i;
}
示例5: readSettings
void MainWindow::readSettings()
{
Preferences pref;
pref.beginGroup(QString::fromUtf8("MainWindow"));
if(pref.contains("geometry")) {
if(restoreGeometry(pref.value("geometry").toByteArray()))
m_posInitialized = true;
}
stackedWidget->setCurrentIndex(pref.value("CurrentTab", wTransfer).toInt());
pref.endGroup();
}