-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.qml
48 lines (45 loc) · 1.57 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import "DropDownInput/" as Comps
import ir.hcoding.models 1.0
Window {
width: 700
height: 500
visible: true
title: qsTr("DropDown Test")
Item{
TagItemsModel {
// Example (original & init original data):
id: tagListModel;
function makeid(length) {
var result = '';
var characters = 'abcdefg1234567890';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() *
charactersLength));
}
return result;
}
Component.onCompleted: {
var x = tagListModel.createTagItem();
for(var i = 0; i<25;++i)
{
x.name = tagListModel.makeid(12);
x.description = "Description: This is simple text to Show QML power.This is simple text to Show QML power.";
x.link = '<html><style type="text/css"></style><a href="http://hcoding.ir">HCoding</a></html>';
tagListModel.addTagItem(x);
}
}
}
}
Comps.DropDownInput{
width: parent.width * 0.7
height: parent.height * 0.7
anchors.centerIn:parent
originalModel: tagListModel;
}
Button{text:"Exit";onClicked:{Qt.quit()}}
}