main.qml Example File
bannerads/assets/main.qml
import bb.cascades 1.0
import bb.cascades.advertisement 1.0
TabbedPane {
id: tabPane
showTabsOnActionBar: true
onCreationCompleted: {
tab1.content = page1.createObject();
tabPane.activeTab = tab1
}
Tab {
id: tab1
title: qsTr("320x50")
imageSource: "asset:///images/ratio.png"
attachedObjects: [
ComponentDefinition {
id: page1
Page {
BanneradsScrollView {
Container {
layout: DockLayout {
}
ImageView {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
imageSource: "asset:///images/background.png"
}
Container {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
Label {
text: qsTr("320x50 banner")
horizontalAlignment: HorizontalAlignment.Center
textStyle {
base: SystemDefaults.TextStyles.TitleText
}
}
Banner {
zoneId: 117145
refreshRate: 60
preferredWidth: 320
preferredHeight: 50
transitionsEnabled: true
placeHolderURL: "asset:///images/placeholder_728x90.png"
backgroundColor: Color.Green
borderColor: Color.Gray
borderWidth: 2
horizontalAlignment: HorizontalAlignment.Center
}
Weather {
}
}
}
}
}
}
]
}
Tab {
id: tab2
title: qsTr("300x50")
imageSource: "asset:///images/ratio.png"
attachedObjects: [
ComponentDefinition {
id: page2
Page {
BanneradsScrollView {
Container {
layout: DockLayout {
}
ImageView {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
imageSource: "asset:///images/background.png"
}
Container {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
Label {
text: qsTr("300x50 banner")
horizontalAlignment: HorizontalAlignment.Center
textStyle {
base: SystemDefaults.TextStyles.TitleText
}
}
Banner {
zoneId: 117145
refreshRate: 60
preferredWidth: 300
preferredHeight: 50
transitionsEnabled: true
placeHolderURL: "asset:///images/placeholder_728x90.png"
backgroundColor: Color.Green
borderColor: Color.Blue
borderWidth: 2
horizontalAlignment: HorizontalAlignment.Center
}
Weather {
}
}
}
}
}
}
]
}
Tab {
id: tab3
title: qsTr("320x48")
imageSource: "asset:///images/ratio.png"
attachedObjects: [
ComponentDefinition {
id: page3
Page {
BanneradsScrollView {
Container {
layout: DockLayout {
}
ImageView {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
imageSource: "asset:///images/background.png"
}
Container {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
Label {
text: qsTr("320x48 banner")
horizontalAlignment: HorizontalAlignment.Center
textStyle {
base: SystemDefaults.TextStyles.TitleText
}
}
Banner {
zoneId: 117145
refreshRate: 60
preferredWidth: 320
preferredHeight: 48
transitionsEnabled: true
placeHolderURL: "asset:///images/placeholder_728x90.png"
backgroundColor: Color.Green
borderColor: Color.Gray
borderWidth: 2
horizontalAlignment: HorizontalAlignment.Center
}
Weather {
}
}
}
}
}
}
]
}
onActiveTabChanged: {
if (activeTab == tab2) {
if (tab2.content == undefined) {
tab2.content = page2.createObject();
}
} else if (activeTab == tab3 ) {
if (tab3.content == undefined) {
tab3.content = page3.createObject();
}
}
}
}