{"id":402909,"date":"2024-06-29T16:47:36","date_gmt":"2024-06-29T16:47:36","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=402909"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=402909","title":{"rendered":"<span>Token-Based Authetification \u0432 \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c Qt6 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Qr-\u043a\u043e\u0434\u043e\u0432. Qr-\u043a\u043e\u0434\u044b<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h4>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h4>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/733788\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 1. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/733832\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 2. \u0421\u0435\u0440\u0432\u0435\u0440<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/734032\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 3. \u0410\u0434\u043c\u0438\u043d\u0441\u043a\u0438\u0439 \u043a\u043b\u0438\u0435\u043d\u0442<\/a><\/p>\n<\/li>\n<\/ul>\n<h2>Qr-\u043a\u043e\u0434\u044b \u043d\u0430 Qt<\/h2>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f Qr-\u043a\u043e\u0434\u043e\u0432 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/danielsanfr\/qt-qrcode\/\" rel=\"noopener noreferrer nofollow\">qt-qrcode<\/a>. \u042d\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430, \u043a\u0430\u043a \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a Qr-\u043a\u043e\u0434\u043e\u0432, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 libqrencode. \u041d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0432 \u043e\u0442\u0432\u0440\u0430\u0442\u043d\u043e\u043c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u0434\u0430. \u0410 \u0432\u043e\u0442 \u044d\u0442\u0430 \u043b\u0438\u0431\u0430 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0438\u043b\u0438\u0447\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442.<\/p>\n<p> \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u0440\u0435\u043a\u0440\u0430\u0442\u0438\u043b\u0430\u0441\u044c 8 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0434\u0435\u043b\u0430\u043b \u044f <a href=\"https:\/\/github.com\/ilyaBykonya\/qt-qrcode\" rel=\"noopener noreferrer nofollow\">\u0444\u043e\u0440\u043a<\/a>. \u0421\u0435\u0439\u0447\u0430\u0441 \u0438\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0442\u0430\u043c \u0435\u0441\u0442\u044c \u0444\u0438\u043a\u0441 \u0431\u0430\u0433\u0430 (\u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c qr-\u043a\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u0435\u043d, \u0440\u0430\u043d\u044c\u0448\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0442\u0442\u0435\u0440\u044b), \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b pro\/pri-\u0444\u0430\u0439\u043b\u044b, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u0442\u0435\u043b\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0439 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0432 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043a\u0430\u043a dll(so), \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u043a \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b.<\/p>\n<h2>\u041e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438<\/h2>\n<p>\u0421\u0430\u043c\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0442\u043e\u043a\u0435\u043d + expiration. \u0411\u0443\u0434\u0443\u0442 \u0438\u043c\u0435\u0442\u044c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0440\u043e\u0433\u043e, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0438 \u043f\u043e\u043a\u0430\u0437\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u0432 \u0432\u0438\u0434\u0435 Qr-\u043a\u043e\u0434\u0430.<\/p>\n<h2>\u0421\u043f\u0438\u0441\u043e\u043a \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/h2>\n<p>\u0414\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c ListModel. \u041c\u043e\u0434\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0441\u0430\u043c\u0430 \u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0430\u0434\u0440\u0435\u0441, \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u044f, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u044f\u044f \u0442\u043e\u043a\u0435\u043d\u044b.<\/p>\n<details class=\"spoiler\">\n<summary>TokenModel<\/summary>\n<div class=\"spoiler__content\">\n<details class=\"spoiler\">\n<summary>TokenModel.h<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">class TokenModel: public QAbstractListModel { private:     QPointer&lt;QNetworkAccessManager> m_manager;     QMap&lt;QUuid, QDateTime> m_tokens;     const QString m_tokenApi; public:     TokenModel(const QString&amp; address, QObject* parent = nullptr); public:     QPair&lt;QUuid, QDateTime> tokenAt(qint32 index) const; public:     void create(qint64 expirationSpan);     void remove(const QUuid&amp; token);     void refresh(); public:     int rowCount(const QModelIndex &amp;parent) const;     QVariant data(const QModelIndex &amp;index, int role) const; private:     void parseTokensFromJson(const QJsonDocument&amp; document); }; <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>TokenModel.cpp<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">TokenModel::TokenModel(const QString&amp; address, QObject* parent)     :QAbstractListModel{ parent },      m_manager{ new QNetworkAccessManager{ this } },      m_tokenApi{ \"http:\/\/\" + address + \"\/auth\/token\" } {} QPair&lt;QUuid, QDateTime> TokenModel::tokenAt(qint32 index) const {     const auto token = std::next(m_tokens.begin(), index);     return { token.key(), token.value() }; }  void TokenModel::create(qint64 expirationSpan) {     const auto request = QNetworkRequest{ QString{ \"%1\/%2\/%3\" }.arg(m_tokenApi).arg(\"create\").arg(expirationSpan) };     const auto reply = m_manager->get(request);     connect(reply, &amp;QNetworkReply::finished, reply, &amp;QObject::deleteLater);     connect(reply, &amp;QNetworkReply::finished, this, &amp;TokenModel::refresh); } void TokenModel::remove(const QUuid &amp;token) {     const auto request = QNetworkRequest{ QString{ \"%1\/%2\/%3\" }.arg(m_tokenApi).arg(\"remove\").arg(token.toString(QUuid::StringFormat::WithoutBraces)) };     const auto reply = m_manager->get(request);     connect(reply, &amp;QNetworkReply::finished, reply, &amp;QObject::deleteLater);     connect(reply, &amp;QNetworkReply::finished, this, &amp;TokenModel::refresh); } void TokenModel::refresh() {     const auto reply = m_manager->get(QNetworkRequest{ QString{ \"%1\/%2\" }.arg(m_tokenApi).arg(\"all\") });     QObject::connect(reply, &amp;QNetworkReply::finished, [this, reply]{         const auto result = QJsonDocument::fromJson(reply->readAll());         this->parseTokensFromJson(result);         reply->deleteLater();     }); }  int TokenModel::rowCount(const QModelIndex&amp;\/*parent*\/) const {     return m_tokens.size(); } QVariant TokenModel::data(const QModelIndex &amp;index, int role) const {     if(not index.isValid()) return {};     if(role != Qt::ItemDataRole::DisplayRole) return {};      const auto item = std::next(m_tokens.begin(), index.row());     return QString{ \"[%1 &lt;=> %2]\" }.arg(item.key().toString(), item.value().toString()); }  void TokenModel::parseTokensFromJson(const QJsonDocument&amp; document) {     this->beginResetModel();     m_tokens.clear();     const auto tokens = document.object();     for(const auto&amp; token: tokens.keys())         m_tokens.insert(QUuid::fromString(token), QDateTime::fromSecsSinceEpoch(tokens[token].toInteger()));      this->endResetModel(); } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<\/div>\n<\/details>\n<h2>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f Qr-\u043a\u043e\u0434\u0430<\/h2>\n<p>\u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430: <strong>QrCodeWidget<\/strong> \u0438 <strong>QrCodeDialog<\/strong>. \u041f\u0435\u0440\u0432\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c Qr-\u043a\u043e\u0434 \u043d\u0430 \u0441\u0435\u0431\u0435, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f qr-\u043a\u043e\u0434\u0430 \u0432 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u043c \u043e\u043a\u043d\u0435.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e. \u0421\u0430\u043c qr-\u043a\u043e\u0434 \u0440\u0438\u0441\u0443\u0435\u0442\u0441\u044f \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 <strong>QtQrCodePainter<\/strong> \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 qt-qrcode. \u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c qr-\u043a\u043e\u0434 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c QPainterDevice, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0438\u0448\u044c \u0437\u0430\u043f\u0438\u0445\u043d\u0443\u0442\u044c QPainterDevice \u0432 QPaint, \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c QtQrCodePainter.<\/p>\n<details class=\"spoiler\">\n<summary>QrCodeWidget<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">class QrCodeWidget: public QWidget { private:     QtQrCode m_code; public:     QrCodeWidget(const QtQrCode &amp;code = {}, QWidget *parent = nullptr); protected:     virtual void paintEvent(QPaintEvent *event) override; };  QrCodeWidget::QrCodeWidget(const QtQrCode &amp;code, QWidget *parent)     :QWidget{ parent }, m_code{ code } {}  void QrCodeWidget::paintEvent(QPaintEvent *event) {     QWidget::paintEvent(event);     QPainter painter{ this };     QtQrCodePainter{}.paint(m_code, painter, width(), height()); }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>QrCodeDialog<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">class QrCodeDialog : public QDialog { public:     QrCodeDialog(const QByteArray &amp;data, QWidget* parent = nullptr); };  QrCodeDialog::QrCodeDialog(const QByteArray &amp;data, QWidget* parent)     :QDialog{ parent } {     auto codeView = new QrCodeWidget{ QtQrCode{ data } };     auto layout = new QVBoxLayout{};     layout->addWidget(codeView);     this->setLayout(layout); }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h2>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c 4 \u043a\u043d\u043e\u043f\u043a\u0438 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u043e\u0432.<\/p>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u043b\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430 \u0441\u0447\u0451\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f (QAbstractSelectionModel). \u042d\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u0435\u043d\u0430 \u043d\u0430 \u043b\u044e\u0431\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e), \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, QListView.<\/p>\n<details class=\"spoiler\">\n<summary>TokenView.h<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">class TokenView: public QWidget { private:     QPointer&lt;TokenModel> m_tokens;     QPointer&lt;QListView> m_view; public:     TokenView(QWidget* parent = nullptr); private slots:     void showToken();     void createToken();     void removeToken(); };<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 4 \u043a\u043d\u043e\u043f\u043a\u0438, \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0437\u0430\u0434\u0430\u0451\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (connect) \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0438 \u0440\u0430\u0441\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u043e layout-\u0430\u043c.<\/p>\n<p>\u0418\u043a\u043e\u043d\u043a\u0438 \u0432\u0437\u044f\u0442\u044b \u0441 \u0441\u0430\u0439\u0442\u0430 <a href=\"https:\/\/icons8.com\" rel=\"noopener noreferrer nofollow\">https:\/\/icons8.com<\/a>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 TokenView<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">TokenView::TokenView(QWidget* parent)     :QWidget{ parent },      m_tokens{ new TokenModel{ \"127.0.0.1:5555\" } },      m_view{ new QListView{} } {         m_view->setModel(m_tokens);         auto showTokenButton = new QPushButton{ QIcon{ \":\/images\/icon-qr-code.png\" }, {} };         auto refreshModelButton = new QPushButton{ QIcon{ \":\/images\/icon-update.png\" }, {} };         auto createTokenButton = new QPushButton{ QIcon{ \":\/images\/icon-plus.png\" }, {} };         auto removeTokenButton = new QPushButton{ QIcon{ \":\/images\/icon-minus.png\" }, {} };          connect(m_view, &amp;QAbstractItemView::doubleClicked, this, &amp;TokenView::showToken);         connect(showTokenButton, &amp;QPushButton::clicked, this, &amp;TokenView::showToken);         connect(refreshModelButton, &amp;QPushButton::clicked, m_tokens, &amp;TokenModel::refresh);         connect(createTokenButton, &amp;QPushButton::clicked, this, &amp;TokenView::createToken);         connect(removeTokenButton, &amp;QPushButton::clicked, this, &amp;TokenView::removeToken);          auto layout = new QVBoxLayout{};             auto buttonLayout = new QHBoxLayout{};             buttonLayout->addWidget(refreshModelButton);             buttonLayout->addWidget(createTokenButton);             buttonLayout->addWidget(removeTokenButton);             buttonLayout->addWidget(showTokenButton);             buttonLayout->addStretch(1);         layout->addLayout(buttonLayout, 0);         layout->addWidget(m_view, 1);         this->setLayout(layout);         m_tokens->refresh();     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0443 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043b\u043e\u0433\u0438\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043d\u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<p>Qr \u043a\u043e\u0434 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u043c \u043e\u043a\u043d\u0435, \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u043e\u043c \u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440. \u0417\u0430\u043a\u0440\u044b\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u043a\u0440\u0435\u0441\u0442\u0438\u043a\u0443, \u0438\u043b\u0438 \u043d\u0430\u0436\u0430\u0432 Escape.<\/p>\n<p>\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u043e\u043a\u0435\u043d\u0430 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0440\u0435\u043c\u044f \u0435\u0433\u043e \u0436\u0438\u0437\u043d\u0438 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445, \u0430 \u043f\u0440\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b \u043e\u0434\u0438\u043d \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d.<\/p>\n<details class=\"spoiler\">\n<summary>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 TokenView<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">void TokenView::showToken() {     const auto selection = m_view->selectionModel()->selection();     if(selection.size() != 1)         return;      const auto token = m_tokens->tokenAt(selection.indexes().front().row());     QrCodeDialog qrCoreView{ token.first.toRfc4122(), this };     qrCoreView.showMaximized();     qrCoreView.exec(); } void TokenView::createToken() {     bool isValidExpirationSpan{};     const auto expirationSpan = QInputDialog::getInt(this, \"Expiration span\", \"Seconds:\", 86400,         0, std::numeric_limits&lt;qint32>::max(), 1, &amp;isValidExpirationSpan);     if(not isValidExpirationSpan)         return;      m_tokens->create(expirationSpan); } void TokenView::removeToken() {     const auto selection = m_view->selectionModel()->selection();     if(selection.size() != 1)         return;      const auto token = m_tokens->tokenAt(selection.indexes().front().row());     m_tokens->remove(token.first); } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9ec\/f4d\/f2c\/9ecf4df2c2d49f66eb637f37aa4abf03.png\" alt=\"\u0421\u043f\u0438\u0441\u043e\u043a \u0442\u043e\u043a\u0435\u043d\u043e\u0432\" title=\"\u0421\u043f\u0438\u0441\u043e\u043a \u0442\u043e\u043a\u0435\u043d\u043e\u0432\" width=\"568\" height=\"445\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9ec\/f4d\/f2c\/9ecf4df2c2d49f66eb637f37aa4abf03.png\"\/><\/p>\n<div><figcaption>\u0421\u043f\u0438\u0441\u043e\u043a \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1a3\/ba6\/555\/1a3ba655529b21e8130167af43b7102b.png\" alt=\"Qr-\u043a\u043e\u0434\" title=\"Qr-\u043a\u043e\u0434\" width=\"1920\" height=\"1040\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1a3\/ba6\/555\/1a3ba655529b21e8130167af43b7102b.png\"\/><\/p>\n<div><figcaption>Qr-\u043a\u043e\u0434<\/figcaption><\/div>\n<\/figure>\n<h2>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/h2>\n<p>\u0414\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u043e\u043a\u043d\u0430 \u0434\u043b\u044f Windows \u2014 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0448\u0430\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0449\u044c (\u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u0435 \u043d\u0440\u0430\u0432\u044f\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u0435 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u044b, \u043a\u0430\u043a Manjaro Linux, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0430\u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0435\u0437 \u0441\u0442\u0438\u043b\u0435\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0438\u044f\u0442\u043d\u043e). <\/p>\n<p>\u041d\u0443 \u0430 \u043d\u0430 Windows \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0431\u043e\u0440 qss-\u0444\u0430\u0439\u043b\u043e\u0432. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c <strong>qt_material<\/strong>. \u0421 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c qss-\u0444\u0430\u0439\u043b\u044b \u0441 \u043a\u0443\u0447\u0435\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0434 (\u043d\u0443 \u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a) \u0432\u0441\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u044b. <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430\u0435\u043c:<\/p>\n<pre><code class=\"python\">pip install qt_material<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443, \u043a\u0443\u0434\u0430 \u0445\u043e\u0442\u0438\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0438\u043b\u0438, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0432 \u043d\u0435\u0439 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043f\u0438\u0442\u043e\u043d\u0430 \u0438 \u0432\u0431\u0438\u0432\u0430\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 <a href=\"https:\/\/pypi.org\/project\/qt-material\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a>):<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a qt_material<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">from qt_material import export_theme  extra = {      # Button colors     'danger': '#dc3545',     'warning': '#ffc107',     'success': '#17a2b8',      # Font     'font_family': 'monospace',     'font_size': '14px',     'line_height': '13px',      # Density Scale     'density_scale': '0',      # environ     'pyside6': True,     'linux': True,  }  export_theme(     theme='dark_teal.xml', qss='dark_teal.qss', rcc='styles.qrc',     output='theme', prefix='icon:\/', invert_secondary=False, extra=extra)<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u0441 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a \u0441\u0432\u043e\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e (\u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c pro-\u0444\u0430\u0439\u043b, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 GitHub). \u0422\u0443\u0442 \u0435\u0449\u0451 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0444\u0430\u0439\u043b\u044b \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a (\u0438\u043a\u043e\u043d\u043a\u0438 \u0438 \u0442.\u043f), \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u043a\u0430\u043a DISTFILES, \u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0445 \u043a\u0430\u043a RESOURCES.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c:<\/p>\n<details class=\"spoiler\">\n<summary>main<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">int main(int argc, char *argv[]) {     QApplication app{ argc, argv };     {         QDir::addSearchPath(\"icon\", \":\/icon\/theme\");         QFile file(\":\/file\/dark_teal.qss\");         file.open(QFile::ReadOnly);         QString styleSheet = QLatin1String(file.readAll());         app.setStyleSheet(styleSheet);     }      TokenView window{};     window.show();     return app.exec(); } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418 \u043e\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e03\/19b\/d3e\/e0319bd3e3508e28f51aed864b536237.png\" alt=\"\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e\" title=\"\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e\" width=\"649\" height=\"383\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e03\/19b\/d3e\/e0319bd3e3508e28f51aed864b536237.png\"\/><\/p>\n<div><figcaption>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e<\/figcaption><\/div>\n<\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7bd\/5a6\/c6b\/7bd5a6c6b72820405ee12e353f001c31.png\" alt=\"\u0414\u0438\u0430\u043b\u043e\u0433 \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u0447\u0438\u0441\u043b\u0430\" title=\"\u0414\u0438\u0430\u043b\u043e\u0433 \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u0447\u0438\u0441\u043b\u0430\" width=\"307\" height=\"147\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7bd\/5a6\/c6b\/7bd5a6c6b72820405ee12e353f001c31.png\"\/><\/p>\n<div><figcaption>\u0414\u0438\u0430\u043b\u043e\u0433 \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u0447\u0438\u0441\u043b\u0430<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/712\/973\/468\/71297346855475644f1506540dada9aa.png\" alt=\"Qr-\u043a\u043e\u0434\" title=\"Qr-\u043a\u043e\u0434\" width=\"1920\" height=\"1041\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/712\/973\/468\/71297346855475644f1506540dada9aa.png\"\/><\/p>\n<div><figcaption>Qr-\u043a\u043e\u0434<\/figcaption><\/div>\n<\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u043e\u043a\u0435\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043b\u0438\u0447\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0447\u0442\u043e\u0431\u044b \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0442\u0435\u0447\u043a\u0438 \u0442\u043e\u043a\u0435\u043d\u0430 \u0431\u044b\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e \u0448\u0430\u043f\u043a\u0435. \u041d\u0443 \u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0431\u044b\u0442\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e, \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0434\u043e\u0439\u0434\u0443\u0442 \u0440\u0443\u043a\u0438, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c Android-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 Qt \u0434\u043b\u044f \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0433\u043e \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445. <\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/734032\/\"> https:\/\/habr.com\/ru\/articles\/734032\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h4>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h4>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/733788\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 1. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/733832\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 2. \u0421\u0435\u0440\u0432\u0435\u0440<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/734032\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 3. \u0410\u0434\u043c\u0438\u043d\u0441\u043a\u0438\u0439 \u043a\u043b\u0438\u0435\u043d\u0442<\/a><\/p>\n<\/li>\n<\/ul>\n<h2>Qr-\u043a\u043e\u0434\u044b \u043d\u0430 Qt<\/h2>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f Qr-\u043a\u043e\u0434\u043e\u0432 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/danielsanfr\/qt-qrcode\/\" rel=\"noopener noreferrer nofollow\">qt-qrcode<\/a>. \u042d\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430, \u043a\u0430\u043a \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a Qr-\u043a\u043e\u0434\u043e\u0432, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 libqrencode. \u041d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0432 \u043e\u0442\u0432\u0440\u0430\u0442\u043d\u043e\u043c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u0434\u0430. \u0410 \u0432\u043e\u0442 \u044d\u0442\u0430 \u043b\u0438\u0431\u0430 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0438\u043b\u0438\u0447\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442.<\/p>\n<p> \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u0440\u0435\u043a\u0440\u0430\u0442\u0438\u043b\u0430\u0441\u044c 8 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0434\u0435\u043b\u0430\u043b \u044f <a href=\"https:\/\/github.com\/ilyaBykonya\/qt-qrcode\" rel=\"noopener noreferrer nofollow\">\u0444\u043e\u0440\u043a<\/a>. \u0421\u0435\u0439\u0447\u0430\u0441 \u0438\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0442\u0430\u043c \u0435\u0441\u0442\u044c \u0444\u0438\u043a\u0441 \u0431\u0430\u0433\u0430 (\u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c qr-\u043a\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u0435\u043d, \u0440\u0430\u043d\u044c\u0448\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0442\u0442\u0435\u0440\u044b), \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b pro\/pri-\u0444\u0430\u0439\u043b\u044b, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u0442\u0435\u043b\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0439 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0432 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043a\u0430\u043a dll(so), \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u043a \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b.<\/p>\n<h2>\u041e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438<\/h2>\n<p>\u0421\u0430\u043c\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0442\u043e\u043a\u0435\u043d + expiration. \u0411\u0443\u0434\u0443\u0442 \u0438\u043c\u0435\u0442\u044c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0440\u043e\u0433\u043e, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0438 \u043f\u043e\u043a\u0430\u0437\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u0432 \u0432\u0438\u0434\u0435 Qr-\u043a\u043e\u0434\u0430.<\/p>\n<h2>\u0421\u043f\u0438\u0441\u043e\u043a \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/h2>\n<p>\u0414\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c ListModel. \u041c\u043e\u0434\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0441\u0430\u043c\u0430 \u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0430\u0434\u0440\u0435\u0441, \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u044f, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u044f\u044f \u0442\u043e\u043a\u0435\u043d\u044b.<\/p>\n<details class=\"spoiler\">\n<summary>TokenModel<\/summary>\n<div class=\"spoiler__content\">\n<details class=\"spoiler\">\n<summary>TokenModel.h<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">class TokenModel: public QAbstractListModel { private:     QPointer&lt;QNetworkAccessManager> m_manager;     QMap&lt;QUuid, QDateTime> m_tokens;     const QString m_tokenApi; public:     TokenModel(const QString&amp; address, QObject* parent = nullptr); public:     QPair&lt;QUuid, QDateTime> tokenAt(qint32 index) const; public:     void create(qint64 expirationSpan);     void remove(const QUuid&amp; token);     void refresh(); public:     int rowCount(const QModelIndex &amp;parent) const;     QVariant data(const QModelIndex &amp;index, int role) const; private:     void parseTokensFromJson(const QJsonDocument&amp; document); }; <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>TokenModel.cpp<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">TokenModel::TokenModel(const QString&amp; address, QObject* parent)     :QAbstractListModel{ parent },      m_manager{ new QNetworkAccessManager{ this } },      m_tokenApi{ \"http:\/\/\" + address + \"\/auth\/token\" } {} QPair&lt;QUuid, QDateTime> TokenModel::tokenAt(qint32 index) const {     const auto token = std::next(m_tokens.begin(), index);     return { token.key(), token.value() }; }  void TokenModel::create(qint64 expirationSpan) {     const auto request = QNetworkRequest{ QString{ \"%1\/%2\/%3\" }.arg(m_tokenApi).arg(\"create\").arg(expirationSpan) };     const auto reply = m_manager->get(request);     connect(reply, &amp;QNetworkReply::finished, reply, &amp;QObject::deleteLater);     connect(reply, &amp;QNetworkReply::finished, this, &amp;TokenModel::refresh); } void TokenModel::remove(const QUuid &amp;token) {     const auto request = QNetworkRequest{ QString{ \"%1\/%2\/%3\" }.arg(m_tokenApi).arg(\"remove\").arg(token.toString(QUuid::StringFormat::WithoutBraces)) };     const auto reply = m_manager->get(request);     connect(reply, &amp;QNetworkReply::finished, reply, &amp;QObject::deleteLater);     connect(reply, &amp;QNetworkReply::finished, this, &amp;TokenModel::refresh); } void TokenModel::refresh() {     const auto reply = m_manager->get(QNetworkRequest{ QString{ \"%1\/%2\" }.arg(m_tokenApi).arg(\"all\") });     QObject::connect(reply, &amp;QNetworkReply::finished, [this, reply]{         const auto result = QJsonDocument::fromJson(reply->readAll());         this->parseTokensFromJson(result);         reply->deleteLater();     }); }  int TokenModel::rowCount(const QModelIndex&amp;\/*parent*\/) const {     return m_tokens.size(); } QVariant TokenModel::data(const QModelIndex &amp;index, int role) const {     if(not index.isValid()) return {};     if(role != Qt::ItemDataRole::DisplayRole) return {};      const auto item = std::next(m_tokens.begin(), index.row());     return QString{ \"[%1 &lt;=> %2]\" }.arg(item.key().toString(), item.value().toString()); }  void TokenModel::parseTokensFromJson(const QJsonDocument&amp; document) {     this->beginResetModel();     m_tokens.clear();     const auto tokens = document.object();     for(const auto&amp; token: tokens.keys())         m_tokens.insert(QUuid::fromString(token), QDateTime::fromSecsSinceEpoch(tokens[token].toInteger()));      this->endResetModel(); } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<\/div>\n<\/details>\n<h2>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f Qr-\u043a\u043e\u0434\u0430<\/h2>\n<p>\u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430: <strong>QrCodeWidget<\/strong> \u0438 <strong>QrCodeDialog<\/strong>. \u041f\u0435\u0440\u0432\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c Qr-\u043a\u043e\u0434 \u043d\u0430 \u0441\u0435\u0431\u0435, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f qr-\u043a\u043e\u0434\u0430 \u0432 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u043c \u043e\u043a\u043d\u0435.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e. \u0421\u0430\u043c qr-\u043a\u043e\u0434 \u0440\u0438\u0441\u0443\u0435\u0442\u0441\u044f \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 <strong>QtQrCodePainter<\/strong> \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 qt-qrcode. \u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c qr-\u043a\u043e\u0434 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c QPainterDevice, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0438\u0448\u044c \u0437\u0430\u043f\u0438\u0445\u043d\u0443\u0442\u044c QPainterDevice \u0432 QPaint, \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c QtQrCodePainter.<\/p>\n<details class=\"spoiler\">\n<summary>QrCodeWidget<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">class QrCodeWidget: public QWidget { private:     QtQrCode m_code; public:     QrCodeWidget(const QtQrCode &amp;code = {}, QWidget *parent = nullptr); protected:     virtual void paintEvent(QPaintEvent *event) override; };  QrCodeWidget::QrCodeWidget(const QtQrCode &amp;code, QWidget *parent)     :QWidget{ parent }, m_code{ code } {}  void QrCodeWidget::paintEvent(QPaintEvent *event) {     QWidget::paintEvent(event);     QPainter painter{ this };     QtQrCodePainter{}.paint(m_code, painter, width(), height()); }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>QrCodeDialog<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">class QrCodeDialog : public QDialog { public:     QrCodeDialog(const QByteArray &amp;data, QWidget* parent = nullptr); };  QrCodeDialog::QrCodeDialog(const QByteArray &amp;data, QWidget* parent)     :QDialog{ parent } {     auto codeView = new QrCodeWidget{ QtQrCode{ data } };     auto layout = new QVBoxLayout{};     layout->addWidget(codeView);     this->setLayout(layout); }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h2>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c 4 \u043a\u043d\u043e\u043f\u043a\u0438 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u043e\u0432.<\/p>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u043b\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430 \u0441\u0447\u0451\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f (QAbstractSelectionModel). \u042d\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u0435\u043d\u0430 \u043d\u0430 \u043b\u044e\u0431\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e), \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, QListView.<\/p>\n<details class=\"spoiler\">\n<summary>TokenView.h<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">class TokenView: public QWidget { private:     QPointer&lt;TokenModel> m_tokens;     QPointer&lt;QListView> m_view; public:     TokenView(QWidget* parent = nullptr); private slots:     void showToken();     void createToken();     void removeToken(); };<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 4 \u043a\u043d\u043e\u043f\u043a\u0438, \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0437\u0430\u0434\u0430\u0451\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (connect) \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0438 \u0440\u0430\u0441\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u043e layout-\u0430\u043c.<\/p>\n<p>\u0418\u043a\u043e\u043d\u043a\u0438 \u0432\u0437\u044f\u0442\u044b \u0441 \u0441\u0430\u0439\u0442\u0430 <a href=\"https:\/\/icons8.com\" rel=\"noopener noreferrer nofollow\">https:\/\/icons8.com<\/a>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 TokenView<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">TokenView::TokenView(QWidget* parent)     :QWidget{ parent },      m_tokens{ new TokenModel{ \"127.0.0.1:5555\" } },      m_view{ new QListView{} } {         m_view->setModel(m_tokens);         auto showTokenButton = new QPushButton{ QIcon{ \":\/images\/icon-qr-code.png\" }, {} };         auto refreshModelButton = new QPushButton{ QIcon{ \":\/images\/icon-update.png\" }, {} };         auto createTokenButton = new QPushButton{ QIcon{ \":\/images\/icon-plus.png\" }, {} };         auto removeTokenButton = new QPushButton{ QIcon{ \":\/images\/icon-minus.png\" }, {} };          connect(m_view, &amp;QAbstractItemView::doubleClicked, this, &amp;TokenView::showToken);         connect(showTokenButton, &amp;QPushButton::clicked, this, &amp;TokenView::showToken);         connect(refreshModelButton, &amp;QPushButton::clicked, m_tokens, &amp;TokenModel::refresh);         connect(createTokenButton, &amp;QPushButton::clicked, this, &amp;TokenView::createToken);         connect(removeTokenButton, &amp;QPushButton::clicked, this, &amp;TokenView::removeToken);          auto layout = new QVBoxLayout{};             auto buttonLayout = new QHBoxLayout{};             buttonLayout->addWidget(refreshModelButton);             buttonLayout->addWidget(createTokenButton);             buttonLayout->addWidget(removeTokenButton);             buttonLayout->addWidget(showTokenButton);             buttonLayout->addStretch(1);         layout->addLayout(buttonLayout, 0);         layout->addWidget(m_view, 1);         this->setLayout(layout);         m_tokens->refresh();     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0443 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043b\u043e\u0433\u0438\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043d\u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<p>Qr \u043a\u043e\u0434 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u043c \u043e\u043a\u043d\u0435, \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u043e\u043c \u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440. \u0417\u0430\u043a\u0440\u044b\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u043a\u0440\u0435\u0441\u0442\u0438\u043a\u0443, \u0438\u043b\u0438 \u043d\u0430\u0436\u0430\u0432 Escape.<\/p>\n<p>\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u043e\u043a\u0435\u043d\u0430 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0440\u0435\u043c\u044f \u0435\u0433\u043e \u0436\u0438\u0437\u043d\u0438 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445, \u0430 \u043f\u0440\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b \u043e\u0434\u0438\u043d \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d.<\/p>\n<details class=\"spoiler\">\n<summary>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 TokenView<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">void TokenView::showToken() {     const auto selection = m_view->selectionModel()->selection();     if(selection.size() != 1)         return;      const auto token = m_tokens->tokenAt(selection.indexes().front().row());     QrCodeDialog qrCoreView{ token.first.toRfc4122(), this };     qrCoreView.showMaximized();     qrCoreView.exec(); } void TokenView::createToken() {     bool isValidExpirationSpan{};     const auto expirationSpan = QInputDialog::getInt(this, \"Expiration span\", \"Seconds:\", 86400,         0, std::numeric_limits&lt;qint32>::max(), 1, &amp;isValidExpirationSpan);     if(not isValidExpirationSpan)         return;      m_tokens->create(expirationSpan); } void TokenView::removeToken() {     const auto selection = m_view->selectionModel()->selection();     if(selection.size() != 1)         return;      const auto token = m_tokens->tokenAt(selection.indexes().front().row());     m_tokens->remove(token.first); } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u043f\u0438\u0441\u043e\u043a \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\">\n<div><figcaption>Qr-\u043a\u043e\u0434<\/figcaption><\/div>\n<\/figure>\n<h2>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/h2>\n<p>\u0414\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u043e\u043a\u043d\u0430 \u0434\u043b\u044f Windows \u2014 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0448\u0430\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0449\u044c (\u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u0435 \u043d\u0440\u0430\u0432\u044f\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u0435 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u044b, \u043a\u0430\u043a Manjaro Linux, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0430\u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0435\u0437 \u0441\u0442\u0438\u043b\u0435\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0438\u044f\u0442\u043d\u043e). <\/p>\n<p>\u041d\u0443 \u0430 \u043d\u0430 Windows \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0431\u043e\u0440 qss-\u0444\u0430\u0439\u043b\u043e\u0432. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c <strong>qt_material<\/strong>. \u0421 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c qss-\u0444\u0430\u0439\u043b\u044b \u0441 \u043a\u0443\u0447\u0435\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0434 (\u043d\u0443 \u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a) \u0432\u0441\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u044b. <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430\u0435\u043c:<\/p>\n<pre><code class=\"python\">pip install qt_material<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443, \u043a\u0443\u0434\u0430 \u0445\u043e\u0442\u0438\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0438\u043b\u0438, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0432 \u043d\u0435\u0439 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043f\u0438\u0442\u043e\u043d\u0430 \u0438 \u0432\u0431\u0438\u0432\u0430\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 <a href=\"https:\/\/pypi.org\/project\/qt-material\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a>):<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a qt_material<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">from qt_material import export_theme  extra = {      # Button colors     'danger': '#dc3545',     'warning': '#ffc107',     'success': '#17a2b8',      # Font     'font_family': 'monospace',     'font_size': '14px',     'line_height': '13px',      # Density Scale     'density_scale': '0',      # environ     'pyside6': True,     'linux':<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-402909","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/402909","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=402909"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/402909\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=402909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=402909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=402909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}