Commit b6ab9815 authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

Kate compiles with Qt6

parent 5a49ff4d
Pipeline #153636 passed with stage
in 2 minutes and 20 seconds
......@@ -136,18 +136,19 @@ bool KateStashManager::popDocument(KTextEditor::Document *doc, const KConfigGrou
if (checksumOk) {
// open file with stashed content
QFile file(stashedFile);
file.open(QIODevice::ReadOnly);
QTextStream out(&file);
QFile input(stashedFile);
input.open(QIODevice::ReadOnly);
const auto codec = QTextCodec::codecForName(kconfig.readEntry("Encoding").toLocal8Bit());
if (codec != nullptr) {
out.setCodec(codec);
}
QString text = codec ? codec->toUnicode(input.readAll()) : QString::fromLocal8Bit(input.readAll());
// normalize line endings, to e.g. catch issues with \r\n on Windows
text.replace(QRegularExpression(QStringLiteral("\r\n?")), QStringLiteral("\n"));
doc->setText(out.readAll());
doc->setText(text);
// clean stashed file
if (!file.remove()) {
if (!input.remove()) {
qCWarning(LOG_KATE) << "Could not remove stash file" << stashedFile;
}
......
......@@ -1119,7 +1119,7 @@ void KateViewManager::restoreViewConfiguration(const KConfigGroup &config)
if (lastViewSpace > m_viewSpaceList.size()) {
lastViewSpace = 0;
}
if (lastViewSpace >= 0 && lastViewSpace < m_viewSpaceList.size()) {
if (lastViewSpace < m_viewSpaceList.size()) {
setActiveSpace(m_viewSpaceList.at(lastViewSpace));
// activate correct view (wish #195435, #188764)
activateView(m_viewSpaceList.at(lastViewSpace)->currentView());
......
......@@ -70,11 +70,13 @@ int main(int argc, char **argv)
*/
Q_INIT_RESOURCE(kate);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
/**
* enable high dpi support
*/
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
#endif
/**
* allow fractional scaling
......
......@@ -204,7 +204,7 @@ public:
QTextCharFormat gray;
gray.setForeground(Qt::gray);
gray.setFontPointSize(options.font.pointSize() - 1);
formats.append({nameLen + space, path.length(), gray});
formats.append({nameLen + space, static_cast<int>(path.length()), gray});
formats.append(pathFormats);
painter->save();
......
......@@ -57,6 +57,7 @@ extern "C" Q_DECL_EXPORT int main(int argc, char **argv)
}
}
#endif
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
/**
* enable high dpi support
......@@ -64,6 +65,7 @@ extern "C" Q_DECL_EXPORT int main(int argc, char **argv)
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
#endif
/**
* allow fractional scaling
* we only activate this on Windows, it seems to creates problems on unices
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment