C++ 入門指南 4.01
練習 29.7 參考程式 - 練習設計圖片檢視器外觀
import QtQuick
import QtQuick.Controls
ApplicationWindow {
width: 627
height: 418
visible: true
title: qsTr("圖片檢視")
SwipeView {
id: view
currentIndex: 1
anchors.fill: parent
Item {
id: firstPage
Image {
width: 627
height: 418
source: "file:///替換路徑/demo1.jpg"
}
}
Item {
id: secondPage
Image {
width: 627
height: 418
source: "file:///替換路徑/demo2.jpg"
}
}
}
PageIndicator {
id: indicator
count: view.count
currentIndex: view.currentIndex
anchors.bottom: view.bottom
anchors.horizontalCenter: parent.horizontalCenter
}
}
/* 《程式語言教學誌》的範例程式
http://kaiching.org/
檔名:main.qml
功能:示範 SwipeView 、 Image 、 PageIndicator 型態
作者:張凱慶 */
回到練習題目