diff --git a/liteidex/src/plugins/golangpackage/gotool.cpp b/liteidex/src/plugins/golangpackage/gotool.cpp index 8c012e7fd..ff4d8eb44 100644 --- a/liteidex/src/plugins/golangpackage/gotool.cpp +++ b/liteidex/src/plugins/golangpackage/gotool.cpp @@ -45,8 +45,13 @@ GoTool::GoTool(LiteApi::IApplication *app, QObject *parent) : m_process = new Process(this); connect(m_process,SIGNAL(readyReadStandardError()),this,SLOT(readError())); connect(m_process,SIGNAL(readyReadStandardOutput()),this,SLOT(readOutput())); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + connect(m_process, &QProcess::errorOccurred, this, &GoTool::error); + connect(m_process, &QProcess::finished, this, &GoTool::finished); +#else connect(m_process,SIGNAL(errorOccurred(QProcess::ProcessError)),this,SIGNAL(error(QProcess::ProcessError))); connect(m_process,SIGNAL(finished(int,QProcess::ExitStatus)),this,SIGNAL(finished(int,QProcess::ExitStatus))); +#endif } GoTool::~GoTool() diff --git a/liteidex/src/plugins/golangpackage/packagebrowser.cpp b/liteidex/src/plugins/golangpackage/packagebrowser.cpp index 4c10ed5af..1bdf34b1a 100644 --- a/liteidex/src/plugins/golangpackage/packagebrowser.cpp +++ b/liteidex/src/plugins/golangpackage/packagebrowser.cpp @@ -119,7 +119,11 @@ PackageBrowser::PackageBrowser(LiteApi::IApplication *app, QObject *parent) : m_toolWindowAct = m_liteApp->toolWindowManager()->addToolWindow(Qt::LeftDockWidgetArea,m_widget,"GoPackageBrowser",tr("Go Package Browser"),true); connect(m_toolWindowAct,SIGNAL(triggered(bool)),this,SLOT(toggledToolWindow(bool))); connect(m_goTool,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(finished(int,QProcess::ExitStatus))); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + connect(m_goTool, &GoTool::error, this, &PackageBrowser::error); +#else connect(m_goTool,SIGNAL(error(QProcess::ProcessError)),this,SLOT(error(QProcess::ProcessError))); +#endif connect(m_treeView,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(customContextMenuRequested(QPoint))); connect(m_treeView,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(doubleClicked())); connect(m_treeView,SIGNAL(enterKeyPressed(QModelIndex)),this,SLOT(enterKeyPressed(QModelIndex))); diff --git a/liteidex/src/utils/vterm/vtermwidget.cpp b/liteidex/src/utils/vterm/vtermwidget.cpp index d81735c77..271bca9e2 100644 --- a/liteidex/src/utils/vterm/vtermwidget.cpp +++ b/liteidex/src/utils/vterm/vtermwidget.cpp @@ -183,6 +183,16 @@ void VTermWidget::keyPressEvent(QKeyEvent *e) return; } if ((e->modifiers() & TermControlModifier) ) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + // Qt key codes for special keys (arrows, function keys, ...) are + // outside the UTF-16 range and must not be converted to QChar. + const int key = e->key(); + if (key >= Qt::Key_A && key <= Qt::Key_Underscore) { + QByteArray array(1, char(key - Qt::Key_A + 1)); + m_process->write(array); + return; + } +#else QChar c(e->key()); char asciiVal = c.toUpper().toLatin1(); QByteArray array; @@ -191,6 +201,7 @@ void VTermWidget::keyPressEvent(QKeyEvent *e) m_process->write(array); return; } +#endif } VTermWidgetBase::keyPressEvent(e); } diff --git a/liteidex/src/utils/vterm/vtermwidgetbase.cpp b/liteidex/src/utils/vterm/vtermwidgetbase.cpp index bb3a52a2f..27ea4fe64 100644 --- a/liteidex/src/utils/vterm/vtermwidgetbase.cpp +++ b/liteidex/src/utils/vterm/vtermwidgetbase.cpp @@ -58,6 +58,21 @@ bool attrs_is_equal(VTermScreenCellAttrs *a, VTermScreenCellAttrs *b) return a->bold == b->bold && a->italic == b->italic && a->strike == b->strike && a->underline == b->underline; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +static bool is_valid_cell_char(const VTermScreenCell &cell) +{ + if (cell.chars[0] == 0 || cell.chars[0] == static_cast(-1)) { + return false; + } + for (int i = 0; i < VTERM_MAX_CHARS_PER_CELL && cell.chars[i]; ++i) { + if (cell.chars[i] == static_cast(-1) || cell.chars[i] > 0x10ffff) { + return false; + } + } + return true; +} +#endif + int vterm_damage(VTermRect rect, void *user) { @@ -889,18 +904,30 @@ void VTermWidgetBase::setSelectionUnderWord(int row, int col) } VTermScreenCell cell; this->adjustFetchCell(row,&col,&cell); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if (!is_valid_cell_char(cell)) { +#else if (!cell.chars[0]) { +#endif int ncol = col+1; for (; ncol < m_cols; ++ncol) { this->fetchCell(row,ncol,&cell); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if (is_valid_cell_char(cell)) { +#else if (cell.chars[0]) { +#endif break; } } int pcol = col-1; for (;pcol >= 0;--pcol) { this->fetchCell(row,pcol,&cell); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if (is_valid_cell_char(cell)) { +#else if (cell.chars[0]) { +#endif break; } } @@ -911,7 +938,11 @@ void VTermWidgetBase::setSelectionUnderWord(int row, int col) int ncol = col+width; for (; ncol < m_cols;) { this->fetchCell(row,ncol,&cell); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if (!is_valid_cell_char(cell)) { +#else if (!cell.chars[0]) { +#endif break; } QChar c = QString::fromUcs4(cell.chars)[0]; @@ -925,7 +956,11 @@ void VTermWidgetBase::setSelectionUnderWord(int row, int col) int pcol = col-1; for (; pcol >= 0;--pcol) { this->adjustFetchCell(row,&pcol,&cell); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if (!is_valid_cell_char(cell)) { +#else if (!cell.chars[0]) { +#endif break; } QChar c = QString::fromUcs4(cell.chars)[0];