[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra/plugins-chartshape_improvements-erione] plugins/chartshape: implement marker settings
From:       Brijesh Patel <brijesh3105 () gmail ! com>
Date:       2012-06-14 17:27:27
Message-ID: 20120614172727.795B7A60A9 () git ! kde ! org
[Download RAW message or body]

Git commit 952d9de592ce07f4228fbee634d0a935216ad916 by Brijesh Patel.
Committed on 14/06/2012 at 19:12.
Pushed by patel into branch 'plugins-chartshape_improvements-erione'.

implement marker settings

M  +163  -5    plugins/chartshape/ChartConfigWidget.cpp
M  +8    -0    plugins/chartshape/ChartConfigWidget.h
M  +62   -47   plugins/chartshape/ChartConfigWidget.ui
M  +12   -0    plugins/chartshape/ChartTool.cpp
M  +4    -0    plugins/chartshape/ChartTool.h
M  +41   -3    plugins/chartshape/DataSet.cpp
M  +1    -1    plugins/chartshape/kdchart/src/KDChartAbstractDiagram.h
M  +20   -22   plugins/chartshape/kdchart/src/KDChartMarkerAttributes.h
M  +6    -0    plugins/chartshape/kdchartpatches/README
A  +66   -0    plugins/chartshape/kdchartpatches/arrange-markers.diff

http://commits.kde.org/calligra/952d9de592ce07f4228fbee634d0a935216ad916

diff --git a/plugins/chartshape/ChartConfigWidget.cpp \
b/plugins/chartshape/ChartConfigWidget.cpp index 4f4a705..8e9b077 100644
--- a/plugins/chartshape/ChartConfigWidget.cpp
+++ b/plugins/chartshape/ChartConfigWidget.cpp
@@ -50,6 +50,7 @@
 #include <KDChartLegend>
 #include <KDChartDataValueAttributes>
 #include <KDChartTextAttributes>
+#include <KDChartMarkerAttributes>
 #include <KDChartMeasure>
 
 // KChart
@@ -156,6 +157,27 @@ public:
     QAction  *dataSetSurfaceChartAction;
     QAction  *dataSetGanttChartAction;
 
+    // marker selection actions for datasets
+    QAction *dataSetNoMarkerAction;
+    QAction *dataSetAutomaticMarkerAction;
+    QAction *dataSetMarkerCircleAction;
+    QAction *dataSetMarkerSquareAction;
+    QAction *dataSetMarkerDiamondAction;
+    QAction *dataSetMarkerRingAction;
+    QAction *dataSetMarkerCrossAction;
+    QAction *dataSetMarkerFastCrossAction;
+    QAction *dataSetMarkerArrowDownAction;
+    QAction *dataSetMarkerArrowUpAction;
+    QAction *dataSetMarkerArrowRightAction;
+    QAction *dataSetMarkerArrowLeftAction;
+    QAction *dataSetMarkerBowTieAction;
+    QAction *dataSetMarkerHourGlassAction;
+    QAction *dataSetMarkerStarAction;
+    QAction *dataSetMarkerXAction;
+    QAction *dataSetMarkerAsteriskAction;
+    QAction *dataSetMarkerHorizontalBarAction;
+    QAction *dataSetMarkerVerticalBarAction;
+
     // Table Editor (a.k.a. the data editor)
     TableEditorDialog    *tableEditorDialog;
     // Source containing all tables the chart uses (name/model pairs)
@@ -423,6 +445,38 @@ ChartConfigWidget::ChartConfigWidget()
     connect(d->ui.dataSetHasChartType, SIGNAL(toggled(bool)),
             this,                      SLOT(ui_dataSetHasChartTypeChanged(bool)));
 
