[−][src]Struct qt_widgets::QGraphicsEffect
The QGraphicsEffect class is the base class for all graphics effects.
C++ class: QGraphicsEffect
.
The QGraphicsEffect class is the base class for all graphics effects.
Effects alter the appearance of elements by hooking into the rendering pipeline and operating between the source (e.g., a QGraphicsPixmapItem) and the destination device (e.g., QGraphicsView's viewport). Effects can be disabled by calling setEnabled(false). If effects are disabled, the source is rendered directly.
To add a visual effect to a QGraphicsItem, for example, you can use one of the standard effects, or alternately, create your own effect by creating a subclass of QGraphicsEffect. The effect can then be installed on the item using QGraphicsItem::setGraphicsEffect().
Qt provides the following standard effects:
- QGraphicsBlurEffect - blurs the item by a given radius
- QGraphicsDropShadowEffect - renders a dropshadow behind the item
- QGraphicsColorizeEffect - renders the item in shades of any given color
- QGraphicsOpacityEffect - renders the item with an opacity
For more information on how to use each effect, refer to the specific effect's documentation.
To create your own custom effect, create a subclass of QGraphicsEffect (or any other existing effects) and reimplement the virtual function draw(). This function is called whenever the effect needs to redraw. The draw() function takes the painter with which to draw as an argument. For more information, refer to the documenation for draw(). In the draw() function you can call sourcePixmap() to get a pixmap of the graphics effect source which you can then process.
If your effect changes, use update() to request for a redraw. If your custom effect changes the bounding rectangle of the source, e.g., a radial glow effect may need to apply an extra margin, you can reimplement the virtual boundingRectFor() function, and call updateBoundingRect() to notify the framework whenever this rectangle changes. The virtual sourceChanged() function is called to notify the effects that the source has changed in some way - e.g., if the source is a QGraphicsRectItem and its rectangle parameters have changed.
Methods
impl QGraphicsEffect
[src]
pub fn slot_set_enabled(&self) -> Receiver<(bool,)>
[src]
This property holds whether the effect is enabled or not.
Returns a built-in Qt slot QGraphicsEffect::setEnabled
that can be passed to qt_core::Signal::connect
.
This property holds whether the effect is enabled or not.
If an effect is disabled, the source will be rendered with as normal, with no interference from the effect. If the effect is enabled, the source will be rendered with the effect applied.
This property is enabled by default.
Using this property, you can disable certain effects on slow platforms, in order to ensure that the user interface is responsive.
Access functions:
bool | isEnabled() const |
void | setEnabled(bool enable) |
Notifier signal:
void | enabledChanged(bool enabled) |
pub fn slot_update(&self) -> Receiver<()>
[src]
Schedules a redraw of the effect. Call this function whenever the effect needs to be redrawn. This function does not trigger a redraw of the source.
Returns a built-in Qt slot QGraphicsEffect::update
that can be passed to qt_core::Signal::connect
.
Schedules a redraw of the effect. Call this function whenever the effect needs to be redrawn. This function does not trigger a redraw of the source.
See also updateBoundingRect().
pub fn enabled_changed(&self) -> Signal<(bool,)>
[src]
This signal is emitted whenever the effect is enabled or disabled. The enabled parameter holds the effects's new enabled state.
Returns a built-in Qt signal QGraphicsEffect::enabledChanged
that can be passed to qt_core::Signal::connect
.
pub unsafe fn bounding_rect(&self) -> CppBox<QRectF>
[src]
Returns the effective bounding rectangle for this effect, i.e., the bounding rectangle of the source in device coordinates, adjusted by any margins applied by the effect itself.
Calls C++ function: QRectF QGraphicsEffect::boundingRect() const
.
Returns the effective bounding rectangle for this effect, i.e., the bounding rectangle of the source in device coordinates, adjusted by any margins applied by the effect itself.
See also boundingRectFor() and updateBoundingRect().
pub unsafe fn bounding_rect_for(
&self,
source_rect: impl CastInto<Ref<QRectF>>
) -> CppBox<QRectF>
[src]
&self,
source_rect: impl CastInto<Ref<QRectF>>
) -> CppBox<QRectF>
Returns the effective bounding rectangle for this effect, given the provided rect in the device coordinates. When writing you own custom effect, you must call updateBoundingRect() whenever any parameters are changed that may cause this this function to return a different value.
Calls C++ function: virtual QRectF QGraphicsEffect::boundingRectFor(const QRectF& sourceRect) const
.
Returns the effective bounding rectangle for this effect, given the provided rect in the device coordinates. When writing you own custom effect, you must call updateBoundingRect() whenever any parameters are changed that may cause this this function to return a different value.
See also sourceBoundingRect().
pub unsafe fn is_enabled(&self) -> bool
[src]
This property holds whether the effect is enabled or not.
Calls C++ function: bool QGraphicsEffect::isEnabled() const
.
This property holds whether the effect is enabled or not.
If an effect is disabled, the source will be rendered with as normal, with no interference from the effect. If the effect is enabled, the source will be rendered with the effect applied.
This property is enabled by default.
Using this property, you can disable certain effects on slow platforms, in order to ensure that the user interface is responsive.
Access functions:
bool | isEnabled() const |
void | setEnabled(bool enable) |
Notifier signal:
void | enabledChanged(bool enabled) |
pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>
[src]
Calls C++ function: virtual const QMetaObject* QGraphicsEffect::metaObject() const
.
pub unsafe fn qt_metacall(
&self,
arg1: Call,
arg2: c_int,
arg3: *mut *mut c_void
) -> c_int
[src]
&self,
arg1: Call,
arg2: c_int,
arg3: *mut *mut c_void
) -> c_int
Calls C++ function: virtual int QGraphicsEffect::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3)
.
pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void
[src]
Calls C++ function: virtual void* QGraphicsEffect::qt_metacast(const char* arg1)
.
pub unsafe fn set_enabled(&self, enable: bool)
[src]
This property holds whether the effect is enabled or not.
Calls C++ function: [slot] void QGraphicsEffect::setEnabled(bool enable)
.
This property holds whether the effect is enabled or not.
If an effect is disabled, the source will be rendered with as normal, with no interference from the effect. If the effect is enabled, the source will be rendered with the effect applied.
This property is enabled by default.
Using this property, you can disable certain effects on slow platforms, in order to ensure that the user interface is responsive.
Access functions:
bool | isEnabled() const |
void | setEnabled(bool enable) |
Notifier signal:
void | enabledChanged(bool enabled) |
pub unsafe fn static_meta_object() -> Ref<QMetaObject>
[src]
Returns a reference to the staticMetaObject
field.
pub unsafe fn tr(
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
[src]
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
Calls C++ function: static QString QGraphicsEffect::tr(const char* s, const char* c, int n)
.
pub unsafe fn tr_utf8(
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
[src]
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
Calls C++ function: static QString QGraphicsEffect::trUtf8(const char* s, const char* c, int n)
.
pub unsafe fn update(&self)
[src]
Schedules a redraw of the effect. Call this function whenever the effect needs to be redrawn. This function does not trigger a redraw of the source.
Calls C++ function: [slot] void QGraphicsEffect::update()
.
Schedules a redraw of the effect. Call this function whenever the effect needs to be redrawn. This function does not trigger a redraw of the source.
See also updateBoundingRect().
Trait Implementations
impl CppDeletable for QGraphicsEffect
[src]
unsafe fn delete(&self)
[src]
Removes the effect from the source, and destroys the graphics effect.
Calls C++ function: virtual [destructor] void QGraphicsEffect::~QGraphicsEffect()
.
Removes the effect from the source, and destroys the graphics effect.
impl Deref for QGraphicsEffect
[src]
type Target = QObject
The resulting type after dereferencing.
fn deref(&self) -> &QObject
[src]
Calls C++ function: QObject* static_cast<QObject*>(QGraphicsEffect* ptr)
.
impl DynamicCast<QGraphicsBlurEffect> for QGraphicsEffect
[src]
unsafe fn dynamic_cast(ptr: Ptr<QGraphicsEffect>) -> Ptr<QGraphicsBlurEffect>
[src]
Calls C++ function: QGraphicsBlurEffect* dynamic_cast<QGraphicsBlurEffect*>(QGraphicsEffect* ptr)
.
impl DynamicCast<QGraphicsColorizeEffect> for QGraphicsEffect
[src]
unsafe fn dynamic_cast(
ptr: Ptr<QGraphicsEffect>
) -> Ptr<QGraphicsColorizeEffect>
[src]
ptr: Ptr<QGraphicsEffect>
) -> Ptr<QGraphicsColorizeEffect>
Calls C++ function: QGraphicsColorizeEffect* dynamic_cast<QGraphicsColorizeEffect*>(QGraphicsEffect* ptr)
.
impl DynamicCast<QGraphicsDropShadowEffect> for QGraphicsEffect
[src]
unsafe fn dynamic_cast(
ptr: Ptr<QGraphicsEffect>
) -> Ptr<QGraphicsDropShadowEffect>
[src]
ptr: Ptr<QGraphicsEffect>
) -> Ptr<QGraphicsDropShadowEffect>
Calls C++ function: QGraphicsDropShadowEffect* dynamic_cast<QGraphicsDropShadowEffect*>(QGraphicsEffect* ptr)
.
impl DynamicCast<QGraphicsEffect> for QObject
[src]
unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QGraphicsEffect>
[src]
Calls C++ function: QGraphicsEffect* dynamic_cast<QGraphicsEffect*>(QObject* ptr)
.
impl DynamicCast<QGraphicsOpacityEffect> for QGraphicsEffect
[src]
unsafe fn dynamic_cast(ptr: Ptr<QGraphicsEffect>) -> Ptr<QGraphicsOpacityEffect>
[src]
Calls C++ function: QGraphicsOpacityEffect* dynamic_cast<QGraphicsOpacityEffect*>(QGraphicsEffect* ptr)
.
impl StaticDowncast<QGraphicsBlurEffect> for QGraphicsEffect
[src]
unsafe fn static_downcast(ptr: Ptr<QGraphicsEffect>) -> Ptr<QGraphicsBlurEffect>
[src]
Calls C++ function: QGraphicsBlurEffect* static_cast<QGraphicsBlurEffect*>(QGraphicsEffect* ptr)
.
impl StaticDowncast<QGraphicsColorizeEffect> for QGraphicsEffect
[src]
unsafe fn static_downcast(
ptr: Ptr<QGraphicsEffect>
) -> Ptr<QGraphicsColorizeEffect>
[src]
ptr: Ptr<QGraphicsEffect>
) -> Ptr<QGraphicsColorizeEffect>
Calls C++ function: QGraphicsColorizeEffect* static_cast<QGraphicsColorizeEffect*>(QGraphicsEffect* ptr)
.
impl StaticDowncast<QGraphicsDropShadowEffect> for QGraphicsEffect
[src]
unsafe fn static_downcast(
ptr: Ptr<QGraphicsEffect>
) -> Ptr<QGraphicsDropShadowEffect>
[src]
ptr: Ptr<QGraphicsEffect>
) -> Ptr<QGraphicsDropShadowEffect>
Calls C++ function: QGraphicsDropShadowEffect* static_cast<QGraphicsDropShadowEffect*>(QGraphicsEffect* ptr)
.
impl StaticDowncast<QGraphicsEffect> for QObject
[src]
unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QGraphicsEffect>
[src]
Calls C++ function: QGraphicsEffect* static_cast<QGraphicsEffect*>(QObject* ptr)
.
impl StaticDowncast<QGraphicsOpacityEffect> for QGraphicsEffect
[src]
unsafe fn static_downcast(
ptr: Ptr<QGraphicsEffect>
) -> Ptr<QGraphicsOpacityEffect>
[src]
ptr: Ptr<QGraphicsEffect>
) -> Ptr<QGraphicsOpacityEffect>
Calls C++ function: QGraphicsOpacityEffect* static_cast<QGraphicsOpacityEffect*>(QGraphicsEffect* ptr)
.
impl StaticUpcast<QGraphicsEffect> for QGraphicsColorizeEffect
[src]
unsafe fn static_upcast(
ptr: Ptr<QGraphicsColorizeEffect>
) -> Ptr<QGraphicsEffect>
[src]
ptr: Ptr<QGraphicsColorizeEffect>
) -> Ptr<QGraphicsEffect>
Calls C++ function: QGraphicsEffect* static_cast<QGraphicsEffect*>(QGraphicsColorizeEffect* ptr)
.
impl StaticUpcast<QGraphicsEffect> for QGraphicsBlurEffect
[src]
unsafe fn static_upcast(ptr: Ptr<QGraphicsBlurEffect>) -> Ptr<QGraphicsEffect>
[src]
Calls C++ function: QGraphicsEffect* static_cast<QGraphicsEffect*>(QGraphicsBlurEffect* ptr)
.
impl StaticUpcast<QGraphicsEffect> for QGraphicsDropShadowEffect
[src]
unsafe fn static_upcast(
ptr: Ptr<QGraphicsDropShadowEffect>
) -> Ptr<QGraphicsEffect>
[src]
ptr: Ptr<QGraphicsDropShadowEffect>
) -> Ptr<QGraphicsEffect>
Calls C++ function: QGraphicsEffect* static_cast<QGraphicsEffect*>(QGraphicsDropShadowEffect* ptr)
.
impl StaticUpcast<QGraphicsEffect> for QGraphicsOpacityEffect
[src]
unsafe fn static_upcast(
ptr: Ptr<QGraphicsOpacityEffect>
) -> Ptr<QGraphicsEffect>
[src]
ptr: Ptr<QGraphicsOpacityEffect>
) -> Ptr<QGraphicsEffect>
Calls C++ function: QGraphicsEffect* static_cast<QGraphicsEffect*>(QGraphicsOpacityEffect* ptr)
.
impl StaticUpcast<QObject> for QGraphicsEffect
[src]
unsafe fn static_upcast(ptr: Ptr<QGraphicsEffect>) -> Ptr<QObject>
[src]
Calls C++ function: QObject* static_cast<QObject*>(QGraphicsEffect* ptr)
.
Auto Trait Implementations
impl RefUnwindSafe for QGraphicsEffect
impl Send for QGraphicsEffect
impl Sync for QGraphicsEffect
impl Unpin for QGraphicsEffect
impl UnwindSafe for QGraphicsEffect
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> CastInto<U> for T where
U: CastFrom<T>,
[src]
U: CastFrom<T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StaticUpcast<T> for T
[src]
unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,