本文整理汇总了C++中QPlainTextEdit::property方法的典型用法代码示例。如果您正苦于以下问题:C++ QPlainTextEdit::property方法的具体用法?C++ QPlainTextEdit::property怎么用?C++ QPlainTextEdit::property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPlainTextEdit
的用法示例。
在下文中一共展示了QPlainTextEdit::property方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
QMap<LanguageManager::LangId, QString> GroupchatTopicDlg::subjectMap() const
{
QMap<LanguageManager::LangId, QString> ret;
for (int i = 0; i < m_ui->twLang->count(); i++) {
QPlainTextEdit *edit = static_cast<QPlainTextEdit *>(m_ui->twLang->widget(i));
LanguageManager::LangId id = edit->property("langId").value<LanguageManager::LangId>();
QString text = edit->toPlainText();
ret.insert(id, text);
}
return ret;
}
示例2: QDialog
GroupchatTopicDlg::GroupchatTopicDlg(GCMainDlg *parent) :
QDialog(parent),
m_ui(new Ui::GroupchatTopicDlg),
m_addLangUi(new Ui::GroupChatTopicAddLangDlg)
{
m_ui->setupUi(this);
QKeySequence sendKey = ShortcutManager::instance()->shortcut("chat.send");
if (sendKey == QKeySequence(Qt::Key_Enter) || sendKey == QKeySequence(Qt::Key_Return)) {
sendKey = QKeySequence(Qt::CTRL + Qt::Key_Return);
}
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setShortcut(sendKey);
auto cw = new QToolButton();
cw->setIcon(IconsetFactory::icon("psi/add").icon());
m_ui->twLang->setCornerWidget(cw);
QObject::connect(m_ui->twLang, &QTabWidget::tabCloseRequested, this, [=](int index) {
m_ui->twLang->widget(index)->deleteLater();
m_ui->twLang->removeTab(index);
});
QObject::connect(cw, &QToolButton::clicked, this, [=](bool checked) {
Q_UNUSED(checked);
if (!addLangDlg) {
addLangDlg = new QDialog(this);
m_addLangUi->setupUi(addLangDlg);
addLangDlg->setWindowIcon(QIcon(IconsetFactory::iconPixmap("psi/logo_128")));
addLangDlg->setAttribute(Qt::WA_DeleteOnClose);
m_addLangUi->cmbLang->addItem(tr("Any Language"), 0);
QMap<QString,QLocale::Language> langs;
for (auto const &loc : QLocale::matchingLocales(
QLocale::AnyLanguage,
QLocale::AnyScript,
QLocale::AnyCountry))
{
if (loc != QLocale::c()) {
langs.insert(QLocale::languageToString(loc.language()), loc.language());
}
}
for (auto lang: langs) {
LanguageManager::LangId id;
id.language = lang;
m_addLangUi->cmbLang->addItem(LanguageManager::languageName(id), lang);
}
populateCountryAndScript();
addLangDlg->adjustSize();
addLangDlg->move(cw->mapToGlobal(QPoint(cw->width() - addLangDlg->width(), cw->height())));
addLangDlg->show();
QObject::connect(addLangDlg, &QDialog::accepted, this, [=]() {
LanguageManager::LangId id;
id.language = m_addLangUi->cmbLang->currentData().toInt();
id.script = m_addLangUi->cmbScript->currentData().toInt();
id.country = m_addLangUi->cmbCountry->currentData().toInt();
bool found = false;
for (int i = 0; i < m_ui->twLang->count(); i++) {
QPlainTextEdit *edit = static_cast<QPlainTextEdit *>(m_ui->twLang->widget(i));
LanguageManager::LangId tabId = edit->property("langId").value<LanguageManager::LangId>();
if (id == tabId) {
m_ui->twLang->setCurrentIndex(i);
found = true;
break;
}
}
if (!found) {
addLanguage(id);
}
});
QObject::connect(m_addLangUi->cmbLang, static_cast<void(QComboBox::*)(int index)>(&QComboBox::currentIndexChanged), this, [=](int index) {
Q_UNUSED(index)
populateCountryAndScript();
});
} else {
addLangDlg->setFocus();
}
});
}