+    // Setup marker menu
+    QMenu *datasetMarkerMenu = new QMenu(this);
+
+    // Default marker is Automatic
+    datasetMarkerMenu->setIcon(QIcon());
+
+    d->dataSetNoMarkerAction = datasetMarkerMenu->addAction(i18n("None"));
+    d->dataSetAutomaticMarkerAction = \
datasetMarkerMenu->addAction(i18n("Automatic")); +
+    QMenu *datasetSelectMarkerMenu = datasetMarkerMenu->addMenu(i18n("Select"));
+    d->dataSetMarkerSquareAction = datasetSelectMarkerMenu->addAction(QIcon(), \
QString()); +    d->dataSetMarkerDiamondAction = \
datasetSelectMarkerMenu->addAction(QIcon(), QString()); +    \
d->dataSetMarkerArrowDownAction = datasetSelectMarkerMenu->addAction(QIcon(), \
QString()); +    d->dataSetMarkerArrowUpAction = \
datasetSelectMarkerMenu->addAction(QIcon(), QString()); +    \
d->dataSetMarkerArrowRightAction = datasetSelectMarkerMenu->addAction(QIcon(), \
QString()); +    d->dataSetMarkerArrowLeftAction = \
datasetSelectMarkerMenu->addAction(QIcon(), QString()); +    \
d->dataSetMarkerBowTieAction = datasetSelectMarkerMenu->addAction(QIcon(), \
QString()); +    d->dataSetMarkerHourGlassAction = \
datasetSelectMarkerMenu->addAction(QIcon(), QString()); +    \
d->dataSetMarkerCircleAction = datasetSelectMarkerMenu->addAction(QIcon(), \
QString()); +    d->dataSetMarkerStarAction = \
datasetSelectMarkerMenu->addAction(QIcon(), QString()); +    d->dataSetMarkerXAction \
= datasetSelectMarkerMenu->addAction(QIcon(), QString()); +    \
d->dataSetMarkerCrossAction = datasetSelectMarkerMenu->addAction(QIcon(), QString()); \
+    d->dataSetMarkerAsteriskAction = datasetSelectMarkerMenu->addAction(QIcon(), \
QString()); +    d->dataSetMarkerHorizontalBarAction = \
datasetSelectMarkerMenu->addAction(QIcon(), QString()); +    \
d->dataSetMarkerVerticalBarAction = datasetSelectMarkerMenu->addAction(QIcon(), \
QString()); +    d->dataSetMarkerRingAction = \
datasetSelectMarkerMenu->addAction(QIcon(), QString()); +    \
d->dataSetMarkerFastCrossAction = datasetSelectMarkerMenu->addAction(QIcon(), \
QString()); +
+    d->ui.datasetMarkerMenu->setMenu(datasetMarkerMenu);
+    connect(datasetMarkerMenu, SIGNAL(triggered(QAction*)),
+            this,              SLOT(datasetMarkerSelected(QAction*)));
+
     // Insert error bar button
     d->ui.formatErrorBar->setEnabled(false);
 
@@ -612,6 +666,53 @@ KAction* ChartConfigWidget::createAction()
     return 0;
 }
 
+QIcon ChartConfigWidget::datasetMarkerIcon(KDChart::MarkerAttributes::MarkerStyle \
markerStyle) +{
+    if (markerStyle != KDChart::MarkerAttributes::NoMarker) {
+        QPixmap *markerPixmap = new QPixmap(16,16);
+        markerPixmap->fill(QColor(255,255,255,0));
+        QPainter *painter = new QPainter(markerPixmap);
+        KDChart::MarkerAttributes matt;
+        matt.setMarkerStyle(markerStyle);
+        DataSet *dataSet = d->dataSets[d->ui.dataSets->currentIndex()];
+        QBrush brush = dataSet->brush();
+        QPen pen = dataSet->pen();
+        KDChart::AbstractDiagram::paintMarker(painter, matt, brush, pen, \
QPointF(7,7), QSizeF(12,12)); +        QIcon markerIcon = QIcon(*markerPixmap);
+        return markerIcon;
+    }
+    return QIcon();
+}
+
+void ChartConfigWidget::updateMarkers()
+{
+    d->dataSetMarkerCircleAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerCircle));
 +    d->dataSetMarkerSquareAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerSquare));
 +    d->dataSetMarkerDiamondAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerDiamond));
 +    d->dataSetMarkerRingAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerRing));
 +    d->dataSetMarkerCrossAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerCross));
 +    d->dataSetMarkerFastCrossAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerFastCross));
 +    d->dataSetMarkerArrowDownAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerArrowDown));
 +    d->dataSetMarkerArrowUpAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerArrowUp));
 +    d->dataSetMarkerArrowRightAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerArrowRight));
 +    d->dataSetMarkerArrowLeftAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerArrowLeft));
 +    d->dataSetMarkerBowTieAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerBowTie));
 +    d->dataSetMarkerHourGlassAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerHourGlass));
 +    d->dataSetMarkerStarAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerStar));
 +    d->dataSetMarkerXAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerX));
 +    d->dataSetMarkerAsteriskAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerAsterisk));
 +    d->dataSetMarkerHorizontalBarAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerHorizontalBar));
 +    d->dataSetMarkerVerticalBarAction->setIcon(datasetMarkerIcon(KDChart::MarkerAttributes::MarkerVerticalBar));
 +
