0

Back there, in QtQuick.Controls 1.2 there was a TextField component which (through some arcane magic of inheritance and private implementation details) possessed an EditMenu component which in turn somehow provides the default editing menu on right-click like Copy, Paste etc. The menu itself is not exactly pretty-looking and also styled like for touch screens, but at least it is there to begin with.

Now, how do I get that default context menu using QtQuick.Controls 2.x?

Some suggested me that "adding three menu items isn't that hard" — that's not the answer I'm looking for. I'd rather expect some kind of QQC2.TextFieldWithDefaultMenu component be available out there, but I can't seem to find any in the Qt/KDE/Plasma/Kirigami frameworks.

ratijas
  • 704
  • 7
  • 14
  • There is no _default_ context menu in `TextEdit` item or whatever. And this is quite reasonable - it just can not be necessary, and it will not be difficult to make your own menu. You can take the [TextEditor](https://doc.qt.io/qt-5/qtquickcontrols-texteditor-example.html) as example from the QML sample projects. – folibis May 08 '20 at 15:21
  • @folibis Please, elaborate on "can not be necessary". I fail to see any reason where you would want a text field without a menu. Assuming desktop environment. – ratijas May 08 '20 at 16:51
  • Tablet without left mouse button, any mobile devices, some custom menu ... whatever. The application I've recently worked on had some custom circle menu. 90% of developers will want no doubt to add custom menu items. So IMHO default menu is almost useless. – folibis May 08 '20 at 17:31
  • @folibis Making such an architecture that allows extending or even replacing all of the menu items would be good, for sure. But not having it at all? It like saying lets not having text on a button, because you might want to customize it with a red rect / whatever. – ratijas May 08 '20 at 22:43
  • Also, slightly separate builds are needed for mobile and desktop. It never "builds once, works everywhere" anyway without UX adjustments. – ratijas May 08 '20 at 22:55
  • Ok, I've just suggested a solution and said that makes sense, nothing more. I'n not Qt developer so you're trying in vain to convince me =) – folibis May 09 '20 at 10:15

0 Answers0