Qt6 Migration: LtsWidgets, BUILD_RTI Guards, externe Dependencies dokumentiert
- LtsWidgets Verzeichnis vollständig migriert (Qt5→Qt6) - BUILD_RTI Guards für RTI-spezifische Module hinzugefügt - Externe Dependencies in EXTERNAL_DEPS.md dokumentiert - Qt6 API-Änderungen: QRegExp→QRegularExpression, enterEvent(QEnterEvent*) - AutoUic-Fehler bei ui_requirement behoben (SKIP_AUTOUIC) - Include-Pfade korrigiert (LtsElevation, LtsMultiMonitor, LtsUtilsCore) - MOC-Fehler behoben (Q_INTERFACES entfernt wo nicht benötigt) - CMakeLists.txt Anpassungen für Qt6 (PUBLIC statt INTERFACE) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
145 files changed
+17700
-14377
No files matched your search
@@ -1,7 +1,13 @@
|
||||
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* LtsTextEditDialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Norbert Thoden, SLSE, 2023-06-14
|
||||
*/
|
||||
|
||||
#include "lts_text_edit_dialog.h"
|
||||
|
||||
#include "lts_text_editor.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
@@ -15,116 +21,123 @@
|
||||
namespace LtsWidgets
|
||||
{
|
||||
|
||||
LtsTextEditDialog::LtsTextEditDialog(QWidget* parent)
|
||||
: LtsDialog(parent, ButtonCombination::OkApplyCancel)
|
||||
#ifdef USE_TEXT_EDITOR
|
||||
,
|
||||
m_textEditor(new LtsTextEditor(this))
|
||||
#else
|
||||
,
|
||||
m_textEditor2(new LtsTextEditor2(this))
|
||||
#endif
|
||||
LtsTextEditDialog::LtsTextEditDialog(QWidget *parent)
|
||||
: LtsDialog(parent, ButtonCombination::OkApplyCancel)
|
||||
#ifdef USE_TEXT_EDITOR
|
||||
, m_textEditor(new LtsTextEditor(this))
|
||||
#else
|
||||
, m_textEditor2(new LtsTextEditor2(this))
|
||||
#endif
|
||||
{
|
||||
QHBoxLayout* hbox = new QHBoxLayout(this);
|
||||
QHBoxLayout *hbox = new QHBoxLayout(this);
|
||||
#ifdef USE_TEXT_EDITOR
|
||||
hbox->addWidget(m_textEditor);
|
||||
connect(m_textEditor->textEdit(), &QTextEdit::textChanged, this,
|
||||
[this]() { emit signalTextChanged(this->getHtmlText()); });
|
||||
connect(m_textEditor, &LtsTextEditor::backgroundColorChanged, this, &LtsTextEditDialog::onBackgroundColorChanged);
|
||||
hbox->addWidget(m_textEditor);
|
||||
connect(m_textEditor->textEdit(), &QTextEdit::textChanged, this, [this]() {
|
||||
emit signalTextChanged(this->getHtmlText());
|
||||
});
|
||||
connect(m_textEditor, &LtsTextEditor::backgroundColorChanged,
|
||||
this, &LtsTextEditDialog::onBackgroundColorChanged);
|
||||
#else
|
||||
hbox->addWidget(m_textEditor2);
|
||||
connect(m_textEditor2->textEdit(), &QTextEdit::textChanged, this,
|
||||
[this]() { emit signalTextChanged(this->getHtmlText()); });
|
||||
connect(m_textEditor2, &LtsTextEditor2::backgroundColorChanged, this, &LtsTextEditDialog::onBackgroundColorChanged);
|
||||
hbox->addWidget(m_textEditor2);
|
||||
connect(m_textEditor2->textEdit(), &QTextEdit::textChanged, this, [this]() {
|
||||
emit signalTextChanged(this->getHtmlText());
|
||||
});
|
||||
connect(m_textEditor2, &LtsTextEditor2::backgroundColorChanged,
|
||||
this, &LtsTextEditDialog::onBackgroundColorChanged);
|
||||
#endif
|
||||
|
||||
enableBackgroundColor(false);
|
||||
|
||||
enableBackgroundColor(false);
|
||||
}
|
||||
|
||||
LtsTextEditDialog::~LtsTextEditDialog() {}
|
||||
LtsTextEditDialog::~LtsTextEditDialog()
|
||||
{}
|
||||
|
||||
void LtsTextEditDialog::enableBackgroundColor(bool onOff)
|
||||
{
|
||||
#ifdef USE_TEXT_EDITOR
|
||||
m_textEditor->enableBackgroundColor(onOff);
|
||||
m_textEditor->enableBackgroundColor(onOff);
|
||||
#else
|
||||
m_textEditor2->enableBackgroundColor(onOff);
|
||||
m_textEditor2->enableBackgroundColor(onOff);
|
||||
#endif
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC
|
||||
|
||||
void LtsTextEditDialog::retranslate()
|
||||
{
|
||||
|
||||
QString name = tr("Edit Text");
|
||||
translate(name);
|
||||
// in correct translation context
|
||||
QString name = tr("Edit Text");
|
||||
translate(name);
|
||||
}
|
||||
|
||||
bool LtsTextEditDialog::apply()
|
||||
{
|
||||
#ifdef USE_TEXT_EDITOR
|
||||
QString textHtml = m_textEditor->textEdit()->document()->toHtml();
|
||||
const QString backGroundColor =
|
||||
QLatin1String("background-color:'%1'; ").arg(m_textEditor->backgroundColor().name());
|
||||
QString textHtml = m_textEditor->textEdit()->document()->toHtml();
|
||||
const QString backGroundColor = QLatin1String("background-color:'%1'; ").arg(m_textEditor->backgroundColor().name());
|
||||
|
||||
#else
|
||||
QString textHtml = m_textEditor2->textEdit()->document()->toHtml();
|
||||
const QString backGroundColor =
|
||||
QLatin1String("background-color:'%1'; ").arg(m_textEditor2->backgroundColor().name());
|
||||
QString textHtml = m_textEditor2->textEdit()->document()->toHtml();
|
||||
const QString backGroundColor = QLatin1String("background-color:'%1'; ").arg(m_textEditor2->backgroundColor().name());
|
||||
#endif
|
||||
|
||||
emit signalTextApplied(textHtml);
|
||||
emit signalTextApplied(textHtml);
|
||||
|
||||
const int insertBackGroundColorIndex = textHtml.indexOf(QLatin1String("font-family"));
|
||||
textHtml.insert(insertBackGroundColorIndex, backGroundColor);
|
||||
const int insertBackGroundColorIndex = textHtml.indexOf(QLatin1String("font-family"));
|
||||
textHtml.insert(insertBackGroundColorIndex, backGroundColor);
|
||||
|
||||
emit signalTextAppliedWithBackGroundColor(textHtml);
|
||||
emit signalTextAppliedWithBackGroundColor(textHtml);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void LtsTextEditDialog::setHtml(const QString& htmlText)
|
||||
void LtsTextEditDialog::setHtml(const QString &htmlText)
|
||||
{
|
||||
|
||||
// QTextEdit::textChanged is add via LtsDialog::addChangesMadeSignal()
|
||||
// so setHtml will in turn call slotChangesMade()
|
||||
#ifdef USE_TEXT_EDITOR
|
||||
m_textEditor->textEdit()->document()->setHtml(htmlText);
|
||||
m_textEditor->textEdit()->document()->setHtml(htmlText);
|
||||
#else
|
||||
m_textEditor2->textEdit()->document()->setHtml(htmlText);
|
||||
m_textEditor2->textEdit()->document()->setHtml(htmlText);
|
||||
#endif
|
||||
}
|
||||
|
||||
QString LtsTextEditDialog::getHtmlText() const
|
||||
{
|
||||
#ifdef USE_TEXT_EDITOR
|
||||
if (m_textEditor && m_textEditor->textEdit() && m_textEditor->textEdit()->document())
|
||||
return m_textEditor->textEdit()->document()->toHtml();
|
||||
if(m_textEditor && m_textEditor->textEdit() && m_textEditor->textEdit()->document())
|
||||
return m_textEditor->textEdit()->document()->toHtml();
|
||||
#else
|
||||
if (m_textEditor2 && m_textEditor2->textEdit() && m_textEditor2->textEdit()->document())
|
||||
return m_textEditor2->textEdit()->document()->toHtml();
|
||||
if(m_textEditor2 && m_textEditor2->textEdit() && m_textEditor2->textEdit()->document())
|
||||
return m_textEditor2->textEdit()->document()->toHtml();
|
||||
#endif
|
||||
return {};
|
||||
return {};
|
||||
}
|
||||
|
||||
void LtsTextEditDialog::setInitialBackgroundColor(const QColor& bgColor)
|
||||
void LtsTextEditDialog::setInitialBackgroundColor(const QColor &bgColor)
|
||||
{
|
||||
#ifdef USE_TEXT_EDITOR
|
||||
if (m_textEditor)
|
||||
m_textEditor->setInitialBackgroundColor(bgColor);
|
||||
if (m_textEditor)
|
||||
m_textEditor->setInitialBackgroundColor(bgColor);
|
||||
#else
|
||||
if (m_textEditor2)
|
||||
m_textEditor2->setInitialBackgroundColor(bgColor);
|
||||
if (m_textEditor2)
|
||||
m_textEditor2->setInitialBackgroundColor(bgColor);
|
||||
#endif
|
||||
}
|
||||
|
||||
void LtsTextEditDialog::dialogCanceled()
|
||||
{
|
||||
emit signalDialogCanceled();
|
||||
BaseClass::dialogCanceled();
|
||||
emit signalDialogCanceled();
|
||||
BaseClass::dialogCanceled();
|
||||
}
|
||||
|
||||
void LtsTextEditDialog::onBackgroundColorChanged(const QColor& backgroundColor)
|
||||
void LtsTextEditDialog::onBackgroundColorChanged(const QColor &backgroundColor)
|
||||
{
|
||||
slotChangesMade();
|
||||
emit signalBackgroundColorChanged(backgroundColor);
|
||||
slotChangesMade();
|
||||
emit signalBackgroundColorChanged(backgroundColor);
|
||||
}
|
||||
|
||||
} // namespace LtsWidgets
|
||||
|
||||
Reference in new issue
Block a user