+    DataSet *dataSet = d->dataSets[d->selectedDataSet];
+    Q_ASSERT(dataSet);
+    if (!dataSet)
+        return;
+
+    QIcon icon = datasetMarkerIcon(dataSet->getMarkerAttributes().markerStyle());
+    d->ui.datasetMarkerMenu->setIcon(icon);
+}
+
 void ChartConfigWidget::chartTypeSelected(QAction *action)
 {
     ChartType     type = LastChartType;
@@ -902,12 +1003,72 @@ void ChartConfigWidget::chartSubTypeSelected(int type)
     emit chartSubTypeChanged(d->subtype);
 }
 
+void ChartConfigWidget::datasetMarkerSelected(QAction *action)
+{
+    if (d->selectedDataSet < 0)
+        return;
+
+    const int numDefaultMarkerTypes = 15;
+    KDChart::MarkerAttributes::MarkerStyle style = \
KDChart::MarkerAttributes::MarkerCircle; +
+    if (action == d->dataSetNoMarkerAction) {
+        style = KDChart::MarkerAttributes::NoMarker;
+    } else if (action == d->dataSetAutomaticMarkerAction) {
+        style = (KDChart::MarkerAttributes::MarkerStyle) (d->selectedDataSet % \
numDefaultMarkerTypes); +    } else if (action == d->dataSetMarkerCircleAction) {
+        style = KDChart::MarkerAttributes::MarkerCircle;
+    } else if (action == d->dataSetMarkerSquareAction) {
+        style = KDChart::MarkerAttributes::MarkerSquare;
+    } else if (action == d->dataSetMarkerDiamondAction) {
+        style = KDChart::MarkerAttributes::MarkerDiamond;
+    } else if (action == d->dataSetMarkerRingAction) {
+        style = KDChart::MarkerAttributes::MarkerRing;
+    } else if (action == d->dataSetMarkerCrossAction) {
+        style = KDChart::MarkerAttributes::MarkerCross;
+    } else if (action == d->dataSetMarkerFastCrossAction) {
+        style = KDChart::MarkerAttributes::MarkerFastCross;
+    } else if (action == d->dataSetMarkerArrowDownAction) {
+        style = KDChart::MarkerAttributes::MarkerArrowDown;
+    } else if (action == d->dataSetMarkerArrowUpAction) {
+        style = KDChart::MarkerAttributes::MarkerArrowUp;
+    } else if (action == d->dataSetMarkerArrowRightAction) {
+        style = KDChart::MarkerAttributes::MarkerArrowRight;
+    } else if (action == d->dataSetMarkerArrowLeftAction) {
+        style = KDChart::MarkerAttributes::MarkerArrowLeft;
+    } else if (action == d->dataSetMarkerBowTieAction) {
+        style = KDChart::MarkerAttributes::MarkerBowTie;
+    } else if (action == d->dataSetMarkerHourGlassAction) {
+        style = KDChart::MarkerAttributes::MarkerHourGlass;
+    } else if (action == d->dataSetMarkerStarAction) {
+        style = KDChart::MarkerAttributes::MarkerStar;
+    } else if (action == d->dataSetMarkerXAction) {
+        style = KDChart::MarkerAttributes::MarkerX;
+    } else if (action == d->dataSetMarkerAsteriskAction) {
+        style = KDChart::MarkerAttributes::MarkerAsterisk;
+    } else if (action == d->dataSetMarkerHorizontalBarAction) {
+        style = KDChart::MarkerAttributes::MarkerHorizontalBar;
+    } else if (action == d->dataSetMarkerVerticalBarAction) {
+        style = KDChart::MarkerAttributes::MarkerVerticalBar;
+    }
+
+    DataSet *dataSet = d->dataSets[d->selectedDataSet];
+    Q_ASSERT(dataSet);
+    if (!dataSet)
+        return;
+
+    d->ui.datasetMarkerMenu->setIcon(datasetMarkerIcon(style));
+    emit dataSetMarkerChanged(dataSet, style);
+
+    update();
+}
+
 void ChartConfigWidget::datasetBrushSelected(const QColor& color)
 {
     if (d->selectedDataSet < 0)
         return;
 
     emit datasetBrushChanged(d->dataSets[d->selectedDataSet], color);
+    updateMarkers();
 }
 
 void ChartConfigWidget::datasetPenSelected(const QColor& color)
