Designing your own quick control with some extra property and function
-
there is source code of qt quick control Module in it there are AbstractButton and Control. I added my some extra property in it and rebuild it, it works fine but if i design new class mybutton deriving qquickbutton and recompile the plugin it fails to visualize in qt app and gives error of not known type .is it good idea to design your own quick control? and how can i make that module to binary compatible for future version?
-
Depends on what properties are we talking about. If you want add simple QML property, then best way is to use Quick Templates.
-
You can chnage button appearance and behavior by extending button:
// MyButton.qml import QtQuick.Controls 2.12 Button { id: control /* Override or add parameters here */ }
Then you can use your button like
MyButton
instead ofButton
. Of course it will inherit everything that QQuickButton have. If you don't like default styles and settings for controls you can use templates:// MyButton.qml import QtQuick.Templates 2.12 as T T.AbstractButton { id: control /* Override or add parameters here */ }
This will also inherit all that QQuickButton have.