Compiling with Qt6

I’ve been trying to create a Kate plugin by following the tutorial: hxxps://develop.kde.org/docs/apps/kate/plugin/

It’s using KF5, so I replaced the “5” with “6” where appropriate.

Still, cmake fails with a cryptic error:

CMake Error at /usr/lib64/cmake/Qt6Core/Qt6CoreVersionlessTargets.cmake:42 (message):
  Some (but not all) targets in this export set were already defined.

  Targets Defined: Qt::Core

  Targets not yet defined: Qt::CorePrivate

More details here: hxxps://bugreports.qt.io/browse/QTBUG-118512

I tried installing qt5-qtbase-private-devel (Fedora 40), like suggested elsewhere, but this just gives another error:

qt_generate_foreign_qml_types() is only available in Qt 6.

Does anyone know how to fix this?

Does there exist a standalone example plugin that works with KF6? Maybe I converted the example wrong.

You can have a look at any built-in kate addons, they are just like regular plugin.

Don’t develop for Qt5, it is end of life and wouldn’t be compatible with current kate. (Can’t mix qt6 and qt6 code)

They are not like standalone plugins because they pull the entire Kate’s cmake build system, and my problem is precisely with cmake.

I mean, I could build a plugin as part of Kate, but I was hoping that I don’t have to build the entire thing.

Also, the original error has nothing to do with Qt5. I started out with Qt6.

So, how do I build a standalone plugin with Qt6?

You can’t have a standalone one, you need kateprivate link target which is well private to kate codebase.

If you don’t mind me asking, what would be your plugin use-case ?

I want the file to be synchronized with what’s on the screen. So basically, press “save” whenever something changes. Then I can use it instead of OpenSCAD’s builtin editor.

kate already notifies when file on-disk changes, and it offers then the option to reload automatically as it changes.

It seems you need the opposite, an continuous autosave. Am I understanding correctly ?
If so this does not need to be in a plugin, there are other usecases for it (qml editing…), and it would be hard or impossible to make it work in a plugin.

Continuous autosave, yes. Why would it be impossible? There’s the text change signal, and I have access to arbitrary code in the plugin, so I could even send out the document over the Internet if I wanted.

Also, the solution seems to be a cmake flag:

-DBUILD_WITH_QT6=ON

and the plugin definitely can be built standalone.

Why would it be impossible? There’s the text change signal, and I have access to arbitrary code in the plugin, so I could even send out the document over the Internet if I wanted.

I was mistaken.

We the use-case you have, I think it would make sense to offer it upstream and include it in kate.

I’m having trouble with Qt compilation. I’ve decided to humble myself and ask some better questions, on account’a I actually think it’ll be doable, and looks like a fun way to write apps/fix bugs.

<REDACTED BECAUSE I WAS BEING AN A**>

We expect you to be more constructive than this.

The tools for kde to alleviate most build issues is kde-builder (or kdesrc-build).
It has doc KDE Builder Documentation — KDE Builder documentation

@meven You know, thanks for the call-out. Funny enough, I am playing with kde-builder, beginning with the qt6-set. As far as basic “QtQuick” app development, do you recommend any other package I should begin with?

My biggest issues had been with Qt Creator and its designer brethren. So question two, (I use arch, btw) should I install that via pacman or the Qt online installer for the best chances of success? I made a good effort to clear out any lingering old installations.

Hey, thanks again, and sorry for my unruly post there. I get grumpy when outsmarted.

You can install Qt from your distro, Arch is sufficiently up-to-date. See: Building KDE software | Developer

@meven @Herzenschein Thank you both very much, I took the time, and properly configuring kde-builder has been an absolute game-changer.

My problem before was not being connected properly to the correct dependencies for a given project, I think even including QtCreator itself, hence the previous crashes. Anyone looking to fix such problems should take a pause and go through both articles in the couple-or-so posts above this.