diff --git a/src/declarativeimports/plasmacomponents3/TopArea.qml b/src/declarativeimports/plasmacomponents3/TopArea.qml new file mode 100644 --- /dev/null +++ b/src/declarativeimports/plasmacomponents3/TopArea.qml @@ -0,0 +1,48 @@ +/* + * Copyright 2020 Niccolò Venerandi + * + * 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.12 +import QtQuick.Layouts 1.12 + +import org.kde.plasma.core 2.0 as PlasmaCore +import QtQuick.Templates @QQC2_VERSION@ as T + + T.Frame { + + property bool flipped: false + + Layout.fillWidth: true + + implicitWidth: contentWidth + leftPadding + rightPadding + implicitHeight: contentHeight + topPadding + bottomPadding + + contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) + contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) + + leftInset: -topAreaSvg.margins.left + rightInset: -topAreaSvg.margins.right + topInset: -topAreaSvg.margins.bottom ? flipped : -topAreaSvg.margins.top + bottomInset: -topAreaSvg.margins.bottom ? flipped : -topAreaSvg.margins.top + + background: PlasmaCore.FrameSvgItem { + id: topAreaSvg + imagePath: "test" + prefix: 'flipped' ? flipped : '' + } + }