Fix Qt6 API compatibility in LtsWidgets

- lts_date_time_edit_p.cpp: Replace QWheelEvent::delta() with angleDelta().y()
- lts_notification_box.cpp: Remove QStyleOption::init() call (removed in Qt6)
- lts_text_editor2.cpp: Remove QTextCodec include, use QString::fromUtf8 instead

All changes are Qt6 API compatibility fixes required for building with Qt 6.10.2.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
torstenandCopilot committed 2026-08-21 11:19:16 +02:00
1 parent 418443c841
commit 22a3a8d5b1
3 files changed
+2 -5

No files matched your search

@@ -101,7 +101,7 @@ void DigitsLineEdit::wheelEvent(QWheelEvent *event)
return;
event->accept();
int cursorPos = cursorPosition();
emit wheelEventReceived(event->delta() > 0, cursorPos);
emit wheelEventReceived(event->angleDelta().y() > 0, cursorPos);
}
void DigitsLineEdit::keyPressEvent(QKeyEvent *event)
@@ -172,7 +172,6 @@ void LtsNotificationBox::message(const QString &title, const QString &text, Mess
void LtsNotificationBox::paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
@@ -21,7 +21,6 @@
#include <QFontDatabase>
#include <QMenu>
#include <QMenuBar>
#include <QTextCodec>
#include <QTextEdit>
#include <QStatusBar>
#include <QToolBar>
@@ -439,8 +438,7 @@ bool LtsTextEditor2::load(const QString &f)
return false;
QByteArray data = file.readAll();
QTextCodec *codec = Qt::codecForHtml(data);
QString str = codec->toUnicode(data);
QString str = QString::fromUtf8(data);
if (Qt::mightBeRichText(str)) {
QUrl baseUrl = (f.front() == QLatin1Char(':') ? QUrl(f) : QUrl::fromLocalFile(f)).adjusted(QUrl::RemoveFilename);
m_textEdit->document()->setBaseUrl(baseUrl);