mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-19 23:07:21 +00:00

Added `checkable` property to `MenuItem` and `MenuEntry` ChangeLog: Added `checkable` and `checked` property to MenuEntry
55 lines
2.2 KiB
Text
55 lines
2.2 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import { CheckBox, StandardListView } from "std-widgets.slint";
|
|
import { AboutPage, ControlsPage, EasingsPage, ListViewPage, TableViewPage, TableViewPageAdapter, TextEditPage } from "ui/pages/pages.slint";
|
|
import { GallerySettings } from "ui/gallery_settings.slint";
|
|
import { SideBar } from "ui/side_bar.slint";
|
|
|
|
export { TableViewPageAdapter }
|
|
|
|
export component App inherits Window {
|
|
preferred-width: 700px;
|
|
preferred-height: 500px;
|
|
title: @tr("Slint Widgets Gallery");
|
|
icon: @image-url("../../logo/slint-logo-small-light.png");
|
|
|
|
MenuBar {
|
|
Menu {
|
|
title: @tr("MenuBar" => "File");
|
|
MenuItem { title: @tr("MenuBar" => "Open"); }
|
|
Menu {
|
|
title: @tr("MenuBar" => "Open Recent");
|
|
for x in 10: MenuItem { title: @tr("MenuBar" => "Recent {}", x+1); }
|
|
}
|
|
MenuSeparator {}
|
|
MenuItem { title: @tr("MenuBar" => "Save"); }
|
|
Menu {
|
|
title: @tr("MenuBar" => "Save As");
|
|
for x in 10: MenuItem { title: @tr("MenuBar" => "Name {}", x+1); }
|
|
}
|
|
MenuSeparator {}
|
|
MenuItem { title: @tr("MenuBar" => "MenuItem with Icon"); icon: @image-url("thumbsup.png"); }
|
|
MenuItem { title: @tr("MenuBar" => "MenuItem with Checkmark"); checkable: true; checked: true; }
|
|
}
|
|
Menu {
|
|
title: @tr("MenuBar" => "Edit");
|
|
MenuItem { title: @tr("MenuBar" => "Copy"); }
|
|
MenuItem { title: @tr("MenuBar" => "Paste"); }
|
|
}
|
|
}
|
|
|
|
HorizontalLayout {
|
|
side-bar := SideBar {
|
|
title: @tr("Slint Widgets Gallery");
|
|
model: [@tr("Menu" => "Controls"), @tr("Menu" => "ListView"), @tr("Menu" => "TableView"), @tr("Menu" => "TextEdit"), @tr("Menu" => "Easings"), @tr("Menu" => "About")];
|
|
}
|
|
|
|
if(side-bar.current-item == 0) : ControlsPage {}
|
|
if(side-bar.current-item == 1) : ListViewPage {}
|
|
if(side-bar.current-item == 2) : TableViewPage {}
|
|
if(side-bar.current-item == 3) : TextEditPage {}
|
|
if(side-bar.current-item == 4) : EasingsPage {}
|
|
if(side-bar.current-item == 5) : AboutPage {}
|
|
}
|
|
}
|