hi,
i have created gui using qml....now i want to print this gui as pdf.....how can i do ...please help me....
hi,
i have created gui using qml....now i want to print this gui as pdf.....how can i do ...please help me....
thank you for your reply.....i am using Qt5
It might be a good idea to update your user profile here as it suggests you are usin Qt4 and Qt/Embedded.
Anyways.... QQuickWindow::grabWindow() is your friend.
i have hello.qml gui
like,
Rectangle{
id:gui
width:100
height:100
color:“redâ€
Text{
id:text
text:“Hello Worldâ€
font.bold:true
anchors.centerinarent
} MouseArea{ anchors.fill: parent onClicked: myObject.print_pdf(); }
}
i have created Qdeclarative view for sending data to c++ function..
please see the mousearea function i have created onclicked finction,
in this onclicked function i want to send hello.qml to c++(print_pdf() function) …this function is in c++)
note: this myObject is Qdeclarative element name
my question is in this onclicked function how to send this hellow.qml to print_pdf function
\
i am using QtQuick 2
sorry wysota,
i am using QQuickView not declarative view...
this is my main.cpp ..
#include<QApplication>
#include"database.h"
#include<QCalendarWidget>
#include<QMetaObject>
#include"retrieve.h"
#include <QQuickView>
#include <QQmlContext>
#include <QGuiApplication>
user_list database_ret;
#include <QGuiApplication>
#include <QQuickView>
#include <QQmlEngine>
#include <QApplication>
int main(int argc, char* argv[])
{
QApplication app(argc,argv);
mainwindow window;
QQuickView * view1= new QQuickView();
view1->setResizeMode(QQuickView::SizeRootObjectToView) ;
view1->rootContext()->setContextProperty("myObject", &window);
view1->setSource(QUrl("hello.qml"));
view1->showFullScreen();
return app.exec();
}
Bookmarks