Commit 90c86f17 authored by camilo higuita's avatar camilo higuita

now there is a custom swipeview to avoid annoying qqc2 one from some styles

parent 46a37051
......@@ -112,8 +112,8 @@ Item
action: control.currentIndex >= control.actions.length && control.currentIndex < control.count? control.hiddenActions[control.currentIndex - control.actions.length] : null
checkable: true
checked: visible
anchors.verticalCenter: parent.verticalCenter
checked: true
Layout.alignment: Qt.AlignVCenter
icon.width: Maui.Style.iconSizes.medium
icon.height: Maui.Style.iconSizes.medium
display: ToolButton.TextBesideIcon
......@@ -166,7 +166,7 @@ Item
onTriggered:
{
control.currentIndex = control.actions.length + index
control.currentIndex = control.actions.length + index
control.clicked(control.currentIndex)
}
}
......
......@@ -24,7 +24,7 @@ import org.kde.mauikit 1.0 as Maui
import org.kde.kirigami 2.8 as Kirigami
import QtGraphicalEffects 1.0
ScrollView
Kirigami.ScrollablePage
{
id: control
......@@ -75,12 +75,12 @@ ScrollView
topPadding: 0
bottomPadding: 0
focus: true
clip: false
// clip: false
// keyboardNavigationEnabled: false
keyboardNavigationEnabled: false
Keys.enabled: false
// verticalScrollBarPolicy: ScrollBar.AlwaysOn
property alias flickable : controlView
verticalScrollBarPolicy: ScrollBar.AlwaysOn
GridView
{
id: controlView
......
/*
* Copyright 2018 Camilo Higuita <milo.h@aol.com>
* Copyright 2019 Camilo Higuita <milo.h@aol.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
......@@ -29,7 +29,7 @@ Page
{
id: control
focus: true
clip: true
// clip: true
leftPadding: control.padding
rightPadding: control.padding
......
/*
* Copyright 2020 Camilo Higuita <milo.h@aol.com>
*
* 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 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.10
import QtQuick.Controls 2.10
import org.kde.mauikit 1.0 as Maui
import org.kde.kirigami 2.7 as Kirigami
Loader
{
id: control
property alias action : _action
default property alias content : control.sourceComponent
active: SwipeView.index < SwipeView.view.maxViews ? SwipeView.isCurrentItem || SwipeView.isPreviousItem || SwipeView.isNextItem || item : SwipeView.isCurrentItem
Action
{
id: _action
}
}
/*
* Copyright 2020 Camilo Higuita <milo.h@aol.com>
*
* 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 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.10
import QtQuick.Controls 2.10
import QtQuick.Layouts 1.3
import org.kde.mauikit 1.0 as Maui
import org.kde.kirigami 2.7 as Kirigami
import QtQuick.Layouts 1.3
SwipeView
{
id: control
interactive: true
clip: true
property int maxViews : 4
property Maui.ToolBar toolbar : window().headBar
property alias actions : _actionGroup.actions
property alias hiddenAction : _actionGroup.hiddenActions
readonly property int index : -1
readonly property QtObject actionGroup : Maui.ActionGroup
{
id: _actionGroup
currentIndex : control.currentIndex
onCurrentIndexChanged: control.currentIndex = currentIndex
Component.onCompleted:
{
control.toolbar.middleContent.push(_actionGroup)
}
}
currentIndex: _actionGroup.currentIndex
onCurrentIndexChanged: _actionGroup.currentIndex = currentIndex
onCurrentItemChanged: currentItem.forceActiveFocus()
contentItem: ListView
{
model: control.contentModel
interactive: control.interactive
currentIndex: control.currentIndex
spacing: control.spacing
orientation: control.orientation
snapMode: ListView.SnapOneItem
boundsBehavior: Flickable.StopAtBounds
highlightRangeMode: ListView.StrictlyEnforceRange
preferredHighlightBegin: 0
highlightMoveDuration: 0
highlightResizeDuration: 0
preferredHighlightEnd: width
// highlight: Item {}
highlightMoveVelocity: -1
highlightResizeVelocity: -1
// resize
maximumFlickVelocity: 4 * (control.orientation === Qt.Horizontal ? width : height)
}
Component.onCompleted:
{
control.toolbar.middleContent.push(control.actionGroup)
for(var i in control.contentChildren)
{
const obj = control.contentChildren[i]
if(obj.hasOwnProperty("action"))
{
if(control.actions.length < control.maxViews)
{
control.actions.push(obj.action)
}else
{
control.hiddenAction.push(obj.action)
}
}
}
}
}
......@@ -65,6 +65,8 @@ SelectionBar 1.1 labs/SelectionBar.qml
ShareDialog 1.1 labs/ShareDialog.qml
ActionToolBar 1.1 labs/ActionToolBar.qml
ToolButtonAction 1.1 labs/ToolButtonAction.qml
AppViews 1.1 labs/AppViews.qml
AppView 1.1 labs/AppView.qml
X 1.0 private/shapes/X.qml
PlusSign 1.0 private/shapes/PlusSign.qml
......
......@@ -130,6 +130,8 @@ void MauiKit::registerTypes(const char *uri)
qmlRegisterType(componentUrl(QStringLiteral("labs/ShareDialog.qml")), uri, 1, 1, "ShareDialog");
qmlRegisterType(componentUrl(QStringLiteral("labs/ActionToolBar.qml")), uri, 1, 1, "ActionToolBar");
qmlRegisterType(componentUrl(QStringLiteral("labs/ToolButtonAction.qml")), uri, 1, 1, "ToolButtonAction");
qmlRegisterType(componentUrl(QStringLiteral("labs/AppViews.qml")), uri, 1, 1, "AppViews");
qmlRegisterType(componentUrl(QStringLiteral("labs/AppView.qml")), uri, 1, 1, "AppView");
/** Experimental **/
qmlRegisterType(componentUrl(QStringLiteral("labs/CSDControls.qml")), uri, 1, 1, "CSDControls");
......
......@@ -80,6 +80,8 @@
<file alias="labs/WindowControls.qml">controls/labs/WindowControls.qml</file>
<file alias="labs/ActionToolBar.qml">controls/labs/ActionToolBar.qml</file>
<file alias="labs/ToolButtonAction.qml">controls/labs/ToolButtonAction.qml</file>
<file alias="labs/AppViews.qml">controls/labs/AppViews.qml</file>
<file alias="labs/AppView.qml">controls/labs/AppView.qml</file>
</qresource>
<qresource prefix="/"/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment