QGraphicsOpacityEffect Class
QGraphicsOpacityEffect クラスは不透明効果を提供します。詳細...
ヘッダ | #include <QGraphicsOpacityEffect> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
継承: | QGraphicsEffect |
プロパティ
- opacity : qreal
- opacityMask : QBrush
パブリック機能
QGraphicsOpacityEffect(QObject *parent = nullptr) | |
virtual | ~QGraphicsOpacityEffect() |
qreal | opacity() const |
QBrush | opacityMask() const |
パブリックスロット
void | setOpacity(qreal opacity) |
void | setOpacityMask(const QBrush &mask) |
シグナル
void | opacityChanged(qreal opacity) |
void | opacityMaskChanged(const QBrush &mask) |
再実装された保護された関数
virtual void | draw(QPainter *painter) override |
詳細説明
不透明度エフェクトは、ソースを不透明度でレンダリングします。このエフェクトは、フェードイン/フェードアウトのシーケンスと同様に、ソースを半透明にするのに便利です。不透明度は、setOpacity() 関数を使用して変更できます。
デフォルトでは、不透明度は 0.7 です。
QGraphicsDropShadowEffect 、QGraphicsBlurEffect 、QGraphicsColorizeEffectも参照して ください。
プロパティ・ドキュメンテーション
opacity : qreal
このプロパティは、エフェクトの不透明度を保持する。
値は 0.0 から 1.0 の範囲で、0.0 は完全に透明、1.0 は完全に不透明です。
デフォルトでは、不透明度は 0.7 です。
アクセス関数:
qreal | opacity() const |
void | setOpacity(qreal opacity) |
通知シグナル:
void | opacityChanged(qreal opacity) |
setOpacityMask()も参照 。
opacityMask : QBrush
このプロパティは、エフェクトの不透明度マスクを保持する。
不透明度マスクを使用すると、要素の一部に不透明度を適用できます。
例えば
... QLinearGradient alphaGradient(rect.topLeft(), rect.bottomLeft()); alphaGradient.setColorAt(0.0, Qt::transparent); alphaGradient.setColorAt(0.5, Qt::black); alphaGradient.setColorAt(1.0, Qt::transparent); QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect; effect->setOpacityMask(alphaGradient); ...
デフォルトでは不透明マスクはありません。
アクセス関数
QBrush | opacityMask() const |
void | setOpacityMask(const QBrush &mask) |
通知シグナル:
void | opacityMaskChanged(const QBrush &mask) |
setOpacity()も参照 。
メンバ関数ドキュメント
QGraphicsOpacityEffect::QGraphicsOpacityEffect(QObject *parent = nullptr)
新しい QGraphicsOpacityEffect インスタンスを構築します。parent パラメータはQGraphicsEffect のコンストラクタに渡されます。
[virtual noexcept]
QGraphicsOpacityEffect::~QGraphicsOpacityEffect()
効果を破壊する。
[override virtual protected]
void QGraphicsOpacityEffect::draw(QPainter *painter)
再実装:QGraphicsEffect::draw(QPainter *painter)。
[signal]
void QGraphicsOpacityEffect::opacityChanged(qreal opacity)
このシグナルは、エフェクトの不透明度が変わるたびに発せられます。opacity パラメータはエフェクトの新しい不透明度を保持する。
注意: opacity プロパティに対するノーティファイアシグナルです。
[signal]
void QGraphicsOpacityEffect::opacityMaskChanged(const QBrush &mask)
このシグナルは、エフェクトの不透明度マスクが変更されるたびに発せられる。mask パラメータはエフェクトの新しい不透明度マスクを保持する。
注: プロパティopacityMask に対するノーティファイアシグナル。
© 2025 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.