Hello community, here is the log from the commit of package kplotting for openSUSE:Factory checked in at 2015-07-14 17:29:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kplotting (Old) and /work/SRC/openSUSE:Factory/.kplotting.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kplotting" Changes: -------- --- /work/SRC/openSUSE:Factory/kplotting/kplotting.changes 2015-06-23 12:11:15.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.kplotting.new/kplotting.changes 2015-07-14 17:29:03.000000000 +0200 @@ -1,0 +2,11 @@ +Sun Jul 5 18:45:21 UTC 2015 - hrvoje.sen...@gmail.com + +- Update to 5.12.0 + * KPlotWidget: add setAutoDeletePlotObjects, fix memory leak in + replacePlotObject + * Fix missing tickmarks when x0 > 0. + * KPlotWidget: no need to setMinimumSize or resize. + * For more details please see: + https://www.kde.org/announcements/kde-frameworks-5.12.0.php + +------------------------------------------------------------------- Old: ---- kplotting-5.11.0.tar.xz New: ---- kplotting-5.12.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kplotting.spec ++++++ --- /var/tmp/diff_new_pack.aWDa5D/_old 2015-07-14 17:29:04.000000000 +0200 +++ /var/tmp/diff_new_pack.aWDa5D/_new 2015-07-14 17:29:04.000000000 +0200 @@ -17,9 +17,9 @@ %define lname libKF5Plotting5 -%define _tar_path 5.11 +%define _tar_path 5.12 Name: kplotting -Version: 5.11.0 +Version: 5.12.0 Release: 0 BuildRequires: cmake >= 2.8.12 BuildRequires: extra-cmake-modules >= %{_tar_path} ++++++ kplotting-5.11.0.tar.xz -> kplotting-5.12.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kplotting-5.11.0/CMakeLists.txt new/kplotting-5.12.0/CMakeLists.txt --- old/kplotting-5.11.0/CMakeLists.txt 2015-06-06 11:31:44.000000000 +0200 +++ new/kplotting-5.12.0/CMakeLists.txt 2015-07-04 22:40:55.000000000 +0200 @@ -3,7 +3,7 @@ project(KPlotting) include(FeatureSummary) -find_package(ECM 5.11.0 NO_MODULE) +find_package(ECM 5.12.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) @@ -23,7 +23,7 @@ include(ECMSetupVersion) include(ECMGenerateHeaders) -set(KF5_VERSION "5.11.0") # handled by release scripts +set(KF5_VERSION "5.12.0") # handled by release scripts ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX KPLOTTING VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kplotting_version.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kplotting-5.11.0/autotests/kplotaxistest.cpp new/kplotting-5.12.0/autotests/kplotaxistest.cpp --- old/kplotting-5.11.0/autotests/kplotaxistest.cpp 2015-06-06 11:31:44.000000000 +0200 +++ new/kplotting-5.12.0/autotests/kplotaxistest.cpp 2015-07-04 22:40:55.000000000 +0200 @@ -73,42 +73,15 @@ void testTickMarks() { m_kPlotAxis->setTickMarks(0.0, 12.0); - - QCOMPARE(m_kPlotAxis->majorTickMarks().size(), 4); - QCOMPARE(m_kPlotAxis->majorTickMarks().at(0), 0.0); - QCOMPARE(m_kPlotAxis->majorTickMarks().at(1), 4.0); - QCOMPARE(m_kPlotAxis->majorTickMarks().at(2), 8.0); - QCOMPARE(m_kPlotAxis->majorTickMarks().at(3), 12.0); - - QCOMPARE(m_kPlotAxis->minorTickMarks().size(), 9); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(0), 1.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(1), 2.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(2), 3.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(3), 5.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(4), 6.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(5), 7.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(6), 9.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(7), 10.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(8), 11.0); + QCOMPARE(m_kPlotAxis->majorTickMarks(), QList<double>() << 0.0 << 4.0 << 8.0 << 12.0); + QCOMPARE(m_kPlotAxis->minorTickMarks(), QList<double>() << 1.0 << 2.0 << 3.0 << 5.0 << 6.0 << 7.0 << 9.0 << 10.0 << 11.0); m_kPlotAxis->setTickMarks(0.0, 120.0); + QCOMPARE(m_kPlotAxis->majorTickMarks(), QList<double>() << 0.0 << 40.0 << 80.0 << 120.0); + QCOMPARE(m_kPlotAxis->minorTickMarks(), QList<double>() << 10.0 << 20.0 << 30.0 << 50.0 << 60.0 << 70.0 << 90.0 << 100.0 << 110.0); - QCOMPARE(m_kPlotAxis->majorTickMarks().size(), 4); - QCOMPARE(m_kPlotAxis->majorTickMarks().at(0), 0.0); - QCOMPARE(m_kPlotAxis->majorTickMarks().at(1), 40.0); - QCOMPARE(m_kPlotAxis->majorTickMarks().at(2), 80.0); - QCOMPARE(m_kPlotAxis->majorTickMarks().at(3), 120.0); - - QCOMPARE(m_kPlotAxis->minorTickMarks().size(), 9); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(0), 10.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(1), 20.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(2), 30.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(3), 50.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(4), 60.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(5), 70.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(6), 90.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(7), 100.0); - QCOMPARE(m_kPlotAxis->minorTickMarks().at(8), 110.0); + m_kPlotAxis->setTickMarks(4.0, 29.0); // from 4 to 4+29 = 33 + QCOMPARE(m_kPlotAxis->majorTickMarks(), QList<double>() << 5.0 << 10.0 << 15.0 << 20.0 << 25.0 << 30.0); } private: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kplotting-5.11.0/src/kplotaxis.cpp new/kplotting-5.12.0/src/kplotaxis.cpp --- old/kplotting-5.11.0/src/kplotaxis.cpp 2015-06-06 11:31:44.000000000 +0200 +++ new/kplotting-5.12.0/src/kplotaxis.cpp 2015-07-04 22:40:55.000000000 +0200 @@ -161,7 +161,7 @@ NumMajorTicks++; } - for (int i = 0; i < NumMajorTicks + 1; i++) { + for (int i = 0; i < NumMajorTicks + 2; i++) { double xmaj = Tick0 + i * TickDistance; if (xmaj >= x0 && xmaj <= x0 + length) { d->m_MajorTickMarks.append(xmaj); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kplotting-5.11.0/src/kplotwidget.cpp new/kplotting-5.12.0/src/kplotwidget.cpp --- old/kplotting-5.11.0/src/kplotwidget.cpp 2015-06-06 11:31:44.000000000 +0200 +++ new/kplotting-5.12.0/src/kplotwidget.cpp 2015-07-04 22:40:55.000000000 +0200 @@ -45,7 +45,7 @@ Private(KPlotWidget *qq) : q(qq), cBackground(Qt::black), cForeground(Qt::white), cGrid(Qt::gray), - showGrid(false), showObjectToolTip(true), useAntialias(false) + showGrid(false), showObjectToolTip(true), useAntialias(false), autoDelete(true) { // create the axes and setting their default properties KPlotAxis *leftAxis = new KPlotAxis(); @@ -62,7 +62,9 @@ ~Private() { - qDeleteAll(objectList); + if (autoDelete) { + qDeleteAll(objectList); + } qDeleteAll(axes); } @@ -82,9 +84,10 @@ //Colors QColor cBackground, cForeground, cGrid; //draw options - bool showGrid : 1; - bool showObjectToolTip : 1; - bool useAntialias : 1; + bool showGrid; + bool showObjectToolTip; + bool useAntialias; + bool autoDelete; //padding int leftPadding, rightPadding, topPadding, bottomPadding; // hashmap with the axes we have @@ -110,9 +113,6 @@ d->calcDataRectLimits(0.0, 1.0, 0.0, 1.0); setDefaultPaddings(); - - setMinimumSize(150, 150); - resize(minimumSizeHint()); } KPlotWidget::~KPlotWidget() @@ -257,13 +257,20 @@ return d->objectList; } +void KPlotWidget::setAutoDeletePlotObjects(bool autoDelete) +{ + d->autoDelete = autoDelete; +} + void KPlotWidget::removeAllPlotObjects() { if (d->objectList.isEmpty()) { return; } - qDeleteAll(d->objectList); + if (d->autoDelete) { + qDeleteAll(d->objectList); + } d->objectList.clear(); update(); } @@ -278,7 +285,9 @@ void KPlotWidget::resetPlot() { - qDeleteAll(d->objectList); + if (d->autoDelete) { + qDeleteAll(d->objectList); + } d->objectList.clear(); clearSecondaryLimits(); d->calcDataRectLimits(0.0, 1.0, 0.0, 1.0); @@ -299,6 +308,12 @@ if (!o || i < 0 || i >= d->objectList.count()) { return; } + if (d->objectList.at(i) == o) { + return; + } + if (d->autoDelete) { + delete d->objectList.at(i); + } d->objectList.replace(i, o); update(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kplotting-5.11.0/src/kplotwidget.h new/kplotting-5.12.0/src/kplotwidget.h --- old/kplotting-5.11.0/src/kplotwidget.h 2015-06-06 11:31:44.000000000 +0200 +++ new/kplotting-5.12.0/src/kplotwidget.h 2015-07-04 22:40:55.000000000 +0200 @@ -70,12 +70,12 @@ kpw->addPlotObject( kpo ); * @endcode * - *@note KPlotWidget will take care of the objects added to it, so when + *@note KPlotWidget will take ownership of the objects added to it, so when *clearing the objects list (eg with removeAllPlotObjects()) any previous *reference to a KPlotObject already added to a KPlotWidget will be invalid. + *You can disable this behavior by using setAutoDelete(false). * *@author Jason Harris - *@version 1.1 */ class KPLOTTING_EXPORT KPlotWidget : public QFrame { @@ -183,14 +183,14 @@ /** * Add an item to the list of KPlotObjects to be plotted. - * @note do not use this multiple time if many objects have to be added, - * addPlotObjects() is strongly suggested in this case + * The widget takes ownership of the plot object, unless auto-delete was disabled. * @param object the KPlotObject to be added */ void addPlotObject(KPlotObject *object); /** * Add more than one KPlotObject at one time. + * The widget takes ownership of the plot object, unless auto-delete was disabled. * @param objects the list of KPlotObjects to be added */ void addPlotObjects(const QList< KPlotObject * > &objects); @@ -201,7 +201,15 @@ QList< KPlotObject * > plotObjects() const; /** - * Remove and delete all items from the list of KPlotObjects + * Enables auto-deletion of plot objects if autoDelete is true; otherwise auto-deletion is disabled. + * Auto-deletion is enabled by default. + * @since 5.12 + */ + void setAutoDeletePlotObjects(bool autoDelete); + + /** + * Removes all plot objects that were added to the widget. + * If auto-delete was not disabled, the plot objects are deleted. */ void removeAllPlotObjects(); @@ -213,6 +221,7 @@ /** * Clear the object list, reset the data limits, and remove axis labels + * If auto-delete was not disabled, the plot objects are deleted. */ void resetPlot(); @@ -220,6 +229,10 @@ * Replace an item in the KPlotObject list. * @param i the index of the item to be replaced * @param o pointer to the replacement KPlotObject + * + * @since 5.12, if auto-deletion is enabled, the previous plot object is deleted. + * Call setAutoDeletePlotObjects(false) if you want to swap between available plot objects + * and therefore you want to handle deletion externally. */ void replacePlotObject(int i, KPlotObject *o);