Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. not able to get selection of pdf document
Forum Updated to NodeBB v4.3 + New Features

not able to get selection of pdf document

Scheduled Pinned Locked Moved Unsolved Qt for Python
qt for python
2 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    heinz_mueller
    wrote on last edited by
    #1

    When using getAllText I get a valid QPdfSelection.

    pdf_view: QPdfView = main_window.ui.pdfView
    document: QPdfDocument = pdf_view.document()
    current_page: int = pdf_view.pageNavigator().currentPage()
    
    selection: QPdfSelection = document.getAllText(current_page)
    print(selection.isValid())
    # True
    print(selection.boundingRectangle())
    # PySide6.QtCore.QRectF(73.000000, 118.000000, 450.000000, 682.000000)
    print(selection.text())
    # some text ...
    

    But when trying to use getSelection (even with the QPointFs of the boundingRectagle above) I get an invalid selection with a QRectF with all its values set to 0.

    What do I'm missing?

    top_left: QPointF = selection.boundingRectangle().topLeft()
    bottom_right: QPointF = selection.boundingRectangle().bottomRight()
    selection: QPdfSelection = document.getSelection(current_page, top_left, bottom_right)
    print(selection.isValid(), selection.boundingRectangle())
    print(selection.isValid())
    # False
    print(selection.boundingRectangle())
    # False PySide6.QtCore.QRectF(0.000000, 0.000000, 0.000000, 0.000000)
    
    1 Reply Last reply
    0
    • F Offline
      F Offline
      friedemannkleint
      wrote on last edited by
      #2

      The QPdfView widget text selection functionality is currently not completely implemented or has bugs, see for example https://bugreports.qt.io/browse/QTBUG-131443 .

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved