Skip to content

Instantly share code, notes, and snippets.

View bibinding.cpp
#include "bibinding.h"
#include <QDebug>
QQmlProperty BiBinding::source() const
{
return m_source;
}
void BiBinding::setSource(const QQmlProperty& source)
{
View Rect.qml
Rect {
radius: Math.min(width, height) / 2
}
View FadeBehavior.qml
import QtQuick 2.15
import QtQml 2.15
Behavior {
id: root
property QtObject fadeTarget: targetProperty.object
property string fadeProperty: "scale"
property int fadeDuration: 150
property string easingType: "Quad"
View DebounceBinding.qml
import QtQuick 2.9
Binding {
id: root
property int delay: 500
property alias value: root._delayedValue
property alias _actualValue: root.value
property var _delayedValue
View DragScrollHelper.qml
import QtQuick 2.7
Item {
id: root
property Flickable flickable: parent
anchors.fill: parent
property MouseArea mouseArea
readonly property bool active: flickable && (mouseArea ? mouseArea.drag.active : false)
View gist:9a78c74808b8a652d17ce3ba98e09cf4
import QtQuick 2.0
SequentialAnimation {
id: root
property QtObject target
property string fadeProperty: "opacity"
property int fadeDuration: 150
property alias outValue: outAnimation.to
property alias inValue: inAnimation.to
property alias outEasingType: outAnimation.easing.type
View ReorderDelegate.qml
import QtQuick 2.0
MouseArea {
id: root
property Item draggedParent: parent ? parent.parent || parent : null
property var modelIndex: typeof model !== "undefined" ? model.index : undefined
signal move(int from, int to)
property bool dropEnabled: true
property bool dropBlocked: false
View TextRectangle.qml
import QtQuick 2.7
Rectangle {
property alias textItem: textItem
property alias text: textItem.text
property alias textColor: textItem.color
property alias maxWidth: textItem.width
property alias maxHeight: textItem.height
View SnappingScrollBar.qml
import QtQuick.Controls 2.0
import QtQuick 2.7
import QtQml 2.2
ScrollBar {
id: scrollBar
property ListView listView: parent
stepSize: 1 / listView.count
property real effectiveStep: stepSize * (1 - 0)
size: listView.visibleArea.heightRatio