Commit cbdfd557 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some qt6 compile error

parent 22c9ddda
Pipeline #153426 failed with stage
in 31 seconds
......@@ -270,7 +270,11 @@ protected:
return QTextBrowser::showEvent(event);
}
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void enterEvent(QEvent *event) override
#else
void enterEvent(QEnterEvent *event) override
#endif
{
m_inContextMenu = false;
m_hideTimer.stop();
......
......@@ -161,7 +161,11 @@ QString CTagsKinds::findKind(const char *kindChar, const QString &extension)
return QString();
}
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QString CTagsKinds::findKindNoi18n(const char *kindChar, const QStringRef &extension)
#else
QString CTagsKinds::findKindNoi18n(const char *kindChar, const QStringView &extension)
#endif
{
if (kindChar == nullptr || extension.isEmpty()) {
return QString();
......
......@@ -15,7 +15,11 @@ class CTagsKinds
{
public:
static QString findKind(const char *kindChar, const QString &extension);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
static QString findKindNoi18n(const char *kindChar, const QStringRef &extension);
#else
static QString findKindNoi18n(const char *kindChar, const QStringView &extension);
#endif
};
#endif
......@@ -213,7 +213,7 @@ void KateCTagsConfigPage::updateGlobalDB()
targets += QLatin1Char('\"') + target + QLatin1String("\" ");
}
QString file = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1String("/katectags");
QString file = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + QLatin1String("/katectags");
QDir().mkpath(file);
file += QLatin1String("/common_db");
......
......@@ -158,7 +158,7 @@ KateCTagsView::KateCTagsView(KTextEditor::Plugin *plugin, KTextEditor::MainWindo
m_mWin->guiFactory()->addClient(this);
m_commonDB = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1String("/katectags/common_db");
m_commonDB = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + QLatin1String("/katectags/common_db");
}
/******************************************************************/
......@@ -526,7 +526,7 @@ void KateCTagsView::updateSessionDB()
targets += QLatin1Char('\"') + target + QLatin1String("\" ");
}
QString pluginFolder = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1String("/katectags");
QString pluginFolder = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + QLatin1String("/katectags");
QDir().mkpath(pluginFolder);
if (m_ctagsUi.tagsFile->text().isEmpty()) {
......
......@@ -83,7 +83,7 @@ unsigned int Tags::numberOfMatches(const QString &tagpart, bool partial)
Tags::TagList Tags::getPartialMatchesNoi8n(const QString &tagFile, const QString &tagpart)
{
setTagsFile(tagFile);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
auto getExtension = [](const QString &fileUrl) -> QStringRef {
int dotPos = fileUrl.lastIndexOf(QLatin1Char('.'));
if (dotPos > -1) {
......@@ -91,7 +91,15 @@ Tags::TagList Tags::getPartialMatchesNoi8n(const QString &tagFile, const QString
}
return QStringRef();
};
#else
auto getExtension = [](const QString &fileUrl) -> QStringView {
int dotPos = fileUrl.lastIndexOf(QLatin1Char('.'));
if (dotPos > -1) {
return QStringView(fileUrl).mid(dotPos + 1);
}
return QStringView();
};
#endif
Tags::TagList list;
if (tagpart.isEmpty()) {
......
......@@ -2833,10 +2833,10 @@ public:
m_triggerRename->setEnabled(renameEnabled);
}
if (m_complDocOn) {
m_complDocOn->setEnabled(server);
m_complDocOn->setEnabled(!server.isNull());
}
if (m_restartServer) {
m_restartServer->setEnabled(server);
m_restartServer->setEnabled(!server.isNull());
}
if (m_requestCodeAction) {
m_requestCodeAction->setEnabled(codeActionEnabled);
......
......@@ -204,8 +204,11 @@ public:
}
protected:
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void enterEvent(QEvent *event) override
#else
void enterEvent(QEnterEvent *event) override
#endif
{
inContextMenu = false;
m_hideTimer.stop();
......
......@@ -1045,7 +1045,11 @@ protected:
QWidget::leaveEvent(e);
}
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void enterEvent(QEvent *e) override
#else
void enterEvent(QEnterEvent *e) override
#endif
{
m_fullPathHideTimer.stop();
QWidget::leaveEvent(e);
......
......@@ -56,13 +56,13 @@ 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
*/
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