ui: Added plain text editing dialog to list boxes in project setup UI
* Added class QtTextEditDialog for displaying text content * Added edit button to QtDirectoryListBox * Replaced show files button dialog using QtProjectWizzardContentSourceList with QtTextEditDialog
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
#include "qt/window/QtTextEditDialog.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPlainTextEdit>
|
||||
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
QtTextEditDialog::QtTextEditDialog(const QString& title, const QString& description, QWidget* parent)
|
||||
: QtWindow(parent)
|
||||
, m_title(title)
|
||||
, m_description(description)
|
||||
{
|
||||
}
|
||||
|
||||
QSize QtTextEditDialog::sizeHint() const
|
||||
{
|
||||
return QSize(550, 550);
|
||||
}
|
||||
|
||||
void QtTextEditDialog::setText(const std::string& text)
|
||||
{
|
||||
m_text->setPlainText(QString::fromStdString(text));
|
||||
}
|
||||
|
||||
std::string QtTextEditDialog::getText()
|
||||
{
|
||||
return m_text->toPlainText().toStdString();
|
||||
}
|
||||
|
||||
void QtTextEditDialog::setReadOnly(bool readOnly)
|
||||
{
|
||||
m_text->setReadOnly(readOnly);
|
||||
}
|
||||
|
||||
void QtTextEditDialog::populateWindow(QWidget* widget)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
QLabel* description = new QLabel(m_description);
|
||||
description->setObjectName("description");
|
||||
layout->addWidget(description);
|
||||
|
||||
m_text = new QPlainTextEdit();
|
||||
m_text->setObjectName("textField");
|
||||
m_text->setLineWrapMode(QPlainTextEdit::NoWrap);
|
||||
layout->addWidget(m_text);
|
||||
|
||||
widget->setLayout(layout);
|
||||
}
|
||||
|
||||
void QtTextEditDialog::windowReady()
|
||||
{
|
||||
updateNextButton("Ok");
|
||||
updateCloseButton("Cancel");
|
||||
|
||||
setPreviousVisible(false);
|
||||
|
||||
updateTitle(m_title);
|
||||
}
|
||||
Reference in New Issue
Block a user