[][src]Struct qt_gui::QSurfaceFormat

#[repr(C)]pub struct QSurfaceFormat { /* fields omitted */ }

The QSurfaceFormat class represents the format of a QSurface.

C++ class: QSurfaceFormat.

C++ documentation:

The QSurfaceFormat class represents the format of a QSurface.

The format includes the size of the color buffers, red, green, and blue; the size of the alpha buffer; the size of the depth and stencil buffers; and number of samples per pixel for multisampling. In addition, the format contains surface configuration parameters such as OpenGL profile and version for rendering, whether or not to enable stereo buffers, and swap behaviour.

Methods

impl QSurfaceFormat[src]

pub unsafe fn alpha_buffer_size(&self) -> c_int[src]

Get the size in bits of the alpha channel of the color buffer.

Calls C++ function: int QSurfaceFormat::alphaBufferSize() const.

C++ documentation:

Get the size in bits of the alpha channel of the color buffer.

See also setAlphaBufferSize().

pub unsafe fn blue_buffer_size(&self) -> c_int[src]

Get the size in bits of the blue channel of the color buffer.

Calls C++ function: int QSurfaceFormat::blueBufferSize() const.

C++ documentation:

Get the size in bits of the blue channel of the color buffer.

See also setBlueBufferSize().

pub unsafe fn color_space(&self) -> ColorSpace[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns the color space.

Calls C++ function: QSurfaceFormat::ColorSpace QSurfaceFormat::colorSpace() const.

C++ documentation:

Returns the color space.

This function was introduced in Qt 5.10.

See also setColorSpace().

pub unsafe fn copy_from(
    &self,
    other: impl CastInto<Ref<QSurfaceFormat>>
) -> Ref<QSurfaceFormat>
[src]

Assigns other to this object.

Calls C++ function: QSurfaceFormat& QSurfaceFormat::operator=(const QSurfaceFormat& other).

C++ documentation:

Assigns other to this object.

pub unsafe fn default_format() -> CppBox<QSurfaceFormat>[src]

Returns the global default surface format.

Calls C++ function: static QSurfaceFormat QSurfaceFormat::defaultFormat().

C++ documentation:

Returns the global default surface format.

When setDefaultFormat() is not called, this is a default-constructed QSurfaceFormat.

This function was introduced in Qt 5.4.

See also setDefaultFormat().

pub unsafe fn depth_buffer_size(&self) -> c_int[src]

Returns the depth buffer size.

Calls C++ function: int QSurfaceFormat::depthBufferSize() const.

C++ documentation:

Returns the depth buffer size.

See also setDepthBufferSize().

pub unsafe fn green_buffer_size(&self) -> c_int[src]

Get the size in bits of the green channel of the color buffer.

Calls C++ function: int QSurfaceFormat::greenBufferSize() const.

C++ documentation:

Get the size in bits of the green channel of the color buffer.

See also setGreenBufferSize().

pub unsafe fn has_alpha(&self) -> bool[src]

Returns true if the alpha buffer size is greater than zero.

Calls C++ function: bool QSurfaceFormat::hasAlpha() const.

C++ documentation:

Returns true if the alpha buffer size is greater than zero.

This means that the surface might be used with per pixel translucency effects.

pub unsafe fn major_version(&self) -> c_int[src]

Returns the major OpenGL version.

Calls C++ function: int QSurfaceFormat::majorVersion() const.

C++ documentation:

Returns the major OpenGL version.

The default version is 2.0.

See also setMajorVersion().

pub unsafe fn minor_version(&self) -> c_int[src]

Returns the minor OpenGL version.

Calls C++ function: int QSurfaceFormat::minorVersion() const.

C++ documentation:

Returns the minor OpenGL version.

See also setMinorVersion().

pub unsafe fn new_0a() -> CppBox<QSurfaceFormat>[src]

Constructs a default initialized QSurfaceFormat.

Calls C++ function: [constructor] void QSurfaceFormat::QSurfaceFormat().

C++ documentation:

Constructs a default initialized QSurfaceFormat.

Note: By default OpenGL 2.0 is requested since this provides the highest grade of portability between platforms and OpenGL implementations.

pub unsafe fn new_1a(options: QFlags<FormatOption>) -> CppBox<QSurfaceFormat>[src]

Constructs a QSurfaceFormat with the given format options.

Calls C++ function: [constructor] void QSurfaceFormat::QSurfaceFormat(QFlags<QSurfaceFormat::FormatOption> options).

C++ documentation:

Constructs a QSurfaceFormat with the given format options.

pub unsafe fn new_copy(
    other: impl CastInto<Ref<QSurfaceFormat>>
) -> CppBox<QSurfaceFormat>
[src]

Constructs a copy of other.

Calls C++ function: [constructor] void QSurfaceFormat::QSurfaceFormat(const QSurfaceFormat& other).

C++ documentation:

Constructs a copy of other.

pub unsafe fn options(&self) -> QFlags<FormatOption>[src]

Returns the currently set format options.

Calls C++ function: QFlags<QSurfaceFormat::FormatOption> QSurfaceFormat::options() const.

C++ documentation:

Returns the currently set format options.

This function was introduced in Qt 5.3.

See also setOption(), setOptions(), and testOption().

pub unsafe fn profile(&self) -> OpenGLContextProfile[src]

Get the configured OpenGL context profile.

Calls C++ function: QSurfaceFormat::OpenGLContextProfile QSurfaceFormat::profile() const.

C++ documentation:

Get the configured OpenGL context profile.

This setting is ignored if the requested OpenGL version is less than 3.2.

See also setProfile().

pub unsafe fn red_buffer_size(&self) -> c_int[src]

Get the size in bits of the red channel of the color buffer.

Calls C++ function: int QSurfaceFormat::redBufferSize() const.

C++ documentation:

Get the size in bits of the red channel of the color buffer.

See also setRedBufferSize().

pub unsafe fn renderable_type(&self) -> RenderableType[src]

Gets the renderable type.

Calls C++ function: QSurfaceFormat::RenderableType QSurfaceFormat::renderableType() const.

C++ documentation:

Gets the renderable type.

Chooses between desktop OpenGL, OpenGL ES, and OpenVG.

See also setRenderableType().

pub unsafe fn samples(&self) -> c_int[src]

Returns the number of samples per pixel when multisampling is enabled. By default, multisampling is disabled.

Calls C++ function: int QSurfaceFormat::samples() const.

C++ documentation:

Returns the number of samples per pixel when multisampling is enabled. By default, multisampling is disabled.

See also setSamples().

pub unsafe fn set_alpha_buffer_size(&self, size: c_int)[src]

Set the desired size in bits of the alpha channel of the color buffer.

Calls C++ function: void QSurfaceFormat::setAlphaBufferSize(int size).

C++ documentation:

Set the desired size in bits of the alpha channel of the color buffer.

See also alphaBufferSize().

pub unsafe fn set_blue_buffer_size(&self, size: c_int)[src]

Set the desired size in bits of the blue channel of the color buffer.

Calls C++ function: void QSurfaceFormat::setBlueBufferSize(int size).

C++ documentation:

Set the desired size in bits of the blue channel of the color buffer.

Note: On Mac OSX, be sure to set the buffer size of all color channels, otherwise this setting will have no effect. If one of the buffer sizes is not set, the current bit-depth of the screen is used.

See also blueBufferSize().

pub unsafe fn set_color_space(&self, color_space: ColorSpace)[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Sets the preferred colorSpace.

Calls C++ function: void QSurfaceFormat::setColorSpace(QSurfaceFormat::ColorSpace colorSpace).

C++ documentation:

Sets the preferred colorSpace.

For example, this allows requesting windows with default framebuffers that are sRGB-capable on platforms that support it.

Note: When the requested color space is not supported by the platform, the request is ignored. Query the QSurfaceFormat after window creation to verify if the color space request could be honored or not.

Note: This setting controls if the default framebuffer of the window is capable of updates and blending in a given color space. It does not change applications' output by itself. The applications' rendering code will still have to opt in via the appropriate OpenGL calls to enable updates and blending to be performed in the given color space instead of using the standard linear operations.

This function was introduced in Qt 5.10.

See also colorSpace().

pub unsafe fn set_default_format(format: impl CastInto<Ref<QSurfaceFormat>>)[src]

Sets the global default surface format.

Calls C++ function: static void QSurfaceFormat::setDefaultFormat(const QSurfaceFormat& format).

C++ documentation:

Sets the global default surface format.

This format is used by default in QOpenGLContext, QWindow, QOpenGLWidget and similar classes.

It can always be overridden on a per-instance basis by using the class in question's own setFormat() function. However, it is often more convenient to set the format for all windows once at the start of the application. It also guarantees proper behavior in cases where shared contexts are required, because settings the format via this function guarantees that all contexts and surfaces, even the ones created internally by Qt, will use the same format.

Note: When setting Qt::AA_ShareOpenGLContexts, it is strongly recommended to place the call to this function before the construction of the QGuiApplication or QApplication. Otherwise format will not be applied to the global share context and therefore issues may arise with context sharing afterwards.

This function was introduced in Qt 5.4.

See also defaultFormat().

pub unsafe fn set_depth_buffer_size(&self, size: c_int)[src]

Set the minimum depth buffer size to size.

Calls C++ function: void QSurfaceFormat::setDepthBufferSize(int size).

C++ documentation:

Set the minimum depth buffer size to size.

See also depthBufferSize().

pub unsafe fn set_green_buffer_size(&self, size: c_int)[src]

Set the desired size in bits of the green channel of the color buffer.

Calls C++ function: void QSurfaceFormat::setGreenBufferSize(int size).

C++ documentation:

Set the desired size in bits of the green channel of the color buffer.

Note: On Mac OSX, be sure to set the buffer size of all color channels, otherwise this setting will have no effect. If one of the buffer sizes is not set, the current bit-depth of the screen is used.

See also greenBufferSize().

pub unsafe fn set_major_version(&self, major_version: c_int)[src]

Sets the desired major OpenGL version.

Calls C++ function: void QSurfaceFormat::setMajorVersion(int majorVersion).

C++ documentation:

Sets the desired major OpenGL version.

See also majorVersion().

pub unsafe fn set_minor_version(&self, minor_version: c_int)[src]

Sets the desired minor OpenGL version.

Calls C++ function: void QSurfaceFormat::setMinorVersion(int minorVersion).

C++ documentation:

Sets the desired minor OpenGL version.

The default version is 2.0.

See also minorVersion().

pub unsafe fn set_option_q_flags_format_option(&self, opt: QFlags<FormatOption>)[src]

Sets the format option option if on is true; otherwise, clears the option.

Calls C++ function: void QSurfaceFormat::setOption(QFlags<QSurfaceFormat::FormatOption> opt).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for void QSurfaceFormat::setOption(FormatOption option, bool on = true):

Sets the format option option if on is true; otherwise, clears the option.

This function was introduced in Qt 5.3.

See also setOptions(), options(), and testOption().

pub unsafe fn set_option_format_option_bool(
    &self,
    option: FormatOption,
    on: bool
)
[src]

Sets the format option option if on is true; otherwise, clears the option.

Calls C++ function: void QSurfaceFormat::setOption(QSurfaceFormat::FormatOption option, bool on = …).

C++ documentation:

Sets the format option option if on is true; otherwise, clears the option.

This function was introduced in Qt 5.3.

See also setOptions(), options(), and testOption().

pub unsafe fn set_option_format_option(&self, option: FormatOption)[src]

Sets the format option option if on is true; otherwise, clears the option.

Calls C++ function: void QSurfaceFormat::setOption(QSurfaceFormat::FormatOption option).

C++ documentation:

Sets the format option option if on is true; otherwise, clears the option.

This function was introduced in Qt 5.3.

See also setOptions(), options(), and testOption().

pub unsafe fn set_options(&self, options: QFlags<FormatOption>)[src]

Sets the format options to options.

Calls C++ function: void QSurfaceFormat::setOptions(QFlags<QSurfaceFormat::FormatOption> options).

C++ documentation:

Sets the format options to options.

This function was introduced in Qt 5.3.

See also options() and testOption().

pub unsafe fn set_profile(&self, profile: OpenGLContextProfile)[src]

Sets the desired OpenGL context profile.

Calls C++ function: void QSurfaceFormat::setProfile(QSurfaceFormat::OpenGLContextProfile profile).

C++ documentation:

Sets the desired OpenGL context profile.

This setting is ignored if the requested OpenGL version is less than 3.2.

See also profile().

pub unsafe fn set_red_buffer_size(&self, size: c_int)[src]

Set the desired size in bits of the red channel of the color buffer.

Calls C++ function: void QSurfaceFormat::setRedBufferSize(int size).

C++ documentation:

Set the desired size in bits of the red channel of the color buffer.

Note: On Mac OSX, be sure to set the buffer size of all color channels, otherwise this setting will have no effect. If one of the buffer sizes is not set, the current bit-depth of the screen is used.

See also redBufferSize().

pub unsafe fn set_renderable_type(&self, type_: RenderableType)[src]

Sets the desired renderable type.

Calls C++ function: void QSurfaceFormat::setRenderableType(QSurfaceFormat::RenderableType type).

C++ documentation:

Sets the desired renderable type.

Chooses between desktop OpenGL, OpenGL ES, and OpenVG.

See also renderableType().

pub unsafe fn set_samples(&self, num_samples: c_int)[src]

Set the preferred number of samples per pixel when multisampling is enabled to numSamples. By default, multisampling is disabled.

Calls C++ function: void QSurfaceFormat::setSamples(int numSamples).

C++ documentation:

Set the preferred number of samples per pixel when multisampling is enabled to numSamples. By default, multisampling is disabled.

See also samples().

pub unsafe fn set_stencil_buffer_size(&self, size: c_int)[src]

Set the preferred stencil buffer size to size bits.

Calls C++ function: void QSurfaceFormat::setStencilBufferSize(int size).

C++ documentation:

Set the preferred stencil buffer size to size bits.

See also stencilBufferSize().

pub unsafe fn set_stereo(&self, enable: bool)[src]

If enable is true enables stereo buffering; otherwise disables stereo buffering.

Calls C++ function: void QSurfaceFormat::setStereo(bool enable).

C++ documentation:

If enable is true enables stereo buffering; otherwise disables stereo buffering.

Stereo buffering is disabled by default.

Stereo buffering provides extra color buffers to generate left-eye and right-eye images.

See also stereo().

pub unsafe fn set_swap_behavior(&self, behavior: SwapBehavior)[src]

Set the swap behavior of the surface.

Calls C++ function: void QSurfaceFormat::setSwapBehavior(QSurfaceFormat::SwapBehavior behavior).

C++ documentation:

Set the swap behavior of the surface.

The swap behavior specifies whether single, double, or triple buffering is desired. The default, DefaultSwapBehavior, gives the default swap behavior of the platform.

See also swapBehavior().

pub unsafe fn set_swap_interval(&self, interval: c_int)[src]

Sets the preferred swap interval. The swap interval specifies the minimum number of video frames that are displayed before a buffer swap occurs. This can be used to sync the GL drawing into a window to the vertical refresh of the screen.

Calls C++ function: void QSurfaceFormat::setSwapInterval(int interval).

C++ documentation:

Sets the preferred swap interval. The swap interval specifies the minimum number of video frames that are displayed before a buffer swap occurs. This can be used to sync the GL drawing into a window to the vertical refresh of the screen.

Setting an interval value of 0 will turn the vertical refresh syncing off, any value higher than 0 will turn the vertical syncing on. Setting interval to a higher value, for example 10, results in having 10 vertical retraces between every buffer swap.

The default interval is 1.

Changing the swap interval may not be supported by the underlying platform. In this case, the request will be silently ignored.

This function was introduced in Qt 5.3.

See also swapInterval().

pub unsafe fn set_version(&self, major: c_int, minor: c_int)[src]

Sets the desired major and minor OpenGL versions.

Calls C++ function: void QSurfaceFormat::setVersion(int major, int minor).

C++ documentation:

Sets the desired major and minor OpenGL versions.

The default version is 2.0.

See also version().

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn stencil_buffer_size(&self) -> c_int[src]

Returns the stencil buffer size in bits.

Calls C++ function: int QSurfaceFormat::stencilBufferSize() const.

C++ documentation:

Returns the stencil buffer size in bits.

See also setStencilBufferSize().

pub unsafe fn stereo(&self) -> bool[src]

Returns true if stereo buffering is enabled; otherwise returns false. Stereo buffering is disabled by default.

Calls C++ function: bool QSurfaceFormat::stereo() const.

C++ documentation:

Returns true if stereo buffering is enabled; otherwise returns false. Stereo buffering is disabled by default.

See also setStereo().

pub unsafe fn swap_behavior(&self) -> SwapBehavior[src]

Returns the configured swap behaviour.

Calls C++ function: QSurfaceFormat::SwapBehavior QSurfaceFormat::swapBehavior() const.

C++ documentation:

Returns the configured swap behaviour.

See also setSwapBehavior().

pub unsafe fn swap_interval(&self) -> c_int[src]

Returns the swap interval.

Calls C++ function: int QSurfaceFormat::swapInterval() const.

C++ documentation:

Returns the swap interval.

This function was introduced in Qt 5.3.

See also setSwapInterval().

pub unsafe fn test_option_q_flags_format_option(
    &self,
    opt: QFlags<FormatOption>
) -> bool
[src]

Returns true if the format option option is set; otherwise returns false.

Calls C++ function: bool QSurfaceFormat::testOption(QFlags<QSurfaceFormat::FormatOption> opt) const.

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool QSurfaceFormat::testOption(FormatOption option) const:

Returns true if the format option option is set; otherwise returns false.

This function was introduced in Qt 5.3.

See also options().

pub unsafe fn test_option_format_option(&self, option: FormatOption) -> bool[src]

Returns true if the format option option is set; otherwise returns false.

Calls C++ function: bool QSurfaceFormat::testOption(QSurfaceFormat::FormatOption option) const.

C++ documentation:

Returns true if the format option option is set; otherwise returns false.

This function was introduced in Qt 5.3.

See also options().

pub unsafe fn version(&self) -> CppBox<QPairOfIntInt>[src]

Returns a QPair<int, int> representing the OpenGL version.

Calls C++ function: QPair<int, int> QSurfaceFormat::version() const.

C++ documentation:

Returns a QPair<int, int> representing the OpenGL version.

Useful for version checks, for example format.version() >= qMakePair(3, 2)

See also setVersion().

Trait Implementations

impl CppDeletable for QSurfaceFormat[src]

unsafe fn delete(&self)[src]

Destroys the QSurfaceFormat.

Calls C++ function: [destructor] void QSurfaceFormat::~QSurfaceFormat().

C++ documentation:

Destroys the QSurfaceFormat.

impl PartialEq<Ref<QSurfaceFormat>> for QSurfaceFormat[src]

fn eq(&self, arg2: &Ref<QSurfaceFormat>) -> bool[src]

Returns true if page layout lhs is equal to page layout rhs, i.e. if all the attributes are exactly equal.

Calls C++ function: bool operator==(const QSurfaceFormat& arg1, const QSurfaceFormat& arg2).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator==(const QPageLayout &lhs, const QPageLayout &rhs):

Returns true if page layout lhs is equal to page layout rhs, i.e. if all the attributes are exactly equal.

Note that this is a strict equality, especially for page size where the QPageSize ID, name and size must exactly match, and the margins where the units must match.

See also QPageLayout::isEquivalentTo().

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.