MobileAd QML Type

Advertisement item designed for mobile applications. More...

Inherits:

Item

Properties

Signals

Methods

Detailed Description

The Qt Digital Advertising module offers easy to include advertisement content in your application. To use this module in your Qt Quick application, add the following import statement to your QML file

import QtDigitalAdvertising 1.1

The advertisement requested from a media server are based on the set up properties. Bare-minimum plugin properties set-up:

 MobileAd{
    anchors.fill:  parent

    playMode: QtDigitalAdvertising.AutoPlay
    displayMode: QtDigitalAdvertising.Singleshot

    pageId: "1515277"
    formatId: "104693"
}

According to displayMode an advertisement could be diplayed in two modes: SingleShot or Loop .

Triggering play of the advertisement is based on playMode property. It could be AutoPlay, OnRequest or

Examples: Plugin playing advertisements in a loop automatically after item creation:

displayMode: QtDigitalAdvertising.Loop
playMode: QtDigitalAdvertising.AutoPlay

Plugin playing advertisements only once when user request it programmatically via play() method:

displayMode: QtDigitalAdvertising.SingleShot
playMode: QtDigitalAdvertising.OnRequest

Plugin playing advertisements in a loop when idle state is detected:

displayMode: QtDigitalAdvertising.Loop
playMode: QtDigitalAdvertising.OnIdle
inactivityTime: 2000

Error handling

In case incorrect of missing advertisement request AdvRequestFailed signal will be emitted. This allows user to i.e. hide the advertisement placeholder.

Property Documentation

adBackgroundColor : int

[Dektop banner only] This property indicated the background color of the ad


displayMode : enumeration

This property holds the display mode of the advertisement. By default, it is set to SingleShot.

The following are the possible values:

ValueDescription
SingleShotDisplays the advertisement once and stops.
LoopReplays the advertisement infinetly.

formatId : int

This property holds format Id which indicates exact width and height


inactivityTime : int

This property indicates how much time, in milliseconds, has to pass from last mouse, touch or keyboard usage, in order to request an advertisement.

By default, it is set to 5000 ms.

This value is used only when playMode is set up to OnIdle.


pageId : int

This property holds pageId Id


playMode : enumeration

This property indicates if advertisements will be displayed immediately, later on by user, or when idle mode is detected By default, it is set to AutoPlay.

ValueDescription
AutoPlayThe advertisements will be displayed immediately
OnRequestThe advertisements will be displayed when requested by user using play() function.
OnIdleThe advertisements will be displayed when no mouse, touch or keyboard inactivity after inactivityTime timer expire

Signal Documentation

adClicked()

This signal is emitted when the advertisement was clicked.

Note: The corresponding handler is onAdClicked.


adEnded()

This signal is emitted when the advertisement ends.

Note: The corresponding handler is onAdEnded.


adError(string = error)

This signal is emitted when ad request parameters are missing or incorrect.

Note: The corresponding handler is onAdError.


adRequested()

This signal is emitted when the advertisement was requested.

Note: The corresponding handler is onAdRequested.


adStarted()

This signal is emitted when the advertisement started to play.

Note: The corresponding handler is onAdStarted.


idleState(bool = isActive)

This signal is emitted when ad request parameters are missing or incorrect.

Note: The corresponding handler is onIdleState.


Method Documentation

play()

Triggers playing advertisements if plugin not displaying advs currently.


stop()

Stops displaying advertisements and all jobs in related. Also triggers expiration procedure for all requested advertisements


© 2023 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.