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(); }
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()); }
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)); }
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(); }
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); }