generated from Eeems-Org/remarkable-template-qt-app
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
346 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import QtQuick 2.10 | ||
import QtQuick.Controls 2.4 | ||
|
||
Label { | ||
id: root | ||
padding: 5 | ||
verticalAlignment: Qt.AlignVCenter | ||
horizontalAlignment: Qt.AlignHCenter | ||
property int border: 0 | ||
property int radius: 0 | ||
property string borderColor: "black" | ||
property string backgroundColor: "transparent" | ||
signal pressed() | ||
signal released() | ||
signal clicked() | ||
MouseArea { | ||
anchors.fill: parent | ||
onPressed: root.pressed() | ||
onReleased: root.released() | ||
onClicked: root.clicked() | ||
} | ||
background: Rectangle{ | ||
border.width: root.border | ||
border.color: root.borderColor | ||
radius: root.radius | ||
color: root.backgroundColor | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import QtQuick 2.10 | ||
import Qt.labs.folderlistmodel 2.15 | ||
import "." | ||
|
||
Item { | ||
id: root | ||
property var nameFilters: ["*.gb"] | ||
property string rootFolder: "file:///home/root" | ||
property string folder: "file:///home/root/roms" | ||
property int selectedIndex: -1 | ||
function selected(){ return folderModel.get(selectedIndex, "filePath") } | ||
|
||
Rectangle { | ||
anchors.fill: parent | ||
color: "white" | ||
} | ||
|
||
FolderListModel { | ||
id: folderModel | ||
nameFilters: root.nameFilters | ||
rootFolder: root.rootFolder | ||
folder: root.folder | ||
} | ||
|
||
Component { | ||
id: fileDelegate | ||
Clickable { | ||
text: fileName | ||
width: parent.width | ||
font.pointSize: 20 | ||
function index(){ return folderModel.indexOf(fileUrl) } | ||
color: root.selectedIndex === index() ? "white" : "black" | ||
backgroundColor: root.selectedIndex === index() ? "black" : "white" | ||
onClicked: root.selectedIndex = root.selectedIndex === index() ? -1 : index() | ||
} | ||
} | ||
|
||
ListView { | ||
id: list | ||
anchors.fill: parent | ||
model: folderModel | ||
delegate: fileDelegate | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.