如何在Python Qt应用程序中使用KDE Okular的文档视图小部件? [英] How to use KDE Okular's document view widget in a Python Qt app?
本文介绍了如何在Python Qt应用程序中使用KDE Okular的文档视图小部件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Qt(4.8)和PyQt在Linux上用Python(3.4)编写桌面应用程序.
I am writing a desktop application in Python (3.4) on Linux using Qt (4.8) and PyQt.
是否可以使用/导入Okular的pdf视图功能作为小部件?如果是,怎么办?
Is there a way to use/import Okular's pdf view functionality as a widget? If yes, how?
推荐答案
这对我有用:
import sys
from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs
from PyKDE4.kdecore import KLibLoader as ll
from PyKDE4.kdeui import KApplication
import PyKDE4.kparts as kp
appName = "KApplication"
catalog = ""
programName = ki18n ("KApplication")
version = "1.0"
description = ki18n ("KApplication")
license = KAboutData.License_GPL
copyright = ki18n ("(c) 2007 John Doe")
text = ki18n ("none")
homePage = "www.johndoe.com"
bugEmail = "johndoe@nowhere.com "
aboutData = KAboutData(
appName, catalog, programName, version, description,
license, copyright, text, homePage, bugEmail
)
KCmdLineArgs.init( sys.argv, aboutData)
app = KApplication()
win= kp.KParts.MainWindow()
okupart= ll.self().factory( 'okularpart').create()
win.setCentralWidget( okupart.widget())
win.show()
app.exec_()
这篇关于如何在Python Qt应用程序中使用KDE Okular的文档视图小部件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文