@@ -916,6 +1077,7 @@ void ChartConfigWidget::datasetPenSelected(const QColor& color)
         return;
 
     emit datasetPenChanged(d->dataSets[d->selectedDataSet], color);
+    updateMarkers();
 }
 
 void ChartConfigWidget::setThreeDMode(bool threeD)
@@ -1095,11 +1257,6 @@ void ChartConfigWidget::update()
         d->ui.legendTitle->blockSignals(false);
     }
 
-    // "Fill" property of data set doesn't make sense for 2D line
-    // charts, there's nothing to fill.
-    bool enableFill = d->type != LineChartType || d->threeDMode;
-    d->ui.datasetBrush->setEnabled(enableFill);
-
     blockSignals(false);
 }
 
@@ -1560,6 +1717,7 @@ void ChartConfigWidget::ui_dataSetSelectionChanged(int index)
     }
 
     d->selectedDataSet = index;
+    updateMarkers();
 }
 
 void ChartConfigWidget::ui_dataSetAxisSelectionChanged(int index)
diff --git a/plugins/chartshape/ChartConfigWidget.h \
b/plugins/chartshape/ChartConfigWidget.h index aa89815..7a5f45f 100644
--- a/plugins/chartshape/ChartConfigWidget.h
+++ b/plugins/chartshape/ChartConfigWidget.h
@@ -27,6 +27,9 @@
 // Calligra
 #include <KoShapeConfigWidgetBase.h>
 
+// KDChart
+#include <KDChartMarkerAttributes>
+
 // KChart
 #include "ChartShape.h"
 #include "ui_ChartConfigWidget.h"
@@ -66,6 +69,9 @@ public:
     /// This is called when e.g. the tool is deactivated.
     void deleteSubDialogs();
 
+    QIcon datasetMarkerIcon(KDChart::MarkerAttributes::MarkerStyle markerStyle);
+    void updateMarkers();
+
 public slots:
     void chartSubTypeSelected(int type);
     void chartTypeSelected(QAction *action);
@@ -77,6 +83,7 @@ public slots:
     void slotShowFormatErrorBarDialog();
 
     void dataSetChartTypeSelected(QAction *action);
+    void datasetMarkerSelected(QAction *action);
     void datasetBrushSelected(const QColor& color);
     void datasetPenSelected(const QColor& color);
     void ui_datasetShowCategoryChanged(bool b);
@@ -142,6 +149,7 @@ signals:
     
     void datasetPenChanged(DataSet *dataSet, const QColor& color);
     void datasetBrushChanged(DataSet *dataSet, const QColor& color);
+    void dataSetMarkerChanged(DataSet *dataSet, \
KDChart::MarkerAttributes::MarkerStyle style);  void \
datasetShowCategoryChanged(DataSet *dataSet, bool b);  void \
dataSetShowNumberChanged(DataSet *dataSet, bool b);  void \
                datasetShowPercentChanged(DataSet *dataSet, bool b);
diff --git a/plugins/chartshape/ChartConfigWidget.ui \
b/plugins/chartshape/ChartConfigWidget.ui index b142635..950641f 100644
--- a/plugins/chartshape/ChartConfigWidget.ui
+++ b/plugins/chartshape/ChartConfigWidget.ui
@@ -440,18 +440,21 @@ p, li { white-space: pre-wrap; }
           </widget>
          </item>
          <item>
-          <widget class="QComboBox" name="datasetMarker">
-           <property name="maximumSize">
+          <widget class="QToolButton" name="datasetMarkerMenu">
+           <property name="minimumSize">
             <size>
-             <width>44</width>
-             <height>24</height>
+             <width>45</width>
+             <height>0</height>
             </size>
            </property>
-           <property name="iconSize">
-            <size>
-             <width>16</width>
-             <height>16</height>
-            </size>
+           <property name="text">
+            <string/>
+           </property>
+           <property name="popupMode">
+            <enum>QToolButton::InstantPopup</enum>
+           </property>
+           <property name="toolButtonStyle">
+            <enum>Qt::ToolButtonTextUnderIcon</enum>
            </property>
           </widget>
          </item>
