feat(Storybook): Button for opening pages directory

Closes: #12271
This commit is contained in:
Michał Cieślak 2023-09-27 14:09:20 +02:00 committed by Michał
parent e94554b209
commit d5317a91ba
2 changed files with 55 additions and 39 deletions

View File

@ -1,5 +1,6 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include "cachecleaner.h"
#include "directorieswatcher.h"
@ -42,6 +43,9 @@ int main(int argc, char *argv[])
for (const auto& path : additionalImportPaths)
engine.addImportPath(path);
engine.rootContext()->setContextProperty(
"pagesFolder", QML_IMPORT_ROOT + QStringLiteral("/pages"));
qmlRegisterType<FigmaDecoratorModel>("Storybook", 1, 0, "FigmaDecoratorModel");
qmlRegisterType<FigmaLinksSource>("Storybook", 1, 0, "FigmaLinksSource");
qmlRegisterType<PagesModelInitialized>("Storybook", 1, 0, "PagesModel");

View File

@ -102,9 +102,13 @@ ApplicationWindow {
SplitView {
anchors.fill: parent
Pane {
ColumnLayout {
SplitView.preferredWidth: 270
Pane {
Layout.fillWidth: true
Layout.fillHeight: true
ColumnLayout {
width: parent.width
height: parent.height
@ -158,6 +162,14 @@ ApplicationWindow {
}
}
Button {
Layout.fillWidth: true
text: "Open pages directory"
onClicked: Qt.openUrlExternally(Qt.resolvedUrl(pagesFolder))
}
}
Page {
SplitView.fillWidth: true