Results 1 to 10 of 10

Thread: printer_pdf

  1. #1
    Join Date
    Nov 2011
    Location
    coimbatore
    Posts
    80
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default printer_pdf

    hi,
    i have created gui using qml....now i want to print this gui as pdf.....how can i do ...please help me....

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: printer_pdf

    Qt4 or Qt5?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2011
    Location
    coimbatore
    Posts
    80
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: printer_pdf

    thank you for your reply.....i am using Qt5

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: printer_pdf

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Nov 2011
    Location
    coimbatore
    Posts
    80
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: printer_pdf

    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

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: printer_pdf

    Are you using QtQuick 2 or QtQuick 1?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Nov 2011
    Location
    coimbatore
    Posts
    80
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: printer_pdf

    \
    i am using QtQuick 2

  8. #8
    Join Date
    Nov 2011
    Location
    coimbatore
    Posts
    80
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: printer_pdf

    Quote Originally Posted by ganeshgladish View Post
    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 want to print this hello.qml(gui) ...

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: printer_pdf

    Quote Originally Posted by ganeshgladish View Post
    \
    i am using QtQuick 2
    Then why is your object a QDeclarativeSomething? classes starting with QDeclarative are part of QtQuick 1.

    All you need to do is expose your object to QML using QQmlContext::setContextProperty()
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. #10
    Join Date
    Nov 2011
    Location
    coimbatore
    Posts
    80
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: printer_pdf

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.