[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kproperty/594-piggz] /: Split KProperty to KPropertyCore and KPropertyWidgets
From: Jaroslaw Staniek <staniek () kde ! org>
Date: 2015-12-01 0:53:29
Message-ID: E1a3ZCD-0007vV-N4 () scm ! kde ! org
[Download RAW message or body]
Git commit 02cbc0421b1e20fc129de06e296fe0999b1fb27f by Jaroslaw Staniek, on behalf of \
Adam Pigg. Committed on 30/11/2015 at 23:08.
Pushed by staniek into branch '594-piggz'.
Split KProperty to KPropertyCore and KPropertyWidgets
This enables use of minimal KProperty on mobile platforms such as Mer/SailfishOS \
where GUI is QML-based instead of QWidget.
Differential Revision: https://phabricator.kde.org/D594
M +22 -9 CMakeLists.txt
C +3 -3 KPropertyCore.pc.cmake [from: KProperty.pc.cmake - 063% similarity]
R +3 -3 KPropertyWidgets.pc.cmake [from: KProperty.pc.cmake - 058% similarity]
M +5 -5 cmake/modules/KPropertyMacros.cmake
M +1 -1 examples/CMakeLists.txt
M +177 -90 src/CMakeLists.txt
M +2 -1 src/KDefaultPropertyFactory.cpp
M +2 -2 src/KDefaultPropertyFactory.h
M +6 -1 src/KProperty.cpp
M +5 -5 src/KProperty.h
C +1 -2 src/KPropertyCoreConfig.cmake.in [from: src/KPropertyConfig.cmake.in - \
086% similarity] M +2 -2 src/KPropertyEditorDataModel.cpp
M +4 -3 src/KPropertyEditorDataModel.h
M +3 -3 src/KPropertyEditorView.cpp
M +2 -2 src/KPropertyEditorView.h
M +4 -244 src/KPropertyFactory.cpp
M +7 -158 src/KPropertyFactory.h
M +2 -2 src/KPropertyLineStyleSelector_p.h
M +1 -1 src/KPropertySet.cpp
M +5 -5 src/KPropertySet.h
M +5 -0 src/KPropertyUnit_p.cpp
M +7 -4 src/KPropertyUnit_p.h
M +2 -2 src/KPropertyUtils.h
R +1 -1 src/KPropertyWidgetsConfig.cmake.in [from: \
src/KPropertyConfig.cmake.in - 092% similarity] C +35 -89 \
src/KPropertyWidgetsFactory.cpp [from: src/KPropertyFactory.cpp - 070% similarity] C \
+22 -83 src/KPropertyWidgetsFactory.h [from: src/KPropertyFactory.h - 065% \
similarity] M +4 -0 src/config-kproperty.h.cmake
M +2 -2 src/editors/CMakeLists.txt
M +3 -3 src/editors/KPropertyStringEditor.h
M +3 -3 src/editors/booledit.h
M +4 -3 src/editors/coloredit.h
M +6 -5 src/editors/combobox.cpp
M +4 -3 src/editors/combobox.h
M +2 -2 src/editors/cursoredit.h
M +1 -1 src/editors/dateedit.cpp
M +3 -3 src/editors/dateedit.h
M +2 -1 src/editors/datetimeedit.cpp
M +3 -3 src/editors/datetimeedit.h
M +1 -1 src/editors/dummywidget.h
M +2 -2 src/editors/fontedit.h
M +3 -3 src/editors/linestyleedit.h
M +3 -3 src/editors/pixmapedit.h
M +3 -3 src/editors/pointedit.h
M +3 -3 src/editors/pointfedit.h
M +3 -3 src/editors/rectedit.h
M +3 -3 src/editors/sizeedit.h
M +3 -3 src/editors/sizefedit.h
M +3 -3 src/editors/sizepolicyedit.h
M +5 -4 src/editors/spinbox.cpp
M +5 -5 src/editors/spinbox.h
M +1 -1 src/editors/stringlistedit.h
M +1 -1 src/editors/symbolcombo.h
M +1 -1 src/editors/timeedit.cpp
M +3 -3 src/editors/timeedit.h
M +1 -1 src/editors/urledit.h
M +1 -1 src/editors/utils.cpp
M +2 -2 src/editors/utils.h
C +3 -13 src/kpropertywidgets_debug.cpp [from: src/KDefaultPropertyFactory.h - \
073% similarity] C +8 -10 src/kpropertywidgets_debug.h [from: \
src/KDefaultPropertyFactory.h - 068% similarity]
http://commits.kde.org/kproperty/02cbc0421b1e20fc129de06e296fe0999b1fb27f
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 35c9a0d..e93a7c8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,10 @@
-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
+if(EXISTS "/usr/lib/qt5/qml/Sailfish/Silica/SilicaGridView.qml") #SailfishOS
+ cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
+else()
+ cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
+endif()
+
+
project(KProperty)
# ECM setup
@@ -25,21 +31,28 @@ include(GenerateExportHeader)
include(MacroLogFeature)
include(KPropertyMacros)
+simple_option(KPROPERTY_WIDGETS "Build the QtWidget components of KProperty" ON)
+
set(KPROPERTY_VERSION "2.96.0") # Update this
# Dependencies
set(REQUIRED_QT_VERSION "5.2.0")
-# Required components to build this framework
-find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED Core Widgets)
-find_package(KF5 5.7.0 REQUIRED Config CoreAddons WidgetsAddons GuiAddons)
-#TODO KIO
+find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED Core)
+
+if(KPROPERTY_WIDGETS)
+ find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED Widgets)
+ find_package(KF5 5.7.0 REQUIRED Config CoreAddons WidgetsAddons GuiAddons)
+
+ #TODO KIO
+ get_git_revision_and_branch()
+ add_tests()
+ add_examples()
+endif()
-get_git_revision_and_branch()
-add_tests()
-add_examples()
add_unfinished_features_option()
-add_pc_file()
+add_pc_file(KPropertyCore)
+add_pc_file(KPropertyWidgets)
add_subdirectory(src)
diff --git a/KProperty.pc.cmake b/KPropertyCore.pc.cmake
similarity index 63%
copy from KProperty.pc.cmake
copy to KPropertyCore.pc.cmake
index c2175e6..71020a3 100644
--- a/KProperty.pc.cmake
+++ b/KPropertyCore.pc.cmake
@@ -3,10 +3,10 @@ exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
-Name: KProperty
-Description: A property editing framework with editor
+Name: KPropertyCore
+Description: A property editing framework with editor (core)
Version: @KPROPERTY_VERSION@
URL: https://community.kde.org/KProperty
-Requires: Qt5Core Qt5Gui KF5WidgetsAddons KF5GuiAddons
+Requires: Qt5Core
Libs: -L${libdir}
Cflags: -I${includedir}
diff --git a/KProperty.pc.cmake b/KPropertyWidgets.pc.cmake
similarity index 58%
rename from KProperty.pc.cmake
rename to KPropertyWidgets.pc.cmake
index c2175e6..7ff30c1 100644
--- a/KProperty.pc.cmake
+++ b/KPropertyWidgets.pc.cmake
@@ -3,10 +3,10 @@ exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
-Name: KProperty
-Description: A property editing framework with editor
+Name: KPropertyWidgets
+Description: A property editing framework with edito (widgets)
Version: @KPROPERTY_VERSION@
URL: https://community.kde.org/KProperty
-Requires: Qt5Core Qt5Gui KF5WidgetsAddons KF5GuiAddons
+Requires: KPropertyCore Qt5Core Qt5Gui KF5WidgetsAddons KF5GuiAddons
Libs: -L${libdir}
Cflags: -I${includedir}
diff --git a/cmake/modules/KPropertyMacros.cmake \
b/cmake/modules/KPropertyMacros.cmake index 0ca41ea..225cfe2 100644
--- a/cmake/modules/KPropertyMacros.cmake
+++ b/cmake/modules/KPropertyMacros.cmake
@@ -90,12 +90,12 @@ macro(add_unfinished_features_option)
"Include unfinished features (useful for testing but may confuse \
end-user)" OFF) endmacro()
-# Adds commands that generate ${PROJECT_NAME}.pc file out of \
${PROJECT_NAME}.pc.cmake file +# Adds commands that generate \
${PKGCONFIG_FILE_NAME}.pc file out of ${PKGCONFIG_FILE_NAME}.pc.cmake file # and \
install the .pc file to ${LIB_INSTALL_DIR}/pkgconfig. These commands are not executed \
for WIN32.
-# ${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.pc.cmake should exist.
-macro(add_pc_file)
+# ${CMAKE_SOURCE_DIR}/${PKGCONFIG_FILE_NAME}.pc.cmake should exist.
+macro(add_pc_file PKGCONFIG_FILE_NAME)
if (NOT WIN32)
- configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.pc.cmake \
${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)
- install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION \
${LIB_INSTALL_DIR}/pkgconfig) + \
configure_file(${CMAKE_SOURCE_DIR}/${PKGCONFIG_FILE_NAME}.pc.cmake \
${CMAKE_BINARY_DIR}/${PKGCONFIG_FILE_NAME}.pc @ONLY) + install(FILES \
${CMAKE_BINARY_DIR}/${PKGCONFIG_FILE_NAME}.pc DESTINATION \
${LIB_INSTALL_DIR}/pkgconfig) endif()
endmacro()
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 921ee4d..dad9f94 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -10,4 +10,4 @@ remove_definitions(
set(kpropertyexample_SRCS main.cpp window.cpp)
add_executable(kpropertyexample ${kpropertyexample_SRCS})
-target_link_libraries(kpropertyexample Qt5::Widgets KProperty)
+target_link_libraries(kpropertyexample Qt5::Widgets KPropertyWidgets)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 58957c0..4101ac8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,57 +1,57 @@
# Options
# simple_option(KPROPERTY_...... "....." OFF)
-
configure_file(config-kproperty.h.cmake \
${CMAKE_CURRENT_BINARY_DIR}/config-kproperty.h)
-add_subdirectory(editors)
-
-set(libkpropertyeditors_SRCS
- editors/utils.cpp
- editors/booledit.cpp
- editors/coloredit.cpp
- editors/combobox.cpp
- editors/cursoredit.cpp
- editors/dateedit.cpp
- editors/datetimeedit.cpp
-# editors/dummywidget.cpp
- editors/fontedit.cpp
- editors/pixmapedit.cpp
- editors/pointedit.cpp
- editors/pointfedit.cpp
- editors/rectedit.cpp
- editors/sizeedit.cpp
- editors/sizefedit.cpp
- editors/sizepolicyedit.cpp
- editors/spinbox.cpp
- editors/KPropertyStringEditor.cpp
- editors/linestyleedit.cpp
-# editors/stringlistedit.cpp
-# editors/symbolcombo.cpp
- editors/timeedit.cpp
-#TODO editors/urledit.cpp
-)
-
-set(kproperty_LIB_SRCS
- kproperty_debug.cpp
+set(kpropertycore_LIB_SRCS
KProperty.cpp
KPropertySet.cpp
- KPropertyFactory.cpp
- KDefaultPropertyFactory.cpp
- KPropertyEditorView.cpp
- KPropertyEditorDataModel.cpp
- KPropertyUtils.cpp
KPropertyUnit_p.cpp
- KPropertyLineStyleSelector_p.cpp
- KPropertyLineStyleModel_p.cpp
- KPropertyLineStyleItemDelegate_p.cpp
- ${libkpropertyeditors_SRCS}
+ KPropertyFactory.cpp
+ kproperty_debug.cpp
)
-ecm_create_qm_loader(kproperty_LIB_SRCS kproperty_qt)
-
-add_library(KProperty SHARED ${kproperty_LIB_SRCS})
-
-generate_export_header(KProperty)
+if(KPROPERTY_WIDGETS)
+ add_subdirectory(editors)
+
+ set(libkpropertyeditors_SRCS
+ editors/utils.cpp
+ editors/booledit.cpp
+ editors/coloredit.cpp
+ editors/combobox.cpp
+ editors/cursoredit.cpp
+ editors/dateedit.cpp
+ editors/datetimeedit.cpp
+ # editors/dummywidget.cpp
+ editors/fontedit.cpp
+ editors/pixmapedit.cpp
+ editors/pointedit.cpp
+ editors/pointfedit.cpp
+ editors/rectedit.cpp
+ editors/sizeedit.cpp
+ editors/sizefedit.cpp
+ editors/sizepolicyedit.cpp
+ editors/spinbox.cpp
+ editors/KPropertyStringEditor.cpp
+ editors/linestyleedit.cpp
+ # editors/stringlistedit.cpp
+ # editors/symbolcombo.cpp
+ editors/timeedit.cpp
+ #TODO editors/urledit.cpp
+ )
+
+ set(kpropertywidgets_LIB_SRCS
+ ${libkpropertyeditors_SRCS}
+ kpropertywidgets_debug.cpp
+ KPropertyWidgetsFactory.cpp
+ KDefaultPropertyFactory.cpp
+ KPropertyEditorView.cpp
+ KPropertyEditorDataModel.cpp
+ KPropertyUtils.cpp
+ KPropertyLineStyleSelector_p.cpp
+ KPropertyLineStyleModel_p.cpp
+ KPropertyLineStyleItemDelegate_p.cpp
+ )
+endif()
set(kproperty_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}/kproperty
@@ -60,26 +60,49 @@ set(kproperty_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/editors
)
-target_include_directories(KProperty
- PUBLIC "$<BUILD_INTERFACE:${kproperty_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/KProperty>"
- PRIVATE editors
+ecm_create_qm_loader(kpropertycore_LIB_SRCS kpropertycore_qt)
+
+add_library(KPropertyCore SHARED ${kpropertycore_LIB_SRCS})
+target_link_libraries(KPropertyCore
+ Qt5::Core
)
+generate_export_header(KPropertyCore)
-target_link_libraries(KProperty
- KF5::WidgetsAddons
- KF5::GuiAddons
- #TODO KF5::KIOWidgets
+target_include_directories(KPropertyCore
+ PUBLIC "$<BUILD_INTERFACE:${kproperty_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/KPropertyCore>"
+ PRIVATE editors
)
-set_target_properties(KProperty
+set_target_properties(KPropertyCore
PROPERTIES VERSION 1.0
SOVERSION 1.0.0
- EXPORT_NAME KProperty
+ EXPORT_NAME KPropertyCore
)
+if(KPROPERTY_WIDGETS)
+ add_library(KPropertyWidgets SHARED ${kpropertywidgets_LIB_SRCS})
+ target_link_libraries(KPropertyWidgets
+ KPropertyCore
+ KF5::WidgetsAddons
+ KF5::GuiAddons
+ )
+ generate_export_header(KPropertyWidgets)
+ target_include_directories(KPropertyWidgets
+ PUBLIC "$<BUILD_INTERFACE:${kproperty_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/KPropertyWidgets>"
+ PRIVATE editors
+ )
+
+ set_target_properties(KPropertyWidgets
+ PROPERTIES VERSION 1.0
+ SOVERSION 1.0.0
+ EXPORT_NAME KPropertyWidgets
+ )
+endif()
+
# Create a Config.cmake and a ConfigVersion.cmake file and install them
-set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KProperty")
+set(CMAKECONFIG_CORE_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KPropertyCore")
# A place for KProperty plugins
set(KPROPERTY_PLUGIN_INSTALL_DIR ${PLUGIN_INSTALL_DIR}/kproperty)
@@ -87,39 +110,79 @@ set(KPROPERTY_PLUGIN_INSTALL_DIR \
${PLUGIN_INSTALL_DIR}/kproperty) ecm_setup_version(${KPROPERTY_VERSION}
VARIABLE_PREFIX KPROPERTY
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kproperty_version.h"
- PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KPropertyConfigVersion.cmake"
+ PACKAGE_VERSION_FILE \
"${CMAKE_CURRENT_BINARY_DIR}/KPropertyCoreConfigVersion.cmake" )
ecm_configure_package_config_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/KPropertyConfig.cmake.in"
- "${CMAKE_CURRENT_BINARY_DIR}/KPropertyConfig.cmake"
- INSTALL_DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
+ "${CMAKE_CURRENT_SOURCE_DIR}/KPropertyCoreConfig.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/KPropertyCoreConfig.cmake"
+ INSTALL_DESTINATION "${CMAKECONFIG_CORE_INSTALL_DIR}"
)
install(FILES
- "${CMAKE_CURRENT_BINARY_DIR}/KPropertyConfig.cmake"
- "${CMAKE_CURRENT_BINARY_DIR}/KPropertyConfigVersion.cmake"
- DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
- COMPONENT Devel)
-
-install(TARGETS KProperty
- EXPORT KPropertyTargets
- ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
-
-install(EXPORT KPropertyTargets
- DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
- FILE KPropertyTargets.cmake)
+ "${CMAKE_CURRENT_BINARY_DIR}/KPropertyCoreConfig.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/KPropertyCoreConfigVersion.cmake"
+ DESTINATION "${CMAKECONFIG_CORE_INSTALL_DIR}"
+ COMPONENT Devel)
+
+install(TARGETS KPropertyCore
+ EXPORT KPropertyCoreTargets
+ ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
+
+install(EXPORT KPropertyCoreTargets
+ DESTINATION "${CMAKECONFIG_CORE_INSTALL_DIR}"
+ FILE KPropertyCoreTargets.cmake)
+
+if(KPROPERTY_WIDGETS)
+ set(CMAKECONFIG_WIDGETS_INSTALL_DIR \
"${CMAKECONFIG_INSTALL_PREFIX}/KPropertyWidgets") +
+ ecm_setup_version(${KPROPERTY_VERSION}
+ VARIABLE_PREFIX KPROPERTY
+ VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kproperty_version.h"
+ PACKAGE_VERSION_FILE \
"${CMAKE_CURRENT_BINARY_DIR}/KPropertyWidgetsConfigVersion.cmake" + )
+ ecm_configure_package_config_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/KPropertyWidgetsConfig.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/KPropertyWidgetsConfig.cmake"
+ INSTALL_DESTINATION "${CMAKECONFIG_WIDGETS_INSTALL_DIR}"
+ )
+
+ install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/KPropertyWidgetsConfig.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/KPropertyWidgetsConfigVersion.cmake"
+ DESTINATION "${CMAKECONFIG_WIDGETS_INSTALL_DIR}"
+ COMPONENT Devel)
+
+ install(TARGETS KPropertyWidgets
+ EXPORT KPropertyWidgetsTargets
+ ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
+
+ install(EXPORT KPropertyWidgetsTargets
+ DESTINATION "${CMAKECONFIG_WIDGETS_INSTALL_DIR}"
+ FILE KPropertyWidgetsTargets.cmake)
+
+endif()
+
+install(FILES ${PRI_FILENAME}
+ DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
ecm_generate_pri_file(
- BASE_NAME KProperty
- LIB_NAME KProperty
- DEPS "widgets"
+ BASE_NAME KPropertyCore
+ LIB_NAME KPropertyCore
+ DEPS "core"
FILENAME_VAR PRI_FILENAME
- INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_DIR}/KProperty
+ INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_DIR}/KPropertyCore
)
-
-install(FILES ${PRI_FILENAME}
- DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
+
+if(KPROPERTY_WIDGETS)
+ ecm_generate_pri_file(
+ BASE_NAME KPropertyWidgets
+ LIB_NAME KPropertyWidgets
+ DEPS ""
+ FILENAME_VAR PRI_FILENAME
+ INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_DIR}/KPropertyWidgets
+ )
+endif()
#ecm_install_icons(${DATA_INSTALL_DIR}/kproperty/icons)
@@ -127,33 +190,57 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kproperty_version.h"
DESTINATION "${INCLUDE_INSTALL_DIR}"
COMPONENT Devel)
-ecm_generate_headers(kproperty_FORWARDING_HEADERS
- REQUIRED_HEADERS kproperty_HEADERS
+ecm_generate_headers(kpropertycore_FORWARDING_HEADERS
+ REQUIRED_HEADERS kpropertycore_HEADERS
ORIGINAL CAMELCASE
HEADER_NAMES
- KPropertyFactory
KProperty
KPropertySet
- KPropertyUtils
KPropertyFactory
- KPropertyEditorView
- KPropertyEditorDataModel
)
install(
FILES
- ${kproperty_HEADERS}
- DESTINATION ${INCLUDE_INSTALL_DIR}/KProperty
+ ${kpropertycore_HEADERS}
+ DESTINATION ${INCLUDE_INSTALL_DIR}/KPropertyCore
COMPONENT Devel
)
install(
FILES
- ${kproperty_FORWARDING_HEADERS}
- ${PROJECT_BINARY_DIR}/src/kproperty_export.h
+ ${kpropertycore_FORWARDING_HEADERS}
+ ${PROJECT_BINARY_DIR}/src/kpropertycore_export.h
${PROJECT_BINARY_DIR}/src/config-kproperty.h
- DESTINATION ${INCLUDE_INSTALL_DIR}/KProperty
+ DESTINATION ${INCLUDE_INSTALL_DIR}/KPropertyCore
COMPONENT Devel
)
+if(KPROPERTY_WIDGETS)
+ ecm_generate_headers(kpropertywidgets_FORWARDING_HEADERS
+ REQUIRED_HEADERS kpropertywidgets_HEADERS
+ ORIGINAL CAMELCASE
+ HEADER_NAMES
+ KPropertyWidgetsFactory
+ KPropertyUtils
+ KPropertyEditorView
+ KPropertyEditorDataModel
+ )
+
+ install(
+ FILES
+ ${kpropertywidgets_HEADERS}
+ DESTINATION ${INCLUDE_INSTALL_DIR}/KPropertyWidgets
+ COMPONENT Devel
+ )
+
+ install(
+ FILES
+ ${kpropertywidgets_FORWARDING_HEADERS}
+ ${PROJECT_BINARY_DIR}/src/kpropertywidgets_export.h
+ ${PROJECT_BINARY_DIR}/src/config-kproperty.h
+ DESTINATION ${INCLUDE_INSTALL_DIR}/KPropertyWidgets
+ COMPONENT Devel
+ )
+endif()
+
enable_testing()
diff --git a/src/KDefaultPropertyFactory.cpp b/src/KDefaultPropertyFactory.cpp
index 4a16a3c..a137a95 100644
--- a/src/KDefaultPropertyFactory.cpp
+++ b/src/KDefaultPropertyFactory.cpp
@@ -18,6 +18,7 @@
*/
#include "KDefaultPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
#include "KProperty.h"
/*
#include "customproperty.h"*/
@@ -45,7 +46,7 @@
// #include "urledit.h"
KDefaultPropertyFactory::KDefaultPropertyFactory()
- : KPropertyFactory()
+ : KPropertyWidgetsFactory()
{
addEditor( KProperty::Bool, new KPropertyBoolDelegate );
addEditor( KProperty::Cursor, new KPropertyCursorDelegate );
diff --git a/src/KDefaultPropertyFactory.h b/src/KDefaultPropertyFactory.h
index a923685..6e8e78e 100644
--- a/src/KDefaultPropertyFactory.h
+++ b/src/KDefaultPropertyFactory.h
@@ -20,9 +20,9 @@
#ifndef KDEFAULTPROPERTYFACTORY_H
#define KDEFAULTPROPERTYFACTORY_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
-class KDefaultPropertyFactory : public KPropertyFactory
+class KDefaultPropertyFactory : public KPropertyWidgetsFactory
{
public:
KDefaultPropertyFactory();
diff --git a/src/KProperty.cpp b/src/KProperty.cpp
index f8f1cc2..c9f3e92 100644
--- a/src/KProperty.cpp
+++ b/src/KProperty.cpp
@@ -26,7 +26,10 @@
#include "kproperty_debug.h"
#include <QPointer>
+
+#ifdef KPROPERTY_WIDGET
#include <QSizePolicy>
+#endif
//! @internal
class KProperty::Private
@@ -359,8 +362,10 @@ void KProperty::setValue(const QVariant &value, bool \
rememberOldValue, bool useC
ch = static_cast<qlonglong>(currentValue.toDouble() * factor) != \
static_cast<qlonglong>(value.toDouble() * factor); } else if (t == QVariant::Invalid \
&& newt == QVariant::Invalid) { ch = false;
+#ifdef KPROPERTY_WIDGET
} else if (t == QVariant::SizePolicy) {
ch = (currentValue.value<QSizePolicy>() != value.value<QSizePolicy>());
+#endif
}
else {
ch = (currentValue != value);
@@ -764,7 +769,7 @@ void KProperty::debug() const
kprDebug() << *this;
}
-KPROPERTY_EXPORT QDebug operator<<(QDebug dbg, const KProperty &p)
+KPROPERTYCORE_EXPORT QDebug operator<<(QDebug dbg, const KProperty &p)
{
dbg.nospace() << "KProperty("
<< "NAME=" << p.name();
diff --git a/src/KProperty.h b/src/KProperty.h
index 2ed73c3..74eda1d 100644
--- a/src/KProperty.h
+++ b/src/KProperty.h
@@ -27,7 +27,7 @@
#include <QByteArray>
#include <QDebug>
-#include "kproperty_export.h"
+#include "kpropertycore_export.h"
/*! \brief Namespace for a set of classes implementing generic properties framework.
@@ -53,7 +53,7 @@ class KComposedPropertyInterface;
class KPropertySet;
/*! Data container for properties of list type. */
-class KPROPERTY_EXPORT KPropertyListData
+class KPROPERTYCORE_EXPORT KPropertyListData
{
public:
/*! Data container for list-value property.
@@ -128,7 +128,7 @@ public:
\author Alexander Dymo <cloudtemple@mskat.net>
\author Jarosław Staniek <staniek@kde.org>
*/
-class KPROPERTY_EXPORT KProperty
+class KPROPERTYCORE_EXPORT KProperty
{
public:
/*! Defines types of properties.
@@ -441,10 +441,10 @@ protected:
friend class KPropertySet;
friend class KPropertyBuffer;
friend class KComposedPropertyInterface;
- friend KPROPERTY_EXPORT QDebug operator<<(QDebug dbg, const KProperty &p);
+ friend KPROPERTYCORE_EXPORT QDebug operator<<(QDebug dbg, const KProperty &p);
};
//! qDebug() stream operator. Writes property @a p to the debug output in a nicely \
formatted way.
-KPROPERTY_EXPORT QDebug operator<<(QDebug dbg, const KProperty &p);
+KPROPERTYCORE_EXPORT QDebug operator<<(QDebug dbg, const KProperty &p);
#endif
diff --git a/src/KPropertyConfig.cmake.in b/src/KPropertyCoreConfig.cmake.in
similarity index 86%
copy from src/KPropertyConfig.cmake.in
copy to src/KPropertyCoreConfig.cmake.in
index f979003..5f1f402 100644
--- a/src/KPropertyConfig.cmake.in
+++ b/src/KPropertyCoreConfig.cmake.in
@@ -14,9 +14,8 @@
@PACKAGE_INIT@
find_dependency(Qt5Core @REQUIRED_QT_VERSION@)
-find_dependency(Qt5Widgets @REQUIRED_QT_VERSION@)
-include("${CMAKE_CURRENT_LIST_DIR}/KPropertyTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/KPropertyCoreTargets.cmake")
# "public" variables:
# TODO
diff --git a/src/KPropertyEditorDataModel.cpp b/src/KPropertyEditorDataModel.cpp
index 7d128ca..69b3836 100644
--- a/src/KPropertyEditorDataModel.cpp
+++ b/src/KPropertyEditorDataModel.cpp
@@ -18,7 +18,7 @@
*/
#include "KPropertyEditorDataModel.h"
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
#include "KProperty.h"
#include "kproperty_debug.h"
@@ -128,7 +128,7 @@ QVariant KPropertyEditorDataModel::data(const QModelIndex &index, \
int role) cons return prop->value();
}
else if (role == Qt::DisplayRole) {
- return KPropertyFactoryManager::self()->convertValueToText(prop);
+ return KPropertyWidgetsFactoryManager::self()->convertValueToText(prop);
}
}
return QVariant();
diff --git a/src/KPropertyEditorDataModel.h b/src/KPropertyEditorDataModel.h
index c87f30a..a958f70 100644
--- a/src/KPropertyEditorDataModel.h
+++ b/src/KPropertyEditorDataModel.h
@@ -20,17 +20,18 @@
#ifndef KPROPERTY_EDITORDATAMODEL_H
#define KPROPERTY_EDITORDATAMODEL_H
+#include "kpropertywidgets_export.h"
+#include "KPropertySet.h"
+
#include <QAbstractItemModel>
#include <QModelIndex>
-#include "KPropertySet.h"
-
class KProperty;
/*! @short A data model for using Set objects within the Qt's model/view API.
@see KPropertyEditorView
*/
-class KPROPERTY_EXPORT KPropertyEditorDataModel : public QAbstractItemModel
+class KPROPERTYWIDGETS_EXPORT KPropertyEditorDataModel : public QAbstractItemModel
{
Q_OBJECT
diff --git a/src/KPropertyEditorView.cpp b/src/KPropertyEditorView.cpp
index 2b3067c..a43bfa7 100644
--- a/src/KPropertyEditorView.cpp
+++ b/src/KPropertyEditorView.cpp
@@ -21,7 +21,7 @@
#include "KPropertyEditorDataModel.h"
#include "KProperty.h"
#include "KPropertySet.h"
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
#include "kproperty_debug.h"
#include <QIcon>
@@ -143,7 +143,7 @@ void ItemDelegate::paint(QPainter *painter,
KProperty *property = editorModel->propertyForItem(index);
const int t = typeForProperty( property );
bool useQItemDelegatePaint = true; // ValueDisplayInterface is used by default
- if (index.column() == 1 && KPropertyFactoryManager::self()->paint(t, painter, \
alteredOption, index)) { + if (index.column() == 1 && \
KPropertyWidgetsFactoryManager::self()->paint(t, painter, alteredOption, index)) { \
useQItemDelegatePaint = false; }
if (useQItemDelegatePaint) {
@@ -201,7 +201,7 @@ QWidget * ItemDelegate::createEditor(QWidget * parent,
KProperty *property = editorModel->propertyForItem(index);
int t = typeForProperty(property);
alteredOption.rect.setHeight(alteredOption.rect.height()+3);
- QWidget *w = KPropertyFactoryManager::self()->createEditor(t, parent, \
alteredOption, index); + QWidget *w = \
KPropertyWidgetsFactoryManager::self()->createEditor(t, parent, alteredOption, \
index); if (w) {
if (-1 != w->metaObject()->indexOfSignal(QMetaObject::normalizedSignature("commitData(QWidget*)").constData())
&& property && !property->children())
diff --git a/src/KPropertyEditorView.h b/src/KPropertyEditorView.h
index 6a9bf89..7d7f17e 100644
--- a/src/KPropertyEditorView.h
+++ b/src/KPropertyEditorView.h
@@ -20,7 +20,7 @@
#ifndef KPROPERTY_EDITORVIEW_H
#define KPROPERTY_EDITORVIEW_H
-#include "kproperty_export.h"
+#include "kpropertywidgets_export.h"
#include <QTreeView>
@@ -57,7 +57,7 @@ class KPropertySet;
</li>
</ul>
*/
-class KPROPERTY_EXPORT KPropertyEditorView : public QTreeView
+class KPROPERTYWIDGETS_EXPORT KPropertyEditorView : public QTreeView
{
Q_OBJECT
public:
diff --git a/src/KPropertyFactory.cpp b/src/KPropertyFactory.cpp
index e1c12ea..ec1f4c9 100644
--- a/src/KPropertyFactory.cpp
+++ b/src/KPropertyFactory.cpp
@@ -19,35 +19,6 @@
#include "KPropertyFactory.h"
-#include "KDefaultPropertyFactory.h"
-#include "KPropertyEditorView.h"
-#include "KPropertyEditorDataModel.h"
-
-KPropertyLabel::KPropertyLabel(QWidget *parent, const KPropertyValueDisplayInterface \
*iface)
- : QLabel(parent)
- , m_iface(iface)
-{
- setAutoFillBackground(true);
- setContentsMargins(0,1,0,0);
- setIndent(1);
-}
-
-QVariant KPropertyLabel::value() const
-{
- return m_value;
-}
-
-void KPropertyLabel::setValue(const QVariant& value)
-{
- setText( m_iface->displayText(value) );
- m_value = value;
-}
-
-void KPropertyLabel::paintEvent( QPaintEvent * event )
-{
- QLabel::paintEvent(event);
- KPropertyFactory::paintTopGridLine(this);
-}
//---------------
@@ -65,9 +36,6 @@ public:
QSet<KPropertyFactory*> factories;
QHash<int, KComposedPropertyCreatorInterface*> composedPropertyCreators;
- QHash<int, KPropertyEditorCreatorInterface*> editorCreators;
- QHash<int, KPropertyValuePainterInterface*> valuePainters;
- QHash<int, KPropertyValueDisplayInterface*> valueDisplays;
};
Q_GLOBAL_STATIC(KPropertyFactoryManager, _self)
@@ -81,19 +49,10 @@ public:
}
~Private()
{
- qDeleteAll(editorCreatorsSet);
- qDeleteAll(valuePaintersSet);
- qDeleteAll(valueDisplaysSet);
}
QHash<int, KComposedPropertyCreatorInterface*> composedPropertyCreators;
- QHash<int, KPropertyEditorCreatorInterface*> editorCreators;
- QHash<int, KPropertyValuePainterInterface*> valuePainters;
- QHash<int, KPropertyValueDisplayInterface*> valueDisplays;
QSet<KComposedPropertyCreatorInterface*> composedPropertyCreatorsSet;
- QSet<KPropertyEditorCreatorInterface*> editorCreatorsSet;
- QSet<KPropertyValuePainterInterface*> valuePaintersSet;
- QSet<KPropertyValueDisplayInterface*> valueDisplaysSet;
};
KPropertyFactory::KPropertyFactory()
@@ -111,6 +70,7 @@ QHash<int, KComposedPropertyCreatorInterface*> \
KPropertyFactory::composedPropert return d->composedPropertyCreators;
}
+#ifdef KPROPERTY_WIDGET
QHash<int, KPropertyEditorCreatorInterface*> KPropertyFactory::editorCreators() \
const {
return d->editorCreators;
@@ -140,56 +100,11 @@ void KPropertyFactory::addEditor(int type, \
KPropertyEditorCreatorInterface *crea
addDisplayInternal( type, \
dynamic_cast<KPropertyValueDisplayInterface*>(creator), false/* !own*/ ); }
}
+#endif
void KPropertyFactory::addComposedPropertyCreator( int type, \
KComposedPropertyCreatorInterface* creator ) {
addComposedPropertyCreatorInternal( type, creator, true );
- if (dynamic_cast<KPropertyEditorCreatorInterface*>(creator)) {
- addEditorInternal( type, \
dynamic_cast<KPropertyEditorCreatorInterface*>(creator), false/* \
!own*/ );
- }
- if (dynamic_cast<KPropertyValuePainterInterface*>(creator)) {
- addPainterInternal( type, \
dynamic_cast<KPropertyValuePainterInterface*>(creator), false/* \
!own*/ );
- }
- if (dynamic_cast<KPropertyValueDisplayInterface*>(creator)) {
- addDisplayInternal( type, \
dynamic_cast<KPropertyValueDisplayInterface*>(creator), false/* \
!own*/ );
- }
-}
-
-void KPropertyFactory::addPainter(int type, KPropertyValuePainterInterface *painter)
-{
- addPainterInternal(type, painter, true);
- if (dynamic_cast<KComposedPropertyCreatorInterface*>(painter)) {
- addComposedPropertyCreatorInternal( type,
- dynamic_cast<KComposedPropertyCreatorInterface*>(painter), false/* !own*/ );
- }
- if (dynamic_cast<KPropertyEditorCreatorInterface*>(painter)) {
- addEditorInternal( type, \
dynamic_cast<KPropertyEditorCreatorInterface*>(painter), false/* \
!own*/ );
- }
- if (dynamic_cast<KPropertyValueDisplayInterface*>(painter)) {
- addDisplayInternal( type, \
dynamic_cast<KPropertyValueDisplayInterface*>(painter), false/* \
!own*/ );
- }
-}
-
-void KPropertyFactory::addDisplay(int type, KPropertyValueDisplayInterface *display)
-{
- addDisplayInternal(type, display, true);
- if (dynamic_cast<KComposedPropertyCreatorInterface*>(display)) {
- addComposedPropertyCreatorInternal( type,
- dynamic_cast<KComposedPropertyCreatorInterface*>(display), false/* !own*/ );
- }
- if (dynamic_cast<KPropertyEditorCreatorInterface*>(display)) {
- addEditorInternal( type, \
dynamic_cast<KPropertyEditorCreatorInterface*>(display), false/* \
!own*/ );
- }
- if (dynamic_cast<KPropertyValueDisplayInterface*>(display)) {
- addDisplayInternal( type, \
dynamic_cast<KPropertyValueDisplayInterface*>(display), false/* \
!own*/ );
- }
-}
-
-void KPropertyFactory::addEditorInternal(int type, KPropertyEditorCreatorInterface \
*editor, bool own)
-{
- if (own)
- d->editorCreatorsSet.insert(editor);
- d->editorCreators.insert(type, editor);
}
void KPropertyFactory::addComposedPropertyCreatorInternal(int type, \
KComposedPropertyCreatorInterface* creator, bool own) @@ -199,44 +114,6 @@ void \
KPropertyFactory::addComposedPropertyCreatorInternal(int type, KComposedPro \
d->composedPropertyCreators.insert(type, creator); }
-void KPropertyFactory::addPainterInternal(int type, KPropertyValuePainterInterface \
*painter, bool own)
-{
- if (own)
- d->valuePaintersSet.insert(painter);
- d->valuePainters.insert(type, painter);
-}
-
-void KPropertyFactory::addDisplayInternal(int type, KPropertyValueDisplayInterface \
*display, bool own)
-{
- if (own)
- d->valueDisplaysSet.insert(display);
- d->valueDisplays.insert(type, display);
-}
-
-//static
-void KPropertyFactory::paintTopGridLine(QWidget *widget)
-{
- // paint top grid line
- QPainter p(widget);
- QColor gridLineColor( dynamic_cast<KPropertyEditorView*>(widget->parentWidget()) \
?
- dynamic_cast<KPropertyEditorView*>(widget->parentWidget())->gridLineColor()
- : KPropertyEditorView::defaultGridLineColor() );
- p.setPen(QPen( QBrush(gridLineColor), 1));
- p.drawLine(0, 0, widget->width()-1, 0);
-}
-
-//static
-void KPropertyFactory::setTopAndBottomBordersUsingStyleSheet(QWidget *widget, \
QWidget* parent, const QString& extraStyleSheet)
-{
- QColor gridLineColor( dynamic_cast<KPropertyEditorView*>(parent) ?
- dynamic_cast<KPropertyEditorView*>(parent)->gridLineColor()
- : KPropertyEditorView::defaultGridLineColor() );
- widget->setStyleSheet(
- QString::fromLatin1("%1 { border-top: 1px solid %2;border-bottom: 1px solid \
%2; } %3")
- .arg(QLatin1String(widget->metaObject()->className()))
- .arg(gridLineColor.name()).arg(extraStyleSheet));
-}
-
//------------
KPropertyFactoryManager::KPropertyFactoryManager()
@@ -244,7 +121,8 @@ KPropertyFactoryManager::KPropertyFactoryManager()
, d(new Private)
{
setObjectName(QLatin1String("KPropertyFactoryManager"));
- registerFactory(new KDefaultPropertyFactory);
+ //TODO ??? registerFactory(new KDefaultPropertyFactory);
+
}
KPropertyFactoryManager::~KPropertyFactoryManager()
@@ -267,95 +145,6 @@ void KPropertyFactoryManager::registerFactory(KPropertyFactory \
*factory) {
d->composedPropertyCreators.insert(it.key(), it.value());
}
- QHash<int, KPropertyEditorCreatorInterface*>::ConstIterator editorCreatorsItEnd
- = factory->editorCreators().constEnd();
- for (QHash<int, KPropertyEditorCreatorInterface*>::ConstIterator it( \
factory->editorCreators().constBegin() );
- it != editorCreatorsItEnd; ++it)
- {
- d->editorCreators.insert(it.key(), it.value());
- }
- QHash<int, KPropertyValuePainterInterface*>::ConstIterator valuePaintersItEnd
- = factory->valuePainters().constEnd();
- for (QHash<int, KPropertyValuePainterInterface*>::ConstIterator it( \
factory->valuePainters().constBegin() );
- it != valuePaintersItEnd; ++it)
- {
- d->valuePainters.insert(it.key(), it.value());
- }
- QHash<int, KPropertyValueDisplayInterface*>::ConstIterator valueDisplaysItEnd
- = factory->valueDisplays().constEnd();
- for (QHash<int, KPropertyValueDisplayInterface*>::ConstIterator it( \
factory->valueDisplays().constBegin() );
- it != valueDisplaysItEnd; ++it)
- {
- d->valueDisplays.insert(it.key(), it.value());
- }
-}
-
-bool KPropertyFactoryManager::isEditorForTypeAvailable( int type ) const
-{
- return d->editorCreators.value(type);
-}
-
-QWidget * KPropertyFactoryManager::createEditor(
- int type, QWidget *parent,
- const QStyleOptionViewItem & option, const QModelIndex & index ) const
-{
- const KPropertyEditorCreatorInterface *creator = d->editorCreators.value(type);
- if (!creator)
- return 0;
- QWidget *w = creator->createEditor(type, parent, option, index);
- if (w) {
- const KPropertyEditorDataModel *editorModel
- = dynamic_cast<const KPropertyEditorDataModel*>(index.model());
- KProperty *property = editorModel->propertyForItem(index);
- w->setObjectName(QLatin1String(property->name()));
- if (creator->options.removeBorders) {
-//! @todo get real border color from the palette
- QColor gridLineColor( dynamic_cast<KPropertyEditorView*>(parent) ?
- dynamic_cast<KPropertyEditorView*>(parent)->gridLineColor()
- : KPropertyEditorView::defaultGridLineColor() );
- QString cssClassName = QLatin1String(w->metaObject()->className());
- cssClassName.replace(QLatin1String("KProperty"), QString()); //!< @todo
- QString css =
- QString::fromLatin1("%1 { border-top: 1px solid %2; } ")
- .arg(cssClassName).arg(gridLineColor.name());
-// kprDebug() << css;
- w->setStyleSheet(css);
- }
- }
- return w;
-}
-
-bool KPropertyFactoryManager::paint( int type, QPainter * painter,
- const QStyleOptionViewItem & option, const QModelIndex & index ) const
-{
- const KPropertyValuePainterInterface *_painter = d->valuePainters.value(type);
- if (!_painter)
- return false;
- QStyleOptionViewItem realOption(option);
- if (option.state & QStyle::State_Selected) {
- // paint background because there may be editor widget with no \
autoFillBackground set
- realOption.palette.setBrush(QPalette::Text, \
realOption.palette.highlightedText());
- painter->fillRect(realOption.rect, realOption.palette.highlight());
- }
- painter->setPen(realOption.palette.text().color());
- _painter->paint(painter, realOption, index);
- return true;
-}
-
-bool KPropertyFactoryManager::canConvertValueToText( int type ) const
-{
- return d->valueDisplays.value(type) != 0;
-}
-
-bool KPropertyFactoryManager::canConvertValueToText( const KProperty* property ) \
const
-{
- return d->valueDisplays.value( property->type() ) != 0;
-}
-
-QString KPropertyFactoryManager::convertValueToText( const KProperty* property ) \
const
-{
- const KPropertyValueDisplayInterface *display = d->valueDisplays.value( \
property->type() );
- return display ? display->displayTextForProperty( property ) : \
property->value().toString(); }
KComposedPropertyInterface* \
KPropertyFactoryManager::createComposedProperty(KProperty *parent) @@ -415,32 +204,3 \
@@ KComposedPropertyCreatorInterface::KComposedPropertyCreatorInterface() \
KComposedPropertyCreatorInterface::~KComposedPropertyCreatorInterface() {
}
-
-KPropertyEditorCreatorInterface::KPropertyEditorCreatorInterface()
-{
-}
-
-KPropertyEditorCreatorInterface::~KPropertyEditorCreatorInterface()
-{
-}
-
-KPropertyEditorCreatorInterface::Options::Options()
- : removeBorders(true)
-{
-}
-
-KPropertyValuePainterInterface::KPropertyValuePainterInterface()
-{
-}
-
-KPropertyValuePainterInterface::~KPropertyValuePainterInterface()
-{
-}
-
-KPropertyValueDisplayInterface::KPropertyValueDisplayInterface()
-{
-}
-
-KPropertyValueDisplayInterface::~KPropertyValueDisplayInterface()
-{
-}
diff --git a/src/KPropertyFactory.h b/src/KPropertyFactory.h
index 2c9fbc7..8907d89 100644
--- a/src/KPropertyFactory.h
+++ b/src/KPropertyFactory.h
@@ -25,9 +25,6 @@
#include <QObject>
#include <QVariant>
#include <QHash>
-#include <QLabel>
-#include <QPainter>
-#include <QStyleOptionViewItem>
//! An interface for for composed property handlers
/*! You have to subclass KComposedPropertyInterface to override the behaviour of a \
property type.\n @@ -36,7 +33,7 @@
Example implementation of composed properties can be found in editors/ directory.
*/
-class KPROPERTY_EXPORT KComposedPropertyInterface
+class KPROPERTYCORE_EXPORT KComposedPropertyInterface
{
public:
explicit KComposedPropertyInterface(KProperty *parent);
@@ -66,7 +63,7 @@ protected:
bool m_childValueChangedEnabled : 1;
};
-class KPROPERTY_EXPORT KComposedPropertyCreatorInterface
+class KPROPERTYCORE_EXPORT KComposedPropertyCreatorInterface
{
public:
KComposedPropertyCreatorInterface();
@@ -76,114 +73,9 @@ public:
virtual KComposedPropertyInterface* createComposedProperty(KProperty *parent) \
const = 0; };
-//! An interface for editor widget creators.
-/*! Options can be set in the options attribute in order to customize
- widget creation process. Do this in the EditorCreatorInterface constructor.
-*/
-class KPROPERTY_EXPORT KPropertyEditorCreatorInterface
-{
-public:
- KPropertyEditorCreatorInterface();
-
- virtual ~KPropertyEditorCreatorInterface();
-
- virtual QWidget * createEditor( int type, QWidget *parent,
- const QStyleOptionViewItem & option, const QModelIndex & index ) const = 0;
-
- /*! Options for altering the editor widget creation process,
- used by KPropertyFactoryManager::createEditor(). */
- class Options {
- public:
- Options();
- /*! In order to have better look of the widget within the property editor \
view,
- we usually remove borders from the widget (see \
FactoryManager::createEditor()).
- and adding 1 pixel 'gray border' on the top. Default value is true. */
- bool removeBorders;
- };
-
- //! Options for altering the editor widget creation process
- Options options;
-};
-
-class KPROPERTY_EXPORT KPropertyValuePainterInterface
-{
-public:
- KPropertyValuePainterInterface();
- virtual ~KPropertyValuePainterInterface();
- virtual void paint( QPainter * painter,
- const QStyleOptionViewItem & option, const QModelIndex & index ) const = 0;
-};
-
-class KPROPERTY_EXPORT KPropertyValueDisplayInterface
-{
-public:
- KPropertyValueDisplayInterface();
- virtual ~KPropertyValueDisplayInterface();
- virtual QString displayTextForProperty( const KProperty* property ) const
- { return displayText(property->value()); }
- virtual QString displayText( const QVariant& value ) const
- { return value.toString(); }
-};
-
-//! Label widget that can be used for displaying text-based read-only items
-//! Used in LabelCreator.
-class KPROPERTY_EXPORT KPropertyLabel : public QLabel
-{
- Q_OBJECT
- Q_PROPERTY(QVariant value READ value WRITE setValue USER true)
-public:
- KPropertyLabel(QWidget *parent, const KPropertyValueDisplayInterface *iface);
- QVariant value() const;
-Q_SIGNALS:
- void commitData( QWidget * editor );
-public Q_SLOTS:
- void setValue(const QVariant& value);
-
-protected:
- virtual void paintEvent( QPaintEvent * event );
-
-private:
- const KPropertyValueDisplayInterface *m_iface;
- QVariant m_value;
-};
-
-//! Creator returning editor
-template<class Widget>
-class KPROPERTY_EXPORT KPropertyEditorCreator : public \
KPropertyEditorCreatorInterface,
- public KPropertyValueDisplayInterface,
- public KPropertyValuePainterInterface
-{
-public:
- KPropertyEditorCreator() : KPropertyEditorCreatorInterface() {}
-
- virtual ~KPropertyEditorCreator() {}
-
- virtual QWidget * createEditor( int type, QWidget *parent,
- const QStyleOptionViewItem & option, const QModelIndex & index ) const
- {
- Q_UNUSED(type);
- Q_UNUSED(option);
- Q_UNUSED(index);
- return new Widget(parent, this);
- }
-
- virtual void paint( QPainter * painter,
- const QStyleOptionViewItem & option, const QModelIndex & index ) const
- {
- painter->save();
- QRect r(option.rect);
- r.setLeft(r.left()+1);
- painter->drawText( r, Qt::AlignLeft | Qt::AlignVCenter,
- displayText( index.data(Qt::EditRole) ) );
- painter->restore();
- }
-};
-
-typedef KPropertyEditorCreator<KPropertyLabel> KPropertyLabelCreator;
-
//! Creator returning composed property object
template<class ComposedProperty>
-class KPROPERTY_EXPORT KComposedPropertyCreator : public \
KComposedPropertyCreatorInterface +class KPROPERTYCORE_EXPORT \
KComposedPropertyCreator : public KComposedPropertyCreatorInterface {
public:
KComposedPropertyCreator() : KComposedPropertyCreatorInterface() {}
@@ -195,44 +87,18 @@ public:
}
};
-class KPROPERTY_EXPORT KPropertyFactory
+class KPROPERTYCORE_EXPORT KPropertyFactory
{
public:
KPropertyFactory();
virtual ~KPropertyFactory();
QHash<int, KComposedPropertyCreatorInterface*> composedPropertyCreators() const;
- QHash<int, KPropertyEditorCreatorInterface*> editorCreators() const;
- QHash<int, KPropertyValuePainterInterface*> valuePainters() const;
- QHash<int, KPropertyValueDisplayInterface*> valueDisplays() const;
-
- //! Adds editor creator @a creator for type @a type.
- //! The creator becomes owned by the factory.
- void addEditor(int type, KPropertyEditorCreatorInterface *creator);
-
void addComposedPropertyCreator( int type, KComposedPropertyCreatorInterface* \
creator );
- void addPainter(int type, KPropertyValuePainterInterface *painter);
-
- void addDisplay(int type, KPropertyValueDisplayInterface *display);
-
- static void paintTopGridLine(QWidget *widget);
- static void setTopAndBottomBordersUsingStyleSheet(QWidget *widget, QWidget* \
parent,
- const QString& extraStyleSheet = QString());
-
protected:
- void addEditorInternal(int type, KPropertyEditorCreatorInterface *editor, bool \
own = true);
-
void addComposedPropertyCreatorInternal(int type,
KComposedPropertyCreatorInterface* creator, bool own = true);
-
- //! Adds value painter @a painter for type @a type.
- //! The painter becomes owned by the factory.
- void addPainterInternal(int type, KPropertyValuePainterInterface *painter, bool \
own = true);
-
- //! Adds value-to-text converted @a painter for type @a type.
- //! The converter becomes owned by the factory.
- void addDisplayInternal(int type, KPropertyValueDisplayInterface *display, bool \
own = true);
-
+
class Private;
Private * const d;
};
@@ -240,31 +106,14 @@ protected:
class KProperty;
class KCustomProperty;
-class KPROPERTY_EXPORT KPropertyFactoryManager : public QObject
+class KPROPERTYCORE_EXPORT KPropertyFactoryManager : public QObject
{
Q_OBJECT
public:
bool isEditorForTypeAvailable( int type ) const;
-
- QWidget * createEditor(
- int type,
- QWidget *parent,
- const QStyleOptionViewItem & option,
- const QModelIndex & index ) const;
-
- bool paint( int type,
- QPainter * painter,
- const QStyleOptionViewItem & option,
- const QModelIndex & index ) const;
-
+
KComposedPropertyInterface* createComposedProperty(KProperty *parent);
- bool canConvertValueToText( int type ) const;
-
- bool canConvertValueToText( const KProperty* property ) const;
-
- QString convertValueToText( const KProperty* property ) const;
-
//! Registers factory @a factory. It becomes owned by the manager.
void registerFactory(KPropertyFactory *factory);
diff --git a/src/KPropertyLineStyleSelector_p.h b/src/KPropertyLineStyleSelector_p.h
index e6bbedb..1f8325f 100644
--- a/src/KPropertyLineStyleSelector_p.h
+++ b/src/KPropertyLineStyleSelector_p.h
@@ -20,14 +20,14 @@
#ifndef KPROPERTYLINESTYLESELECTOR_H
#define KPROPERTYLINESTYLESELECTOR_H
-#include "kproperty_export.h"
+#include "kpropertywidgets_export.h"
#include <QComboBox>
/**
* A custom combobox widget for selecting line styles.
*/
-class KPROPERTY_EXPORT KPropertyLineStyleSelector : public QComboBox
+class KPROPERTYWIDGETS_EXPORT KPropertyLineStyleSelector : public QComboBox
{
Q_OBJECT
public:
diff --git a/src/KPropertySet.cpp b/src/KPropertySet.cpp
index 8a5b373..3bbcfc0 100644
--- a/src/KPropertySet.cpp
+++ b/src/KPropertySet.cpp
@@ -581,7 +581,7 @@ void KPropertySet::debug() const
kprDebug() << *this;
}
-KPROPERTY_EXPORT QDebug operator<<(QDebug dbg, const KPropertySet &set)
+KPROPERTYCORE_EXPORT QDebug operator<<(QDebug dbg, const KPropertySet &set)
{
dbg.nospace() << "KPropertySet(";
if (!set.typeName().isEmpty()) {
diff --git a/src/KPropertySet.h b/src/KPropertySet.h
index d70e85d..e2724d5 100644
--- a/src/KPropertySet.h
+++ b/src/KPropertySet.h
@@ -30,7 +30,7 @@
//! An interface for functor selecting properties.
/*! Used in Iterator. */
-class KPROPERTY_EXPORT KPropertySelector
+class KPROPERTYCORE_EXPORT KPropertySelector
{
public:
KPropertySelector();
@@ -52,7 +52,7 @@ public:
Usage with selector:
@code for (Set::Iterator it(set, MySelector()); it.current(); ++it) { .... }
@endcode */
-class KPROPERTY_EXPORT KPropertySetIterator
+class KPROPERTYCORE_EXPORT KPropertySetIterator
{
public:
//! Creates iterator for @a set set of properties.
@@ -108,7 +108,7 @@ private:
\author Alexander Dymo <cloudtemple@mskat.net>
\author Jarosław Staniek <staniek@kde.org>
*/
-class KPROPERTY_EXPORT KPropertySet : public QObject
+class KPROPERTYCORE_EXPORT KPropertySet : public QObject
{
Q_OBJECT
@@ -310,7 +310,7 @@ protected:
};
//! qDebug() stream operator. Writes this set to the debug output in a nicely \
formatted way.
-KPROPERTY_EXPORT QDebug operator<<(QDebug dbg, const KPropertySet &set);
+KPROPERTYCORE_EXPORT QDebug operator<<(QDebug dbg, const KPropertySet &set);
/*! A property buffer
\author Cedric Pasteur <cedric.pasteur@free.fr>
@@ -318,7 +318,7 @@ KPROPERTY_EXPORT QDebug operator<<(QDebug dbg, const KPropertySet \
&set); \author Adam Treat <treat@kde.org>
@todo Find a better name to show it's a set that doesn't own property
*/
-class KPROPERTY_EXPORT KPropertyBuffer : public KPropertySet
+class KPROPERTYCORE_EXPORT KPropertyBuffer : public KPropertySet
{
Q_OBJECT
diff --git a/src/KPropertyUnit_p.cpp b/src/KPropertyUnit_p.cpp
index 0571092..86217fe 100644
--- a/src/KPropertyUnit_p.cpp
+++ b/src/KPropertyUnit_p.cpp
@@ -22,7 +22,10 @@
#include "KPropertyUnit_p.h"
#include "kproperty_debug.h"
+#ifdef KPROPERTY_WIDGET
#include <QTransform>
+#endif
+
#include <QLocale>
#include <cmath>
@@ -370,6 +373,7 @@ qreal KPropertyUnit::parseAngle(const QString& _value, qreal \
defaultVal) return defaultVal;
}
+#ifdef KPROPERTY_WIDGET
qreal KPropertyUnit::approxTransformScale(const QTransform &t)
{
return std::sqrt(t.determinant());
@@ -379,6 +383,7 @@ void KPropertyUnit::adjustByPixelTransform(const QTransform &t)
{
m_pixelConversion *= approxTransformScale(t);
}
+#endif
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug debug, const KPropertyUnit &unit)
diff --git a/src/KPropertyUnit_p.h b/src/KPropertyUnit_p.h
index e779f08..e83291f 100644
--- a/src/KPropertyUnit_p.h
+++ b/src/KPropertyUnit_p.h
@@ -24,7 +24,7 @@
#ifndef KPROPERTYUNIT_H
#define KPROPERTYUNIT_H
-#include "kproperty_export.h"
+#include "kpropertycore_export.h"
#include <QString>
#include <QStringList>
@@ -64,7 +64,7 @@
* bound to the order in the enum (so ABI-compatible extension is possible) and
* with the order and scope of listed types controlled by the @c ListOptions \
parameter.
*/
-class KPROPERTY_EXPORT KPropertyUnit
+class KPROPERTYCORE_EXPORT KPropertyUnit
{
public:
/** Length units supported by Calligra. */
@@ -240,6 +240,8 @@ public:
return symbol();
}
+#ifdef KPROPERTY_WIDGET
+
/**
* Get an approximate scale of a unit vector that was converted by
* the transfomation.
@@ -257,14 +259,15 @@ public:
* average scale of the matrix.
*/
void adjustByPixelTransform(const QTransform &t);
-
+#endif
+
private:
Type m_type;
qreal m_pixelConversion;
};
#ifndef QT_NO_DEBUG_STREAM
-KPROPERTY_EXPORT QDebug operator<<(QDebug, const KPropertyUnit &);
+KPROPERTYCORE_EXPORT QDebug operator<<(QDebug, const KPropertyUnit &);
#endif
Q_DECLARE_METATYPE(KPropertyUnit)
diff --git a/src/KPropertyUtils.h b/src/KPropertyUtils.h
index 37ac5f7..544b694 100644
--- a/src/KPropertyUtils.h
+++ b/src/KPropertyUtils.h
@@ -20,13 +20,13 @@
#ifndef KPROPERTY_UTILS_H
#define KPROPERTY_UTILS_H
-#include "kproperty_export.h"
+#include "kpropertywidgets_export.h"
#include <QWidget>
//! @short A container widget that can be used to split information into hideable \
sections //! for a property editor-like panes.
-class KPROPERTY_EXPORT KPropertyGroupWidget : public QWidget
+class KPROPERTYWIDGETS_EXPORT KPropertyGroupWidget : public QWidget
{
public:
KPropertyGroupWidget(const QString& title, QWidget* parent);
diff --git a/src/KPropertyConfig.cmake.in b/src/KPropertyWidgetsConfig.cmake.in
similarity index 92%
rename from src/KPropertyConfig.cmake.in
rename to src/KPropertyWidgetsConfig.cmake.in
index f979003..4e28e53 100644
--- a/src/KPropertyConfig.cmake.in
+++ b/src/KPropertyWidgetsConfig.cmake.in
@@ -16,7 +16,7 @@
find_dependency(Qt5Core @REQUIRED_QT_VERSION@)
find_dependency(Qt5Widgets @REQUIRED_QT_VERSION@)
-include("${CMAKE_CURRENT_LIST_DIR}/KPropertyTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/KPropertyWidgetsTargets.cmake")
# "public" variables:
# TODO
diff --git a/src/KPropertyFactory.cpp b/src/KPropertyWidgetsFactory.cpp
similarity index 70%
copy from src/KPropertyFactory.cpp
copy to src/KPropertyWidgetsFactory.cpp
index e1c12ea..6299234 100644
--- a/src/KPropertyFactory.cpp
+++ b/src/KPropertyWidgetsFactory.cpp
@@ -19,6 +19,7 @@
#include "KPropertyFactory.h"
+
#include "KDefaultPropertyFactory.h"
#include "KPropertyEditorView.h"
#include "KPropertyEditorDataModel.h"
@@ -46,13 +47,13 @@ void KPropertyLabel::setValue(const QVariant& value)
void KPropertyLabel::paintEvent( QPaintEvent * event )
{
QLabel::paintEvent(event);
- KPropertyFactory::paintTopGridLine(this);
+ KPropertyWidgetsFactory::paintTopGridLine(this);
}
//---------------
//! @internal
-class KPropertyFactoryManager::Private
+class KPropertyWidgetsFactoryManager::Private
{
public:
Private()
@@ -64,16 +65,16 @@ public:
}
QSet<KPropertyFactory*> factories;
- QHash<int, KComposedPropertyCreatorInterface*> composedPropertyCreators;
QHash<int, KPropertyEditorCreatorInterface*> editorCreators;
QHash<int, KPropertyValuePainterInterface*> valuePainters;
QHash<int, KPropertyValueDisplayInterface*> valueDisplays;
+
};
- Q_GLOBAL_STATIC(KPropertyFactoryManager, _self)
+ Q_GLOBAL_STATIC(KPropertyWidgetsFactoryManager, _self)
//! @internal
-class KPropertyFactory::Private
+class KPropertyWidgetsFactory::Private
{
public:
Private()
@@ -86,47 +87,42 @@ public:
qDeleteAll(valueDisplaysSet);
}
- QHash<int, KComposedPropertyCreatorInterface*> composedPropertyCreators;
QHash<int, KPropertyEditorCreatorInterface*> editorCreators;
QHash<int, KPropertyValuePainterInterface*> valuePainters;
QHash<int, KPropertyValueDisplayInterface*> valueDisplays;
- QSet<KComposedPropertyCreatorInterface*> composedPropertyCreatorsSet;
+
QSet<KPropertyEditorCreatorInterface*> editorCreatorsSet;
QSet<KPropertyValuePainterInterface*> valuePaintersSet;
QSet<KPropertyValueDisplayInterface*> valueDisplaysSet;
+
};
-KPropertyFactory::KPropertyFactory()
+KPropertyWidgetsFactory::KPropertyWidgetsFactory()
: d( new Private )
{
}
-KPropertyFactory::~KPropertyFactory()
+KPropertyWidgetsFactory::~KPropertyWidgetsFactory()
{
delete d;
}
-QHash<int, KComposedPropertyCreatorInterface*> \
KPropertyFactory::composedPropertyCreators() const
-{
- return d->composedPropertyCreators;
-}
-
-QHash<int, KPropertyEditorCreatorInterface*> KPropertyFactory::editorCreators() \
const +QHash<int, KPropertyEditorCreatorInterface*> \
KPropertyWidgetsFactory::editorCreators() const {
return d->editorCreators;
}
-QHash<int, KPropertyValuePainterInterface*> KPropertyFactory::valuePainters() const
+QHash<int, KPropertyValuePainterInterface*> KPropertyWidgetsFactory::valuePainters() \
const {
return d->valuePainters;
}
-QHash<int, KPropertyValueDisplayInterface*> KPropertyFactory::valueDisplays() const
+QHash<int, KPropertyValueDisplayInterface*> KPropertyWidgetsFactory::valueDisplays() \
const {
return d->valueDisplays;
}
-void KPropertyFactory::addEditor(int type, KPropertyEditorCreatorInterface *creator)
+void KPropertyWidgetsFactory::addEditor(int type, KPropertyEditorCreatorInterface \
*creator) {
addEditorInternal( type, creator, true );
if (dynamic_cast<KComposedPropertyCreatorInterface*>(creator)) {
@@ -141,21 +137,7 @@ void KPropertyFactory::addEditor(int type, \
KPropertyEditorCreatorInterface *crea }
}
-void KPropertyFactory::addComposedPropertyCreator( int type, \
KComposedPropertyCreatorInterface* creator )
-{
- addComposedPropertyCreatorInternal( type, creator, true );
- if (dynamic_cast<KPropertyEditorCreatorInterface*>(creator)) {
- addEditorInternal( type, \
dynamic_cast<KPropertyEditorCreatorInterface*>(creator), false/* \
!own*/ );
- }
- if (dynamic_cast<KPropertyValuePainterInterface*>(creator)) {
- addPainterInternal( type, \
dynamic_cast<KPropertyValuePainterInterface*>(creator), false/* \
!own*/ );
- }
- if (dynamic_cast<KPropertyValueDisplayInterface*>(creator)) {
- addDisplayInternal( type, \
dynamic_cast<KPropertyValueDisplayInterface*>(creator), false/* \
!own*/ );
- }
-}
-
-void KPropertyFactory::addPainter(int type, KPropertyValuePainterInterface *painter)
+void KPropertyWidgetsFactory::addPainter(int type, KPropertyValuePainterInterface \
*painter) {
addPainterInternal(type, painter, true);
if (dynamic_cast<KComposedPropertyCreatorInterface*>(painter)) {
@@ -170,7 +152,7 @@ void KPropertyFactory::addPainter(int type, \
KPropertyValuePainterInterface *pain }
}
-void KPropertyFactory::addDisplay(int type, KPropertyValueDisplayInterface *display)
+void KPropertyWidgetsFactory::addDisplay(int type, KPropertyValueDisplayInterface \
*display) {
addDisplayInternal(type, display, true);
if (dynamic_cast<KComposedPropertyCreatorInterface*>(display)) {
@@ -185,28 +167,21 @@ void KPropertyFactory::addDisplay(int type, \
KPropertyValueDisplayInterface *disp }
}
-void KPropertyFactory::addEditorInternal(int type, KPropertyEditorCreatorInterface \
*editor, bool own) +void KPropertyWidgetsFactory::addEditorInternal(int type, \
KPropertyEditorCreatorInterface *editor, bool own) {
if (own)
d->editorCreatorsSet.insert(editor);
d->editorCreators.insert(type, editor);
}
-void KPropertyFactory::addComposedPropertyCreatorInternal(int type, \
KComposedPropertyCreatorInterface* creator, bool own)
-{
- if (own)
- d->composedPropertyCreatorsSet.insert(creator);
- d->composedPropertyCreators.insert(type, creator);
-}
-
-void KPropertyFactory::addPainterInternal(int type, KPropertyValuePainterInterface \
*painter, bool own) +void KPropertyWidgetsFactory::addPainterInternal(int type, \
KPropertyValuePainterInterface *painter, bool own) {
if (own)
d->valuePaintersSet.insert(painter);
d->valuePainters.insert(type, painter);
}
-void KPropertyFactory::addDisplayInternal(int type, KPropertyValueDisplayInterface \
*display, bool own) +void KPropertyWidgetsFactory::addDisplayInternal(int type, \
KPropertyValueDisplayInterface *display, bool own) {
if (own)
d->valueDisplaysSet.insert(display);
@@ -214,7 +189,7 @@ void KPropertyFactory::addDisplayInternal(int type, \
KPropertyValueDisplayInterfa }
//static
-void KPropertyFactory::paintTopGridLine(QWidget *widget)
+void KPropertyWidgetsFactory::paintTopGridLine(QWidget *widget)
{
// paint top grid line
QPainter p(widget);
@@ -226,7 +201,7 @@ void KPropertyFactory::paintTopGridLine(QWidget *widget)
}
//static
-void KPropertyFactory::setTopAndBottomBordersUsingStyleSheet(QWidget *widget, \
QWidget* parent, const QString& extraStyleSheet) +void \
KPropertyWidgetsFactory::setTopAndBottomBordersUsingStyleSheet(QWidget *widget, \
QWidget* parent, const QString& extraStyleSheet) {
QColor gridLineColor( dynamic_cast<KPropertyEditorView*>(parent) ?
dynamic_cast<KPropertyEditorView*>(parent)->gridLineColor()
@@ -239,34 +214,28 @@ void \
KPropertyFactory::setTopAndBottomBordersUsingStyleSheet(QWidget *widget, QW
//------------
-KPropertyFactoryManager::KPropertyFactoryManager()
- : QObject(0)
+KPropertyWidgetsFactoryManager::KPropertyWidgetsFactoryManager()
+ : KPropertyFactoryManager()
, d(new Private)
{
- setObjectName(QLatin1String("KPropertyFactoryManager"));
+ setObjectName(QLatin1String("KPropertyWidgetsFactoryManager"));
registerFactory(new KDefaultPropertyFactory);
}
-KPropertyFactoryManager::~KPropertyFactoryManager()
+KPropertyWidgetsFactoryManager::~KPropertyWidgetsFactoryManager()
{
delete d;
}
-KPropertyFactoryManager* KPropertyFactoryManager::self()
+KPropertyWidgetsFactoryManager* KPropertyWidgetsFactoryManager::self()
{
return _self;
}
-void KPropertyFactoryManager::registerFactory(KPropertyFactory *factory)
+void KPropertyWidgetsFactoryManager::registerFactory(KPropertyWidgetsFactory \
*factory) {
d->factories.insert(factory);
- QHash<int, KComposedPropertyCreatorInterface*>::ConstIterator \
composedPropertyCreatorsItEnd
- = factory->composedPropertyCreators().constEnd();
- for (QHash<int, KComposedPropertyCreatorInterface*>::ConstIterator it( \
factory->composedPropertyCreators().constBegin() );
- it != composedPropertyCreatorsItEnd; ++it)
- {
- d->composedPropertyCreators.insert(it.key(), it.value());
- }
+
QHash<int, KPropertyEditorCreatorInterface*>::ConstIterator editorCreatorsItEnd
= factory->editorCreators().constEnd();
for (QHash<int, KPropertyEditorCreatorInterface*>::ConstIterator it( \
factory->editorCreators().constBegin() ); @@ -290,12 +259,12 @@ void \
KPropertyFactoryManager::registerFactory(KPropertyFactory *factory) }
}
-bool KPropertyFactoryManager::isEditorForTypeAvailable( int type ) const
+bool KPropertyWidgetsFactoryManager::isEditorForTypeAvailable( int type ) const
{
return d->editorCreators.value(type);
}
-QWidget * KPropertyFactoryManager::createEditor(
+QWidget * KPropertyWidgetsFactoryManager::createEditor(
int type, QWidget *parent,
const QStyleOptionViewItem & option, const QModelIndex & index ) const
{
@@ -325,7 +294,7 @@ QWidget * KPropertyFactoryManager::createEditor(
return w;
}
-bool KPropertyFactoryManager::paint( int type, QPainter * painter,
+bool KPropertyWidgetsFactoryManager::paint( int type, QPainter * painter,
const QStyleOptionViewItem & option, const QModelIndex & index ) const
{
const KPropertyValuePainterInterface *_painter = d->valuePainters.value(type);
@@ -342,28 +311,22 @@ bool KPropertyFactoryManager::paint( int type, QPainter * \
painter, return true;
}
-bool KPropertyFactoryManager::canConvertValueToText( int type ) const
+bool KPropertyWidgetsFactoryManager::canConvertValueToText( int type ) const
{
return d->valueDisplays.value(type) != 0;
}
-bool KPropertyFactoryManager::canConvertValueToText( const KProperty* property ) \
const +bool KPropertyWidgetsFactoryManager::canConvertValueToText( const KProperty* \
property ) const {
return d->valueDisplays.value( property->type() ) != 0;
}
-QString KPropertyFactoryManager::convertValueToText( const KProperty* property ) \
const +QString KPropertyWidgetsFactoryManager::convertValueToText( const KProperty* \
property ) const {
const KPropertyValueDisplayInterface *display = d->valueDisplays.value( \
property->type() );
return display ? display->displayTextForProperty( property ) : \
property->value().toString(); }
-KComposedPropertyInterface* \
KPropertyFactoryManager::createComposedProperty(KProperty *parent)
-{
- const KComposedPropertyCreatorInterface *creator = \
d->composedPropertyCreators.value( parent->type() );
- return creator ? creator->createComposedProperty(parent) : 0;
-}
-
//! @todo
#if 0
const int type = parent->type();
@@ -398,24 +361,6 @@ KComposedPropertyInterface* \
KPropertyFactoryManager::createComposedProperty(KPro return 0;
#endif
-KComposedPropertyInterface::KComposedPropertyInterface(KProperty *parent)
- : m_childValueChangedEnabled(true)
-{
- Q_UNUSED(parent)
-}
-
-KComposedPropertyInterface::~KComposedPropertyInterface()
-{
-}
-
-KComposedPropertyCreatorInterface::KComposedPropertyCreatorInterface()
-{
-}
-
-KComposedPropertyCreatorInterface::~KComposedPropertyCreatorInterface()
-{
-}
-
KPropertyEditorCreatorInterface::KPropertyEditorCreatorInterface()
{
}
@@ -444,3 +389,4 @@ KPropertyValueDisplayInterface::KPropertyValueDisplayInterface()
KPropertyValueDisplayInterface::~KPropertyValueDisplayInterface()
{
}
+
diff --git a/src/KPropertyFactory.h b/src/KPropertyWidgetsFactory.h
similarity index 65%
copy from src/KPropertyFactory.h
copy to src/KPropertyWidgetsFactory.h
index 2c9fbc7..a2a6dfa 100644
--- a/src/KPropertyFactory.h
+++ b/src/KPropertyWidgetsFactory.h
@@ -17,70 +17,26 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef KPROPERTY_FACTORY_H
-#define KPROPERTY_FACTORY_H
+#ifndef KPROPERTYWIDGETS_FACTORY_H
+#define KPROPERTYWIDGETS_FACTORY_H
+#include "kpropertywidgets_export.h"
#include "KProperty.h"
+#include "KPropertyFactory.h"
#include <QObject>
#include <QVariant>
#include <QHash>
+
#include <QLabel>
#include <QPainter>
#include <QStyleOptionViewItem>
-//! An interface for for composed property handlers
-/*! You have to subclass KComposedPropertyInterface to override the behaviour of a \
property type.\n
- In the constructor, you should create the child properties (if needed).
- Then, you need to implement the functions concerning values.\n
-
- Example implementation of composed properties can be found in editors/ directory.
-*/
-class KPROPERTY_EXPORT KComposedPropertyInterface
-{
-public:
- explicit KComposedPropertyInterface(KProperty *parent);
- virtual ~KComposedPropertyInterface();
-
- /*! This function modifies the child properties for parent value @a value.
- It is called by @ref Property::setValue() when
- the property is composed.
- You don't have to modify the property value, it is done by Property class.
- Note that when calling Property::setValue, you <b>need</b> to set
- useComposedProperty (the third parameter) to false, or there will be infinite \
recursion. */
- virtual void setValue(KProperty *property, const QVariant &value, bool \
rememberOldValue) = 0;
-
- void childValueChangedInternal(KProperty *child, const QVariant &value, bool \
rememberOldValue) {
- if (m_childValueChangedEnabled)
- childValueChanged(child, value, rememberOldValue);
- }
-
- void setChildValueChangedEnabled(bool set) { m_childValueChangedEnabled = set; }
-
-protected:
- virtual void childValueChanged(KProperty *child, const QVariant &value, bool \
rememberOldValue) = 0;
-
- /*! This method emits the \a Set::propertyChanged() signal for all
- sets our parent-property is registered in. */
- void emitPropertyChanged();
- bool m_childValueChangedEnabled : 1;
-};
-
-class KPROPERTY_EXPORT KComposedPropertyCreatorInterface
-{
-public:
- KComposedPropertyCreatorInterface();
-
- virtual ~KComposedPropertyCreatorInterface();
-
- virtual KComposedPropertyInterface* createComposedProperty(KProperty *parent) \
const = 0;
-};
-
//! An interface for editor widget creators.
/*! Options can be set in the options attribute in order to customize
widget creation process. Do this in the EditorCreatorInterface constructor.
*/
-class KPROPERTY_EXPORT KPropertyEditorCreatorInterface
+class KPROPERTYWIDGETS_EXPORT KPropertyEditorCreatorInterface
{
public:
KPropertyEditorCreatorInterface();
@@ -105,7 +61,7 @@ public:
Options options;
};
-class KPROPERTY_EXPORT KPropertyValuePainterInterface
+class KPROPERTYWIDGETS_EXPORT KPropertyValuePainterInterface
{
public:
KPropertyValuePainterInterface();
@@ -114,7 +70,7 @@ public:
const QStyleOptionViewItem & option, const QModelIndex & index ) const = 0;
};
-class KPROPERTY_EXPORT KPropertyValueDisplayInterface
+class KPROPERTYWIDGETS_EXPORT KPropertyValueDisplayInterface
{
public:
KPropertyValueDisplayInterface();
@@ -125,9 +81,10 @@ public:
{ return value.toString(); }
};
+
//! Label widget that can be used for displaying text-based read-only items
//! Used in LabelCreator.
-class KPROPERTY_EXPORT KPropertyLabel : public QLabel
+class KPROPERTYWIDGETS_EXPORT KPropertyLabel : public QLabel
{
Q_OBJECT
Q_PROPERTY(QVariant value READ value WRITE setValue USER true)
@@ -149,7 +106,7 @@ private:
//! Creator returning editor
template<class Widget>
-class KPROPERTY_EXPORT KPropertyEditorCreator : public \
KPropertyEditorCreatorInterface, +class KPROPERTYWIDGETS_EXPORT \
KPropertyEditorCreator : public KPropertyEditorCreatorInterface,
public KPropertyValueDisplayInterface,
public KPropertyValuePainterInterface
{
@@ -181,26 +138,13 @@ public:
typedef KPropertyEditorCreator<KPropertyLabel> KPropertyLabelCreator;
-//! Creator returning composed property object
-template<class ComposedProperty>
-class KPROPERTY_EXPORT KComposedPropertyCreator : public \
KComposedPropertyCreatorInterface
-{
-public:
- KComposedPropertyCreator() : KComposedPropertyCreatorInterface() {}
- virtual ~KComposedPropertyCreator() {}
-
- virtual ComposedProperty* createComposedProperty(KProperty *parent) const {
- return new ComposedProperty(parent);
- }
-};
-
-class KPROPERTY_EXPORT KPropertyFactory
+class KPROPERTYWIDGETS_EXPORT KPropertyWidgetsFactory : public KPropertyFactory
{
public:
- KPropertyFactory();
- virtual ~KPropertyFactory();
- QHash<int, KComposedPropertyCreatorInterface*> composedPropertyCreators() const;
+ KPropertyWidgetsFactory();
+ virtual ~KPropertyWidgetsFactory();
+
QHash<int, KPropertyEditorCreatorInterface*> editorCreators() const;
QHash<int, KPropertyValuePainterInterface*> valuePainters() const;
QHash<int, KPropertyValueDisplayInterface*> valueDisplays() const;
@@ -209,8 +153,6 @@ public:
//! The creator becomes owned by the factory.
void addEditor(int type, KPropertyEditorCreatorInterface *creator);
- void addComposedPropertyCreator( int type, KComposedPropertyCreatorInterface* \
creator );
-
void addPainter(int type, KPropertyValuePainterInterface *painter);
void addDisplay(int type, KPropertyValueDisplayInterface *display);
@@ -222,9 +164,6 @@ public:
protected:
void addEditorInternal(int type, KPropertyEditorCreatorInterface *editor, bool \
own = true);
- void addComposedPropertyCreatorInternal(int type,
- KComposedPropertyCreatorInterface* creator, bool own = true);
-
//! Adds value painter @a painter for type @a type.
//! The painter becomes owned by the factory.
void addPainterInternal(int type, KPropertyValuePainterInterface *painter, bool \
own = true); @@ -232,7 +171,7 @@ protected:
//! Adds value-to-text converted @a painter for type @a type.
//! The converter becomes owned by the factory.
void addDisplayInternal(int type, KPropertyValueDisplayInterface *display, bool \
own = true);
-
+
class Private;
Private * const d;
};
@@ -240,7 +179,7 @@ protected:
class KProperty;
class KCustomProperty;
-class KPROPERTY_EXPORT KPropertyFactoryManager : public QObject
+class KPROPERTYWIDGETS_EXPORT KPropertyWidgetsFactoryManager : public \
KPropertyFactoryManager {
Q_OBJECT
public:
@@ -256,7 +195,7 @@ public:
QPainter * painter,
const QStyleOptionViewItem & option,
const QModelIndex & index ) const;
-
+
KComposedPropertyInterface* createComposedProperty(KProperty *parent);
bool canConvertValueToText( int type ) const;
@@ -266,15 +205,15 @@ public:
QString convertValueToText( const KProperty* property ) const;
//! Registers factory @a factory. It becomes owned by the manager.
- void registerFactory(KPropertyFactory *factory);
+ void registerFactory(KPropertyWidgetsFactory *factory);
KCustomProperty* createCustomProperty( KProperty *parent );
/*! \return a pointer to a factory manager instance.*/
- static KPropertyFactoryManager* self();
+ static KPropertyWidgetsFactoryManager* self();
- KPropertyFactoryManager();
- ~KPropertyFactoryManager();
+ KPropertyWidgetsFactoryManager();
+ ~KPropertyWidgetsFactoryManager();
private:
class Private;
diff --git a/src/config-kproperty.h.cmake b/src/config-kproperty.h.cmake
index 5ee9707..e5c9d32 100644
--- a/src/config-kproperty.h.cmake
+++ b/src/config-kproperty.h.cmake
@@ -31,4 +31,8 @@
//! @brief Defined if unfinished features of KProperty are enabled
#cmakedefine KPROPERTY_UNFINISHED
+//! @def KPROPERTY_WIDGET
+//! @brief Defined if QtWidgets components of KProperty are enabled
+#cmakedefine KPROPERTY_WIDGET
+
#endif
diff --git a/src/editors/CMakeLists.txt b/src/editors/CMakeLists.txt
index 147ffc4..8c1af75 100644
--- a/src/editors/CMakeLists.txt
+++ b/src/editors/CMakeLists.txt
@@ -34,13 +34,13 @@ ecm_generate_headers(kproperty_editors_FORWARDING_HEADERS
install(
FILES
${kproperty_editors_HEADERS}
- DESTINATION ${INCLUDE_INSTALL_DIR}/KProperty
+ DESTINATION ${INCLUDE_INSTALL_DIR}/KPropertyWidgets
COMPONENT Devel
)
install(
FILES
${kproperty_editors_FORWARDING_HEADERS}
- DESTINATION ${INCLUDE_INSTALL_DIR}/KProperty
+ DESTINATION ${INCLUDE_INSTALL_DIR}/KPropertyWidgets
COMPONENT Devel
)
diff --git a/src/editors/KPropertyStringEditor.h \
b/src/editors/KPropertyStringEditor.h index 908c89c..5862180 100644
--- a/src/editors/KPropertyStringEditor.h
+++ b/src/editors/KPropertyStringEditor.h
@@ -22,11 +22,11 @@
#ifndef KPROPERTY_STRINGEDIT_H
#define KPROPERTY_STRINGEDIT_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
#include <QLineEdit>
-class KPROPERTY_EXPORT KPropertyStringEditor : public QLineEdit
+class KPROPERTYWIDGETS_EXPORT KPropertyStringEditor : public QLineEdit
{
Q_OBJECT
Q_PROPERTY(QString value READ value WRITE setValue USER true)
@@ -50,7 +50,7 @@ private:
bool m_slotTextChangedEnabled;
};
-class KPROPERTY_EXPORT KPropertyStringDelegate : public \
KPropertyEditorCreatorInterface +class KPROPERTYWIDGETS_EXPORT \
KPropertyStringDelegate : public KPropertyEditorCreatorInterface {
public:
KPropertyStringDelegate() {}
diff --git a/src/editors/booledit.h b/src/editors/booledit.h
index 8ca5f5f..c2b8459 100644
--- a/src/editors/booledit.h
+++ b/src/editors/booledit.h
@@ -32,7 +32,7 @@
//! A bool editor supporting two states: true and false.
/*! For null values, false is displayed.
*/
-class KPROPERTY_EXPORT KPropertyBoolEditor : public QToolButton
+class KPROPERTYWIDGETS_EXPORT KPropertyBoolEditor : public QToolButton
{
Q_OBJECT
Q_PROPERTY(bool value READ value WRITE setValue USER true)
@@ -70,7 +70,7 @@ private:
//! A bool editor supporting three states: true, false and null.
/*! The editor is implemented as a drop-down list.
*/
-class KPROPERTY_EXPORT KPropertyThreeStateBoolEditor : public \
KPropertyComboBoxEditor +class KPROPERTYWIDGETS_EXPORT KPropertyThreeStateBoolEditor \
: public KPropertyComboBoxEditor {
Q_OBJECT
// Q_PROPERTY(QVariant value READ value WRITE setValue USER true)
@@ -86,7 +86,7 @@ Q_SIGNALS:
void commitData( QWidget * editor );
};
-class KPROPERTY_EXPORT KPropertyBoolDelegate : public \
KPropertyEditorCreatorInterface, +class KPROPERTYWIDGETS_EXPORT KPropertyBoolDelegate \
: public KPropertyEditorCreatorInterface,
public KPropertyValuePainterInterface
{
public:
diff --git a/src/editors/coloredit.h b/src/editors/coloredit.h
index 47a58bb..da2f931 100644
--- a/src/editors/coloredit.h
+++ b/src/editors/coloredit.h
@@ -20,14 +20,15 @@
#ifndef KPROPERTY_COLOREDIT_H
#define KPROPERTY_COLOREDIT_H
-#include "KPropertyFactory.h"
+#include "kpropertywidgets_export.h"
+#include "KPropertyWidgetsFactory.h"
#include <KColorCombo>
//! Color combo box
//! @todo enable transparency selection
//! @todo add transparency option
//! @todo reimplement view using KColorCells
-class KPROPERTY_EXPORT KPropertyColorComboEditor : public KColorCombo
+class KPROPERTYWIDGETS_EXPORT KPropertyColorComboEditor : public KColorCombo
{
Q_OBJECT
Q_PROPERTY(QVariant value READ value WRITE setValue USER true)
@@ -49,7 +50,7 @@ protected Q_SLOTS:
void slotValueChanged(const QColor&);
};
-class KPROPERTY_EXPORT KPropertyColorComboDelegate : public \
KPropertyEditorCreatorInterface, +class KPROPERTYWIDGETS_EXPORT \
KPropertyColorComboDelegate : public KPropertyEditorCreatorInterface,
public \
KPropertyValuePainterInterface {
public:
diff --git a/src/editors/combobox.cpp b/src/editors/combobox.cpp
index 3fcc7f9..855aa77 100644
--- a/src/editors/combobox.cpp
+++ b/src/editors/combobox.cpp
@@ -22,7 +22,8 @@
#include "combobox.h"
#include "KPropertyEditorDataModel.h"
#include "KPropertyEditorView.h"
-#include "kproperty_debug.h"
+#include "kpropertywidgets_debug.h"
+#include "KPropertyWidgetsFactory.h"
#include <QCompleter>
#include <QGuiApplication>
@@ -105,7 +106,7 @@ KPropertyComboBoxEditor::~KPropertyComboBoxEditor()
bool KPropertyComboBoxEditor::listDataKeysAvailable() const
{
if (m_listData.keys.isEmpty()) {
- kprWarning() << "property listData not available!";
+ kprwWarning() << "property listData not available!";
return false;
}
return true;
@@ -143,13 +144,13 @@ void KPropertyComboBoxEditor::setValue(const QVariant &value)
setCurrentIndex(-1);
setEditText(value.toString());
}
- kprWarning() << "NO SUCH KEY:" << value.toString()
+ kprwWarning() << "NO SUCH KEY:" << value.toString()
<< "property=" << objectName();
} else {
QStringList list;
for (int i = 0; i < count(); i++)
list += itemText(i);
- kprWarning() << "NO SUCH INDEX WITHIN COMBOBOX:" << idx
+ kprwWarning() << "NO SUCH INDEX WITHIN COMBOBOX:" << idx
<< "count=" << count() << "value=" << value.toString()
<< "property=" << objectName() << "\nActual combobox contents"
<< list;
@@ -218,7 +219,7 @@ void KPropertyComboBoxEditor::slotValueChanged(int)
void KPropertyComboBoxEditor::paintEvent( QPaintEvent * event )
{
QComboBox::paintEvent(event);
- KPropertyFactory::paintTopGridLine(this);
+ KPropertyWidgetsFactory::paintTopGridLine(this);
}
/*
diff --git a/src/editors/combobox.h b/src/editors/combobox.h
index 73c0207..d5ba5e3 100644
--- a/src/editors/combobox.h
+++ b/src/editors/combobox.h
@@ -22,11 +22,12 @@
#ifndef KPROPERTY_COMBOBOX_H
#define KPROPERTY_COMBOBOX_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
+#include "kpropertywidgets_export.h"
#include <QComboBox>
-class KPROPERTY_EXPORT KPropertyComboBoxEditor : public QComboBox
+class KPROPERTYWIDGETS_EXPORT KPropertyComboBoxEditor : public QComboBox
{
Q_OBJECT
Q_PROPERTY(QVariant value READ value WRITE setValue USER true)
@@ -87,7 +88,7 @@ protected:
Options m_options;
};
-class KPROPERTY_EXPORT KPropertyComboBoxDelegate : public \
KPropertyEditorCreatorInterface, +class KPROPERTYWIDGETS_EXPORT \
KPropertyComboBoxDelegate : public KPropertyEditorCreatorInterface,
public \
KPropertyValueDisplayInterface {
public:
diff --git a/src/editors/cursoredit.h b/src/editors/cursoredit.h
index bb1e3a6..0aca816 100644
--- a/src/editors/cursoredit.h
+++ b/src/editors/cursoredit.h
@@ -24,7 +24,7 @@
#include "combobox.h"
-class KPROPERTY_EXPORT KPropertyCursorEditor : public KPropertyComboBoxEditor
+class KPROPERTYWIDGETS_EXPORT KPropertyCursorEditor : public KPropertyComboBoxEditor
{
Q_OBJECT
Q_PROPERTY(QCursor value READ cursorValue WRITE setCursorValue USER true)
@@ -37,7 +37,7 @@ public:
virtual void setCursorValue(const QCursor &value);
};
-class KPROPERTY_EXPORT KPropertyCursorDelegate : public \
KPropertyEditorCreatorInterface, +class KPROPERTYWIDGETS_EXPORT \
KPropertyCursorDelegate : public KPropertyEditorCreatorInterface,
public \
KPropertyValuePainterInterface {
public:
diff --git a/src/editors/dateedit.cpp b/src/editors/dateedit.cpp
index 251de80..e52b656 100644
--- a/src/editors/dateedit.cpp
+++ b/src/editors/dateedit.cpp
@@ -62,7 +62,7 @@ void KPropertyDateEditor::setValue(const QVariant& value)
void KPropertyDateEditor::paintEvent(QPaintEvent* event)
{
QDateEdit::paintEvent(event);
- KPropertyFactory::paintTopGridLine(this);
+ KPropertyWidgetsFactory::paintTopGridLine(this);
}
diff --git a/src/editors/dateedit.h b/src/editors/dateedit.h
index 4699e48..955131d 100644
--- a/src/editors/dateedit.h
+++ b/src/editors/dateedit.h
@@ -22,10 +22,10 @@
#ifndef KPROPERTY_DATEEDIT_H
#define KPROPERTY_DATEEDIT_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
#include <QDateEdit>
-class KPROPERTY_EXPORT KPropertyDateEditor : public QDateEdit
+class KPROPERTYWIDGETS_EXPORT KPropertyDateEditor : public QDateEdit
{
Q_OBJECT
Q_PROPERTY(QVariant value READ value WRITE setValue USER true)
@@ -49,7 +49,7 @@ protected Q_SLOTS:
void onDateChanged();
};
-class KPROPERTY_EXPORT KPropertyDateDelegate : public \
KPropertyEditorCreatorInterface, +class KPROPERTYWIDGETS_EXPORT KPropertyDateDelegate \
: public KPropertyEditorCreatorInterface,
public KPropertyValueDisplayInterface
{
public:
diff --git a/src/editors/datetimeedit.cpp b/src/editors/datetimeedit.cpp
index 037f48b..a0b50f4 100644
--- a/src/editors/datetimeedit.cpp
+++ b/src/editors/datetimeedit.cpp
@@ -22,6 +22,7 @@
#include "datetimeedit.h"
#include "KPropertyEditorDataModel.h"
+#include "KPropertyWidgetsFactory.h"
#include <QLocale>
@@ -64,7 +65,7 @@ void KPropertyDateTimeEditor::setValue(const QVariant& value)
void KPropertyDateTimeEditor::paintEvent(QPaintEvent* event)
{
QDateTimeEdit::paintEvent(event);
- KPropertyFactory::paintTopGridLine(this);
+ KPropertyWidgetsFactory::paintTopGridLine(this);
}
diff --git a/src/editors/datetimeedit.h b/src/editors/datetimeedit.h
index 5e24e1f..050f5b3 100644
--- a/src/editors/datetimeedit.h
+++ b/src/editors/datetimeedit.h
@@ -22,10 +22,10 @@
#ifndef KPROPERTY_DATETIMEEDIT_H
#define KPROPERTY_DATETIMEEDIT_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
#include <QDateTimeEdit>
-class KPROPERTY_EXPORT KPropertyDateTimeEditor : public QDateTimeEdit
+class KPROPERTYWIDGETS_EXPORT KPropertyDateTimeEditor : public QDateTimeEdit
{
Q_OBJECT
Q_PROPERTY(QVariant value READ value WRITE setValue USER true)
@@ -49,7 +49,7 @@ protected Q_SLOTS:
void onDateTimeChanged();
};
-class KPROPERTY_EXPORT KPropertyDateTimeDelegate : public \
KPropertyEditorCreatorInterface, +class KPROPERTYWIDGETS_EXPORT \
KPropertyDateTimeDelegate : public KPropertyEditorCreatorInterface,
public \
KPropertyValueDisplayInterface {
public:
diff --git a/src/editors/dummywidget.h b/src/editors/dummywidget.h
index 43a1ea4..42cceb3 100644
--- a/src/editors/dummywidget.h
+++ b/src/editors/dummywidget.h
@@ -25,7 +25,7 @@
#include <QVariant>
-class KPROPERTY_EXPORT KPropertyDummyWidget: public Widget
+class KPROPERTYWIDGETS_EXPORT KPropertyDummyWidget: public Widget
{
Q_OBJECT
diff --git a/src/editors/fontedit.h b/src/editors/fontedit.h
index e406b36..36ca59a 100644
--- a/src/editors/fontedit.h
+++ b/src/editors/fontedit.h
@@ -22,10 +22,10 @@
#ifndef KPROPERTY_FONTEDIT_H
#define KPROPERTY_FONTEDIT_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
-class KPROPERTY_EXPORT KPropertyFontDelegate : public \
KPropertyEditorCreatorInterface, +class KPROPERTYWIDGETS_EXPORT KPropertyFontDelegate \
: public KPropertyEditorCreatorInterface,
public KPropertyValuePainterInterface
{
public:
diff --git a/src/editors/linestyleedit.h b/src/editors/linestyleedit.h
index 407d798..82acfdc 100644
--- a/src/editors/linestyleedit.h
+++ b/src/editors/linestyleedit.h
@@ -20,14 +20,14 @@
#ifndef KPROPERTY_LINESTYLEEDIT_H
#define KPROPERTY_LINESTYLEEDIT_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
#include "KPropertyLineStyleSelector_p.h"
//! Line style combo box (Property::LineStyle, equivalent of Qt::PenStyle)
//! @todo enable transparency selection
//! @todo add transparency option
//! @todo reimplement view using KColorCells
-class KPROPERTY_EXPORT KPropertyLineStyleComboEditor : public \
KPropertyLineStyleSelector +class KPROPERTYWIDGETS_EXPORT \
KPropertyLineStyleComboEditor : public KPropertyLineStyleSelector {
Q_OBJECT
Q_PROPERTY(QVariant value READ value WRITE setValue USER true)
@@ -49,7 +49,7 @@ protected Q_SLOTS:
void slotValueChanged(int index);
};
-class KPROPERTY_EXPORT KPropertyLineStyleComboDelegate : public \
KPropertyEditorCreatorInterface, +class KPROPERTYWIDGETS_EXPORT \
KPropertyLineStyleComboDelegate : public \
KPropertyEditorCreatorInterface,
public \
KPropertyValuePainterInterface {
public:
diff --git a/src/editors/pixmapedit.h b/src/editors/pixmapedit.h
index fd1e6e2..954152d 100644
--- a/src/editors/pixmapedit.h
+++ b/src/editors/pixmapedit.h
@@ -22,7 +22,7 @@
#ifndef KPROPERTY_PIXMAPEDIT_H
#define KPROPERTY_PIXMAPEDIT_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
#include <QPixmap>
#include <QVariant>
@@ -30,7 +30,7 @@
class QLabel;
class QPushButton;
-class KPROPERTY_EXPORT KPropertyPixmapEditor : public QWidget
+class KPROPERTYWIDGETS_EXPORT KPropertyPixmapEditor : public QWidget
{
Q_OBJECT
Q_PROPERTY(QVariant value READ value WRITE setValue USER true)
@@ -71,7 +71,7 @@ protected:
QPixmap m_previewPixmap;
};
-class KPROPERTY_EXPORT KPropertyPixmapDelegate : public \
KPropertyEditorCreatorInterface, +class KPROPERTYWIDGETS_EXPORT \
KPropertyPixmapDelegate : public KPropertyEditorCreatorInterface,
public \
KPropertyValuePainterInterface {
public:
diff --git a/src/editors/pointedit.h b/src/editors/pointedit.h
index 4f9e195..a68ed83 100644
--- a/src/editors/pointedit.h
+++ b/src/editors/pointedit.h
@@ -22,9 +22,9 @@
#ifndef KPROPERTY_POINTEDIT_H
#define KPROPERTY_POINTEDIT_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
-class KPROPERTY_EXPORT KPointComposedProperty : public KComposedPropertyInterface
+class KPROPERTYWIDGETS_EXPORT KPointComposedProperty : public \
KComposedPropertyInterface {
public:
explicit KPointComposedProperty(KProperty *parent);
@@ -36,7 +36,7 @@ public:
const QVariant &value, bool rememberOldValue);
};
-class KPROPERTY_EXPORT KPropertyPointDelegate : public KPropertyLabelCreator,
+class KPROPERTYWIDGETS_EXPORT KPropertyPointDelegate : public KPropertyLabelCreator,
public \
KComposedPropertyCreator<KPointComposedProperty> {
public:
diff --git a/src/editors/pointfedit.h b/src/editors/pointfedit.h
index c0583e0..e1284b8 100644
--- a/src/editors/pointfedit.h
+++ b/src/editors/pointfedit.h
@@ -23,9 +23,9 @@
#ifndef KPROPERTY_POINTFEDIT_H
#define KPROPERTY_POINTFEDIT_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
-class KPROPERTY_EXPORT KPointFComposedProperty : public KComposedPropertyInterface
+class KPROPERTYWIDGETS_EXPORT KPointFComposedProperty : public \
KComposedPropertyInterface {
public:
explicit KPointFComposedProperty(KProperty *parent);
@@ -37,7 +37,7 @@ public:
const QVariant &value, bool rememberOldValue);
};
-class KPROPERTY_EXPORT KPropertyPointFDelegate : public KPropertyLabelCreator,
+class KPROPERTYWIDGETS_EXPORT KPropertyPointFDelegate : public \
KPropertyLabelCreator,
public \
KComposedPropertyCreator<KPointFComposedProperty> {
public:
diff --git a/src/editors/rectedit.h b/src/editors/rectedit.h
index 8a38df6..468d9c2 100644
--- a/src/editors/rectedit.h
+++ b/src/editors/rectedit.h
@@ -20,9 +20,9 @@
#ifndef KPROPERTY_RECTEDIT_H
#define KPROPERTY_RECTEDIT_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
-class KPROPERTY_EXPORT KRectComposedProperty : public KComposedPropertyInterface
+class KPROPERTYWIDGETS_EXPORT KRectComposedProperty : public \
KComposedPropertyInterface {
public:
explicit KRectComposedProperty(KProperty *parent);
@@ -34,7 +34,7 @@ public:
const QVariant &value, bool rememberOldValue);
};
-class KPROPERTY_EXPORT KPropertyRectDelegate : public KPropertyLabelCreator,
+class KPROPERTYWIDGETS_EXPORT KPropertyRectDelegate : public KPropertyLabelCreator,
public \
KComposedPropertyCreator<KRectComposedProperty> {
public:
diff --git a/src/editors/sizeedit.h b/src/editors/sizeedit.h
index 7a17bae..5d423f1 100644
--- a/src/editors/sizeedit.h
+++ b/src/editors/sizeedit.h
@@ -22,9 +22,9 @@
#ifndef KPROPERTY_SIZEEDIT_H
#define KPROPERTY_SIZEEDIT_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
-class KPROPERTY_EXPORT KSizeComposedProperty : public KComposedPropertyInterface
+class KPROPERTYWIDGETS_EXPORT KSizeComposedProperty : public \
KComposedPropertyInterface {
public:
explicit KSizeComposedProperty(KProperty *parent);
@@ -36,7 +36,7 @@ public:
const QVariant &value, bool rememberOldValue);
};
-class KPROPERTY_EXPORT KPropertySizeDelegate : public KPropertyLabelCreator,
+class KPROPERTYWIDGETS_EXPORT KPropertySizeDelegate : public KPropertyLabelCreator,
public \
KComposedPropertyCreator<KSizeComposedProperty> {
public:
diff --git a/src/editors/sizefedit.h b/src/editors/sizefedit.h
index 993a735..0a35465 100644
--- a/src/editors/sizefedit.h
+++ b/src/editors/sizefedit.h
@@ -22,9 +22,9 @@
#ifndef KPROPERTY_SIZEFEDIT_H
#define KPROPERTY_SIZEFEDIT_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
-class KPROPERTY_EXPORT KSizeFComposedProperty : public KComposedPropertyInterface
+class KPROPERTYWIDGETS_EXPORT KSizeFComposedProperty : public \
KComposedPropertyInterface {
public:
explicit KSizeFComposedProperty(KProperty *parent);
@@ -36,7 +36,7 @@ public:
const QVariant &value, bool rememberOldValue);
};
-class KPROPERTY_EXPORT KPropertySizeFDelegate : public KPropertyLabelCreator,
+class KPROPERTYWIDGETS_EXPORT KPropertySizeFDelegate : public KPropertyLabelCreator,
public \
KComposedPropertyCreator<KSizeFComposedProperty> {
public:
diff --git a/src/editors/sizepolicyedit.h b/src/editors/sizepolicyedit.h
index 6f83018..4276f5e 100644
--- a/src/editors/sizepolicyedit.h
+++ b/src/editors/sizepolicyedit.h
@@ -20,9 +20,9 @@
#ifndef KPROPERTY_SIZEPOLICYEDIT_H
#define KPROPERTY_SIZEPOLICYEDIT_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
-class KPROPERTY_EXPORT KSizePolicyComposedProperty : public \
KComposedPropertyInterface +class KPROPERTYWIDGETS_EXPORT KSizePolicyComposedProperty \
: public KComposedPropertyInterface {
public:
explicit KSizePolicyComposedProperty(KProperty *parent);
@@ -34,7 +34,7 @@ public:
const QVariant &value, bool rememberOldValue);
};
-class KPROPERTY_EXPORT KPropertySizePolicyDelegate : public KPropertyLabelCreator,
+class KPROPERTYWIDGETS_EXPORT KPropertySizePolicyDelegate : public \
KPropertyLabelCreator,
public \
KComposedPropertyCreator<KSizePolicyComposedProperty> {
public:
diff --git a/src/editors/spinbox.cpp b/src/editors/spinbox.cpp
index ff3cd53..0d46f9e 100644
--- a/src/editors/spinbox.cpp
+++ b/src/editors/spinbox.cpp
@@ -25,7 +25,8 @@
#include "KPropertyEditorDataModel.h"
#include "KPropertyEditorView.h"
#include "KPropertyUnit_p.h"
-#include "kproperty_debug.h"
+#include "KPropertyWidgetsFactory.h"
+#include "kpropertywidgets_debug.h"
#include <QVariant>
#include <QLineEdit>
@@ -71,7 +72,7 @@ KPropertyIntSpinBox::KPropertyIntSpinBox(const KProperty* prop, \
QWidget *parent, // kprDebug() << parent->font().pointSize();
setFrame(true);
QString css = cssForSpinBox("QSpinBox", font(), itemHeight);
- KPropertyFactory::setTopAndBottomBordersUsingStyleSheet(this, parent, css);
+ KPropertyWidgetsFactory::setTopAndBottomBordersUsingStyleSheet(this, parent, \
css); setStyleSheet(css);
QVariant minVal(prop->option("min", m_unsigned ? 0 : -INT_MAX));
@@ -99,7 +100,7 @@ void KPropertyIntSpinBox::setValue(const QVariant& value)
{
int v( value.toInt() );
if (m_unsigned && v<0) {
- kprWarning() << "could not assign negative value" << v << "- assigning 0";
+ kprwWarning() << "could not assign negative value" << v << "- assigning 0";
v = 0;
}
QSpinBox::setValue(v);
@@ -150,7 +151,7 @@ KPropertyDoubleSpinBox::KPropertyDoubleSpinBox(const KProperty* \
prop, QWidget *p ).arg(itemHeight/2).arg(itemHeight - itemHeight/2)
);*/
QString css = cssForSpinBox("QDoubleSpinBox", font(), itemHeight);
- KPropertyFactory::setTopAndBottomBordersUsingStyleSheet(this, parent, css);
+ KPropertyWidgetsFactory::setTopAndBottomBordersUsingStyleSheet(this, parent, \
css); setStyleSheet(css);
QVariant minVal(prop->option("min"));
diff --git a/src/editors/spinbox.h b/src/editors/spinbox.h
index 9e8ad8c..1dd8532 100644
--- a/src/editors/spinbox.h
+++ b/src/editors/spinbox.h
@@ -22,7 +22,7 @@
#ifndef KPROPERTY_SPINBOX_H
#define KPROPERTY_SPINBOX_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
#include <QSpinBox>
#include <QDoubleSpinBox>
@@ -31,7 +31,7 @@
/*! Note that due to KIntNumInput limitations, for UInt the maximum value
is INT_MAX, not UINT_MAX.
*/
-class KPROPERTY_EXPORT KPropertyIntSpinBox : public QSpinBox
+class KPROPERTYWIDGETS_EXPORT KPropertyIntSpinBox : public QSpinBox
{
Q_OBJECT
Q_PROPERTY(QVariant value READ value WRITE setValue USER true)
@@ -62,7 +62,7 @@ private:
};
//! Double editor
-class KPROPERTY_EXPORT KPropertyDoubleSpinBox : public QDoubleSpinBox
+class KPROPERTYWIDGETS_EXPORT KPropertyDoubleSpinBox : public QDoubleSpinBox
{
Q_OBJECT
Q_PROPERTY(double value READ value WRITE setValue USER true)
@@ -97,7 +97,7 @@ protected:
};
//! A delegate supporting Int, UInt, LongLong and ULongLong types
-class KPROPERTY_EXPORT KPropertyIntSpinBoxDelegate : public \
KPropertyEditorCreatorInterface, +class KPROPERTYWIDGETS_EXPORT \
KPropertyIntSpinBoxDelegate : public KPropertyEditorCreatorInterface,
public \
KPropertyValueDisplayInterface {
public:
@@ -109,7 +109,7 @@ public:
const QStyleOptionViewItem & option, const QModelIndex & index ) const;
};
-class KPROPERTY_EXPORT KPropertyDoubleSpinBoxDelegate : public \
KPropertyEditorCreatorInterface, +class KPROPERTYWIDGETS_EXPORT \
KPropertyDoubleSpinBoxDelegate : public \
KPropertyEditorCreatorInterface,
public \
KPropertyValueDisplayInterface {
public:
diff --git a/src/editors/stringlistedit.h b/src/editors/stringlistedit.h
index 65a39d3..0a74adb 100644
--- a/src/editors/stringlistedit.h
+++ b/src/editors/stringlistedit.h
@@ -28,7 +28,7 @@
class QLineEdit;
class QPushButton;
-class KPROPERTY_EXPORT KPropertyStringListEditor : public Widget
+class KPROPERTYWIDGETS_EXPORT KPropertyStringListEditor : public Widget
{
Q_OBJECT
diff --git a/src/editors/symbolcombo.h b/src/editors/symbolcombo.h
index 6a184f5..dc09a31 100644
--- a/src/editors/symbolcombo.h
+++ b/src/editors/symbolcombo.h
@@ -26,7 +26,7 @@
class QLineEdit;
class QPushButton;
-class KPROPERTY_EXPORT KPropertySymbolComboEditor : public Widget
+class KPROPERTYWIDGETS_EXPORT KPropertySymbolComboEditor : public Widget
{
Q_OBJECT
diff --git a/src/editors/timeedit.cpp b/src/editors/timeedit.cpp
index a88c4d8..ca49aca 100644
--- a/src/editors/timeedit.cpp
+++ b/src/editors/timeedit.cpp
@@ -60,7 +60,7 @@ void KPropertyTimeEditor::setValue(const QVariant& value)
void KPropertyTimeEditor::paintEvent(QPaintEvent* event)
{
QTimeEdit::paintEvent(event);
- KPropertyFactory::paintTopGridLine(this);
+ KPropertyWidgetsFactory::paintTopGridLine(this);
}
diff --git a/src/editors/timeedit.h b/src/editors/timeedit.h
index fd63f64..aa596ba 100644
--- a/src/editors/timeedit.h
+++ b/src/editors/timeedit.h
@@ -22,10 +22,10 @@
#ifndef KPROPERTY_TIMEEDIT_H
#define KPROPERTY_TIMEEDIT_H
-#include "KPropertyFactory.h"
+#include "KPropertyWidgetsFactory.h"
#include <QTimeEdit>
-class KPROPERTY_EXPORT KPropertyTimeEditor : public QTimeEdit
+class KPROPERTYWIDGETS_EXPORT KPropertyTimeEditor : public QTimeEdit
{
Q_OBJECT
Q_PROPERTY(QVariant value READ value WRITE setValue USER true)
@@ -49,7 +49,7 @@ protected Q_SLOTS:
void onTimeChanged();
};
-class KPROPERTY_EXPORT KPropertyTimeDelegate : public \
KPropertyEditorCreatorInterface, +class KPROPERTYWIDGETS_EXPORT KPropertyTimeDelegate \
: public KPropertyEditorCreatorInterface,
public KPropertyValueDisplayInterface
{
public:
diff --git a/src/editors/urledit.h b/src/editors/urledit.h
index dab2b64..fc3a1aa 100644
--- a/src/editors/urledit.h
+++ b/src/editors/urledit.h
@@ -25,7 +25,7 @@
class KUrlRequester;
-class KPROPERTY_EXPORT KPropertyUrlEditor : public Widget
+class KPROPERTYWIDGETS_EXPORT KPropertyUrlEditor : public Widget
{
Q_PROPERTY(QVariant value READ value WRITE setValue USER true)
Q_OBJECT
diff --git a/src/editors/utils.cpp b/src/editors/utils.cpp
index 744cb36..d85655b 100644
--- a/src/editors/utils.cpp
+++ b/src/editors/utils.cpp
@@ -22,7 +22,7 @@
#include <QPushButton>
#include <QFontMetrics>
-KPROPERTY_EXPORT void KPropertyUtils::setupDotDotDotButton(QPushButton *button, \
const QString& toolTip, const QString& whatsThis) +KPROPERTYCORE_EXPORT void \
KPropertyUtils::setupDotDotDotButton(QPushButton *button, const QString& toolTip, \
const QString& whatsThis) {
button->setText(QObject::tr("...", "Three dots for 'Insert image from file' \
button")); if (!toolTip.isEmpty())
diff --git a/src/editors/utils.h b/src/editors/utils.h
index f037c8b..9238c25 100644
--- a/src/editors/utils.h
+++ b/src/editors/utils.h
@@ -20,7 +20,7 @@
#ifndef KPROPERTY_EDITORS_UTILS_H
#define KPROPERTY_EDITORS_UTILS_H
-#include "kproperty_export.h"
+#include "kpropertycore_export.h"
#include <QString>
@@ -30,7 +30,7 @@ namespace KPropertyUtils
{
//! Sets up a "..." button with fine-tuned settings.
-KPROPERTY_EXPORT void setupDotDotDotButton(QPushButton *button,
+KPROPERTYCORE_EXPORT void setupDotDotDotButton(QPushButton *button,
const QString& toolTip = QString(), const QString& whatsThis = QString());
}
diff --git a/src/KDefaultPropertyFactory.h b/src/kpropertywidgets_debug.cpp
similarity index 73%
copy from src/KDefaultPropertyFactory.h
copy to src/kpropertywidgets_debug.cpp
index a923685..07bcb30 100644
--- a/src/KDefaultPropertyFactory.h
+++ b/src/kpropertywidgets_debug.cpp
@@ -1,5 +1,5 @@
/* This file is part of the KDE project
- Copyright (C) 2008 Jarosław Staniek <staniek@kde.org>
+ Copyright (C) 2015 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -17,16 +17,6 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef KDEFAULTPROPERTYFACTORY_H
-#define KDEFAULTPROPERTYFACTORY_H
+#include "kpropertywidgets_debug.h"
+Q_LOGGING_CATEGORY(KPROPERTYW_LOG, "org.kde.kproperty.widgets")
-#include "KPropertyFactory.h"
-
-class KDefaultPropertyFactory : public KPropertyFactory
-{
-public:
- KDefaultPropertyFactory();
- ~KDefaultPropertyFactory();
-};
-
-#endif
diff --git a/src/KDefaultPropertyFactory.h b/src/kpropertywidgets_debug.h
similarity index 68%
copy from src/KDefaultPropertyFactory.h
copy to src/kpropertywidgets_debug.h
index a923685..7b67090 100644
--- a/src/KDefaultPropertyFactory.h
+++ b/src/kpropertywidgets_debug.h
@@ -1,5 +1,5 @@
/* This file is part of the KDE project
- Copyright (C) 2008 Jarosław Staniek <staniek@kde.org>
+ Copyright (C) 2015 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -17,16 +17,14 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef KDEFAULTPROPERTYFACTORY_H
-#define KDEFAULTPROPERTYFACTORY_H
+#ifndef KPROPERTYWIDGETS_DEBUG_H
+#define KPROPERTYWIDGETS_DEBUG_H
-#include "KPropertyFactory.h"
+#include <QLoggingCategory>
+Q_DECLARE_LOGGING_CATEGORY(KPROPERTYW_LOG)
-class KDefaultPropertyFactory : public KPropertyFactory
-{
-public:
- KDefaultPropertyFactory();
- ~KDefaultPropertyFactory();
-};
+#define kprwDebug(...) qCDebug(KPROPERTYW_LOG, __VA_ARGS__)
+#define kprwWarning(...) qCWarning(KPROPERTYW_LOG, __VA_ARGS__)
+#define kprwCritical(...) qCCritical(KPROPERTYW_LOG, __VA_ARGS__)
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic