diff --git a/kirigami.qrc b/kirigami.qrc --- a/kirigami.qrc +++ b/kirigami.qrc @@ -39,6 +39,7 @@ src/controls/private/ActionMenuItemQt59.qml src/controls/private/ActionMenuItemBase.qml src/controls/Separator.qml + src/controls/Spacer.qml src/controls/OverlayDrawer.qml src/controls/OverlaySheet.qml src/controls/GlobalDrawer.qml diff --git a/kirigami.qrc.in b/kirigami.qrc.in --- a/kirigami.qrc.in +++ b/kirigami.qrc.in @@ -37,6 +37,7 @@ @kirigami_QML_DIR@/src/controls/private/@kirigami_ActionMenuItem@ @kirigami_QML_DIR@/src/controls/private/ActionMenuItemBase.qml @kirigami_QML_DIR@/src/controls/Separator.qml + @kirigami_QML_DIR@/src/controls/Spacer.qml @kirigami_QML_DIR@/src/controls/OverlayDrawer.qml @kirigami_QML_DIR@/src/controls/OverlaySheet.qml @kirigami_QML_DIR@/src/controls/GlobalDrawer.qml diff --git a/src/controls/Spacer.qml b/src/controls/Spacer.qml new file mode 100644 --- /dev/null +++ b/src/controls/Spacer.qml @@ -0,0 +1,38 @@ +/* + * Copyright 2018 Nate Graham + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.1 +import QtQuick.Layouts 1.2 +import org.kde.kirigami 2.4 + +/** + * A simple spacer + * + * Useful for separating groups of elements or controls from one another + * with a pre-defined amount of whitespace (18px) + * + * @inherit QtQuick.Item + */ + +Item { + width: Units.gridUnit + height: Units.gridUnit + Layout.preferredWidth: Units.gridUnit + Layout.preferredHeight: Units.gridUnit +} diff --git a/src/kirigamiplugin.cpp b/src/kirigamiplugin.cpp --- a/src/kirigamiplugin.cpp +++ b/src/kirigamiplugin.cpp @@ -131,6 +131,7 @@ qmlRegisterType(componentUrl(QStringLiteral("GlobalDrawer.qml")), uri, 2, 0, "GlobalDrawer"); qmlRegisterType(componentUrl(QStringLiteral("Heading.qml")), uri, 2, 0, "Heading"); qmlRegisterType(componentUrl(QStringLiteral("Separator.qml")), uri, 2, 0, "Separator"); + qmlRegisterType(componentUrl(QStringLiteral("Spacer.qml")), uri, 2, 0, "Spacer"); qmlRegisterType(componentUrl(QStringLiteral("PageRow.qml")), uri, 2, 0, "PageRow"); qmlRegisterType(uri, 2, 0, "Icon"); diff --git a/src/qmldir b/src/qmldir --- a/src/qmldir +++ b/src/qmldir @@ -43,3 +43,4 @@ ListItemDragHandle 2.5 ListItemDragHandle.qml ActionToolBar 2.5 ActionToolBar.qml BannerImage 2.5 private/BannerImage.qml +Spacer 2.0 Spacer.qml