2010-01-27 11:48:46 +01:00
|
|
|
import Qt 4.6
|
|
|
|
|
import Bauhaus 1.0
|
|
|
|
|
|
|
|
|
|
QToolButton {
|
2010-02-05 15:42:31 +10:00
|
|
|
id: extendedFunctionButton
|
2010-01-27 11:48:46 +01:00
|
|
|
|
|
|
|
|
property var backendValue
|
|
|
|
|
|
|
|
|
|
Script {
|
|
|
|
|
function setIcon() {
|
|
|
|
|
if (backendValue == null)
|
2010-02-05 15:42:31 +10:00
|
|
|
extendedFunctionButton.iconFromFile = "images/placeholder.png"
|
2010-01-27 11:48:46 +01:00
|
|
|
else if (backendValue.isBound) {
|
2010-02-05 15:42:31 +10:00
|
|
|
extendedFunctionButton.iconFromFile = "images/expression.png"
|
2010-01-27 11:48:46 +01:00
|
|
|
} else {
|
|
|
|
|
if (backendValue.complexNode != null && backendValue.complexNode.exists) {
|
2010-02-05 15:42:31 +10:00
|
|
|
extendedFunctionButton.iconFromFile = "images/behaivour.png"
|
2010-01-27 11:48:46 +01:00
|
|
|
} else {
|
2010-02-05 15:42:31 +10:00
|
|
|
extendedFunctionButton.iconFromFile = "images/placeholder.png"
|
2010-01-27 11:48:46 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onBackendValueChanged: {
|
|
|
|
|
setIcon();
|
|
|
|
|
}
|
2010-01-28 11:57:52 +01:00
|
|
|
property bool isBoundBackend: backendValue === undefinded ? false : backendValue.isBound;
|
2010-01-27 11:48:46 +01:00
|
|
|
|
|
|
|
|
onIsBoundBackendChanged: {
|
|
|
|
|
setIcon();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toolButtonStyle: "Qt::ToolButtonIconOnly"
|
|
|
|
|
popupMode: "QToolButton::InstantPopup";
|
|
|
|
|
property bool active: false;
|
|
|
|
|
|
|
|
|
|
iconFromFile: "images/placeholder.png";
|
|
|
|
|
width: 14;
|
|
|
|
|
height: 14;
|
|
|
|
|
focusPolicy: "Qt::NoFocus";
|
|
|
|
|
|
|
|
|
|
styleSheet: "*::down-arrow, *::menu-indicator { image: none; width: 0; height: 0; }";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMouseOverChanged: {
|
|
|
|
|
if (mouseOver) {
|
|
|
|
|
iconFromFile = "images/submenu.png";
|
|
|
|
|
} else {
|
|
|
|
|
setIcon();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onActiveChanged: {
|
|
|
|
|
if (active) {
|
|
|
|
|
setIcon();
|
|
|
|
|
opacity = 1;
|
|
|
|
|
} else {
|
|
|
|
|
opacity = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
actions: [
|
|
|
|
|
QAction {
|
|
|
|
|
text: "Reset";
|
|
|
|
|
onTriggered: {
|
|
|
|
|
backendValue.resetValue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
QAction {
|
|
|
|
|
text: "Set Expression";
|
|
|
|
|
onTriggered: {
|
2010-02-05 15:42:31 +10:00
|
|
|
expressionEdit.globalY = extendedFunctionButton.globalY;
|
|
|
|
|
expressionEdit.backendValue = extendedFunctionButton.backendValue
|
2010-01-27 11:48:46 +01:00
|
|
|
expressionEdit.show();
|
|
|
|
|
expressionEdit.raise();
|
|
|
|
|
expressionEdit.active = true;
|
|
|
|
|
}
|
2010-02-25 15:33:10 +01:00
|
|
|
}
|
2010-01-27 11:48:46 +01:00
|
|
|
]
|
|
|
|
|
}
|