このページでは

QPrinterInfo Class

QPrinterInfo クラスは、既存のプリンタに関する情報へのアクセスを提供します。詳細...

ヘッダー: #include <QPrinterInfo>
CMake: find_package(Qt6 REQUIRED COMPONENTS PrintSupport)
target_link_libraries(mytarget PRIVATE Qt6::PrintSupport)
qmake: QT += printsupport

パブリック関数

QPrinterInfo()
QPrinterInfo(const QPrinter &printer)
QPrinterInfo(const QPrinterInfo &other)
~QPrinterInfo()
QPrinter::ColorMode defaultColorMode() const
QPrinter::DuplexMode defaultDuplexMode() const
QPageSize defaultPageSize() const
QString description() const
bool isDefault() const
bool isNull() const
bool isRemote() const
QString location() const
QString makeAndModel() const
QPageSize maximumPhysicalPageSize() const
QPageSize minimumPhysicalPageSize() const
QString printerName() const
QPrinter::PrinterState state() const
QList<QPrinter::ColorMode> supportedColorModes() const
QList<QPrinter::DuplexMode> supportedDuplexModes() const
QList<QPageSize> supportedPageSizes() const
QList<int> supportedResolutions() const
bool supportsCustomPageSizes() const
QPrinterInfo &operator=(const QPrinterInfo &other)

静的パブリックメンバー

QStringList availablePrinterNames()
QList<QPrinterInfo> availablePrinters()
QPrinterInfo defaultPrinter()
QString defaultPrinterName()
QPrinterInfo printerInfo(const QString &printerName)

詳細な説明

静的関数を使用して、QPrinterInfo オブジェクトのリストを生成します。リスト内の各 QPrinterInfo オブジェクトは 1 台のプリンタを表しており、名前、サポートされている用紙サイズ、およびデフォルトのプリンタであるかどうかを照会することができます。

メンバ関数のドキュメント

QPrinterInfo::QPrinterInfo()

空の QPrinterInfo オブジェクトを生成します。

isNull()も参照してください 。

[explicit] QPrinterInfo::QPrinterInfo(const QPrinter &printer)

printer から QPrinterInfo オブジェクトを生成します。

QPrinterInfo::QPrinterInfo(const QPrinterInfo &other)

other のコピーを作成します。

[noexcept] QPrinterInfo::~QPrinterInfo()

QPrinterInfo オブジェクトを破棄します。このオブジェクト内の値への参照は無効になります。

[static] QStringList QPrinterInfo::availablePrinterNames()

このシステムで使用可能なすべてのプリンタ名のリストを返します。

ほとんどのシステムではavailablePrinters()よりも高速に動作するため、こちらを使用することを推奨します。

ローカルシステムやリモートプリントサーバーで変更が行われた場合、リストの内容が古くなる可能性があることに注意してください。QPrinterInfo のインスタンスは必要な場合にのみ作成し、呼び出す前には常に有効性を確認してください。

[static] QList<QPrinterInfo> QPrinterInfo::availablePrinters()

このシステム上で利用可能なすべてのプリンタに対するQPrinterInfo オブジェクトのリストを返します。

各プリンタインスタンスの生成には、特にリモートネットワークプリンタが存在する場合、時間がかかる可能性があるほか、ローカルシステムやリモートプリントサーバーで変更が行われた際に保持されているインスタンスが古くなってしまう恐れがあるため、この関数の使用は推奨されません。代わりに `availablePrinterNames()` を使用し、プリンタインスタンスは必要な場合にのみ生成してください。

QPrinter::ColorMode QPrinterInfo::defaultColorMode() const

このプリンタのデフォルトの色モードを返します。

QPrinter::DuplexMode QPrinterInfo::defaultDuplexMode() const

このプリンタのデフォルトの両面印刷モードを取得します。

QPageSize QPrinterInfo::defaultPageSize() const

このプリンタにおける現在のデフォルトのページサイズを返します。

[static] QPrinterInfo QPrinterInfo::defaultPrinter()

システム上のデフォルトのプリンタを返します。

デフォルトのプリンタが存在しない場合があるため、使用前にisNull()を使用して戻り値を確認する必要があります。

一部のシステムでは、利用可能なプリンタが存在しても、そのいずれもデフォルトのプリンタとして設定されていない場合があります。

isNull()、isDefault()、およびavailablePrinters()も参照してください 。

[static] QString QPrinterInfo::defaultPrinterName()

現在のデフォルトプリンタ名を返します。

QString QPrinterInfo::description() const

そのプリンタに関する、人間が読みやすい説明を返します。

QPrinterInfo::printerName()も参照してください 。

bool QPrinterInfo::isDefault() const

このプリンタが現在デフォルトのプリンタであるかどうかを返します。

bool QPrinterInfo::isNull() const

このQPrinterInfo オブジェクトがプリンタ定義を保持しているかどうかを返します。

たとえば、システム上にプリンタが存在しない状態でdefaultPrinter()を呼び出した場合、空のQPrinterInfo オブジェクトが返されることがあります。

bool QPrinterInfo::isRemote() const

このプリンタがリモートネットワークプリンタであるかどうかを返します。

QString QPrinterInfo::location() const

プリンタの場所を、人間が読みやすい形式で返します。

QString QPrinterInfo::makeAndModel() const

プリンタの人間に理解しやすいメーカー名とモデル名を返します。

QPageSize QPrinterInfo::maximumPhysicalPageSize() const

このプリンタがサポートする最大物理ページサイズを返します。

minimumPhysicalPageSize()も参照してください 。

QPageSize QPrinterInfo::minimumPhysicalPageSize() const

このプリンタがサポートする最小の物理ページサイズを返します。

maximumPhysicalPageSize()も参照してください 。

[static] QPrinterInfo QPrinterInfo::printerInfo(const QString &printerName)

プリンタ `printerName` を返します。

指定されたプリンタが存在しない場合があるため、使用する前にisNull() を使用して戻り値を確認する必要があります。

isNull()も参照してください 。

QString QPrinterInfo::printerName() const

プリンタ名を返します。

これはプリンタを識別するための一意のIDであり、人間が読み取れる形式ではない場合があります。

QPrinterInfo::description() およびQPrinter::setPrinterName()も参照してください 。

QPrinter::PrinterState QPrinterInfo::state() const

このプリンタの現在の状態を返します。

プラットフォーム、プリンタドライバ、またはプリンタ本体によっては、この状態が必ずしも正確とは限りません。

QList<QPrinter::ColorMode> QPrinterInfo::supportedColorModes() const

このプリンタでサポートされているカラーモードを返します。

QList<QPrinter::DuplexMode> QPrinterInfo::supportedDuplexModes() const

このプリンタでサポートされているデュプレックスモードのリストを返します。

QList<QPageSize> QPrinterInfo::supportedPageSizes() const

このプリンタでサポートされている用紙サイズのリストを返します。

QList<int> QPrinterInfo::supportedResolutions() const

このプリンタでサポートされている解像度のリストを返します。

bool QPrinterInfo::supportsCustomPageSizes() const

このプリンタがカスタム用紙サイズに対応しているかどうかを返します。

QPrinterInfo &QPrinterInfo::operator=(const QPrinterInfo &other)

QPrinterInfo オブジェクトをother と同じ値に設定します。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.