Results 1 to 5 of 5

Thread: Need help, i want know how i mus do to see in main window piece of paper

  1. #1

    Default Need help, i want know how i mus do to see in main window piece of paper

    Need help, i want know how i mus do to see in main window piece of paper like in office word

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Need help, i want know how i mus do to see in main window piece of paper

    It is hard to understand what you are asking. Microsoft Office does not display "paper", it displays the formatted contents of documents. Maybe the Text Edit example from the Qt distribution might give you some help. If you want to display the image of a page you have scanned into your computer, then the Image Viewer example might be helpful.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Need help, i want know how i mus do to see in main window piece of paper

    If it is a matter of one single paper (as you call it so), put the paper widget in a layout and set the layout margins accordingly.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  4. #4

    Default Re: Need help, i want know how i mus do to see in main window piece of paper

    I would like it to look exactly like in the microsoft word
    when the end of the card and the other is starting, I do not know how to write such leyout with margins

  5. #5
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Need help, i want know how i mus do to see in main window piece of paper

    Here is an example
    Screen Shot 2017-06-30 at 12.17.21 PM.png
    Qt Code:
    1. #include <QtWidgets>
    2.  
    3. class PageLayout : public QWidget
    4. {
    5. public:
    6. explicit PageLayout(QWidget * parent = 0)
    7. : QWidget(parent)
    8. , mLayout(new QGridLayout(this))
    9. {
    10. QPalette pal = palette();
    11. pal.setColor(QPalette::Background, Qt::darkGray);
    12. setPalette(pal);
    13. setAutoFillBackground(true);
    14. mLayout->setMargin(20);
    15. mLayout->setSpacing(20);
    16. }
    17.  
    18. void addPage(QWidget * page)
    19. {
    20. page->setAutoFillBackground(true);
    21. page->setFixedSize(QSize(100, 100));
    22. mLayout->rowCount();
    23. mLayout->addWidget(page, mLayout->rowCount() + 1, 0, 1, 1, Qt::AlignCenter);
    24. }
    25.  
    26. private:
    27. QGridLayout * const mLayout;
    28. };
    29.  
    30. int main(int argc, char *argv[])
    31. {
    32. QApplication a(argc, argv);
    33.  
    34. PageLayout layout;
    35. layout.addPage(new QLabel("Page 1"));
    36. layout.addPage(new QLabel("Page 2"));
    37. layout.addPage(new QLabel("Page 3"));
    38. layout.addPage(new QLabel("Page 4"));
    39. layout.show();
    40.  
    41. return a.exec();
    42. }
    To copy to clipboard, switch view to plain text mode 
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. Replies: 3
    Last Post: 8th April 2011, 19:55
  2. Replies: 2
    Last Post: 17th February 2011, 12:30
  3. Replies: 9
    Last Post: 16th May 2010, 16:21
  4. Replies: 11
    Last Post: 11th August 2008, 09:14
  5. Replies: 15
    Last Post: 23rd March 2007, 16:16

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.