If I do this:
main.qml
import QtQuick 1.1
import ManagementButtonLib 1.0
Rectangle {
width: 800
height: 600
MouseArea {
anchors.fill: parent
property variant previousPosition
onPressed: {
previousPosition = Qt.point(mouseX, mouseY)
}
onPositionChanged: {
if (pressedButtons == Qt.LeftButton) {
var dx = mouseX - previousPosition.x
var dy = mouseY - previousPosition.y
viewerWidget.pos = Qt.point(viewerWidget.pos.x + dx,
viewerWidget.pos.y + dy)
}
}
}
Rectangle {
id: viewArea
color: "#606060"
anchors.fill: parent
border.width: 1
border.color: "#000000"
transformOrigin: Item.Center
anchors.rightMargin: 1
anchors.bottomMargin: 1
ManagementButton
{
ManagementButton2{}
anchors.top: parent.top
anchors.topMargin: 6
anchors.right: parent.right
anchors.rightMargin: 6
}
}
}
and this in ManagementButton.cpp:
#include "ManagementButton.h"
ManagementButton::ManagementButton(QDeclarativeItem *parent) : QDeclarativeItem(parent)
{
setCursor(Qt::PointingHandCursor);
setProperty("height", 30);
setProperty("width", 30);
}
ManagementButton::~ManagementButton(){
}
mousearea work fine, but I need to connect with the possibilities of the form QML of C++. I want to make the item which you can use to choose the image transfer, and of the other properties will be issued automatically. What am I doing wrong? Information and there is no such example.
↧