Files
comaps/qt/qt_common/text_dialog.cpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

37 lines
976 B
C++

#include "qt/qt_common/text_dialog.hpp"
#include <QtWidgets/QDialogButtonBox>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QTextEdit>
TextDialog::TextDialog(QWidget * parent, QString const & htmlOrText, QString const & title)
: QDialog(parent)
{
auto * textEdit = new QTextEdit(this);
textEdit->setReadOnly(true);
textEdit->setHtml(htmlOrText);
auto * closeButton = new QPushButton("Close");
closeButton->setDefault(true);
connect(closeButton, &QAbstractButton::clicked, this, &TextDialog::OnClose);
auto * dbb = new QDialogButtonBox();
dbb->addButton(closeButton, QDialogButtonBox::RejectRole);
auto * vBoxLayout = new QVBoxLayout(this);
vBoxLayout->addWidget(textEdit);
vBoxLayout->addWidget(dbb);
setLayout(vBoxLayout);
setWindowTitle(title);
if (htmlOrText.size() > 10000)
setWindowState(Qt::WindowMaximized);
else
resize(parent->size());
}
void TextDialog::OnClose() { reject(); }