@@ -472,13 +475,13 @@ p, li { white-space: pre-wrap; }
            </property>
            <property name="minimumSize">
             <size>
-             <width>60</width>
+             <width>50</width>
              <height>26</height>
             </size>
            </property>
            <property name="maximumSize">
             <size>
-             <width>64</width>
+             <width>50</width>
              <height>26</height>
             </size>
            </property>
@@ -501,6 +504,9 @@ p, li { white-space: pre-wrap; }
            <property name="text">
             <string>Fill</string>
            </property>
+           <property name="alignment">
+            <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+           </property>
           </widget>
          </item>
          <item>
@@ -516,13 +522,13 @@ p, li { white-space: pre-wrap; }
            </property>
            <property name="minimumSize">
             <size>
-             <width>60</width>
+             <width>50</width>
              <height>26</height>
             </size>
            </property>
            <property name="maximumSize">
             <size>
-             <width>64</width>
+             <width>50</width>
              <height>26</height>
             </size>
            </property>
@@ -530,38 +536,6 @@ p, li { white-space: pre-wrap; }
          </item>
         </layout>
        </item>
-       <item row="9" column="0" colspan="2">
-        <layout class="QGridLayout" name="gridLayout_5">
-         <item row="0" column="0">
-          <widget class="QCheckBox" name="datasetShowCategory">
-           <property name="text">
-            <string>Category</string>
-           </property>
-          </widget>
-         </item>
-         <item row="1" column="1">
-          <widget class="QCheckBox" name="datasetShowSymbol">
-           <property name="text">
-            <string>Symbol</string>
-           </property>
-          </widget>
-         </item>
-         <item row="0" column="1">
-          <widget class="QCheckBox" name="dataSetShowNumber">
-           <property name="text">
-            <string>Number</string>
-           </property>
-          </widget>
-         </item>
-         <item row="1" column="0">
-          <widget class="QCheckBox" name="datasetShowPercent">
-           <property name="text">
-            <string>Percent</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
        <item row="8" column="0" colspan="2">
         <widget class="QWidget" name="errorBarProperties" native="true">
          <property name="sizePolicy">
@@ -594,7 +568,7 @@ p, li { white-space: pre-wrap; }
            </widget>
           </item>
           <item>
-           <widget class="QPushButton" name="formatErrorBar">
+           <widget class="QToolButton" name="formatErrorBar">
             <property name="sizePolicy">
              <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
               <horstretch>0</horstretch>
@@ -604,7 +578,7 @@ p, li { white-space: pre-wrap; }
             <property name="minimumSize">
              <size>
               <width>50</width>
-              <height>24</height>
+              <height>26</height>
              </size>
             </property>
             <property name="maximumSize">
@@ -621,6 +595,47 @@ p, li { white-space: pre-wrap; }
          </layout>
         </widget>
        </item>
+       <item row="9" column="0" colspan="2">
+        <widget class="QWidget" name="widget" native="true">
+         <layout class="QGridLayout" name="gridLayout_5">
+          <item row="1" column="0">
+           <widget class="QCheckBox" name="datasetShowCategory">
+            <property name="text">
+             <string>Category</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="1">
+           <widget class="QCheckBox" name="datasetShowSymbol">
+            <property name="text">
+             <string>Symbol</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="QCheckBox" name="dataSetShowNumber">
+            <property name="text">
+             <string>Number</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="0">
+           <widget class="QCheckBox" name="datasetShowPercent">
+            <property name="text">
+             <string>Percent</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="0">
+           <widget class="QLabel" name="label_7">
+            <property name="text">
+             <string/>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tab_3">
diff --git a/plugins/chartshape/ChartTool.cpp b/plugins/chartshape/ChartTool.cpp
index bab225a..49984d3 100644
--- a/plugins/chartshape/ChartTool.cpp
+++ b/plugins/chartshape/ChartTool.cpp
@@ -275,6 +275,8 @@ QWidget *ChartTool::createOptionWidget()
             this,   SLOT(setDataSetChartSubType(DataSet*, ChartSubtype)));
     connect(widget, SIGNAL(datasetBrushChanged(DataSet*, const QColor&)),
             this, SLOT(setDataSetBrush(DataSet*, const QColor&)));
