Skip to content

Commit

Permalink
pdf view fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisflesch committed Oct 2, 2018
1 parent 0fd08cf commit 6de6b63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions partielatormods/other/qpdfview.py
Expand Up @@ -82,6 +82,7 @@ def render(self):
foo = QLabel()
foo.setPixmap(pixmap)
self.addWidget(foo)
self.setAlignment(foo, QtCore.Qt.AlignCenter)

def clearLayout(layout):
"""Function to clear self (which is a layout) of all its child widgets"""
Expand Down Expand Up @@ -121,6 +122,7 @@ def repaint(self, width=1):
#add new QLabels to self (which is a layout)
for f in foo:
self.addWidget(f)
self.setAlignment(f, QtCore.Qt.AlignCenter)


def createPdf(self, filename):
Expand Down
6 changes: 3 additions & 3 deletions texamator.py
Expand Up @@ -1146,19 +1146,19 @@ def initiatePdf(self):
"""Creates the pdf Area and loads the help.pdf file into it"""
self.pdfScrollArea.setWidgetResizable(True)
self.pdfScrollBar = self.pdfScrollArea.verticalScrollBar()
w = int(self.settings["big_splitter_s2"])
w = int(self.settings["big_splitter_s2"])-1
self.pdfWidgetContainer = QtWidgets.QWidget()
self.pdfScrollArea.fun = self.repaintPdf
self.pdfScrollArea.setWidget(self.pdfWidgetContainer)
self.pdfWidgetContainer.setStyleSheet("background-color:white;")
self.pdfwidget = PDFWidget(None,parent=self.pdfWidgetContainer, width=w-1)
self.pdfwidget = PDFWidget(None, parent=self.pdfWidgetContainer, width=w-30)
#Initiate horizontal scroll bar to be notified when pdfscrollArea is shrinked
self.pdfScrollBarh = self.pdfScrollArea.horizontalScrollBar()


def repaintPdf(self):
#Recalculate size of the pdf and repaint
w = self.big_splitter.sizes()[1]-self.pdfScrollBar.width()-4
w = self.big_splitter.sizes()[1]-self.pdfScrollBar.width()-1
self.pdfwidget.repaint(w)


Expand Down

0 comments on commit 6de6b63

Please sign in to comment.