ChatCrawlersearch across public Telegram Open the app
Q

Qt for Python (PySide/Shiboken)

14 January 2021
2021-01-14×
14 January 2021
Фотография
click to show
Hi, I'm trying to change PageMargins, but it doesn't work at all
I
No matters what value I set in QMargins, the output remains the same
id 370142589No matters what value I set in QMargins, the output remains the same
you, mean you change the margin, but the final document does not respect the new margins? Because at least the pageLayout reports the change: >>> printer = QPrinter() >>> printer.pageLayout() <PySide6.QtGui.QPageLayout("A4", Portrait, l:10 r:10 t:10 b:10 pt) at 0x7f3798f20bc0> >>> printer.setPageMargins(QMarginsF(1, 15, 15, 100)) True >>> printer.pageLayout() <PySide6.QtGui.QPageLayout("A4", Portrait, l:1 r:15 t:15 b:100 mm) at 0x7f3798f28dc0>
C
I guess the best would be to open a bug report on jira, with a minimal reproducible example
Фотография
click to show
% python Python 3.9.1 (default, Dec 13 2020, 11:55:53) [GCC 10.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from PySide2.QtWidgets import QApplication >>> app = QApplication() >>> from PySide2.QtPrintSupport import QPrinter >>> from PySide2.QtCore import QMarginsF >>> printer = QPrinter() >>> printer.pageLayout() <PySide2.QtGui.QPageLayout("A4", Portrait, l:10 r:10 t:10 b:10 pt) at 0x7f0c246820c0> >>> printer.setPageMargins(QMarginsF(1, 15, 15, 100)) True >>> printer.pageLayout() <PySide2.QtGui.QPageLayout("A4", Portrait, l:1 r:15 t:15 b:100 pt) at 0x7f0c246820c0> 🤷‍♂️
I'm using 5.15.2 on that last snippet
C
the problems are your values: >>> printer.setPageMargins(QMarginsF(100, 2000, 1, 1)) False
It doesn't matter the value I give it... it wont change, the output remains the same
I have tested for example 20, 20, 1, 1.. Same result
I'm using pyside2 5.15.2
setPageMargins returns False for me as well
C
can you just try the interactive python shell, so you take out of the picture some code of yours that has might be generating the issue?
C
if the problem persist, I recommend you to file a bug report, at least on linux I cannot reproduce
I
I'm on macOS Big Sur
C
it's late here, but tomorrow morning I can try on my mac and confirm I can reproduce, but still, better to open a bug report ;)
Фотография
click to show
It's a very very little project with just one window, so I just installed PySide6, replaced PySide2 occurrences and ran it again. Now the pagelayout changes, but the False remains and the margins in the output page as well
If I change the PageSize to A3 setPageMargins works and returns True.
It doesn't work in A4
I
Well, in fact, it works in all sizes I've tried but A4 😂
Calendar: January 2021
Archive by month
Open in Telegram Каталог площадок Искать в ChatCrawler

A snapshot of an open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · What we do not do · Remove a page · Catalog