+    connect(widget, \
SIGNAL(dataSetMarkerChanged(DataSet*,KDChart::MarkerAttributes::MarkerStyle)), +      \
this, SLOT(setDataSetMarker(DataSet*,KDChart::MarkerAttributes::MarkerStyle)));  \
connect(widget, SIGNAL(datasetPenChanged(DataSet*, const QColor&)),  this, \
SLOT(setDataSetPen(DataSet*, const QColor&)));  connect(widget, \
SIGNAL(datasetShowCategoryChanged(DataSet*, bool)), @@ -463,6 +465,16 @@ void \
ChartTool::setDataSetPen(DataSet *dataSet, const QColor& color)  d->shape->update();
 }
 
+void ChartTool::setDataSetMarker(DataSet *dataSet, \
KDChart::MarkerAttributes::MarkerStyle style) +{
+    Q_ASSERT(d->shape);
+    if (!dataSet)
+        return;
+
+    KDChart::MarkerAttributes matt = dataSet->getMarkerAttributes();
+    matt.setMarkerStyle(style);
+    dataSet->setMarkerAttributes(matt);
+}
 void ChartTool::setDataSetAxis(DataSet *dataSet, Axis *axis)
 {
     Q_ASSERT(d->shape);
diff --git a/plugins/chartshape/ChartTool.h b/plugins/chartshape/ChartTool.h
index 779b7ef..64f130c 100644
--- a/plugins/chartshape/ChartTool.h
+++ b/plugins/chartshape/ChartTool.h
@@ -25,6 +25,9 @@
 // Calligra
 #include <KoToolBase.h>
 
+// KDChart
+#include <KDChartMarkerAttributes>
+
 // KChart
 #include "ChartShape.h"
 
@@ -89,6 +92,7 @@ private slots:
 
     void setDataSetPen(DataSet *dataSet, const QColor& color);
     void setDataSetBrush(DataSet *dataSet, const QColor& color);
+    void setDataSetMarker(DataSet *dataSet, KDChart::MarkerAttributes::MarkerStyle \
style);  void setDataSetAxis(DataSet *dataSet, Axis *axis);
     
     // Plot Area
diff --git a/plugins/chartshape/DataSet.cpp b/plugins/chartshape/DataSet.cpp
index 2821254..3b79452 100644
--- a/plugins/chartshape/DataSet.cpp
+++ b/plugins/chartshape/DataSet.cpp
@@ -110,6 +110,7 @@ const KDChart::MarkerAttributes::MarkerStyle \
defaultMarkerTypes[]= {  KDChart::MarkerAttributes::MarkerFastCross,
     KDChart::MarkerAttributes::Marker1Pixel,
     KDChart::MarkerAttributes::Marker4Pixels,
+    KDChart::MarkerAttributes::NoMarker
 };
 
 class DataSet::Private
@@ -474,9 +475,13 @@ QPen DataSet::Private::defaultPen() const
     QPen pen(Qt::black);
     ChartType chartType = effectiveChartType();
     if (chartType == LineChartType ||
-         chartType == ScatterChartType)
-        pen = QPen(defaultDataSetColor(num));
-
+         chartType == ScatterChartType) {
+        if (penIsSet) {
+            pen = pen;
+        } else {
+            pen = QPen(defaultDataSetColor(num));
+        }
+    }
     return pen;
 }
 
@@ -836,6 +841,35 @@ KDChart::DataValueAttributes DataSet::dataValueAttributes(int \
section /* = -1 */  return attr;
 }
 
+KDChart::MarkerAttributes DataSet::getMarkerAttributes(int section, bool *success) \
const +{
+    KDChart::DataValueAttributes attr(d->dataValueAttributes);
+    Q_ASSERT(attr.isVisible() == d->dataValueAttributes.isVisible());
+    if (d->sectionsDataValueAttributes.contains(section))
+        attr = d->sectionsDataValueAttributes[section];
+
+    KDChart::MarkerAttributes ma(attr.markerAttributes());
+    ma.setMarkerStyle(defaultMarkerTypes[d->symbolID]);
+    ma.setMarkerSize(QSize(10, 10));
+    ma.setVisible(true);
+
+    return ma;
+}
+
+void DataSet::setMarkerAttributes(const KDChart::MarkerAttributes &attribs, int \
section) +{
+    KDChart::DataValueAttributes attr(d->dataValueAttributes);
+    Q_ASSERT(attr.isVisible() == d->dataValueAttributes.isVisible());
+    if (d->sectionsDataValueAttributes.contains(section))
+        attr = d->sectionsDataValueAttributes[section];
+
+    attr.setMarkerAttributes(attribs);
+    d->dataValueAttributes = attr;
+
+    d->symbolsActivated = true;
+    d->symbolID = attribs.markerStyle();
+}
+
 void DataSet::setPen(const QPen &pen)
 {
     d->pen = pen;
@@ -1493,6 +1527,9 @@ bool DataSet::loadOdf(const KoXmlElement &n,
                 else
                     d->symbolID = 0;
             }
+        } else if (name == "none") {
+            d->symbolsActivated = false;
+            d->symbolID = 19;
         }
     }
 
