2

Here in this tutorial a custom control named PieChart has been created by extending <QtQuick/QQuickItem> But I need to extend QQuickTextEdit I tried to find it but it seems QQuickTextEdit class is not available in in Qt framework. So I'm not able to extend it. Where could I find it?

How Can I extend a particular qt quick control (such as TextArea or TextBlock) in c++?

a.toraby
  • 3,232
  • 5
  • 41
  • 73
  • 1
    QQuickTextEdit is defined in `./qtdeclarative/src/quick/items/qquicktextedit_p_p.h`, `./qtdeclarative/src/quick/items/qquicktextedit.cpp`, `./qtdeclarative/src/quick/items/qquicktextedit_p.h`. As the suffix `_p` indicates, its header is private, so it is not intended to be used from C++. You can extend it in QML. What is your goal? – Simon Warta Feb 14 '16 at 14:50
  • @SimonWarta thanks for your comment. I need to extend it as a terminal console. I want to develop it in c++ because all functions and key input handlers are already developed for `QPlainTextEdit`. I do not want to rewrite all of them in `qml`. – a.toraby Feb 15 '16 at 06:01
  • So the way to go is probably to use [Keys.pressed()](https://doc.qt.io/qt-5/qml-qtquick-keys.html#pressed-signal) to capture a key event and call a C++ function from there. This function can handle the logic in an abstract way and send signals, which the Qt Widgets version can use as well as the QML version. – Simon Warta Feb 16 '16 at 19:46

0 Answers0