Results 1 to 12 of 12

Thread: QStackedWidget fill Postscript image And scroll problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: QStackedWidget fill Postscript image And scroll problem

    Yes, and the code I've shown you should work just fine.
    Isn't SplashOutputDev the widget in which you are rendering the current pdf page?
    I assumed it was when I answered. Adding it to a scroll area and then adding the scroll area to the stacked widget will work.

    You will not need any additional layouts or anything else...

    Regards

  2. #2
    Join Date
    May 2006
    Posts
    788
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    49
    Thanked 48 Times in 46 Posts

    Default Re: QStackedWidget fill Postscript image And scroll problem

    Quote Originally Posted by marcel View Post
    Yes, and the code I've shown you should work just fine.
    Isn't SplashOutputDev the widget in which you are rendering the current pdf page?
    I assumed it was when I answered. Adding it to a scroll area and then adding the scroll area to the stacked widget will work.

    You will not need any additional layouts or anything else...

    Regards
    now is run tanks...

    Qt Code:
    1. public:
    2. QPdf(const QString pdf_file) {
    3.  
    4. setWindowTitle ( tr( "Pdf display.. file %1 " ).arg(pdf_file));
    5. pages = 0;
    6. spage = new QStackedWidget(this);
    7.  
    8. GString *ownerPW, *userPW;
    9. doc = new PDFDoc(new GString(pdf_file),ownerPW, userPW);
    10.  
    11. if (userPW) {
    12. delete userPW;
    13. }
    14. if (ownerPW) {
    15. delete ownerPW;
    16. }
    17. if (doc->isOk()) {
    18. qDebug() << "### doc->isOk() "<< doc->isOk();
    19. pages = doc->getNumPages();
    20. qDebug() << "### pages "<< pages;
    21.  
    22. for (int i=0;i<pages;i++) {
    23. int nowrender = i + 1; /* render page pdf nr. */
    24. qDebug() << "### page item "<< nowrender;
    25. QScrollArea *src = new QScrollArea(spage);
    26. SplashOutputDev *onepdf = new SplashOutputDev(src);
    27. /////onepdf->InPaint(doc->getBitmap(nowrender));
    28. onepdf->SetPage(nowrender,QSize(doc->getPageWidth(nowrender),doc->getPageHeight(nowrender)));
    29. src->setWidget(onepdf);
    30. onepdf->setMinimumHeight(doc->getPageHeight(nowrender) + 1);
    31. onepdf->setMinimumWidth(doc->getPageHeight(nowrender) + 50);
    32. src->setBackgroundRole(QPalette::Dark);
    33. spage->addWidget(src);
    34. }
    35.  
    36. spage->setCurrentIndex(0); /* jump first */
    37.  
    38. }
    39. setCentralWidget ( spage );
    40. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: QStackedWidget fill Postscript image And scroll problem

    Nice...
    Qt Code:
    1. onepdf->SetPage(nowrender,QSize(doc->getPageWidth(nowrender),doc->getPageHeight(nowrender)));
    2. src->setWidget(onepdf);
    3. onepdf->setMinimumHeight(doc->getPageHeight(nowrender) + 1);
    4. onepdf->setMinimumWidth(doc->getPageHeight(nowrender) + 50);
    5. src->setBackgroundRole(QPalette::Dark);
    To copy to clipboard, switch view to plain text mode 
    I thought that:
    Qt Code:
    1. onepdf->SetPage(nowrender,QSize(doc->getPageWidth(nowrender),doc->getPageHeight(nowrender)));
    To copy to clipboard, switch view to plain text mode 
    was already setting the size of onepdf.

    EDIT:
    Shouldn't you use:
    Qt Code:
    1. onepdf->setMinimumHeight(doc->getPageWidth(nowrender) + 1);
    2. onepdf->setMinimumWidth(doc->getPageHeight(nowrender) + 50);
    To copy to clipboard, switch view to plain text mode 
    You were setting page height for both minimum width and height.
    Regards
    Last edited by marcel; 22nd April 2007 at 09:38.

Similar Threads

  1. Big image, how to scroll to see it ?
    By probine in forum Qt Programming
    Replies: 1
    Last Post: 18th January 2007, 13:27
  2. Scroll large image in game
    By Morea in forum Qt Programming
    Replies: 2
    Last Post: 11th August 2006, 23:06

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.