diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e3884c1e..c578689e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,241 +1,241 @@ cmake_minimum_required(VERSION 3.0) set(KF5_VERSION "5.43.0") # handled by release scripts set(KF5_DEP_VERSION "5.42.0") # handled by release scripts project(Plasma VERSION ${KF5_VERSION}) # ECM setup include(FeatureSummary) find_package(ECM 5.42.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) include(GenerateExportHeader) include(ECMGenerateHeaders) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(CMakePackageConfigHelpers) include(ECMSetupVersion) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(ECMQtDeclareLoggingCategory) include(ECMAddQch) include(KDEPackageAppTemplates) include(ECMGenerateQmlTypes) option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") ecm_setup_version(PROJECT VARIABLE_PREFIX PLASMA VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/plasma_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5PlasmaConfigVersion.cmake" SOVERSION 5) if(KDE_PLATFORM_FEATURE_DISABLE_DEPRECATED) set(KDE_NO_DEPRECATED TRUE) set(CMAKE_AUTOMOC_MOC_OPTIONS "-DKDE_NO_DEPRECATED") endif() ################# Enable C++0x (still too early for -std=c++11) features for clang and gcc ################# if(UNIX) #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x") add_definitions("-Wall -std=c++0x") endif() ################# now find all used packages ################# set (REQUIRED_QT_VERSION 5.7.0) -find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Quick Gui Sql Qml Svg) +find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Quick Gui Sql Qml Svg QuickControls2) find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS Activities Archive Config ConfigWidgets CoreAddons DBusAddons Declarative GlobalAccel GuiAddons I18n IconThemes KIO Service WindowSystem XmlGui Notifications Package Kirigami2 OPTIONAL_COMPONENTS Wayland DocTools ) set_package_properties(KF5Wayland PROPERTIES DESCRIPTION "Integration with the Wayland compositor" TYPE OPTIONAL ) if(KF5Wayland_FOUND) set(HAVE_KWAYLAND 1) endif() set_package_properties(KF5DocTools PROPERTIES DESCRIPTION "Tools to generate documentation" TYPE OPTIONAL ) #optional features find_package(X11 MODULE) set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries" URL "http://www.x.org" TYPE OPTIONAL ) find_package(XCB MODULE COMPONENTS XCB COMPOSITE DAMAGE SHAPE XFIXES RENDER) set_package_properties(XCB PROPERTIES DESCRIPTION "X protocol C-language Binding" URL "http://xcb.freedesktop.org" TYPE OPTIONAL ) if(X11_FOUND AND XCB_XCB_FOUND) set(HAVE_X11 1) find_package(Qt5 REQUIRED NO_MODULE COMPONENTS X11Extras) #X11_Xrender discovery is done by FindX11 #add_feature_info("X Rendering Extension (libXrender)" X11_Xrender_FOUND "Support for compositing, rendering operations, and alpha-blending. STRONGLY RECOMMENDED") endif() #FIXME: when we have a qca for qt5, reenable # find_package(QCA2 2.0.0 MODULE) set_package_properties(QCA2 PROPERTIES DESCRIPTION "Support for remote plasma widgets" URL "http://delta.affinix.com/qca" TYPE OPTIONAL ) find_package(OpenGL) set_package_properties(OpenGL PROPERTIES DESCRIPTION "The OpenGL libraries" URL "http://www.opengl.org" TYPE OPTIONAL ) find_package(EGL) set_package_properties(EGL PROPERTIES PURPOSE "Support for Window Thumbnail on EGL platform" TYPE OPTIONAL ) set(HAVE_EGL ${EGL_FOUND}) if(OPENGL_FOUND AND (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL "GL")) set(HAVE_GLX ${HAVE_X11}) else() set(HAVE_GLX 0) endif() ######################################################################### set(Plasma_AUTOMOC_MACRO_NAMES "K_EXPORT_PLASMA_SERVICE" "K_EXPORT_PLASMA_SERVICE_WITH_JSON" "K_EXPORT_PLASMA_APPLET" "K_EXPORT_PLASMA_APPLET_WITH_JSON" "K_EXPORT_PLASMA_PACKAGE" "K_EXPORT_PLASMA_PACKAGE_WITH_JSON" "K_EXPORT_PLASMA_APPLETSCRIPTENGINE" "K_EXPORT_PLASMA_APPLETSCRIPTENGINE_WITH_JSON" "K_EXPORT_PLASMA_DATAENGINESCRIPTENGINE" "K_EXPORT_PLASMA_DATAENGINESCRIPTENGINE_WITH_JSON" "K_EXPORT_PLASMA_CONTAINMENTACTIONS_WITH_JSON" "K_EXPORT_PLASMA_DATAENGINE" "K_EXPORT_PLASMA_DATAENGINE_WITH_JSON" ) if(NOT CMAKE_VERSION VERSION_LESS "3.10.0") # CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros. # 3.10+ lets us provide more macro names that require automoc. list(APPEND CMAKE_AUTOMOC_MACRO_NAMES ${Plasma_AUTOMOC_MACRO_NAMES}) endif() add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) #add_definitions(-Wno-deprecated) add_definitions(-DQT_USE_QSTRINGBUILDER) add_definitions(-DQT_NO_URL_CAST_FROM_STRING) include(KF5PlasmaMacros.cmake) ######################################################################### option(BUILD_EXAMPLES "Build and install Plasma examples." OFF) option(BUILD_COVERAGE "Build Plasma Frameworks with gcov support" OFF) if(BUILD_COVERAGE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov") endif() # make plasma_version.h available include_directories(${CMAKE_CURRENT_BINARY_DIR}) ################# list the subdirectories ################# if (KF5DocTools_FOUND) add_subdirectory(docs) endif() add_definitions(-DTRANSLATION_DOMAIN=\"libplasma5\") if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") ki18n_install(po) if (KF5DocTools_FOUND) kdoctools_install(po) endif() endif() add_subdirectory(src) if (BUILD_EXAMPLES) add_subdirectory(examples) endif() add_subdirectory(autotests) add_subdirectory(tests) add_subdirectory(templates) ################ create PlasmaConfig.cmake and install it ########################### # create a Config.cmake and a ConfigVersion.cmake file and install them set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Plasma") if (BUILD_QCH) ecm_install_qch_export( TARGETS KF5Plasma_QCH FILE KF5PlasmaQchTargets.cmake DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF5PlasmaQchTargets.cmake\")") endif() configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/KF5PlasmaConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KF5PlasmaConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} PATH_VARS KF5_INCLUDE_INSTALL_DIR CMAKE_INSTALL_PREFIX ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5PlasmaConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/KF5PlasmaConfigVersion.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/KF5PlasmaMacros.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) install(EXPORT KF5PlasmaTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5PlasmaTargets.cmake NAMESPACE KF5:: COMPONENT Devel) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plasma_version.h DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel ) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/declarativeimports/CMakeLists.txt b/src/declarativeimports/CMakeLists.txt index 8ac236239..60c1eea49 100644 --- a/src/declarativeimports/CMakeLists.txt +++ b/src/declarativeimports/CMakeLists.txt @@ -1,53 +1,72 @@ add_subdirectory(accessdenied) add_subdirectory(core) add_subdirectory(plasmacomponents) add_subdirectory(plasmaextracomponents) add_subdirectory(platformcomponents) add_subdirectory(calendar) install(DIRECTORY plasmastyle/ DESTINATION ${KDE_INSTALL_QMLDIR}/QtQuick/Controls/Styles/Plasma) install(DIRECTORY kirigamiplasmastyle/ DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kirigami.2/styles/Plasma) install(DIRECTORY kirigamiplasmadesktopstyle/ DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kirigami.2/styles/org.kde.desktop.plasma) + +math(EXPR QQC2_VERSION "${Qt5QuickControls2_VERSION_MINOR} - 7") +set(QQC2_VERSION "2.${QQC2_VERSION}") + + +# Find all the source qml files +FILE(GLOB_RECURSE inFiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}/plasmacomponents3/*") + + #for each file, replace @QQC2_VERSION@ with the version we found +FOREACH(infileName ${inFiles}) + configure_package_config_file( + "${CMAKE_CURRENT_SOURCE_DIR}/${infileName}" + "${CMAKE_CURRENT_BINARY_DIR}/${infileName}" + INSTALL_DESTINATION "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Plasma" + PATH_VARS QQC2_VERSION + ) +ENDFOREACH(infileName) + #install the components as a QQC2 Style, as style for applications (mainly for Plasma Mobile) -install(DIRECTORY plasmacomponents3/ DESTINATION ${KDE_INSTALL_QMLDIR}/QtQuick/Controls.2/Plasma PATTERN qmldir EXCLUDE) +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/ DESTINATION ${KDE_INSTALL_QMLDIR}/QtQuick/Controls.2/Plasma) #install some of the componets as a separate import, to be used in plasmoids (some of them like ApplicationWindow are of no use for plasmoids) -install(FILES plasmacomponents3/BusyIndicator.qml - plasmacomponents3/Button.qml - plasmacomponents3/CheckBox.qml - plasmacomponents3/CheckDelegate.qml - plasmacomponents3/CheckIndicator.qml +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/BusyIndicator.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/Button.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/CheckBox.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/CheckDelegate.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/CheckIndicator.qml #combobox is not in a new window, but maybe better already than the broken qqc1 combobox? - plasmacomponents3/ComboBox.qml - plasmacomponents3/Container.qml - plasmacomponents3/Control.qml - plasmacomponents3/Dial.qml - plasmacomponents3/Frame.qml - plasmacomponents3/GroupBox.qml - plasmacomponents3/ItemDelegate.qml - plasmacomponents3/Label.qml - - plasmacomponents3/ProgressBar.qml - plasmacomponents3/RadioButton.qml - plasmacomponents3/RadioDelegate.qml - plasmacomponents3/RadioIndicator.qml - plasmacomponents3/RangeSlider.qml - plasmacomponents3/ScrollBar.qml - plasmacomponents3/Slider.qml - plasmacomponents3/SpinBox.qml - plasmacomponents3/Switch.qml - plasmacomponents3/SwitchDelegate.qml - plasmacomponents3/SwitchIndicator.qml - plasmacomponents3/TabBar.qml - plasmacomponents3/TabButton.qml - plasmacomponents3/TextArea.qml - plasmacomponents3/TextField.qml - plasmacomponents3/ToolBar.qml - plasmacomponents3/ToolButton.qml - plasmacomponents3/qmldir + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/ComboBox.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/Container.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/Control.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/Dial.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/Frame.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/GroupBox.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/ItemDelegate.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/Label.qml + + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/ProgressBar.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/RadioButton.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/RadioDelegate.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/RadioIndicator.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/RangeSlider.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/ScrollBar.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/Slider.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/SpinBox.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/Switch.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/SwitchDelegate.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/SwitchIndicator.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/TabBar.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/TabButton.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/TextArea.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/TextField.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/ToolBar.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/ToolButton.qml + ${CMAKE_CURRENT_BINARY_DIR}/plasmacomponents3/qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/components.3) install(DIRECTORY plasmacomponents3/private DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/components.3) diff --git a/src/declarativeimports/plasmacomponents3/BusyIndicator.qml b/src/declarativeimports/plasmacomponents3/BusyIndicator.qml index da421776c..7ff8a1657 100644 --- a/src/declarativeimports/plasmacomponents3/BusyIndicator.qml +++ b/src/declarativeimports/plasmacomponents3/BusyIndicator.qml @@ -1,61 +1,61 @@ /* * Copyright (C) 2014 Kai Uwe Broulik * Copyright 2016 Marco Martin * * 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 2.010-1301, USA. */ import QtQuick 2.2 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore T.BusyIndicator { id: control implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding padding: units.smallSpacing contentItem: PlasmaCore.SvgItem { id: indicatorItem svg: PlasmaCore.Svg { imagePath: "widgets/busywidget" colorGroup: PlasmaCore.ColorScope.colorGroup } elementId: "busywidget" implicitWidth: units.gridUnit * 2 implicitHeight: width Connections { target: control onRunningChanged: { rotationAnimator.from = rotation rotationAnimator.to = rotation + 360 } } RotationAnimator on rotation { id: rotationAnimator from: 0 to: 360 duration: 1500 running: control.running && indicatorItem.visible && indicatorItem.opacity > 0; loops: Animation.Infinite } } } diff --git a/src/declarativeimports/plasmacomponents3/Button.qml b/src/declarativeimports/plasmacomponents3/Button.qml index 428101f88..9ffa63e5d 100644 --- a/src/declarativeimports/plasmacomponents3/Button.qml +++ b/src/declarativeimports/plasmacomponents3/Button.qml @@ -1,93 +1,93 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore import "private" as Private T.Button { id: control implicitWidth: Math.max(background.implicitWidth, contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(background.implicitHeight, contentItem.implicitHeight + topPadding + bottomPadding) leftPadding: surfaceNormal.margins.left topPadding: surfaceNormal.margins.top rightPadding: surfaceNormal.margins.right bottomPadding: surfaceNormal.margins.bottom hoverEnabled: true //Qt.styleHints.useHoverEffects TODO: how to make this work in 5.7? contentItem: Label { text: control.text font: control.font opacity: enabled || control.highlighted || control.checked ? 1 : 0.4 color: theme.buttonTextColor horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } background: Item { //retrocompatibility with old controls implicitWidth: units.gridUnit * 6 implicitHeight: units.gridUnit * 1.6 Private.ButtonShadow { anchors.fill: parent state: { if (control.pressed) { return "hidden" } else if (control.hovered) { return "hover" } else if (control.activeFocus) { return "focus" } else { return "shadow" } } } PlasmaCore.FrameSvgItem { id: surfaceNormal anchors.fill: parent imagePath: "widgets/button" prefix: "normal" opacity: control.checked || control.pressed ? 0 : 1 Behavior on opacity { OpacityAnimator { duration: units.longDuration easing.type: Easing.InOutQuad } } } PlasmaCore.FrameSvgItem { anchors.fill: parent imagePath: "widgets/button" prefix: "pressed" opacity: control.checked || control.pressed ? 1 : 0 Behavior on opacity { OpacityAnimator { duration: units.longDuration easing.type: Easing.InOutQuad } } } } } diff --git a/src/declarativeimports/plasmacomponents3/CheckBox.qml b/src/declarativeimports/plasmacomponents3/CheckBox.qml index 7f5e8f765..04e90ae50 100644 --- a/src/declarativeimports/plasmacomponents3/CheckBox.qml +++ b/src/declarativeimports/plasmacomponents3/CheckBox.qml @@ -1,62 +1,62 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls 2.0 +import QtQuick.Templates @QQC2_VERSION@ as T +import QtQuick.Controls @QQC2_VERSION@ import org.kde.plasma.core 2.0 as PlasmaCore T.CheckBox { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset padding: 1 spacing: Math.round(units.gridUnit / 8) hoverEnabled: true indicator: CheckIndicator { LayoutMirroring.enabled: control.mirrored LayoutMirroring.childrenInherit: true anchors { left: parent.left verticalCenter: parent.verticalCenter } control: control } contentItem: Label { leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 opacity: control.enabled ? 1 : 0.6 text: control.text font: control.font color: PlasmaCore.ColorScope.textColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } } diff --git a/src/declarativeimports/plasmacomponents3/CheckDelegate.qml b/src/declarativeimports/plasmacomponents3/CheckDelegate.qml index f4a9c0fac..50ab5bd94 100644 --- a/src/declarativeimports/plasmacomponents3/CheckDelegate.qml +++ b/src/declarativeimports/plasmacomponents3/CheckDelegate.qml @@ -1,60 +1,60 @@ /* * Copyright 2016 Marco Martin * * 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.5 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore import "private" T.CheckDelegate { id: control implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding hoverEnabled: true topPadding: background.margins.top bottomPadding: background.margins.bottom leftPadding: background.margins.left rightPadding: background.margins.right spacing: units.smallSpacing contentItem: Label { leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 rightPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 text: control.text font: control.font color: theme.viewTextColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } indicator: CheckIndicator { x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding y: control.topPadding + (control.availableHeight - height) / 2 control: control } background: DefaultListItemBackground {} } diff --git a/src/declarativeimports/plasmacomponents3/ComboBox.qml b/src/declarativeimports/plasmacomponents3/ComboBox.qml index 0d8e019b6..bbfb1d8d0 100644 --- a/src/declarativeimports/plasmacomponents3/ComboBox.qml +++ b/src/declarativeimports/plasmacomponents3/ComboBox.qml @@ -1,137 +1,137 @@ /* * Copyright 2016 Marco Martin * * 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.6 import QtQuick.Window 2.2 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls 2.0 as Controls +import QtQuick.Templates @QQC2_VERSION@ as T +import QtQuick.Controls @QQC2_VERSION@ as Controls import QtGraphicalEffects 1.0 import org.kde.plasma.core 2.0 as PlasmaCore import "private" as Private T.ComboBox { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) + indicator.implicitWidth + rightPadding implicitHeight: units.gridUnit * 1.6 baselineOffset: contentItem.y + contentItem.baselineOffset hoverEnabled: true topPadding: surfaceNormal.margins.top leftPadding: surfaceNormal.margins.left rightPadding: surfaceNormal.margins.right bottomPadding: surfaceNormal.margins.bottom delegate: ItemDelegate { width: control.popup.width text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData highlighted: control.highlightedIndex == index property bool separatorVisible: false } indicator: PlasmaCore.SvgItem { implicitWidth: units.iconSizes.small implicitHeight: implicitWidth anchors { right: parent.right rightMargin: surfaceNormal.margins.right verticalCenter: parent.verticalCenter } svg: PlasmaCore.Svg { imagePath: "widgets/arrows" colorGroup: PlasmaCore.Theme.ButtonColorGroup } elementId: "down-arrow" } contentItem: Label { text: control.displayText font: control.font color: theme.buttonTextColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } background: PlasmaCore.FrameSvgItem { id: surfaceNormal //retrocompatibility with old controls implicitWidth: units.gridUnit * 6 anchors.fill: parent imagePath: "widgets/button" prefix: control.pressed ? "pressed" : "normal" Private.ButtonShadow { z: -1 anchors.fill: parent state: { if (control.pressed) { return "hidden" } else if (control.hovered) { return "hover" } else if (control.activeFocus) { return "focus" } else { return "shadow" } } } } popup: T.Popup { x: control.mirrored ? control.width - width : 0 y: control.height width: Math.max(control.width, 150) implicitHeight: contentItem.implicitHeight topMargin: 6 bottomMargin: 6 contentItem: ListView { id: listview clip: true implicitHeight: contentHeight model: control.popup.visible ? control.delegateModel : null currentIndex: control.highlightedIndex highlightRangeMode: ListView.ApplyRange highlightMoveDuration: 0 LayoutMirroring.enabled: true LayoutMirroring.childrenInherit: true T.ScrollBar.vertical: Controls.ScrollBar { } } background: Rectangle { anchors { fill: parent margins: -1 } radius: 2 color: theme.viewBackgroundColor border.color: Qt.rgba(theme.textColor.r, theme.textColor.g, theme.textColor.b, 0.3) layer.enabled: true layer.effect: DropShadow { transparentBorder: true radius: 4 samples: 8 horizontalOffset: 2 verticalOffset: 2 color: Qt.rgba(0, 0, 0, 0.3) } } } } diff --git a/src/declarativeimports/plasmacomponents3/Container.qml b/src/declarativeimports/plasmacomponents3/Container.qml index 5247cdd75..e14e0556e 100644 --- a/src/declarativeimports/plasmacomponents3/Container.qml +++ b/src/declarativeimports/plasmacomponents3/Container.qml @@ -1,30 +1,30 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T T.Container { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding) } diff --git a/src/declarativeimports/plasmacomponents3/Control.qml b/src/declarativeimports/plasmacomponents3/Control.qml index d2cceacb5..3882aa291 100644 --- a/src/declarativeimports/plasmacomponents3/Control.qml +++ b/src/declarativeimports/plasmacomponents3/Control.qml @@ -1,30 +1,30 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T T.Control { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding) } diff --git a/src/declarativeimports/plasmacomponents3/Dial.qml b/src/declarativeimports/plasmacomponents3/Dial.qml index 0729ce3d8..7589d8ef6 100644 --- a/src/declarativeimports/plasmacomponents3/Dial.qml +++ b/src/declarativeimports/plasmacomponents3/Dial.qml @@ -1,102 +1,102 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore import "private" as Private T.Dial { id: control implicitWidth: units.gridUnit * 5 implicitHeight: implicitWidth hoverEnabled: true onPositionChanged: canvas.requestPaint() background:Canvas { id: canvas width: control.availableWidth height: control.availableHeight onPaint: { var ctx = getContext("2d"); ctx.reset(); var centreX = width / 2; var centreY = height / 2; ctx.globalAlpha = 0.3; ctx.beginPath(); ctx.strokeStyle = theme.textColor; ctx.lineWidth=5; ctx.arc(centreX, centreY, width/2.4, 0, 2*Math.PI, false); ctx.stroke(); ctx.globalAlpha = 1; ctx.beginPath(); ctx.strokeStyle = theme.highlightColor; ctx.lineWidth=5; ctx.arc(centreX, centreY, width/2.4, 0.7*Math.PI, 1.6*Math.PI * control.position - 1.25*Math.PI, false); ctx.stroke(); } } PlasmaCore.Svg { id: grooveSvg imagePath: "widgets/slider" colorGroup: PlasmaCore.ColorScope.colorGroup } handle: Item { x: (control.width/2) + Math.cos((-(control.angle-90)*Math.PI)/180) * (control.width/2-width/2) - width/2 y: (control.height/2) + Math.sin(((control.angle-90)*Math.PI)/180) * (control.height/2-height/2) - height/2 implicitHeight: Math.floor(units.gridUnit*1.6) implicitWidth: implicitHeight Private.RoundShadow { id: roundShadow anchors.fill: parent state: { if (control.pressed) { return "hidden" } else if (control.hovered) { return "hover" } else if (control.activeFocus) { return "focus" } else { return "shadow" } } } PlasmaCore.SvgItem { svg: PlasmaCore.Svg { id: buttonSvg imagePath: "widgets/actionbutton" } elementId: control.pressed? "pressed" : "normal" width: Math.floor(parent.height/2) * 2 height: width anchors.centerIn: parent Behavior on opacity { NumberAnimation { duration: units.longDuration } } } } } diff --git a/src/declarativeimports/plasmacomponents3/Dialog.qml b/src/declarativeimports/plasmacomponents3/Dialog.qml index 373a6f8b2..6b505a3a7 100644 --- a/src/declarativeimports/plasmacomponents3/Dialog.qml +++ b/src/declarativeimports/plasmacomponents3/Dialog.qml @@ -1,70 +1,70 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.1 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore T.Dialog { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentWidth > 0 ? contentHeight + topPadding + bottomPadding : 0) contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) leftPadding: background.margins.left topPadding: background.margins.top rightPadding: background.margins.right bottomPadding: background.margins.bottom enter: Transition { NumberAnimation { property: "opacity" from: 0 to: 1 easing.type: Easing.InOutQuad duration: 250 } } exit: Transition { NumberAnimation { property: "opacity" from: 1 to: 0 easing.type: Easing.InOutQuad duration: 250 } } contentItem: Item { } background: PlasmaCore.FrameSvgItem { implicitWidth: units.gridUnit * 12 imagePath: "widgets/background" } footer: DialogButtonBox { position: DialogButtonBox.Footer } } diff --git a/src/declarativeimports/plasmacomponents3/DialogButtonBox.qml b/src/declarativeimports/plasmacomponents3/DialogButtonBox.qml index a9e375138..227c0d5e7 100644 --- a/src/declarativeimports/plasmacomponents3/DialogButtonBox.qml +++ b/src/declarativeimports/plasmacomponents3/DialogButtonBox.qml @@ -1,53 +1,53 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.1 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore T.DialogButtonBox { id: control implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding spacing: units.smallSpacing leftPadding: parent.leftPadding topPadding: parent.topPadding rightPadding: parent.rightPadding bottomPadding: parent.bottomPadding alignment: Qt.AlignRight delegate: Button { width: Math.min(implicitWidth, control.width / control.count - control.rightPadding - control.spacing * (control.count-1)) } contentItem: ListView { implicitWidth: contentWidth implicitHeight: units.gridUnit * 1.6 model: control.contentModel spacing: control.spacing orientation: ListView.Horizontal boundsBehavior: Flickable.StopAtBounds snapMode: ListView.SnapToItem } background: Item {} } diff --git a/src/declarativeimports/plasmacomponents3/Drawer.qml b/src/declarativeimports/plasmacomponents3/Drawer.qml index 36ddafd5f..8dda065d2 100644 --- a/src/declarativeimports/plasmacomponents3/Drawer.qml +++ b/src/declarativeimports/plasmacomponents3/Drawer.qml @@ -1,75 +1,75 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore T.Drawer { id: control parent: T.ApplicationWindow.overlay implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding) contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) topPadding: control.edge === Qt.BottomEdge ? Math.round(units.devicePixelRatio) : 0 leftPadding: control.edge === Qt.RightEdge ? Math.round(units.devicePixelRatio) : 0 rightPadding: control.edge === Qt.LeftEdge ? Math.round(units.devicePixelRatio) : 0 bottomPadding: control.edge === Qt.TopEdge ? Math.round(units.devicePixelRatio) : 0 background: PlasmaCore.FrameSvgItem { anchors { fill: parent leftMargin: -margins.left topMargin: -margins.top rightMargin: -margins.right bottomMargin: -margins.bottom } implicitWidth: units.gridUnit * 12 imagePath: "widgets/background" enabledBorders: { switch (control.edge) { case Qt.BottomEdge: return PlasmaCore.FrameSvgItem.TopBorder; case Qt.RightEdge: return PlasmaCore.FrameSvgItem.LeftBorder; case Qt.TopEdge: return PlasmaCore.FrameSvgItem.BottomBorder; case Qt.LeftEdge: default: return PlasmaCore.FrameSvgItem.RightBorder; } } } enter: Transition { SmoothedAnimation { velocity: 5 } } exit: Transition { SmoothedAnimation { velocity: 5 } } } diff --git a/src/declarativeimports/plasmacomponents3/Frame.qml b/src/declarativeimports/plasmacomponents3/Frame.qml index f9617e5cc..edf64229d 100644 --- a/src/declarativeimports/plasmacomponents3/Frame.qml +++ b/src/declarativeimports/plasmacomponents3/Frame.qml @@ -1,40 +1,40 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick.Controls @QQC2_VERSION@ +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore T.Frame { id: control 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) padding: units.smallSpacing background: PlasmaCore.FrameSvgItem { imagePath: "widgets/frame" prefix: "plain" } } diff --git a/src/declarativeimports/plasmacomponents3/GroupBox.qml b/src/declarativeimports/plasmacomponents3/GroupBox.qml index 6eee9deee..591192e9b 100644 --- a/src/declarativeimports/plasmacomponents3/GroupBox.qml +++ b/src/declarativeimports/plasmacomponents3/GroupBox.qml @@ -1,53 +1,53 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick.Controls @QQC2_VERSION@ +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore T.GroupBox { id: control 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) padding: 6 topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0) label: Label { x: control.leftPadding width: control.availableWidth text: control.title font: control.font color: SystemPaletteSingleton.text(control.enabled) elide: Text.ElideRight horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } background: PlasmaCore.FrameSvgItem { imagePath: "widgets/frame" prefix: "plain" } } diff --git a/src/declarativeimports/plasmacomponents3/ItemDelegate.qml b/src/declarativeimports/plasmacomponents3/ItemDelegate.qml index 965fff13a..98d3e4533 100644 --- a/src/declarativeimports/plasmacomponents3/ItemDelegate.qml +++ b/src/declarativeimports/plasmacomponents3/ItemDelegate.qml @@ -1,53 +1,53 @@ /* * Copyright 2016 Marco Martin * * 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.5 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore import "private" T.CheckDelegate { id: control implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding hoverEnabled: true topPadding: background.margins.top bottomPadding: background.margins.bottom leftPadding: background.margins.left rightPadding: background.margins.right spacing: units.smallSpacing contentItem: Label { leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 rightPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 text: control.text font: control.font color: theme.viewTextColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } background: DefaultListItemBackground {} } diff --git a/src/declarativeimports/plasmacomponents3/Label.qml b/src/declarativeimports/plasmacomponents3/Label.qml index 2a56213a3..630918083 100644 --- a/src/declarativeimports/plasmacomponents3/Label.qml +++ b/src/declarativeimports/plasmacomponents3/Label.qml @@ -1,42 +1,42 @@ /* * Copyright 2016 Marco Martin * * 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.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore T.Label { id: control verticalAlignment: lineCount > 1 ? Text.AlignTop : Text.AlignVCenter activeFocusOnTab: false renderType: Text.NativeRendering //font data is the system one by default //TODO: from theme singleton? color: PlasmaCore.ColorScope.textColor linkColor: theme.linkColor textFormat: Text.PlainText opacity: enabled? 1 : 0.6 Accessible.role: Accessible.StaticText Accessible.name: text } diff --git a/src/declarativeimports/plasmacomponents3/Menu.qml b/src/declarativeimports/plasmacomponents3/Menu.qml index 7878b0b92..c6b7b9b49 100644 --- a/src/declarativeimports/plasmacomponents3/Menu.qml +++ b/src/declarativeimports/plasmacomponents3/Menu.qml @@ -1,74 +1,74 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick.Controls @QQC2_VERSION@ +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore T.Menu { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding margins: 0 leftPadding: background.margins.left topPadding: background.margins.top rightPadding: background.margins.right bottomPadding: background.margins.bottom contentItem: ListView { implicitHeight: contentHeight model: control.contentModel clip: true keyNavigationWraps: false currentIndex: -1 T.ScrollBar.vertical: ScrollBar {} } enter: Transition { NumberAnimation { property: "opacity" from: 0 to: 1 easing.type: Easing.InOutQuad duration: 150 } } exit: Transition { NumberAnimation { property: "opacity" from: 1 to: 0 easing.type: Easing.InOutQuad duration: 150 } } background: PlasmaCore.FrameSvgItem { imagePath: "widgets/background" implicitWidth: units.gridUnit * 8 implicitHeight: units.gridUnit * 2 } } diff --git a/src/declarativeimports/plasmacomponents3/MenuItem.qml b/src/declarativeimports/plasmacomponents3/MenuItem.qml index c286f1106..555763d04 100644 --- a/src/declarativeimports/plasmacomponents3/MenuItem.qml +++ b/src/declarativeimports/plasmacomponents3/MenuItem.qml @@ -1,79 +1,79 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore T.MenuItem { id: controlRoot implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset leftPadding: highlight.margins.left topPadding: highlight.margins.top rightPadding: highlight.margins.right bottomPadding: highlight.margins.bottom spacing: units.smallSpacing hoverEnabled: true contentItem: Label { leftPadding: !controlRoot.mirrored ? (controlRoot.indicator ? controlRoot.indicator.width : 0) + controlRoot.spacing : 0 rightPadding: controlRoot.mirrored ? (controlRoot.indicator ? controlRoot.indicator.width : 0) + controlRoot.spacing : 0 text: controlRoot.text font: controlRoot.font color: theme.textColor elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } indicator: CheckIndicator { x: controlRoot.mirrored ? controlRoot.width - width - controlRoot.rightPadding : controlRoot.leftPadding y: controlRoot.topPadding + (controlRoot.availableHeight - height) / 2 visible: controlRoot.checkable control: controlRoot } background: Item { implicitWidth: units.gridUnit * 8 PlasmaCore.FrameSvgItem { id: highlight imagePath: "widgets/viewitem" prefix: "hover" colorGroup: PlasmaCore.ColorScope.colorGroup anchors.fill: parent opacity: controlRoot.hovered && !controlRoot.pressed ? 1 : 0 Behavior on opacity { NumberAnimation { duration: units.longDuration } } } } } diff --git a/src/declarativeimports/plasmacomponents3/Popup.qml b/src/declarativeimports/plasmacomponents3/Popup.qml index d698d4105..ec6d91846 100644 --- a/src/declarativeimports/plasmacomponents3/Popup.qml +++ b/src/declarativeimports/plasmacomponents3/Popup.qml @@ -1,66 +1,66 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.1 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore T.Popup { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentWidth > 0 ? contentHeight + topPadding + bottomPadding : 0) contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) leftPadding: background.margins.left topPadding: background.margins.top rightPadding: background.margins.right bottomPadding: background.margins.bottom enter: Transition { NumberAnimation { property: "opacity" from: 0 to: 1 easing.type: Easing.InOutQuad duration: 250 } } exit: Transition { NumberAnimation { property: "opacity" from: 1 to: 0 easing.type: Easing.InOutQuad duration: 250 } } contentItem: Item { } background: PlasmaCore.FrameSvgItem { implicitWidth: units.gridUnit * 12 imagePath: "widgets/background" } } diff --git a/src/declarativeimports/plasmacomponents3/ProgressBar.qml b/src/declarativeimports/plasmacomponents3/ProgressBar.qml index db8a75c3f..28c33ed78 100644 --- a/src/declarativeimports/plasmacomponents3/ProgressBar.qml +++ b/src/declarativeimports/plasmacomponents3/ProgressBar.qml @@ -1,80 +1,80 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore T.ProgressBar { id: control implicitWidth: units.gridUnit * 8 implicitHeight: background.implicitHeight hoverEnabled: true contentItem: Item { scale: control.mirrored ? -1 : 1 PlasmaCore.FrameSvgItem { id: indicator height: parent.height width: control.indeterminate ? units.gridUnit * 2 : parent.width * control.position imagePath: "widgets/bar_meter_horizontal" prefix: "bar-active" colorGroup: PlasmaCore.ColorScope.colorGroup } SequentialAnimation { id: anim loops: Animation.Infinite running: control.indeterminate && control.visible PropertyAnimation { target: indicator property: "x" duration: 800 to: control.width - indicator.width onToChanged: { //the animation won't update the boundaries automatically if (anim.running) { anim.restart(); } } } PropertyAnimation { target: indicator property: "x" duration: 800 to: 0 } } } background: PlasmaCore.FrameSvgItem { imagePath: "widgets/bar_meter_horizontal" prefix: "bar-inactive" colorGroup: PlasmaCore.ColorScope.colorGroup onRepaintNeeded: { implicitHeight = barSvg.elementSize("hint-bar-size").height if (implicitHeight == 0) { implicitHeight = barSvg.elementSize("bar-inactive-top").height + barSvg.elementSize("bar-inactive-bottom").height } } } } diff --git a/src/declarativeimports/plasmacomponents3/RadioButton.qml b/src/declarativeimports/plasmacomponents3/RadioButton.qml index d22be5099..bf495688b 100644 --- a/src/declarativeimports/plasmacomponents3/RadioButton.qml +++ b/src/declarativeimports/plasmacomponents3/RadioButton.qml @@ -1,60 +1,60 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls 2.0 +import QtQuick.Templates @QQC2_VERSION@ as T +import QtQuick.Controls @QQC2_VERSION@ import org.kde.plasma.core 2.0 as PlasmaCore T.RadioButton { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: units.gridUnit * 1.6 baselineOffset: contentItem.y + contentItem.baselineOffset padding: 1 spacing: Math.round(units.gridUnit / 8) hoverEnabled: true indicator: RadioIndicator { LayoutMirroring.enabled: control.mirrored LayoutMirroring.childrenInherit: true anchors { left: parent.left verticalCenter: parent.verticalCenter } control: control } contentItem: Label { leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 opacity: control.enabled ? 1 : 0.6 text: control.text font: control.font color: PlasmaCore.ColorScope.textColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } } diff --git a/src/declarativeimports/plasmacomponents3/RadioDelegate.qml b/src/declarativeimports/plasmacomponents3/RadioDelegate.qml index f95df897f..df732d4ce 100644 --- a/src/declarativeimports/plasmacomponents3/RadioDelegate.qml +++ b/src/declarativeimports/plasmacomponents3/RadioDelegate.qml @@ -1,60 +1,60 @@ /* * Copyright 2016 Marco Martin * * 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.5 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore import "private" T.RadioDelegate { id: control implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding hoverEnabled: true topPadding: background.margins.top bottomPadding: background.margins.bottom leftPadding: background.margins.left rightPadding: background.margins.right spacing: units.smallSpacing contentItem: Label { leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 rightPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 text: control.text font: control.font color: theme.viewTextColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } indicator: RadioIndicator { x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding y: control.topPadding + (control.availableHeight - height) / 2 control: control } background: DefaultListItemBackground {} } diff --git a/src/declarativeimports/plasmacomponents3/RangeSlider.qml b/src/declarativeimports/plasmacomponents3/RangeSlider.qml index f61bb3517..f80d8deef 100644 --- a/src/declarativeimports/plasmacomponents3/RangeSlider.qml +++ b/src/declarativeimports/plasmacomponents3/RangeSlider.qml @@ -1,109 +1,109 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore import "private" as Private T.RangeSlider { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, Math.max(first.handle ? first.handle.implicitWidth : 0, second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, Math.max(first.handle ? first.handle.implicitHeight : 0, second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding) padding: units.gridUnit PlasmaCore.Svg { id: grooveSvg imagePath: "widgets/slider" colorGroup: PlasmaCore.ColorScope.colorGroup } first.handle: Item { property bool horizontal: control.orientation === Qt.Horizontal x: control.leftPadding + (horizontal ? control.first.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height)) width: firstHandle.naturalSize.width height: firstHandle.naturalSize.height Private.RoundShadow { anchors.fill: parent imagePath: "widgets/slider" focusElement: parent.horizontal ? "horizontal-slider-focus" : "vertical-slider-focus" hoverElement: parent.horizontal ? "horizontal-slider-hover" : "vertical-slider-hover" shadowElement: parent.horizontal ? "horizontal-slider-shadow" : "vertical-slider-shadow" state: control.activeFocus ? "focus" : (control.hovered ? "hover" : "shadow") } PlasmaCore.SvgItem { id: firstHandle anchors.fill: parent svg: grooveSvg elementId: parent.horizontal ? "horizontal-slider-handle" : "vertical-slider-handle" } } second.handle: Item { property bool horizontal: control.orientation === Qt.Horizontal x: control.leftPadding + (horizontal ? control.second.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.second.visualPosition * (control.availableHeight - height)) width: secondHandle.naturalSize.width height: secondHandle.naturalSize.height Private.RoundShadow { anchors.fill: parent imagePath: "widgets/slider" focusElement: parent.horizontal ? "horizontal-slider-focus" : "vertical-slider-focus" hoverElement: parent.horizontal ? "horizontal-slider-hover" : "vertical-slider-hover" shadowElement: parent.horizontal ? "horizontal-slider-shadow" : "vertical-slider-shadow" state: control.activeFocus ? "focus" : (control.hovered ? "hover" : "shadow") } PlasmaCore.SvgItem { id: secondHandle anchors.fill: parent svg: grooveSvg elementId: parent.horizontal ? "horizontal-slider-handle" : "vertical-slider-handle" } } background: PlasmaCore.FrameSvgItem { imagePath: "widgets/slider" prefix: "groove" readonly property bool horizontal: control.orientation === Qt.Horizontal implicitWidth: horizontal ? units.gridUnit * 8 : margins.left + margins.right implicitHeight: horizontal ? margins.top + margins.bottom : units.gridUnit * 8 width: horizontal ? control.availableWidth : implicitWidth height: horizontal ? implicitHeight : control.availableHeight anchors.centerIn: parent scale: horizontal && control.mirrored ? -1 : 1 PlasmaCore.FrameSvgItem { imagePath: "widgets/slider" prefix: "groove-highlight" x: parent.horizontal ? control.first.position * parent.width : 0 y: parent.horizontal ? 0 : control.second.visualPosition * parent.height width: parent.horizontal ? control.second.position * parent.width - control.first.position * parent.width : parent.width height: parent.horizontal ? parent.height : control.second.position * parent.height - control.first.position * parent.height } } } diff --git a/src/declarativeimports/plasmacomponents3/ScrollBar.qml b/src/declarativeimports/plasmacomponents3/ScrollBar.qml index aa0a6cfc0..08a8f3796 100644 --- a/src/declarativeimports/plasmacomponents3/ScrollBar.qml +++ b/src/declarativeimports/plasmacomponents3/ScrollBar.qml @@ -1,75 +1,75 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.kirigami 2.2 as Kirigami T.ScrollBar { id: control implicitWidth: background.implicitWidth implicitHeight: background.implicitHeight hoverEnabled: !Kirigami.Settings.isMobile visible: control.size < 1.0 background: PlasmaCore.FrameSvgItem { imagePath:"widgets/scrollbar" implicitWidth: scrollbarSvg.elementSize("hint-scrollbar-size").width implicitHeight: implicitWidth colorGroup: PlasmaCore.ColorScope.colorGroup visible: control.size < 1.0 prefix: control.horizontal ? "background-horizontal" : "background-vertical" opacity: Kirigami.Settings.isMobile ? (control.active ? 1 : 0) : (control.hovered ? 1 : 0) Behavior on opacity { OpacityAnimator { duration: units.longDuration } } } contentItem: PlasmaCore.FrameSvgItem { imagePath:"widgets/scrollbar" implicitWidth: scrollbarSvg.elementSize("hint-scrollbar-size").width implicitHeight: implicitWidth colorGroup: PlasmaCore.ColorScope.colorGroup visible: control.size < 1.0 prefix: control.hovered ? "mouseover-slider" : "slider" opacity: Kirigami.Settings.isMobile ? (control.active ? 1 : 0) : 1 Behavior on opacity { OpacityAnimator { duration: units.longDuration } } } PlasmaCore.Svg { id: scrollbarSvg imagePath: "widgets/scrollbar" //TODO: support arrows? property bool arrowPresent: scrollbarSvg.hasElement("arrow-up") //new theme may be different onRepaintNeeded: arrowPresent = scrollbarSvg.hasElement("arrow-up") } } diff --git a/src/declarativeimports/plasmacomponents3/Slider.qml b/src/declarativeimports/plasmacomponents3/Slider.qml index c499cebe9..90946ea60 100644 --- a/src/declarativeimports/plasmacomponents3/Slider.qml +++ b/src/declarativeimports/plasmacomponents3/Slider.qml @@ -1,101 +1,101 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore import "private" as Private T.Slider { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, Math.max(handle ? handle.implicitWidth : 0, handle ? handle.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, Math.max(handle ? handle.implicitHeight : 0, handle ? handle.implicitHeight : 0) + topPadding + bottomPadding) padding: units.gridUnit snapMode: T.Slider.SnapOnRelease PlasmaCore.Svg { id: grooveSvg imagePath: "widgets/slider" colorGroup: PlasmaCore.ColorScope.colorGroup } handle: Item { property bool horizontal: control.orientation === Qt.Horizontal x: control.leftPadding + (horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height)) width: firstHandle.naturalSize.width height: firstHandle.naturalSize.height Private.RoundShadow { anchors.fill: parent imagePath: "widgets/slider" focusElement: parent.horizontal ? "horizontal-slider-focus" : "vertical-slider-focus" hoverElement: parent.horizontal ? "horizontal-slider-hover" : "vertical-slider-hover" shadowElement: parent.horizontal ? "horizontal-slider-shadow" : "vertical-slider-shadow" state: control.activeFocus ? "focus" : (control.hovered ? "hover" : "shadow") } PlasmaCore.SvgItem { id: firstHandle anchors.fill: parent svg: grooveSvg elementId: parent.horizontal ? "horizontal-slider-handle" : "vertical-slider-handle" } } background: PlasmaCore.FrameSvgItem { imagePath: "widgets/slider" prefix: "groove" readonly property bool horizontal: control.orientation === Qt.Horizontal implicitWidth: horizontal ? units.gridUnit * 8 : margins.left + margins.right implicitHeight: horizontal ? margins.top + margins.bottom : units.gridUnit * 8 width: horizontal ? control.availableWidth : implicitWidth height: horizontal ? implicitHeight : control.availableHeight anchors.centerIn: parent scale: horizontal && control.mirrored ? -1 : 1 PlasmaCore.FrameSvgItem { imagePath: "widgets/slider" prefix: "groove-highlight" x: parent.horizontal ? 0 : (parent.width - width) / 2 y: parent.horizontal ? (parent.height - height) / 2 : control.visualPosition * parent.height width: parent.horizontal ? control.position * parent.width : parent.width height: parent.horizontal ? parent.height : control.position * parent.height } Repeater { id: repeater model: control.stepSize > 0 ? 1 + (control.to - control.from) / control.stepSize : 0 anchors.fill: parent Rectangle { color: PlasmaCore.ColorScope.textColor width: background.horizontal ? units.devicePixelRatio : units.gridUnit/2 height: background.horizontal ? units.gridUnit/2 : units.devicePixelRatio y: background.horizontal ? background.height : handle.height / 2 + index * ((repeater.height - handle.height) / (repeater.count > 1 ? repeater.count - 1 : 1)) x: background.horizontal ? handle.width / 2 + index * ((repeater.width - handle.width) / (repeater.count > 1 ? repeater.count - 1 : 1)) : background.width } } } } diff --git a/src/declarativeimports/plasmacomponents3/SpinBox.qml b/src/declarativeimports/plasmacomponents3/SpinBox.qml index e48798a6d..b1eaf749c 100644 --- a/src/declarativeimports/plasmacomponents3/SpinBox.qml +++ b/src/declarativeimports/plasmacomponents3/SpinBox.qml @@ -1,89 +1,89 @@ import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick.Controls @QQC2_VERSION@ +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore import "private" as Private T.SpinBox { id: control implicitWidth: Math.max(units.gridUnit * 6, contentItem.implicitWidth + 2 * padding + up.indicator.implicitWidth + down.indicator.implicitWidth) implicitHeight: units.gridUnit * 1.6 padding: 6 leftPadding: padding + height rightPadding: padding + height validator: IntValidator { locale: control.locale.name bottom: Math.min(control.from, control.to) top: Math.max(control.from, control.to) } contentItem: TextInput { text: control.textFromValue(control.value, control.locale) opacity: control.enabled ? 1 : 0.6 font: control.font color: theme.viewTextColor selectionColor: theme.highlightColor selectedTextColor: theme.selectedTextColor horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter readOnly: !control.editable validator: control.validator inputMethodHints: Qt.ImhFormattedNumbersOnly } up.indicator: Item { x: control.mirrored ? 0 : parent.width - width implicitHeight: parent.height implicitWidth: implicitHeight PlasmaCore.FrameSvgItem { anchors { fill: parent margins: base.margins.right } imagePath: "widgets/button" prefix: up.pressed ? "pressed" : "normal" Label { anchors.centerIn: parent text: "+" } } } down.indicator:Item { x: control.mirrored ? parent.width - width : 0 implicitHeight: parent.height implicitWidth: implicitHeight PlasmaCore.FrameSvgItem { anchors { fill: parent margins: base.margins.left } imagePath: "widgets/button" prefix: down.pressed ? "pressed" : "normal" Label { anchors.centerIn: parent text: "-" } } } background: Item { Private.TextFieldFocus { state: control.activeFocus ? "focus" : (control.hovered ? "hover" : "hidden") anchors.fill: parent } PlasmaCore.FrameSvgItem { id: base anchors.fill: parent imagePath: "widgets/lineedit" prefix: "base" } } } diff --git a/src/declarativeimports/plasmacomponents3/Switch.qml b/src/declarativeimports/plasmacomponents3/Switch.qml index 333070e71..17e672298 100644 --- a/src/declarativeimports/plasmacomponents3/Switch.qml +++ b/src/declarativeimports/plasmacomponents3/Switch.qml @@ -1,60 +1,60 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls 2.0 +import QtQuick.Templates @QQC2_VERSION@ as T +import QtQuick.Controls @QQC2_VERSION@ import org.kde.plasma.core 2.0 as PlasmaCore T.Switch { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: units.gridUnit * 1.6 baselineOffset: contentItem.y + contentItem.baselineOffset padding: 1 spacing: Math.round(units.gridUnit / 8) hoverEnabled: true indicator: SwitchIndicator { LayoutMirroring.enabled: control.mirrored LayoutMirroring.childrenInherit: true anchors { left: parent.left verticalCenter: parent.verticalCenter } control: control } contentItem: Label { leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 opacity: control.enabled ? 1 : 0.6 text: control.text font: control.font color: PlasmaCore.ColorScope.textColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } } diff --git a/src/declarativeimports/plasmacomponents3/SwitchDelegate.qml b/src/declarativeimports/plasmacomponents3/SwitchDelegate.qml index 8985d71f5..a6a079718 100644 --- a/src/declarativeimports/plasmacomponents3/SwitchDelegate.qml +++ b/src/declarativeimports/plasmacomponents3/SwitchDelegate.qml @@ -1,60 +1,60 @@ /* * Copyright 2016 Marco Martin * * 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.5 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore import "private" T.SwitchDelegate { id: control implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding hoverEnabled: true topPadding: background.margins.top bottomPadding: background.margins.bottom leftPadding: background.margins.left rightPadding: background.margins.right spacing: units.smallSpacing contentItem: Label { leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 rightPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 text: control.text font: control.font color: theme.viewTextColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } indicator: SwitchIndicator { x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding y: control.topPadding + (control.availableHeight - height) / 2 control: control } background: DefaultListItemBackground {} } diff --git a/src/declarativeimports/plasmacomponents3/TabBar.qml b/src/declarativeimports/plasmacomponents3/TabBar.qml index cc2b307b4..ef547892f 100644 --- a/src/declarativeimports/plasmacomponents3/TabBar.qml +++ b/src/declarativeimports/plasmacomponents3/TabBar.qml @@ -1,59 +1,59 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore T.TabBar { id: control implicitWidth: contentItem.implicitWidth implicitHeight: contentItem.implicitHeight spacing: 0 contentItem: ListView { implicitWidth: control.contentModel.get(0).implicitWidth * count implicitHeight: control.contentModel.get(0).height model: control.contentModel currentIndex: control.currentIndex spacing: 0 orientation: ListView.Horizontal boundsBehavior: Flickable.StopAtBounds flickableDirection: Flickable.AutoFlickIfNeeded snapMode: ListView.SnapToItem highlightMoveDuration: units.longDuration highlightRangeMode: ListView.ApplyRange preferredHighlightBegin: 40 preferredHighlightEnd: width - 40 highlight: PlasmaCore.FrameSvgItem { imagePath: "widgets/tabbar" prefix: control.position == T.TabBar.Header ? "north-active-tab" : "south-active-tab" colorGroup: PlasmaCore.ColorScope.colorGroup } } background: Item {} } diff --git a/src/declarativeimports/plasmacomponents3/TabButton.qml b/src/declarativeimports/plasmacomponents3/TabButton.qml index 0383f0fce..61ec49863 100644 --- a/src/declarativeimports/plasmacomponents3/TabButton.qml +++ b/src/declarativeimports/plasmacomponents3/TabButton.qml @@ -1,48 +1,48 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls @QQC2_VERSION@ import QtQml.Models 2.1 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore T.TabButton { id: control implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding baselineOffset: contentItem.y + contentItem.baselineOffset padding: units.smallSpacing hoverEnabled: true contentItem: Label { text: control.text font: control.font elide: Text.ElideRight opacity: enabled ? 1 : 0.3 color: theme.textColor horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } background: Item {} } diff --git a/src/declarativeimports/plasmacomponents3/TextArea.qml b/src/declarativeimports/plasmacomponents3/TextArea.qml index 0fd1458ce..861d02203 100644 --- a/src/declarativeimports/plasmacomponents3/TextArea.qml +++ b/src/declarativeimports/plasmacomponents3/TextArea.qml @@ -1,74 +1,74 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick.Controls @QQC2_VERSION@ +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore import "private" as Private T.TextArea { id: control implicitWidth: Math.max(contentWidth + leftPadding + rightPadding, background ? background.implicitWidth : 0, placeholder.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(contentHeight + topPadding + bottomPadding, background ? background.implicitHeight : 0, placeholder.implicitHeight + topPadding + bottomPadding) padding: 6 color: theme.viewTextColor selectionColor: theme.highlightColor selectedTextColor: theme.highlightedTextColor opacity: control.enabled ? 1 : 0.6 wrapMode: Text.WordWrap verticalAlignment: TextEdit.AlignTop renderType: Text.NativeRendering Label { id: placeholder x: control.leftPadding y: control.topPadding width: control.width - (control.leftPadding + control.rightPadding) height: control.height - (control.topPadding + control.bottomPadding) text: control.placeholderText font: control.font color: theme.viewTextColor horizontalAlignment: control.horizontalAlignment verticalAlignment: control.verticalAlignment visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) elide: Text.ElideRight } background: Item { Private.TextFieldFocus { state: control.activeFocus ? "focus" : (control.hovered ? "hover" : "hidden") anchors.fill: parent } PlasmaCore.FrameSvgItem { id: base anchors.fill: parent imagePath: "widgets/lineedit" prefix: "base" } } } diff --git a/src/declarativeimports/plasmacomponents3/TextField.qml b/src/declarativeimports/plasmacomponents3/TextField.qml index 2fc5c9e31..dabcbe010 100644 --- a/src/declarativeimports/plasmacomponents3/TextField.qml +++ b/src/declarativeimports/plasmacomponents3/TextField.qml @@ -1,72 +1,72 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick.Controls @QQC2_VERSION@ +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore import "private" as Private T.TextField { id: control implicitWidth: Math.max(units.gridUnit * 8, placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0) || contentWidth + leftPadding + rightPadding implicitHeight: units.gridUnit * 1.6 padding: 6 color: theme.viewTextColor selectionColor: theme.highlightColor selectedTextColor: theme.highlightedTextColor verticalAlignment: TextInput.AlignVCenter opacity: control.enabled ? 1 : 0.6 renderType: Text.NativeRendering Label { id: placeholder x: control.leftPadding y: control.topPadding width: control.width - (control.leftPadding + control.rightPadding) height: control.height - (control.topPadding + control.bottomPadding) text: control.placeholderText font: control.font color: theme.viewTextColor horizontalAlignment: control.horizontalAlignment verticalAlignment: control.verticalAlignment visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) elide: Text.ElideRight } background: Item { Private.TextFieldFocus { state: control.activeFocus ? "focus" : (control.hovered ? "hover" : "hidden") anchors.fill: parent } PlasmaCore.FrameSvgItem { id: base anchors.fill: parent imagePath: "widgets/lineedit" prefix: "base" } } } diff --git a/src/declarativeimports/plasmacomponents3/ToolBar.qml b/src/declarativeimports/plasmacomponents3/ToolBar.qml index d43f64403..3b236558f 100644 --- a/src/declarativeimports/plasmacomponents3/ToolBar.qml +++ b/src/declarativeimports/plasmacomponents3/ToolBar.qml @@ -1,40 +1,40 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore T.ToolBar { id: control implicitWidth: contentWidth + leftPadding + rightPadding implicitHeight: contentHeight + topPadding + bottomPadding contentWidth: contentChildren[0].implicitWidth contentHeight: contentChildren[0].implicitHeight contentItem: Item { } background: PlasmaCore.FrameSvgItem { imagePath: "widgets/toolbar" colorGroup: PlasmaCore.ColorScope.colorGroup enabledBorders: control.position == T.ToolBar.Header ? PlasmaCore.FrameSvgItem.BottomBorder : PlasmaCore.FrameSvgItem.TopBorder } } diff --git a/src/declarativeimports/plasmacomponents3/ToolButton.qml b/src/declarativeimports/plasmacomponents3/ToolButton.qml index 61d5cfd13..11d92559c 100644 --- a/src/declarativeimports/plasmacomponents3/ToolButton.qml +++ b/src/declarativeimports/plasmacomponents3/ToolButton.qml @@ -1,96 +1,96 @@ /* * Copyright 2016 Marco Martin * * 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.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore import "private" as Private T.ToolButton { id: control implicitWidth: Math.max(background.implicitWidth, contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(background.implicitHeight, contentItem.implicitHeight + topPadding + bottomPadding) leftPadding: surfaceNormal.margins.left topPadding: surfaceNormal.margins.top rightPadding: surfaceNormal.margins.right bottomPadding: surfaceNormal.margins.bottom hoverEnabled: true //Qt.styleHints.useHoverEffects TODO: how to make this work in 5.7? flat: true contentItem: Label { text: control.text font: control.font opacity: enabled || control.highlighted || control.checked ? 1 : 0.4 color: theme.buttonTextColor horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } background: Item { //retrocompatibility with old controls implicitWidth: units.gridUnit * 6 implicitHeight: units.gridUnit * 1.6 Private.ButtonShadow { anchors.fill: parent visible: (!control.flat || control.hovered) && (!control.pressed || !control.checked) state: { if (control.pressed) { return "hidden" } else if (control.hovered) { return "hover" } else if (control.activeFocus) { return "focus" } else { return "shadow" } } } PlasmaCore.FrameSvgItem { id: surfaceNormal anchors.fill: parent imagePath: "widgets/button" prefix: "normal" opacity: (!control.flat || control.hovered) && (!control.pressed || !control.checked) ? 1 : 0 Behavior on opacity { OpacityAnimator { duration: units.longDuration easing.type: Easing.InOutQuad } } } PlasmaCore.FrameSvgItem { anchors.fill: parent imagePath: "widgets/button" prefix: "pressed" opacity: control.checked || control.pressed ? 1 : 0 Behavior on opacity { OpacityAnimator { duration: units.longDuration easing.type: Easing.InOutQuad } } } } } diff --git a/src/declarativeimports/plasmacomponents3/ToolTip.qml b/src/declarativeimports/plasmacomponents3/ToolTip.qml index 8268acf36..656a108ed 100644 --- a/src/declarativeimports/plasmacomponents3/ToolTip.qml +++ b/src/declarativeimports/plasmacomponents3/ToolTip.qml @@ -1,51 +1,51 @@ /* * Copyright 2016 Marco Martin * Copyright (C) 2016 The Qt Company Ltd. * * 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.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore T.ToolTip { id: control x: parent ? (parent.width - implicitWidth) / 2 : 0 y: -implicitHeight - 3 implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding margins: units.gridUnit leftPadding: background.margins.left topPadding: background.margins.top rightPadding: background.margins.right bottomPadding: background.margins.bottom closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent contentItem: Label { text: control.text font: control.font color: PlasmaCore.ColorScope.textColor } background: PlasmaCore.FrameSvgItem { imagePath: "widgets/background" } } diff --git a/src/declarativeimports/plasmacomponents3/private/DefaultListItemBackground.qml b/src/declarativeimports/plasmacomponents3/private/DefaultListItemBackground.qml index 96ecba023..ff73fd754 100644 --- a/src/declarativeimports/plasmacomponents3/private/DefaultListItemBackground.qml +++ b/src/declarativeimports/plasmacomponents3/private/DefaultListItemBackground.qml @@ -1,56 +1,55 @@ /* * Copyright 2016 Marco Martin * * 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 //for Settings -import QtQuick.Controls 1.0 as Controls import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.kirigami 2.2 as Kirigami PlasmaCore.FrameSvgItem { id: background property bool separatorVisible: false imagePath: "widgets/listitem" prefix: control.highlighted || control.pressed ? "pressed" : "normal" visible: control.ListView.view ? control.ListView.view.highlight === null : true PlasmaCore.FrameSvgItem { imagePath: "widgets/listitem" visible: !Kirigami.Settings.isMobile prefix: "hover" anchors.fill: parent opacity: control.hovered && !control.pressed ? 1 : 0 Behavior on opacity { NumberAnimation { duration: units.longDuration } } } PlasmaCore.SvgItem { svg: PlasmaCore.Svg {imagePath: "widgets/listitem"} elementId: "separator" anchors { left: parent.left right: parent.right top: parent.top } height: naturalSize.height visible: separatorVisible && (listItem.sectionDelegate || (typeof(index) != "undefined" && index > 0 && !listItem.checked && !itemMouse.pressed)) } }