当前位置: 首页>>代码示例>>Python>>正文


Python QPrintPreviewDialog.setWindowFlags方法代码示例

本文整理汇总了Python中PyQt5.QtPrintSupport.QPrintPreviewDialog.setWindowFlags方法的典型用法代码示例。如果您正苦于以下问题:Python QPrintPreviewDialog.setWindowFlags方法的具体用法?Python QPrintPreviewDialog.setWindowFlags怎么用?Python QPrintPreviewDialog.setWindowFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtPrintSupport.QPrintPreviewDialog的用法示例。


在下文中一共展示了QPrintPreviewDialog.setWindowFlags方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: printpage

# 需要导入模块: from PyQt5.QtPrintSupport import QPrintPreviewDialog [as 别名]
# 或者: from PyQt5.QtPrintSupport.QPrintPreviewDialog import setWindowFlags [as 别名]
    def printpage(self, preview=False, count: {'special': 'count'}=None):
        """Print the current/[count]th tab.

        Args:
            preview: Show preview instead of printing.
            count: The tab index to print, or None.
        """
        if not qtutils.check_print_compat():
            # WORKAROUND (remove this when we bump the requirements to 5.3.0)
            raise cmdexc.CommandError(
                "Printing on Qt < 5.3.0 on Windows is broken, please upgrade!")
        tab = self._cntwidget(count)
        if tab is not None:
            if preview:
                diag = QPrintPreviewDialog()
                diag.setAttribute(Qt.WA_DeleteOnClose)
                diag.setWindowFlags(diag.windowFlags() |
                                    Qt.WindowMaximizeButtonHint |
                                    Qt.WindowMinimizeButtonHint)
                diag.paintRequested.connect(tab.print)
                diag.exec_()
            else:
                diag = QPrintDialog()
                diag.setAttribute(Qt.WA_DeleteOnClose)
                diag.open(lambda: tab.print(diag.printer()))
开发者ID:helenst,项目名称:qutebrowser,代码行数:27,代码来源:commands.py

示例2: _print_preview

# 需要导入模块: from PyQt5.QtPrintSupport import QPrintPreviewDialog [as 别名]
# 或者: from PyQt5.QtPrintSupport.QPrintPreviewDialog import setWindowFlags [as 别名]
def _print_preview(tab: apitypes.Tab) -> None:
    """Show a print preview."""
    def print_callback(ok: bool) -> None:
        if not ok:
            message.error("Printing failed!")

    tab.printing.check_preview_support()
    diag = QPrintPreviewDialog(tab)
    diag.setAttribute(Qt.WA_DeleteOnClose)
    diag.setWindowFlags(diag.windowFlags() | Qt.WindowMaximizeButtonHint |
                        Qt.WindowMinimizeButtonHint)
    diag.paintRequested.connect(functools.partial(
        tab.printing.to_printer, callback=print_callback))
    diag.exec_()
开发者ID:fiete201,项目名称:qutebrowser,代码行数:16,代码来源:misccommands.py

示例3: __init__

# 需要导入模块: from PyQt5.QtPrintSupport import QPrintPreviewDialog [as 别名]
# 或者: from PyQt5.QtPrintSupport.QPrintPreviewDialog import setWindowFlags [as 别名]
    def __init__(self, parent=None, html=None):
        super(PrintHtml, self).__init__(parent)

        # html = codecs.open(b"template.html", encoding='utf-8').read()
        baseurl = QUrl.fromLocalFile(os.getcwd() + "/temp/index.html")
        self.setHtml(html, baseurl)
        self.printer = QPrinter()
        self.printer.setPageSize(QPrinter.A4)
        self.printer.setOrientation(QPrinter.Portrait)
        self.printer.setPageMargins(5, 5, 5, 5, QPrinter.Millimeter)
        self.setFixedWidth(1000)

        dialog = QPrintPreviewDialog(self.printer)
        dialog.setWindowState(Qt.WindowMaximized)
        dialog.paintRequested.connect(self.print_)
        dialog.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint | Qt.WindowContextHelpButtonHint)
        dialog.exec()
开发者ID:Meller008,项目名称:CRM-Avi,代码行数:19,代码来源:print_qt.py

示例4: printReview

# 需要导入模块: from PyQt5.QtPrintSupport import QPrintPreviewDialog [as 别名]
# 或者: from PyQt5.QtPrintSupport.QPrintPreviewDialog import setWindowFlags [as 别名]
 def printReview(self):
     printer = QPrinter(QPrinter.HighResolution)
     review = QPrintPreviewDialog(printer, self)
     review.setWindowFlags(QtCore.Qt.Window)
     review.paintRequested.connect(self.print)
     review.exec_()
开发者ID:golovatyi,项目名称:1Term_Project,代码行数:8,代码来源:notepad.py


注:本文中的PyQt5.QtPrintSupport.QPrintPreviewDialog.setWindowFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。