PDF 查看器范例
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>700</width> <height>600</height> </rect> </property> <property name="windowTitle"> <string>PDF Viewer</string> </property> <property name="unifiedTitleAndToolBarOnMac"> <bool>true</bool> </property> <widget class="QWidget" name="centralWidget"> <layout class="QVBoxLayout" name="verticalLayout"> <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="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::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::West</enum> </property> <property name="currentIndex"> <number>0</number> </property> <property name="documentMode"> <bool>false</bool> </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> <property name="headerHidden"> <bool>true</bool> </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> </widget> <widget class="QMenuBar" name="menuBar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>700</width> <height>22</height> </rect> </property> <widget class="QMenu" name="menuFile"> <property name="title"> <string>File</string> </property> <addaction name="actionOpen"/> <addaction name="actionQuit"/> </widget> <widget class="QMenu" name="menuHelp"> <property name="title"> <string>Help</string> </property> <addaction name="actionAbout"/> <addaction name="actionAbout_Qt"/> </widget> <widget class="QMenu" name="menuView"> <property name="title"> <string>View</string> </property> <addaction name="actionZoom_In"/> <addaction name="actionZoom_Out"/> <addaction name="actionPrevious_Page"/> <addaction name="actionNext_Page"/> <addaction name="separator"/> <addaction name="actionContinuous"/> </widget> <addaction name="menuFile"/> <addaction name="menuView"/> <addaction name="menuHelp"/> </widget> <widget class="QToolBar" name="mainToolBar"> <property name="movable"> <bool>false</bool> </property> <property name="floatable"> <bool>false</bool> </property> <attribute name="toolBarArea"> <enum>TopToolBarArea</enum> </attribute> <attribute name="toolBarBreak"> <bool>false</bool> </attribute> <addaction name="actionOpen"/> <addaction name="separator"/> <addaction name="actionZoom_Out"/> <addaction name="actionZoom_In"/> <addaction name="separator"/> </widget> <widget class="QStatusBar" name="statusBar"/> <action name="actionOpen"> <property name="icon"> <iconset resource="resources.qrc"> <normaloff>:/icons/images/fileopen.png</normaloff>:/icons/images/fileopen.png</iconset> </property> <property name="text"> <string>Open...</string> </property> <property name="shortcut"> <string>Ctrl+O</string> </property> </action> <action name="actionQuit"> <property name="text"> <string>Quit</string> </property> <property name="shortcut"> <string>Ctrl+Q</string> </property> </action> <action name="actionAbout"> <property name="text"> <string>About</string> </property> </action> <action name="actionAbout_Qt"> <property name="text"> <string>About Qt</string> </property> </action> <action name="actionZoom_In"> <property name="icon"> <iconset resource="resources.qrc"> <normaloff>:/icons/images/zoom-in-24.png</normaloff>:/icons/images/zoom-in-24.png</iconset> </property> <property name="text"> <string>Zoom In</string> </property> <property name="shortcut"> <string>Ctrl+=</string> </property> </action> <action name="actionZoom_Out"> <property name="icon"> <iconset resource="resources.qrc"> <normaloff>:/icons/images/zoom-out-24.png</normaloff>:/icons/images/zoom-out-24.png</iconset> </property> <property name="text"> <string>Zoom Out</string> </property> <property name="shortcut"> <string>Ctrl+-</string> </property> </action> <action name="actionPrevious_Page"> <property name="text"> <string>Previous Page</string> </property> <property name="shortcut"> <string>PgUp</string> </property> </action> <action name="actionNext_Page"> <property name="text"> <string>Next Page</string> </property> <property name="shortcut"> <string>PgDown</string> </property> </action> <action name="actionContinuous"> <property name="checkable"> <bool>true</bool> </property> <property name="text"> <string>Continuous</string> </property> </action> </widget> <layoutdefault spacing="6" margin="11"/> <customwidgets> <customwidget> <class>QPdfView</class> <extends>QWidget</extends> <header location="global">qpdfview.h</header> <container>1</container> </customwidget> </customwidgets> <resources> <include location="resources.qrc"/> </resources> <connections/> </ui>