Warning, /kdevelop/kdevelop/plugins/qmljs/navigation/propertywidgets/README is written in an unsupported language. File is not indexed.
0001 This folder contains the implementations for the "edit a property with a slider-style" widgets 0002 which show up when you move the cursor over certain properties in a QML document. 0003 When creating a new widget, you MUST: 0004 * create a new QML file in this folder, named like whatever you want 0005 * add that file with the property name you want to support to propertypreviewwidget.cpp::constructIfPossible 0006 (it's okay to redirect multiple properties to the same file) 0007 * implement the widget in QML, where you MUST 0008 - add a "property string value" property to your root widget, which will 0009 be set to the value the widget should start with during initialization 0010 (but after the component completes loading, so you have to listen for changes on it) 0011 - add a signal with signature "signal valueChanged(string newValue)" to your root widget 0012 - specify a width and height for your root widget, in pixels. 0013 You usually do the following in your widget then: 0014 * If it's a slider based widget, just copy one of the examples, e.g. Distance.qml and edit it. 0015 For sliders, you MUST have two functions 0016 function sliderToValue(slider) { 0017 return slider; 0018 } 0019 function valueToSlider(value) { 0020 return value; 0021 } 0022 defined in your root widget, which convert the slider value (0-96) to the value you want in the text document 0023 and vice versa (so sliderToValue ° valueToSlider must be identity if you don't want your slider to jump) 0024 If the widget is slider based, the valueChanged signal you defined will be emitted automatically by the Slider class. 0025 * Otherwise, do whatever you like, just call valueChanged(text) when you want to update the text in the document. 0026 The text will be set directly to whatever you pass to that signal, without any checks done. 0027 0028 Widgets only displaying stuff are fine too, see e.g. FontFamily.qml. 0029 Such a "read-only" widget must still have a value property and a valueChanged signal defined! 0030 0031 Although it might seem obvious, you do not have to restart KDevelop to test these widgets, just running "make install" 0032 and re-opening the widget is enough. You can even specify the path to your kdev-qml/navigation/propertywidgets folder 0033 in the propertypreviewwidget class temporarily (instead of the one determined by kstandarddirs), then you can 0034 test without re-running installation.