[Qt-creator] R.I.P. for QPlainTextEdit in Qr Creator 17?

apoenitz apoenitz at t-online.de
Thu Jun 19 22:51:53 CEST 2025


Hi.

On Wed, Jun 18, 2025 at 06:05:08PM +0200, Henry Skoglund wrote:
> Hi, just updated to Qt Creator 17 and it looks good, however when rebuilding
> my Qt Creator plugin I got stuck for a bit with this failing:
> 
>   auto pe =
> qobject_cast<QPlainTextEdit*>(EditorManager::currentEditor()->widget());
> 
> For almost 15 years that statement served me well and it allowed for example
> setting a fatter cursor at Qt Creator start (useful on 4K screens) but
> today, it returns a nullptr :-(
> 
> 
> Instead, the new incantation for Qt Creator 17 (and onwards?) seems to be:
> 
>   auto pe = qobject_cast<Utils::PlainTextEdit*>(EditorManager::currentEditor()->widget());
> 
> After that fix, it's smooth sailing (Utils::PlainTextEdit behaves 100%
> compatible with QPlainTextEdit).
> 
> But if there was a bit of documentation of this new class in the Utils::
> Namespace I would be even more happy!

Sorry to hear that this bit you.

I guess nobody expected that some plugin out there had a hard dependency
on Editor::widget() being in fact a QPlainTextEdit for text editors.

The fact that Utils::PlainTextEdit behaves like QPlainTextEdit is not
quite an accident, the idea is add a few features and try to upstream
it to Qt proper again. For this to happen it has to stay compatible.

In case this upstreaming will be  successful there's a good chance that
Utils::PlainTextEdit will vanish again. But then there'll hopefully
be a more communication.

> Rgrds Henry

Regards,
Andre'


More information about the Qt-creator mailing list