Struct qt_gui::QSurfaceFormat

source ·
#[repr(C)]
pub struct QSurfaceFormat { /* private fields */ }
Expand description

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.

Implementations§

source§

impl QSurfaceFormat

source

pub unsafe fn alpha_buffer_size(&self) -> c_int

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().

source

pub unsafe fn blue_buffer_size(&self) -> c_int

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().

source

pub unsafe fn color_space(&self) -> ColorSpace

Available 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().

source

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

Assigns other to this object.

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

C++ documentation:

Assigns other to this object.

source

pub unsafe fn default_format() -> CppBox<QSurfaceFormat>

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().

source

pub unsafe fn depth_buffer_size(&self) -> c_int

Returns the depth buffer size.

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

C++ documentation:

Returns the depth buffer size.

See also setDepthBufferSize().

source

pub unsafe fn green_buffer_size(&self) -> c_int

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().

source

pub unsafe fn has_alpha(&self) -> bool

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.

source

pub unsafe fn major_version(&self) -> c_int

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().

source

pub unsafe fn minor_version(&self) -> c_int

Returns the minor OpenGL version.

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

C++ documentation:

Returns the minor OpenGL version.

See also setMinorVersion().

source

pub unsafe fn new_0a() -> CppBox<QSurfaceFormat>

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.

source

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

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.

source

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

Constructs a copy of other.

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

C++ documentation:

Constructs a copy of other.

source

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

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().

source

pub unsafe fn profile(&self) -> OpenGLContextProfile

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().

source

pub unsafe fn red_buffer_size(&self) -> c_int

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().

source

pub unsafe fn renderable_type(&self) -> RenderableType

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().

source

pub unsafe fn samples(&self) -> c_int

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().

source

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

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().

source

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

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().

source

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

Available 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().

source

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

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().

source

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

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().

source

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

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().

source

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

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().

source

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

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().

source

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

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().

source

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

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().

source

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

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().

source

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

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().

source

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

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().

source

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

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().

source

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

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().

source

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

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().

source

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

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().

source

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

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().

source

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

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().

source

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

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().

source

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

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().

source

pub unsafe fn static_meta_object() -> Ref<QMetaObject>

Returns a reference to the staticMetaObject field.

source

pub unsafe fn stencil_buffer_size(&self) -> c_int

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().

source

pub unsafe fn stereo(&self) -> bool

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().

source

pub unsafe fn swap_behavior(&self) -> SwapBehavior

Returns the configured swap behaviour.

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

C++ documentation:

Returns the configured swap behaviour.

See also setSwapBehavior().

source

pub unsafe fn swap_interval(&self) -> c_int

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().

source

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

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().

source

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

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().

source

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

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§

source§

impl CppDeletable for QSurfaceFormat

source§

unsafe fn delete(&self)

Destroys the QSurfaceFormat.

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

C++ documentation:

Destroys the QSurfaceFormat.

source§

impl PartialEq<Ref<QSurfaceFormat>> for QSurfaceFormat

source§

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

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().

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.