MaterialWidget Class

Acrylic material is a special widget that emulates a type of brush that creates a partially transparent texture. More...

Header: #include <MaterialWidget>
Inherits: QWidget

Public Types

enum BlendType { DisabledBlend, InAppBlend, BackgroundBlend }


Public Functions

MaterialWidget::BlendType blendType() const
double noiseOpacity() const
void setBlendType(MaterialWidget::BlendType type)
void setNoiseOpacity(double opacity)
void setTintColor(const QColor &color)
void setTintOpacity(double opacity)
const QColor &tintColor() const
double tintOpacity() const

Protected Functions

QBrush createAcrylicBrush() const
void paintBackground(QPainter *painter, const QRegion &clip)

Reimplemented Protected Functions

virtual void changeEvent(QEvent *event) override
virtual void hideEvent(QHideEvent *event) override
virtual void paintEvent(QPaintEvent *event) override
virtual void resizeEvent(QResizeEvent *event) override
virtual void showEvent(QShowEvent *event) override

Detailed Description

You can add acrylic widget to your Qt application window to add depth and and emphasize the hierarchy visually. Note: Rendering acrylic material surfaces is GPU intensive, which can slow down the application, increase the power consumption on the devices on which the application is running. Material widget adds Qt::AA_DontCreateNativeWidgetSiblings attribute to the application. Therefore, this can affect on your application which use native windows - for example, widgets with OpenGL.

Member Type Documentation

enum MaterialWidget::BlendType

Enumerator BlendTyle describes what's visible through the acrylic material widget.

MaterialWidget::DisabledBlend0The blending mode is not used. The material widget is not transparent.
MaterialWidget::InAppBlend1Through material widget the other widgets are visible within the application that are located under this widget.
MaterialWidget::BackgroundBlend2Through the material widget the contents of the desktop are visible which is located under the top-level window. For proper operation of this mode, the platform should support blur effect for native top-level windows.

Property Documentation

blend : BlendType

This property describes how the acrylic texture should be blended with the background under the current widget.

Access functions:

MaterialWidget::BlendType blendType() const
void setBlendType(MaterialWidget::BlendType type)

See also AcrylicBlend.

noiseOpacity : double

This property holds the opacity value of the noise for acrylic texture.

Access functions:

double noiseOpacity() const
void setNoiseOpacity(double opacity)

See also tintColor and tintOpacity.

tintColor : QColor

This property holds the color of the tint for acrylic texture.

Access functions:

const QColor &tintColor() const
void setTintColor(const QColor &color)

See also tintOpacity and noiseOpacity.

tintOpacity : double

This property holds the opacity value of the tint for acrylic texture.

Access functions:

double tintOpacity() const
void setTintOpacity(double opacity)

See also tintColor and noiseOpacity.

Member Function Documentation

[override virtual protected] void MaterialWidget::changeEvent(QEvent *event)

Reimplements: QWidget::changeEvent(QEvent *event).

[protected] QBrush MaterialWidget::createAcrylicBrush() const

Creates acrylic material brush based on widget's settings.

[override virtual protected] void MaterialWidget::hideEvent(QHideEvent *event)

Reimplements: QWidget::hideEvent(QHideEvent *event).

[protected] void MaterialWidget::paintBackground(QPainter *painter, const QRegion &clip)

Paints acrylic material texture on painter that bounded by clip region.

[override virtual protected] void MaterialWidget::paintEvent(QPaintEvent *event)

Reimplements: QWidget::paintEvent(QPaintEvent *event).

[override virtual protected] void MaterialWidget::resizeEvent(QResizeEvent *event)

Reimplements: QWidget::resizeEvent(QResizeEvent *event).

[override virtual protected] void MaterialWidget::showEvent(QShowEvent *event)

Reimplements: QWidget::showEvent(QShowEvent *event).