@@ -1659,6 +1696,7 @@ void DataSet::saveOdf(KoShapeSavingContext &context) const
         case 12: symbolName = "asterisk"; break;
         case 13: symbolName = "horizontal-bar"; break;
         case 14: symbolName = "vertical-bar"; break;
+        case 19: symbolType = "none"; break;
         default: symbolType = "automatic"; break;
         }
 
diff --git a/plugins/chartshape/kdchart/src/KDChartAbstractDiagram.h \
b/plugins/chartshape/kdchart/src/KDChartAbstractDiagram.h index a410cb8..9a0e723 \
                100644
--- a/plugins/chartshape/kdchart/src/KDChartAbstractDiagram.h
+++ b/plugins/chartshape/kdchart/src/KDChartAbstractDiagram.h
@@ -592,7 +592,7 @@ namespace KDChart {
          */
         bool percentMode() const;
 
-        virtual void paintMarker( QPainter* painter,
+        static void paintMarker( QPainter* painter,
                                   const MarkerAttributes& markerAttributes,
                                   const QBrush& brush, const QPen&,
                                   const QPointF& point, const QSizeF& size );
diff --git a/plugins/chartshape/kdchart/src/KDChartMarkerAttributes.h \
b/plugins/chartshape/kdchart/src/KDChartMarkerAttributes.h index f8b7646..f054a9e \
                100644
--- a/plugins/chartshape/kdchart/src/KDChartMarkerAttributes.h
+++ b/plugins/chartshape/kdchart/src/KDChartMarkerAttributes.h
@@ -46,28 +46,26 @@ namespace KDChart {
 
         ~MarkerAttributes();
 
-        enum MarkerStyle { MarkerCircle  = 0,
-                           MarkerSquare  = 1,
-                           MarkerDiamond = 2,
-                           Marker1Pixel  = 3,
-                           Marker4Pixels = 4,
-                           MarkerRing    = 5,
-                           MarkerCross   = 6,
-                           MarkerFastCross = 7,
-                           NoMarker = 8,
-                           // Above is kept for backwards binary compatibility.
-                           // Below are added for compatibility with ODF
-                           MarkerArrowDown     =  9,
-                           MarkerArrowUp       = 10,
-                           MarkerArrowRight    = 11,
-                           MarkerArrowLeft     = 12,
-                           MarkerBowTie        = 13,
-                           MarkerHourGlass     = 14,
-                           MarkerStar          = 15,
-                           MarkerX             = 16,
-                           MarkerAsterisk      = 17,
-                           MarkerHorizontalBar = 18,
-                           MarkerVerticalBar   = 19 };
+        enum MarkerStyle { MarkerSquare         = 0,
+                           MarkerDiamond        = 1,
+                           MarkerArrowDown      = 2,
+                           MarkerArrowUp        = 3,
+                           MarkerArrowRight     = 4,
+                           MarkerArrowLeft      = 5,
+                           MarkerBowTie         = 6,
+                           MarkerHourGlass      = 7,
+                           MarkerCircle         = 8,
+                           MarkerStar           = 9,
+                           MarkerX              = 10,
+                           MarkerCross          = 11,
+                           MarkerAsterisk       = 12,
+                           MarkerHorizontalBar  = 13,
+                           MarkerVerticalBar    = 14,
+                           MarkerRing           = 15,
+                           MarkerFastCross      = 16,
+                           Marker1Pixel         = 17,
+                           Marker4Pixels        = 18,
+                           NoMarker             = 19   };
 
         enum MarkerSizeMode {
             /// the marker size is directly specified in pixels
diff --git a/plugins/chartshape/kdchartpatches/README \
b/plugins/chartshape/kdchartpatches/README index 9d3f184..1329d65 100644
--- a/plugins/chartshape/kdchartpatches/README
+++ b/plugins/chartshape/kdchartpatches/README
@@ -8,6 +8,12 @@ odf-marker-types.diff
   This patch implements missing marker types that are present in ODF
   1.1 and 1.2 but were not implemented in KDChart.
 
+arrange-markers.diff
+  i) This patch arranges the marker types in enum in accordance with the
+  types in DataSet.cpp
+  ii) It also makes AbstractDiagram::paintMarker() method static to generate
+  icons for UI for marker settings
+
 text-overlap.diff
   This patch takes into consideration the value of 'chart:text-overlap' attribute
   while drawing labels
diff --git a/plugins/chartshape/kdchartpatches/arrange-markers.diff \
b/plugins/chartshape/kdchartpatches/arrange-markers.diff new file mode 100644
index 0000000..d8677d2
--- /dev/null
+++ b/plugins/chartshape/kdchartpatches/arrange-markers.diff
@@ -0,0 +1,66 @@
+diff --git a/plugins/chartshape/kdchart/src/KDChartAbstractDiagram.h \
b/plugins/chartshape/kdchart/src/KDChartAbstractDiagram.h +index a410cb8..9a0e723 \
100644 +--- a/plugins/chartshape/kdchart/src/KDChartAbstractDiagram.h
++++ b/plugins/chartshape/kdchart/src/KDChartAbstractDiagram.h
+@@ -592,7 +592,7 @@ namespace KDChart {
+          */
+         bool percentMode() const;
+ 
+-        virtual void paintMarker( QPainter* painter,
++        static void paintMarker( QPainter* painter,
+                                   const MarkerAttributes& markerAttributes,
+                                   const QBrush& brush, const QPen&,
+                                   const QPointF& point, const QSizeF& size );
+diff --git a/plugins/chartshape/kdchart/src/KDChartMarkerAttributes.h \
b/plugins/chartshape/kdchart/src/KDChartMarkerAttributes.h +index f8b7646..f054a9e \
100644 +--- a/plugins/chartshape/kdchart/src/KDChartMarkerAttributes.h
++++ b/plugins/chartshape/kdchart/src/KDChartMarkerAttributes.h
+@@ -46,28 +46,26 @@ namespace KDChart {
+ 
+         ~MarkerAttributes();
+ 
+-        enum MarkerStyle { MarkerCircle  = 0,
+-                           MarkerSquare  = 1,
+-                           MarkerDiamond = 2,
+-                           Marker1Pixel  = 3,
+-                           Marker4Pixels = 4,
+-                           MarkerRing    = 5,
+-                           MarkerCross   = 6,
+-                           MarkerFastCross = 7,
+-                           NoMarker = 8,
+-                           // Above is kept for backwards binary compatibility.
+-                           // Below are added for compatibility with ODF
+-                           MarkerArrowDown     =  9,
+-                           MarkerArrowUp       = 10,
+-                           MarkerArrowRight    = 11,
+-                           MarkerArrowLeft     = 12,
+-                           MarkerBowTie        = 13,
+-                           MarkerHourGlass     = 14,
+-                           MarkerStar          = 15,
+-                           MarkerX             = 16,
+-                           MarkerAsterisk      = 17,
+-                           MarkerHorizontalBar = 18,
+-                           MarkerVerticalBar   = 19 };
++        enum MarkerStyle { MarkerSquare         = 0,
++                           MarkerDiamond        = 1,
++                           MarkerArrowDown      = 2,
++                           MarkerArrowUp        = 3,
++                           MarkerArrowRight     = 4,
++                           MarkerArrowLeft      = 5,
++                           MarkerBowTie         = 6,
++                           MarkerHourGlass      = 7,
++                           MarkerCircle         = 8,
++                           MarkerStar           = 9,
++                           MarkerX              = 10,
++                           MarkerCross          = 11,
++                           MarkerAsterisk       = 12,
++                           MarkerHorizontalBar  = 13,
++                           MarkerVerticalBar    = 14,
++                           MarkerRing           = 15,
++                           MarkerFastCross      = 16,
++                           Marker1Pixel         = 17,
++                           Marker4Pixels        = 18,
++                           NoMarker             = 19   };
+ 
+         enum MarkerSizeMode {
+             /// the marker size is directly specified in pixels


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic