本文整理汇总了C++中QTextEdit::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextEdit::setAttribute方法的具体用法?C++ QTextEdit::setAttribute怎么用?C++ QTextEdit::setAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextEdit
的用法示例。
在下文中一共展示了QTextEdit::setAttribute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showFullExifInfo
void FQTermImageOrigin::showFullExifInfo() {
QString exifInfo = QString::fromStdString(exifExtractor_->extractExifInfo(model_->filePath(tree_->currentIndex()).toLocal8Bit().data()));
QString comment;
if ((*exifExtractor_)["UserComment"].length() > 8) {
QString commentEncoding = QString::fromStdString((*exifExtractor_)["UserComment"].substr(0, 8));
if (commentEncoding.startsWith("UNICODE")) {
//UTF-16
QTextCodec* c = QTextCodec::codecForName("UTF-16");
comment = c->toUnicode((*exifExtractor_)["UserComment"].substr(8).c_str());
} else if (commentEncoding.startsWith("JIS")) {
//JIS X 0208
QTextCodec* c = QTextCodec::codecForName("JIS X 0208");
comment = c->toUnicode((*exifExtractor_)["UserComment"].substr(8).c_str());
} else {
comment = QString::fromStdString((*exifExtractor_)["UserComment"].substr(8));
}
}
QTextEdit* info = new QTextEdit;
info->setText(exifInfo + tr("Comment : ") + comment + "\n");
info->setWindowFlags(Qt::Dialog);
info->setAttribute(Qt::WA_DeleteOnClose);
info->setAttribute(Qt::WA_ShowModal);
// info->setLineWrapMode(QTextEdit::NoWrap);
info->setReadOnly(true);
QFontMetrics fm(font());
info->resize(fm.width("Orientation : 1st row - 1st col : top - left side "), fm.height() * 20);
info->show();
}
示例2: slotSourceDownloaded
void MainWindow::slotSourceDownloaded()
{
QNetworkReply* reply = qobject_cast<QNetworkReply*>(const_cast<QObject*>(sender()));
QTextEdit* textEdit = new QTextEdit(NULL);
textEdit->setAttribute(Qt::WA_DeleteOnClose);
textEdit->show();
textEdit->setPlainText(reply->readAll());
}
示例3: viewSource
void MainWindow::viewSource()
{
QTextEdit* textEdit = new QTextEdit(NULL);
textEdit->setAttribute(Qt::WA_DeleteOnClose);
textEdit->adjustSize();
textEdit->move(this->geometry().center() - textEdit->rect().center());
textEdit->show();
view->page()->toHtml(invoke(textEdit, &QTextEdit::setPlainText));
}
示例4: handleLicenseClicked
void QtAboutWidget::handleLicenseClicked() {
QTextEdit* text = new QTextEdit();
text->setAttribute(Qt::WA_DeleteOnClose);
text->setReadOnly(true);
QFile file(":/COPYING");
file.open(QIODevice::ReadOnly);
QTextStream in(&file);
in.setCodec("UTF-8");
text->setPlainText(in.readAll());
file.close();
text->resize(500, 600);
text->show();
text->activateWindow();
}
示例5: file
ConfigPage::ConfigPage(Context *context) : context(context)
{
QTextEdit *text = new QTextEdit(this);
text->setAutoFillBackground(false);
#ifdef Q_OS_MAC
text->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
text->setFrameStyle(QFrame::NoFrame);
text->setContentsMargins(0,0,0,0);
QFile file(":gcconfig.pri");
file.open(QFile::ReadOnly);
QTextStream stream(&file);
QString contents = stream.readAll();
file.close();
text->setText(contents);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->setSpacing(0);
mainLayout->setContentsMargins(0,0,0,0);
mainLayout->addWidget(text);
setLayout(mainLayout);
}