Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
qplatformprintplugin.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
6#include "qprinterinfo.h"
7#include "private/qfactoryloader_p.h"
8#include <qcoreapplication.h>
9#include <qdebug.h>
10
11#ifndef QT_NO_PRINTER
12
13#if defined(Q_OS_MACOS)
15#elif defined(Q_OS_WIN)
17#endif
18
20
21using namespace Qt::StringLiterals;
22
25
28{
29}
30
32{
33}
34
36
38{
39 delete printerSupport;
40 printerSupport = nullptr;
41}
42
52{
53 if (!printerSupport) {
54 const QMultiMap<int, QString> keyMap = loader()->keyMap();
56 if (!qEnvironmentVariableIsEmpty("QT_PRINTER_MODULE")) {
57 QString module = QString::fromLocal8Bit(qgetenv("QT_PRINTER_MODULE"));
58 QMultiMap<int, QString>::const_iterator it2 = std::find_if(keyMap.cbegin(), keyMap.cend(), [module](const QString &value){ return value == module; });
59 if (it2 == keyMap.cend())
60 qWarning() << "Unable to load printer plugin" << module;
61 else
62 it = it2;
63 }
64 if (it != keyMap.cend())
65 printerSupport = qLoadPlugin<QPlatformPrinterSupport, QPlatformPrinterSupportPlugin>(loader(), it.value());
68 }
69 return printerSupport;
70}
71
73
74#include "moc_qplatformprintplugin.cpp"
75
76#endif
\inmodule QtCore
Definition qobject.h:90
static QPlatformPrinterSupport * get()
QPlatformPrinterSupportPlugin(QObject *parent=nullptr)
The QPlatformPrinterSupport class provides an abstraction for print support.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
static QString fromLocal8Bit(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5788
QSet< QString >::iterator it
Combined button and popup list for selecting options.
@ CaseInsensitive
void qAddPostRoutine(QtCleanUpFunction p)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)
#define qWarning
Definition qlogging.h:162
static QPlatformPrinterSupport * printerSupport
static void cleanupPrinterSupport()
#define QPlatformPrinterSupportFactoryInterface_iid
#define Q_IMPORT_PLUGIN(PLUGIN)
Definition qplugin.h:194
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) noexcept
static const struct @437 keyMap[]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent