Hello,
I want t use Qt/c++ layouts with my personalized widget (that I’ve created using ‘ Qt quick ‘) but I didn’t know how to realize this(in my case I want insert a picture and a button at the center of the home page).
here is the ‘ main.cpp ‘:
#include <QGuiApplication>
#include <QQuickView>
int main(int argc, char** argv)
{
QGuiApplication app(argc, argv);
QQuickView view;
view.resize(800, 480);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:///main.qml"));
view.show();
return app.exec();
}
main.qml
import QtQuick 2.0
Rectangle {
color: "#ffffff"
}
button.qml
import QtQuick 2.0
Rectangle {
width: 200
height: 50
radius: 14
border.width: 6
border.color: "#e67739"
gradient: Gradient {
GradientStop {
position: 0
color: "#e8d84a"
}
GradientStop {
position: 1
color: "#ffffff"
}
GradientStop {
position: 0.391
color: "#eade70"
}
}
Text {
anchors.centerIn: parent
text: "Enter"
}
}
Thanks in advance.
↧