Implement a PDF Viewer Dialog

This is based on the example in pyside6 changed to use a QDialog and
not a QMainWindow.  The MenuBar is gone, the Status Bar is gone.
This commit is contained in:
Christopher T. Johnson
2025-02-20 10:09:32 -05:00
parent 50b14562fc
commit 9f1c54c1e7
16 changed files with 4040 additions and 21 deletions

227
ui/pdfViewer.ui Normal file
View File

@@ -0,0 +1,227 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>pdfViewer</class>
<widget class="QDialog" name="pdfViewer">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>513</height>
</rect>
</property>
<property name="windowTitle">
<string>PDF Viewer</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QToolBar" name="mainToolBar">
<addaction name="actionZoom_Out"/>
<addaction name="actionZoom_In"/>
<addaction name="separator"/>
<addaction name="actionBack"/>
<addaction name="actionForward"/>
<addaction name="actionPrevious_Page"/>
<addaction name="actionNext_Page"/>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="tabPosition">
<enum>QTabWidget::TabPosition::West</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="bookmarkTab">
<attribute name="title">
<string>Bookmarks</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="QTreeView" name="bookmarkView">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pagesTab">
<attribute name="title">
<string>Pages</string>
</attribute>
</widget>
</widget>
<widget class="QPdfView" name="pdfView" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>10</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
<action name="actionZoom_In">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::ZoomIn"/>
</property>
<property name="text">
<string>Zoom In</string>
</property>
<property name="toolTip">
<string>Zoom In</string>
</property>
<property name="shortcut">
<string>Ctrl+=</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionZoom_Out">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::ZoomOut"/>
</property>
<property name="text">
<string>Zoom Out</string>
</property>
<property name="shortcut">
<string>Ctrl+-</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionPrevious_Page">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/images/go-previous-view-page.svgz</normaloff>:/icons/images/go-previous-view-page.svgz</iconset>
</property>
<property name="text">
<string>Previous Page</string>
</property>
<property name="shortcut">
<string>PgUp</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionNext_Page">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/images/go-next-view-page.svgz</normaloff>:/icons/images/go-next-view-page.svgz</iconset>
</property>
<property name="text">
<string>Next Page</string>
</property>
<property name="shortcut">
<string>PgDown</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionContinuous">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Continuous</string>
</property>
<property name="toolTip">
<string>Continuous</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionBack">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/images/go-previous-view.svgz</normaloff>:/icons/images/go-previous-view.svgz</iconset>
</property>
<property name="text">
<string>Back</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionForward">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/images/go-next-view.svgz</normaloff>:/icons/images/go-next-view.svgz</iconset>
</property>
<property name="text">
<string>Forward</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>QPdfView</class>
<extends>QWidget</extends>
<header>qpdfview.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="resources.qrc"/>
</resources>
<connections/>
</ui>