Git commit 66bd624dd7a298de8fc50942acd461575780465e by Christian Butcher. Committed on 14/12/2015 at 04:40. Pushed by cbutcher into branch 'frameworks'.
Merge remote-tracking branch 'origin/master' into frameworks-merge M +119 -0 doc/index.docbook R +15 -0 org.kde.labplot.appdata.xml M +22 -1 src/CMakeLists.txt M +9 -9 src/backend/core/AbstractAspect.cpp M +9 -3 src/backend/core/AbstractPart.cpp M +9 -0 src/backend/core/Folder.cpp M +7 -0 src/backend/gsl/ExpressionParser.cpp M +8 -1 src/backend/gsl/functions.h M +3 -0 src/backend/spreadsheet/SpreadsheetModel.cpp M +89 -17 src/backend/worksheet/plots/cartesian/CartesianPlot.cpp M +8 -1 src/backend/worksheet/plots/cartesian/CartesianPlot.h M +3 -4 src/backend/worksheet/plots/cartesian/CartesianPlotLegend.cpp M +10 -119 src/backend/worksheet/plots/cartesian/XYCurve.cpp M +3 -7 src/backend/worksheet/plots/cartesian/XYCurve.h M +1 -1 src/backend/worksheet/plots/cartesian/XYEquationCurve.cpp M +8 -2 src/backend/worksheet/plots/cartesian/XYFitCurve.cpp M +27 -28 src/commonfrontend/ProjectExplorer.cpp M +48 -0 src/commonfrontend/spreadsheet/SpreadsheetView.cpp M +37 -31 src/commonfrontend/worksheet/WorksheetView.cpp M +69 -0 src/kdefrontend/GuiObserver.cpp M +100 -13 src/kdefrontend/MainWin.cpp M +14 -1 src/kdefrontend/MainWin.h M +1 -1 src/kdefrontend/TemplateHandler.cpp M +1 -1 src/kdefrontend/TemplateHandler.h M +5 -11 src/kdefrontend/dockwidgets/AxisDock.cpp M +1 -1 src/kdefrontend/dockwidgets/AxisDock.h M +126 -7 src/kdefrontend/dockwidgets/CartesianPlotDock.cpp M +3 -1 src/kdefrontend/dockwidgets/CartesianPlotDock.h M +3 -4 src/kdefrontend/dockwidgets/CartesianPlotLegendDock.cpp M +1 -1 src/kdefrontend/dockwidgets/CartesianPlotLegendDock.h M +10 -9 src/kdefrontend/dockwidgets/XYCurveDock.cpp M +2 -1 src/kdefrontend/dockwidgets/XYCurveDock.h M +1 -1 src/kdefrontend/dockwidgets/XYFitCurveDock.cpp http://commits.kde.org/labplot/66bd624dd7a298de8fc50942acd461575780465e diff --cc src/backend/core/AbstractAspect.cpp index d1b92c3,f32a319..4b8e9b4 --- a/src/backend/core/AbstractAspect.cpp +++ b/src/backend/core/AbstractAspect.cpp @@@ -35,16 -37,10 +37,15 @@@ #include "backend/lib/SignallingUndoCommand.h" #include "backend/lib/PropertyChangeCommand.h" -#include <KIcon> +#include <QIcon> +#include <QMenu> +#include <QStyle> +#include <QApplication> +#include <QXmlStreamWriter> + - #include <QIcon> #include <KAction> #include <KStandardAction> -#include <KMenu> +#include <QMenu> /** * \class AbstractAspect @@@ -310,8 -306,12 +311,12 @@@ QMenu* AbstractAspect::createContextMen // menu->addAction(KStandardAction::copy(this)); // menu->addAction(KStandardAction::paste(this)); // menu->addSeparator(); - menu->addAction(QIcon::fromTheme("edit-rename"), i18n("Rename"), this, SIGNAL(renameRequested())); - menu->addAction(QIcon::fromTheme("edit-delete"), i18n("Delete"), this, SLOT(remove())); + menu->addAction(QIcon(KIcon("edit-rename")), i18n("Rename"), this, SIGNAL(renameRequested())); + + //don't allow to delete data spreadsheets in the datapicker curves + if ( !(dynamic_cast<const Spreadsheet*>(this) && dynamic_cast<const DatapickerCurve*>(this->parentAspect())) ) - menu->addAction(QIcon(KIcon("edit-delete")), i18n("Delete"), this, SLOT(remove())); ++ menu->addAction(QIcon::fromTheme("edit-delete"), i18n("Delete"), this, SLOT(remove())); + return menu; } diff --cc src/backend/gsl/ExpressionParser.cpp index a82cd7b,5c42259..0036e52 --- a/src/backend/gsl/ExpressionParser.cpp +++ b/src/backend/gsl/ExpressionParser.cpp @@@ -1140,7 -1140,7 +1140,8 @@@ bool ExpressionParser::evaluateCartesia return false; (*xVector)[i] = x; - if (isfinite(y)) + if (std::isfinite(y)) ++ // if (isfinite(y)) // NOTE -> This is the master branch version (*yVector)[i] = y; else (*yVector)[i] = NAN; @@@ -1169,7 -1169,7 +1170,8 @@@ bool ExpressionParser::evaluateCartesia return false; (*xVector)[i] = x; - if (isfinite(y)) + if (std::isfinite(y)) ++ // if (isfinite(y)) // NOTE -> As above (*yVector)[i] = y; else (*yVector)[i] = NAN; @@@ -1193,7 -1193,7 +1195,8 @@@ bool ExpressionParser::evaluateCartesia if(parse_errors()>0) return false; - if (isfinite(y)) + if (std::isfinite(y)) ++ // if (isfinite(y)) // NOTE -> As above (*yVector)[i] = y; else (*yVector)[i] = NAN; @@@ -1240,7 -1240,7 +1243,8 @@@ bool ExpressionParser::evaluateCartesia if(parse_errors()>0) return false; - if (isfinite(y)) + if (std::isfinite(y)) ++ // if (isfinite(y)) // NOTE -> Again (*yVector)[i] = y; else (*yVector)[i] = NAN; @@@ -1267,7 -1267,7 +1271,8 @@@ bool ExpressionParser::evaluatePolar(co if(parse_errors()>0) return false; - if (isfinite(r)) { + if (std::isfinite(r)) { ++ // if (isfinite(r)) { // NOTE -> Some more (*xVector)[i] = r*cos(phi); (*yVector)[i] = r*sin(phi); } else { @@@ -1299,7 -1299,7 +1304,8 @@@ bool ExpressionParser::evaluateParametr if(parse_errors()>0) return false; - if (isfinite(x)) + if (std::isfinite(x)) ++ // if (isfinite(x)) // NOTE -> Again (*xVector)[i] = x; else (*xVector)[i] = NAN; @@@ -1308,7 -1308,7 +1314,8 @@@ if(parse_errors()>0) return false; - if (isfinite(y)) + if (std::isfinite(y)) ++ // if (isfinite(y)) // NOTE -> Again (*yVector)[i] = y; else (*yVector)[i] = NAN; diff --cc src/backend/worksheet/plots/cartesian/CartesianPlot.cpp index c95b4fb,83ca595..ff3b98e --- a/src/backend/worksheet/plots/cartesian/CartesianPlot.cpp +++ b/src/backend/worksheet/plots/cartesian/CartesianPlot.cpp @@@ -341,12 -342,13 +342,13 @@@ void CartesianPlot::initDefault(Type ty void CartesianPlot::initActions(){ //"add new" actions - addCurveAction = new KAction(KIcon("labplot-xy-curve"), i18n("xy-curve"), this); - addEquationCurveAction = new KAction(KIcon("labplot-xy-equation-curve"), i18n("xy-curve from a mathematical equation"), this); - addFitCurveAction = new KAction(KIcon("labplot-xy-fit-curve"), i18n("xy-curve from a fit to data"), this); - addLegendAction = new KAction(KIcon("text-field"), i18n("legend"), this); - addHorizontalAxisAction = new KAction(KIcon("labplot-axis-horizontal"), i18n("horizontal axis"), this); - addVerticalAxisAction = new KAction(KIcon("labplot-axis-vertical"), i18n("vertical axis"), this); - addCustomPointAction = new KAction(KIcon("labplot-custom-point"), i18n("custom point"), this); + addCurveAction = new QAction(QIcon::fromTheme("labplot-xy-curve"), i18n("xy-curve"), this); + addEquationCurveAction = new QAction(QIcon::fromTheme("labplot-xy-equation-curve"), i18n("xy-curve from a mathematical equation"), this); + addFitCurveAction = new QAction(QIcon::fromTheme("labplot-xy-fit-curve"), i18n("xy-curve from a fit to data"), this); + addLegendAction = new QAction(QIcon::fromTheme("text-field"), i18n("legend"), this); + addHorizontalAxisAction = new QAction(QIcon::fromTheme("labplot-axis-horizontal"), i18n("horizontal axis"), this); + addVerticalAxisAction = new QAction(QIcon::fromTheme("labplot-axis-vertical"), i18n("vertical axis"), this); ++ addCustomPointAction = new QAction(QIcon::fromTheme("labplot-custom-point"), i18n("custom point"), this); connect(addCurveAction, SIGNAL(triggered()), SLOT(addCurve())); connect(addEquationCurveAction, SIGNAL(triggered()), SLOT(addEquationCurve())); @@@ -354,21 -356,22 +356,22 @@@ connect(addLegendAction, SIGNAL(triggered()), SLOT(addLegend())); connect(addHorizontalAxisAction, SIGNAL(triggered()), SLOT(addHorizontalAxis())); connect(addVerticalAxisAction, SIGNAL(triggered()), SLOT(addVerticalAxis())); + connect(addCustomPointAction, SIGNAL(triggered()), SLOT(addCustomPoint())); //zoom/navigate actions - scaleAutoAction = new KAction(KIcon("labplot-auto-scale-all"), i18n("auto scale"), this); - scaleAutoXAction = new KAction(KIcon("labplot-auto-scale-x"), i18n("auto scale X"), this); - scaleAutoYAction = new KAction(KIcon("labplot-auto-scale-y"), i18n("auto scale Y"), this); - zoomInAction = new KAction(KIcon("zoom-in"), i18n("zoom in"), this); - zoomOutAction = new KAction(KIcon("zoom-out"), i18n("zoom out"), this); - zoomInXAction = new KAction(KIcon("labplot-zoom-in-x"), i18n("zoom in X"), this); - zoomOutXAction = new KAction(KIcon("labplot-zoom-out-x"), i18n("zoom out X"), this); - zoomInYAction = new KAction(KIcon("labplot-zoom-in-y"), i18n("zoom in Y"), this); - zoomOutYAction = new KAction(KIcon("labplot-zoom-out-y"), i18n("zoom out Y"), this); - shiftLeftXAction = new KAction(KIcon("labplot-shift-left-x"), i18n("shift left X"), this); - shiftRightXAction = new KAction(KIcon("labplot-shift-right-x"), i18n("shift right X"), this); - shiftUpYAction = new KAction(KIcon("labplot-shift-up-y"), i18n("shift up Y"), this); - shiftDownYAction = new KAction(KIcon("labplot-shift-down-y"), i18n("shift down Y"), this); + scaleAutoAction = new QAction(QIcon::fromTheme("labplot-auto-scale-all"), i18n("auto scale"), this); + scaleAutoXAction = new QAction(QIcon::fromTheme("labplot-auto-scale-x"), i18n("auto scale X"), this); + scaleAutoYAction = new QAction(QIcon::fromTheme("labplot-auto-scale-y"), i18n("auto scale Y"), this); + zoomInAction = new QAction(QIcon::fromTheme("zoom-in"), i18n("zoom in"), this); + zoomOutAction = new QAction(QIcon::fromTheme("zoom-out"), i18n("zoom out"), this); + zoomInXAction = new QAction(QIcon::fromTheme("labplot-zoom-in-x"), i18n("zoom in X"), this); + zoomOutXAction = new QAction(QIcon::fromTheme("labplot-zoom-out-x"), i18n("zoom out X"), this); + zoomInYAction = new QAction(QIcon::fromTheme("labplot-zoom-in-y"), i18n("zoom in Y"), this); + zoomOutYAction = new QAction(QIcon::fromTheme("labplot-zoom-out-y"), i18n("zoom out Y"), this); + shiftLeftXAction = new QAction(QIcon::fromTheme("labplot-shift-left-x"), i18n("shift left X"), this); + shiftRightXAction = new QAction(QIcon::fromTheme("labplot-shift-right-x"), i18n("shift right X"), this); + shiftUpYAction = new QAction(QIcon::fromTheme("labplot-shift-up-y"), i18n("shift up Y"), this); + shiftDownYAction = new QAction(QIcon::fromTheme("labplot-shift-down-y"), i18n("shift down Y"), this); connect(scaleAutoAction, SIGNAL(triggered()), SLOT(scaleAuto())); connect(scaleAutoXAction, SIGNAL(triggered()), SLOT(scaleAutoX())); diff --cc src/commonfrontend/spreadsheet/SpreadsheetView.cpp index 8bb104a,0d898b7..a08b3c7 --- a/src/commonfrontend/spreadsheet/SpreadsheetView.cpp +++ b/src/commonfrontend/spreadsheet/SpreadsheetView.cpp @@@ -1029,73 -1028,73 +1029,121 @@@ void SpreadsheetView::fillSelectedCells } void SpreadsheetView::fillSelectedCellsWithRandomNumbers(){ + if (selectedColumnCount() < 1) return; + int first = firstSelectedRow(); + int last = lastSelectedRow(); + if ( first < 0 ) return; + + WAIT_CURSOR; + m_spreadsheet->beginMacro(i18n("%1: fill cells with random values", m_spreadsheet->name())); + qsrand(QTime::currentTime().msec()); + foreach(Column* col_ptr, selectedColumns()) { + int col = m_spreadsheet->indexOfChild<Column>(col_ptr); + col_ptr->setSuppressDataChangedSignal(true); + switch (col_ptr->columnMode()) { + case AbstractColumn::Numeric: + { + QVector<double> results(last-first+1); + for (int row=first; row<=last; row++) + if (isCellSelected(row, col)) + results[row-first] = double(qrand())/double(RAND_MAX); + else + results[row-first] = col_ptr->valueAt(row); + col_ptr->replaceValues(first, results); + break; + } + case AbstractColumn::Text: + { + QStringList results; + for (int row=first; row<=last; row++) + if (isCellSelected(row, col)) + results << QString::number(double(qrand())/double(RAND_MAX)); + else + results << col_ptr->textAt(row); + col_ptr->replaceTexts(first, results); + break; + } + case AbstractColumn::DateTime: + case AbstractColumn::Month: + case AbstractColumn::Day: - { - QList<QDateTime> results; - QDate earliestDate(1,1,1); - QDate latestDate(2999,12,31); - QTime midnight(0,0,0,0); - for (int row=first; row<=last; row++) - if (isCellSelected(row, col)) - results << QDateTime( - earliestDate.addDays(((double)qrand())*((double)earliestDate.daysTo(latestDate))/((double)RAND_MAX)), - midnight.addMSecs(((qint64)qrand())*1000*60*60*24/RAND_MAX)); - else - results << col_ptr->dateTimeAt(row); - col_ptr->replaceDateTimes(first, results); - break; - } ++ break; + } + + col_ptr->setSuppressDataChangedSignal(false); + col_ptr->setChanged(); + } + m_spreadsheet->endMacro(); + RESET_CURSOR; + } + ++void SpreadsheetView::fillSelectedCellsWithRandomNumbers(){ + if (selectedColumnCount() < 1) return; + int first = firstSelectedRow(); + int last = lastSelectedRow(); + if ( first < 0 ) return; + + WAIT_CURSOR; + m_spreadsheet->beginMacro(i18n("%1: fill cells with random values", m_spreadsheet->name())); + qsrand(QTime::currentTime().msec()); + foreach(Column* col_ptr, selectedColumns()) { + int col = m_spreadsheet->indexOfChild<Column>(col_ptr); + col_ptr->setSuppressDataChangedSignal(true); + switch (col_ptr->columnMode()) { + case AbstractColumn::Numeric: + { + QVector<double> results(last-first+1); + for (int row=first; row<=last; row++) + if (isCellSelected(row, col)) + results[row-first] = double(qrand())/double(RAND_MAX); + else + results[row-first] = col_ptr->valueAt(row); + col_ptr->replaceValues(first, results); + break; + } + case AbstractColumn::Text: + { + QStringList results; + for (int row=first; row<=last; row++) + if (isCellSelected(row, col)) + results << QString::number(double(qrand())/double(RAND_MAX)); + else + results << col_ptr->textAt(row); + col_ptr->replaceTexts(first, results); + break; + } + case AbstractColumn::DateTime: + case AbstractColumn::Month: + case AbstractColumn::Day: + { + QList<QDateTime> results; + QDate earliestDate(1,1,1); + QDate latestDate(2999,12,31); + QTime midnight(0,0,0,0); + for (int row=first; row<=last; row++) + if (isCellSelected(row, col)) + results << QDateTime( + earliestDate.addDays(((double)qrand())*((double)earliestDate.daysTo(latestDate))/((double)RAND_MAX)), + midnight.addMSecs(((qint64)qrand())*1000*60*60*24/RAND_MAX)); + else + results << col_ptr->dateTimeAt(row); + col_ptr->replaceDateTimes(first, results); + break; + } + } + + col_ptr->setSuppressDataChangedSignal(false); + col_ptr->setChanged(); + } + m_spreadsheet->endMacro(); + RESET_CURSOR; +} + void SpreadsheetView::fillWithRandomValues() { - if (selectedColumnCount() < 1) return; - RandomValuesDialog* dlg = new RandomValuesDialog(m_spreadsheet); - dlg->setAttribute(Qt::WA_DeleteOnClose); - dlg->setColumns(selectedColumns()); - dlg->exec(); + if (selectedColumnCount() < 1) return; + RandomValuesDialog* dlg = new RandomValuesDialog(m_spreadsheet); + dlg->setAttribute(Qt::WA_DeleteOnClose); + dlg->setColumns(selectedColumns()); + dlg->exec(); } void SpreadsheetView::fillWithEquidistantValues() { diff --cc src/commonfrontend/worksheet/WorksheetView.cpp index a06b9e3,ab93198..d2c7086 --- a/src/commonfrontend/worksheet/WorksheetView.cpp +++ b/src/commonfrontend/worksheet/WorksheetView.cpp @@@ -490,17 -490,17 +490,17 @@@ void WorksheetView::setScene(QGraphicsS } void WorksheetView::drawForeground(QPainter* painter, const QRectF& rect) { - if (m_mouseMode==ZoomSelectionMode && m_selectionBandIsShown) { - painter->save(); - const QRectF& selRect = mapToScene(QRect(m_selectionStart, m_selectionEnd).normalized()).boundingRect(); - painter->setPen(QPen(Qt::black, 5/transform().m11())); - painter->drawRect(selRect); - painter->setBrush(Qt::blue); - painter->setOpacity(0.2); - painter->drawRect(selRect); - painter->restore(); - } - QGraphicsView::drawForeground(painter, rect); + if (m_mouseMode==ZoomSelectionMode && m_selectionBandIsShown) { + painter->save(); + const QRectF& selRect = mapToScene(QRect(m_selectionStart, m_selectionEnd).normalized()).boundingRect(); - painter->setPen(QPen(Qt::black, 5)); ++ painter->setPen(QPen(Qt::black, 5/transform().m11())); + painter->drawRect(selRect); + painter->setBrush(Qt::blue); + painter->setOpacity(0.2); + painter->drawRect(selRect); + painter->restore(); + } + QGraphicsView::drawForeground(painter, rect); } void WorksheetView::drawBackground(QPainter* painter, const QRectF& rect) { @@@ -676,72 -676,79 +676,78 @@@ void WorksheetView::wheelEvent(QWheelEv } void WorksheetView::mousePressEvent(QMouseEvent* event) { - if (m_mouseMode == ZoomSelectionMode) { - m_selectionStart = event->pos(); - m_selectionBandIsShown = true; - } - - //prevent the deselection of items when context menu event - //was triggered (right button click) - if (event->button() == Qt::RightButton) { + //prevent the deselection of items when context menu event + //was triggered (right button click) - if (event->button() != Qt::LeftButton) { ++ if (event->button() == Qt::RightButton) { event->accept(); return; } ++ ++ if (event->button() == Qt::LeftButton && m_mouseMode == ZoomSelectionMode) { ++ m_selectionStart = event->pos(); ++ m_selectionBandIsShown = true; ++ } - if (event->button() == Qt::LeftButton && m_mouseMode == ZoomSelectionMode) { - m_selectionStart = event->pos(); - m_selectionBandIsShown = true; - } - - // select the worksheet in the project explorer if the view was clicked - // and there is no selection currently. We need this for the case when - // there is a single worksheet in the project and we change from the project-node - // in the project explorer to the worksheet-node by clicking the view. - if ( scene()->selectedItems().empty() ) - m_worksheet->setSelectedInView(true); + // select the worksheet in the project explorer if the view was clicked + // and there is no selection currently. We need this for the case when + // there is a single worksheet in the project and we change from the project-node + // in the project explorer to the worksheet-node by clicking the view. + if ( scene()->selectedItems().empty() ) + m_worksheet->setSelectedInView(true); - QGraphicsView::mousePressEvent(event); + QGraphicsView::mousePressEvent(event); } void WorksheetView::mouseReleaseEvent(QMouseEvent* event) { - if (m_mouseMode == ZoomSelectionMode) { - if (event->button() == Qt::LeftButton && m_mouseMode == ZoomSelectionMode) { - m_selectionBandIsShown = false; - viewport()->repaint(QRect(m_selectionStart, m_selectionEnd).normalized()); - - //don't zoom if very small region was selected, avoid occasional/unwanted zooming - m_selectionEnd = event->pos(); - if ( abs(m_selectionEnd.x()-m_selectionStart.x())>20 && abs(m_selectionEnd.y()-m_selectionStart.y())>20 ) - fitInView(mapToScene(QRect(m_selectionStart, m_selectionEnd).normalized()).boundingRect(), Qt::KeepAspectRatio); - } - QGraphicsView::mouseReleaseEvent(event); ++ if (event->button() == Qt::LeftButton && m_mouseMode == ZoomSelectionMode) { + m_selectionBandIsShown = false; + viewport()->repaint(QRect(m_selectionStart, m_selectionEnd).normalized()); + + //don't zoom if very small region was selected, avoid occasional/unwanted zooming + m_selectionEnd = event->pos(); + if ( abs(m_selectionEnd.x()-m_selectionStart.x())>20 && abs(m_selectionEnd.y()-m_selectionStart.y())>20 ) + fitInView(mapToScene(QRect(m_selectionStart, m_selectionEnd).normalized()).boundingRect(), Qt::KeepAspectRatio); + } + QGraphicsView::mouseReleaseEvent(event); } void WorksheetView::mouseMoveEvent(QMouseEvent* event) { - if (m_mouseMode == SelectionMode && m_cartesianPlotMouseMode != CartesianPlot::SelectionMode ) { - //check whether there is a cartesian plot under the cursor - bool plot = false; - QGraphicsItem* item = itemAt(event->pos()); - if (item) { - plot = item->data(0).toInt() == WorksheetElement::NameCartesianPlot; - if (!plot && item->parentItem()) - plot = item->parentItem()->data(0).toInt() == WorksheetElement::NameCartesianPlot; - } - - //set the cursor appearance according to the current mouse mode for the cartesian plots - if (plot) { - if (m_cartesianPlotMouseMode == CartesianPlot::ZoomSelectionMode) { - setCursor(Qt::CrossCursor); - } else if (m_cartesianPlotMouseMode == CartesianPlot::ZoomXSelectionMode) { - setCursor(Qt::SizeHorCursor); - } else if (m_cartesianPlotMouseMode == CartesianPlot::ZoomYSelectionMode) { - setCursor(Qt::SizeVerCursor); - } - } else { - setCursor(Qt::ArrowCursor); - } - } else if (m_mouseMode == SelectionMode && m_cartesianPlotMouseMode == CartesianPlot::SelectionMode ) { - setCursor(Qt::ArrowCursor); - } else if (m_selectionBandIsShown) { - QRect rect = QRect(m_selectionStart, m_selectionEnd).normalized(); - m_selectionEnd = event->pos(); - rect = rect.united(QRect(m_selectionStart, m_selectionEnd).normalized()); - int penWidth = 5/transform().m11(); - rect.setX(rect.x()-penWidth); - rect.setY(rect.y()-penWidth); - rect.setHeight(rect.height()+2*penWidth); - rect.setWidth(rect.width()+2*penWidth); - viewport()->repaint(rect); - } - - QGraphicsView::mouseMoveEvent(event); + if (m_mouseMode == SelectionMode && m_cartesianPlotMouseMode != CartesianPlot::SelectionMode ) { - //check whether there is a cartesian plot under the cursor - bool plot = false; - QGraphicsItem* item = itemAt(event->pos()); - if (item) { - plot = item->data(0).toInt() == WorksheetElement::NameCartesianPlot; - if (!plot && item->parentItem()) - plot = item->parentItem()->data(0).toInt() == WorksheetElement::NameCartesianPlot; - } ++ //check whether there is a cartesian plot under the cursor ++ bool plot = false; ++ QGraphicsItem* item = itemAt(event->pos()); ++ if (item) { ++ plot = item->data(0).toInt() == WorksheetElement::NameCartesianPlot; ++ if (!plot && item->parentItem()) ++ plot = item->parentItem()->data(0).toInt() == WorksheetElement::NameCartesianPlot; ++ } + - //set the cursor appearance according to the current mouse mode for the cartesian plots - if (plot) { - if (m_cartesianPlotMouseMode == CartesianPlot::ZoomSelectionMode) { - setCursor(Qt::CrossCursor); - } else if (m_cartesianPlotMouseMode == CartesianPlot::ZoomXSelectionMode) { - setCursor(Qt::SizeHorCursor); - } else if (m_cartesianPlotMouseMode == CartesianPlot::ZoomYSelectionMode) { - setCursor(Qt::SizeVerCursor); ++ //set the cursor appearance according to the current mouse mode for the cartesian plots ++ if (plot) { ++ if (m_cartesianPlotMouseMode == CartesianPlot::ZoomSelectionMode) { ++ setCursor(Qt::CrossCursor); ++ } else if (m_cartesianPlotMouseMode == CartesianPlot::ZoomXSelectionMode) { ++ setCursor(Qt::SizeHorCursor); ++ } else if (m_cartesianPlotMouseMode == CartesianPlot::ZoomYSelectionMode) { ++ setCursor(Qt::SizeVerCursor); ++ } ++ } else { ++ setCursor(Qt::ArrowCursor); + } - } else { - setCursor(Qt::ArrowCursor); - } + } else if (m_mouseMode == SelectionMode && m_cartesianPlotMouseMode == CartesianPlot::SelectionMode ) { - setCursor(Qt::ArrowCursor); ++ setCursor(Qt::ArrowCursor); + } else if (m_selectionBandIsShown) { - m_selectionEnd = event->pos(); - viewport()->repaint(QRect(m_selectionStart, m_selectionEnd).normalized()); ++ QRect rect = QRect(m_selectionStart, m_selectionEnd).normalized(); ++ m_selectionEnd = event->pos(); ++ rect = rect.united(QRect(m_selectionStart, m_selectionEnd).normalized()); ++ int penWidth = 5/transform().m11(); ++ rect.setX(rect.x()-penWidth); ++ rect.setY(rect.y()-penWidth); ++ rect.setHeight(rect.height()+2*penWidth); ++ rect.setWidth(rect.width()+2*penWidth); ++ viewport()->repaint(rect); + } - + QGraphicsView::mouseMoveEvent(event); } void WorksheetView::contextMenuEvent(QContextMenuEvent* e) { diff --cc src/kdefrontend/MainWin.cpp index 5a06631,f53802b..b58357f --- a/src/kdefrontend/MainWin.cpp +++ b/src/kdefrontend/MainWin.cpp @@@ -212,7 -219,11 +218,11 @@@ void MainWin::initActions() actionCollection()->addAction("new_workbook", m_newWorkbookAction); connect(m_newWorkbookAction, SIGNAL(triggered()),SLOT(newWorkbook())); - m_newDatapickerAction = new KAction(KIcon("color-picker-black"),i18n("Datapicker"),this); - actionCollection()->addAction("new_datapicker", m_newDatapickerAction); - connect(m_newDatapickerAction, SIGNAL(triggered()),SLOT(newDatapicker())); - - m_newSpreadsheetAction = new KAction(KIcon("labplot-spreadsheet-new"),i18n("Spreadsheet"),this); ++ m_newDatapickerAction = new QAction(QIcon::fromTheme("color-picker-black"), i18n("Datapicker"), this); ++ actionCollection()->addAction("new_datapicker", m_newDatapickerAction); ++ connect(m_newDatapickerAction, SIGNAL(triggered()),SLOT(newDatapicker())); ++ + m_newSpreadsheetAction = new QAction(QIcon::fromTheme("labplot-spreadsheet-new"),i18n("Spreadsheet"),this); // m_newSpreadsheetAction->setShortcut(Qt::CTRL+Qt::Key_Equal); actionCollection()->addAction("new_spreadsheet", m_newSpreadsheetAction); connect(m_newSpreadsheetAction, SIGNAL(triggered()),SLOT(newSpreadsheet())); diff --cc src/kdefrontend/MainWin.h index ea51fca,bfbef00..33e3f1d --- a/src/kdefrontend/MainWin.h +++ b/src/kdefrontend/MainWin.h @@@ -89,54 -95,54 +95,55 @@@ private Qt::WindowStates m_lastWindowState; //< last window state before switching to full screen mode KRecentFilesAction* m_recentProjectsAction; - KAction* m_saveAction; - KAction* m_saveAsAction; - KAction* m_printAction; - KAction* m_printPreviewAction; - KAction* m_importAction; - KAction* m_exportAction; - KAction* m_closeAction; - KAction* m_newFolderAction; - KAction* m_newWorkbookAction; - KAction* m_newSpreadsheetAction; - KAction* m_newMatrixAction; - KAction* m_newWorksheetAction; - KAction* m_newFileDataSourceAction; - KAction* m_newSqlDataSourceAction; - KAction* m_newScriptAction; - KAction* m_newProjectAction; - KAction* m_historyAction; - KAction* m_undoAction; - KAction* m_redoAction; - KAction* m_tileWindows; - KAction* m_cascadeWindows; - KAction* m_newDatapickerAction; - + QAction* m_saveAction; + QAction* m_saveAsAction; + QAction* m_printAction; + QAction* m_printPreviewAction; + QAction* m_importAction; + QAction* m_exportAction; + QAction* m_closeAction; + QAction* m_newFolderAction; + QAction* m_newWorkbookAction; + QAction* m_newSpreadsheetAction; + QAction* m_newMatrixAction; + QAction* m_newWorksheetAction; + QAction* m_newFileDataSourceAction; + QAction* m_newSqlDataSourceAction; + QAction* m_newScriptAction; + QAction* m_newProjectAction; + QAction* m_historyAction; + QAction* m_undoAction; + QAction* m_redoAction; + QAction* m_tileWindows; + QAction* m_cascadeWindows; ++ QAction* m_newDatapickerAction; //toggling doch widgets - KAction* m_toggleProjectExplorerDockAction; - KAction* m_togglePropertiesDockAction; + QAction* m_toggleProjectExplorerDocQAction; + QAction* m_togglePropertiesDocQAction; //worksheet actions - KAction* worksheetZoomInAction; - KAction* worksheetZoomOutAction; - KAction* worksheetZoomOriginAction; - KAction* worksheetZoomFitPageHeightAction; - KAction* worksheetZoomFitPageWidthAction; - KAction* worksheetZoomFitSelectionAction; - - KAction* worksheetNavigationModeAction; - KAction* worksheetZoomModeAction; - KAction* worksheetSelectionModeAction; - - KAction* worksheetVerticalLayoutAction; - KAction* worksheetHorizontalLayoutAction; - KAction* worksheetGridLayoutAction; - KAction* worksheetBreakLayoutAction; - - KAction* m_visibilityFolderAction; - KAction* m_visibilitySubfolderAction; - KAction* m_visibilityAllAction; + QAction* worksheetZoomInAction; + QAction* worksheetZoomOutAction; + QAction* worksheetZoomOriginAction; + QAction* worksheetZoomFitPageHeightAction; + QAction* worksheetZoomFitPageWidthAction; + QAction* worksheetZoomFitSelectionAction; + + QAction* worksheetNavigationModeAction; + QAction* worksheetZoomModeAction; + QAction* worksheetSelectionModeAction; + + QAction* worksheetVerticalLayoutAction; + QAction* worksheetHorizontalLayoutAction; + QAction* worksheetGridLayoutAction; + QAction* worksheetBreakLayoutAction; + + QAction* m_visibilityFolderAction; + QAction* m_visibilitySubfolderAction; + QAction* m_visibilityAllAction; + QAction* m_toggleProjectExplorerDockAction; + QAction* m_togglePropertiesDockAction; //Menus QMenu* m_visibilityMenu; diff --cc src/kdefrontend/dockwidgets/CartesianPlotDock.cpp index 1fd04f9,1876ff6..a4e7fd7 --- a/src/kdefrontend/dockwidgets/CartesianPlotDock.cpp +++ b/src/kdefrontend/dockwidgets/CartesianPlotDock.cpp @@@ -50,109 -49,109 +50,215 @@@ */ CartesianPlotDock::CartesianPlotDock(QWidget *parent): QWidget(parent), ++<<<<<<< HEAD + m_initializing(false){ + + ui.setupUi(this); + + //"Coordinate system"-tab + ui.bAddXBreak->setIcon( QIcon::fromTheme("list-add") ); + ui.bRemoveXBreak->setIcon( QIcon::fromTheme("list-remove") ); + ui.cbXBreak->addItem("1"); + + ui.bAddYBreak->setIcon( QIcon::fromTheme("list-add") ); + ui.bRemoveYBreak->setIcon( QIcon::fromTheme("list-remove") ); + ui.cbYBreak->addItem("1"); + + //"Background"-tab + ui.kleBackgroundFileName->setClearButtonShown(true); + ui.bOpen->setIcon( QIcon::fromTheme("document-open") ); + + KUrlCompletion *comp = new KUrlCompletion(); + ui.kleBackgroundFileName->setCompletionObject(comp); + + //"Title"-tab + QHBoxLayout* hboxLayout = new QHBoxLayout(ui.tabTitle); + labelWidget=new LabelWidget(ui.tabTitle); + hboxLayout->addWidget(labelWidget); + hboxLayout->setContentsMargins(2,2,2,2); + hboxLayout->setSpacing(2); + + //adjust layouts in the tabs + for (int i=0; i<ui.tabWidget->count(); ++i){ + QGridLayout* layout = dynamic_cast<QGridLayout*>(ui.tabWidget->widget(i)->layout()); + if (!layout) + continue; + + layout->setContentsMargins(2,2,2,2); + layout->setHorizontalSpacing(2); + layout->setVerticalSpacing(2); + } + + //Validators + ui.leXBreakStart->setValidator( new QDoubleValidator(ui.leXBreakStart) ); + ui.leXBreakEnd->setValidator( new QDoubleValidator(ui.leXBreakEnd) ); + ui.leYBreakStart->setValidator( new QDoubleValidator(ui.leYBreakStart) ); + ui.leYBreakEnd->setValidator( new QDoubleValidator(ui.leYBreakEnd) ); + + //SIGNAL/SLOT + //General + connect( ui.leName, SIGNAL(returnPressed()), this, SLOT(nameChanged()) ); + connect( ui.leComment, SIGNAL(returnPressed()), this, SLOT(commentChanged()) ); + connect( ui.chkVisible, SIGNAL(stateChanged(int)), this, SLOT(visibilityChanged(int)) ); + connect( ui.sbLeft, SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) ); + connect( ui.sbTop, SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) ); + connect( ui.sbWidth, SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) ); + connect( ui.sbHeight, SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) ); + + connect( ui.chkAutoScaleX, SIGNAL(stateChanged(int)), this, SLOT(autoScaleXChanged(int)) ); + connect( ui.kleXMin, SIGNAL(returnPressed()), this, SLOT(xMinChanged()) ); + connect( ui.kleXMax, SIGNAL(returnPressed()), this, SLOT(xMaxChanged()) ); + connect( ui.cbXScaling, SIGNAL(currentIndexChanged(int)), this, SLOT(xScaleChanged(int)) ); + + connect( ui.chkAutoScaleY, SIGNAL(stateChanged(int)), this, SLOT(autoScaleYChanged(int)) ); + connect( ui.kleYMin, SIGNAL(returnPressed()), this, SLOT(yMinChanged()) ); + connect( ui.kleYMax, SIGNAL(returnPressed()), this, SLOT(yMaxChanged()) ); + connect( ui.cbYScaling, SIGNAL(currentIndexChanged(int)), this, SLOT(yScaleChanged(int)) ); + + //Scale breakings + connect( ui.chkXBreak, SIGNAL(stateChanged(int)), this, SLOT(toggleXBreak(int)) ); + connect( ui.bAddXBreak, SIGNAL(clicked()), this, SLOT(addXBreak()) ); + connect( ui.bRemoveXBreak, SIGNAL(clicked()), this, SLOT(removeXBreak()) ); + connect( ui.cbXBreak, SIGNAL(currentIndexChanged(int)), this, SLOT(currentXBreakChanged(int)) ); + connect( ui.leXBreakStart, SIGNAL(returnPressed()), this, SLOT(xBreakStartChanged()) ); + connect( ui.leXBreakEnd, SIGNAL(returnPressed()), this, SLOT(xBreakEndChanged()) ); + connect( ui.sbXBreakPosition, SIGNAL(valueChanged(int)), this, SLOT(xBreakPositionChanged(int)) ); + + connect( ui.chkYBreak, SIGNAL(stateChanged(int)), this, SLOT(toggleYBreak(int)) ); + connect( ui.bAddYBreak, SIGNAL(clicked()), this, SLOT(addYBreak()) ); + connect( ui.bRemoveYBreak, SIGNAL(clicked()), this, SLOT(removeYBreak()) ); + connect( ui.cbYBreak, SIGNAL(currentIndexChanged(int)), this, SLOT(currentYBreakChanged(int)) ); + connect( ui.leYBreakStart, SIGNAL(returnPressed()), this, SLOT(yBreakStartChanged()) ); + connect( ui.leYBreakEnd, SIGNAL(returnPressed()), this, SLOT(yBreakEndChanged()) ); + connect( ui.sbYBreakPosition, SIGNAL(valueChanged(int)), this, SLOT(yBreakPositionChanged(int)) ); + + //Background + connect( ui.cbBackgroundType, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundTypeChanged(int)) ); + connect( ui.cbBackgroundColorStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundColorStyleChanged(int)) ); + connect( ui.cbBackgroundImageStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundImageStyleChanged(int)) ); + connect( ui.cbBackgroundBrushStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundBrushStyleChanged(int)) ); + connect(ui.bOpen, SIGNAL(clicked(bool)), this, SLOT(selectFile())); + connect( ui.kleBackgroundFileName, SIGNAL(returnPressed()), this, SLOT(fileNameChanged()) ); + connect( ui.kleBackgroundFileName, SIGNAL(clearButtonClicked()), this, SLOT(fileNameChanged()) ); + connect( ui.kcbBackgroundFirstColor, SIGNAL(changed(QColor)), this, SLOT(backgroundFirstColorChanged(QColor)) ); + connect( ui.kcbBackgroundSecondColor, SIGNAL(changed(QColor)), this, SLOT(backgroundSecondColorChanged(QColor)) ); + connect( ui.sbBackgroundOpacity, SIGNAL(valueChanged(int)), this, SLOT(backgroundOpacityChanged(int)) ); + + //Border + connect( ui.cbBorderStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(borderStyleChanged(int)) ); + connect( ui.kcbBorderColor, SIGNAL(changed(QColor)), this, SLOT(borderColorChanged(QColor)) ); + connect( ui.sbBorderWidth, SIGNAL(valueChanged(double)), this, SLOT(borderWidthChanged(double)) ); + connect( ui.sbBorderCornerRadius, SIGNAL(valueChanged(double)), this, SLOT(borderCornerRadiusChanged(double)) ); + connect( ui.sbBorderOpacity, SIGNAL(valueChanged(int)), this, SLOT(borderOpacityChanged(int)) ); + + //Padding + connect( ui.sbPaddingHorizontal, SIGNAL(valueChanged(double)), this, SLOT(horizontalPaddingChanged(double)) ); + connect( ui.sbPaddingVertical, SIGNAL(valueChanged(double)), this, SLOT(verticalPaddingChanged(double)) ); ++======= + m_initializing(false){ + + ui.setupUi(this); + + //"Coordinate system"-tab + ui.bAddXBreak->setIcon( KIcon("list-add") ); + ui.bRemoveXBreak->setIcon( KIcon("list-remove") ); + ui.cbXBreak->addItem("1"); + + ui.bAddYBreak->setIcon( KIcon("list-add") ); + ui.bRemoveYBreak->setIcon( KIcon("list-remove") ); + ui.cbYBreak->addItem("1"); + + //"Background"-tab + ui.kleBackgroundFileName->setClearButtonShown(true); + ui.bOpen->setIcon( KIcon("document-open") ); + + KUrlCompletion *comp = new KUrlCompletion(); + ui.kleBackgroundFileName->setCompletionObject(comp); + + //"Title"-tab + QHBoxLayout* hboxLayout = new QHBoxLayout(ui.tabTitle); + labelWidget=new LabelWidget(ui.tabTitle); + hboxLayout->addWidget(labelWidget); + hboxLayout->setContentsMargins(2,2,2,2); + hboxLayout->setSpacing(2); + + //adjust layouts in the tabs + for (int i=0; i<ui.tabWidget->count(); ++i){ + QGridLayout* layout = dynamic_cast<QGridLayout*>(ui.tabWidget->widget(i)->layout()); + if (!layout) + continue; + + layout->setContentsMargins(2,2,2,2); + layout->setHorizontalSpacing(2); + layout->setVerticalSpacing(2); + } + + //Validators + ui.leXBreakStart->setValidator( new QDoubleValidator(ui.leXBreakStart) ); + ui.leXBreakEnd->setValidator( new QDoubleValidator(ui.leXBreakEnd) ); + ui.leYBreakStart->setValidator( new QDoubleValidator(ui.leYBreakStart) ); + ui.leYBreakEnd->setValidator( new QDoubleValidator(ui.leYBreakEnd) ); + + //SIGNAL/SLOT + //General + connect( ui.leName, SIGNAL(returnPressed()), this, SLOT(nameChanged()) ); + connect( ui.leComment, SIGNAL(returnPressed()), this, SLOT(commentChanged()) ); + connect( ui.chkVisible, SIGNAL(clicked(bool)), this, SLOT(visibilityChanged(bool)) ); + connect( ui.sbLeft, SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) ); + connect( ui.sbTop, SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) ); + connect( ui.sbWidth, SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) ); + connect( ui.sbHeight, SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) ); + + connect( ui.chkAutoScaleX, SIGNAL(stateChanged(int)), this, SLOT(autoScaleXChanged(int)) ); + connect( ui.kleXMin, SIGNAL(returnPressed()), this, SLOT(xMinChanged()) ); + connect( ui.kleXMax, SIGNAL(returnPressed()), this, SLOT(xMaxChanged()) ); + connect( ui.cbXScaling, SIGNAL(currentIndexChanged(int)), this, SLOT(xScaleChanged(int)) ); + + connect( ui.chkAutoScaleY, SIGNAL(stateChanged(int)), this, SLOT(autoScaleYChanged(int)) ); + connect( ui.kleYMin, SIGNAL(returnPressed()), this, SLOT(yMinChanged()) ); + connect( ui.kleYMax, SIGNAL(returnPressed()), this, SLOT(yMaxChanged()) ); + connect( ui.cbYScaling, SIGNAL(currentIndexChanged(int)), this, SLOT(yScaleChanged(int)) ); + + //Scale breakings + connect( ui.chkXBreak, SIGNAL(stateChanged(int)), this, SLOT(toggleXBreak(int)) ); + connect( ui.bAddXBreak, SIGNAL(clicked()), this, SLOT(addXBreak()) ); + connect( ui.bRemoveXBreak, SIGNAL(clicked()), this, SLOT(removeXBreak()) ); + connect( ui.cbXBreak, SIGNAL(currentIndexChanged(int)), this, SLOT(currentXBreakChanged(int)) ); + connect( ui.leXBreakStart, SIGNAL(returnPressed()), this, SLOT(xBreakStartChanged()) ); + connect( ui.leXBreakEnd, SIGNAL(returnPressed()), this, SLOT(xBreakEndChanged()) ); + connect( ui.sbXBreakPosition, SIGNAL(valueChanged(int)), this, SLOT(xBreakPositionChanged(int)) ); + + connect( ui.chkYBreak, SIGNAL(stateChanged(int)), this, SLOT(toggleYBreak(int)) ); + connect( ui.bAddYBreak, SIGNAL(clicked()), this, SLOT(addYBreak()) ); + connect( ui.bRemoveYBreak, SIGNAL(clicked()), this, SLOT(removeYBreak()) ); + connect( ui.cbYBreak, SIGNAL(currentIndexChanged(int)), this, SLOT(currentYBreakChanged(int)) ); + connect( ui.leYBreakStart, SIGNAL(returnPressed()), this, SLOT(yBreakStartChanged()) ); + connect( ui.leYBreakEnd, SIGNAL(returnPressed()), this, SLOT(yBreakEndChanged()) ); + connect( ui.sbYBreakPosition, SIGNAL(valueChanged(int)), this, SLOT(yBreakPositionChanged(int)) ); + + //Background + connect( ui.cbBackgroundType, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundTypeChanged(int)) ); + connect( ui.cbBackgroundColorStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundColorStyleChanged(int)) ); + connect( ui.cbBackgroundImageStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundImageStyleChanged(int)) ); + connect( ui.cbBackgroundBrushStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundBrushStyleChanged(int)) ); + connect(ui.bOpen, SIGNAL(clicked(bool)), this, SLOT(selectFile())); + connect( ui.kleBackgroundFileName, SIGNAL(returnPressed()), this, SLOT(fileNameChanged()) ); + connect( ui.kleBackgroundFileName, SIGNAL(clearButtonClicked()), this, SLOT(fileNameChanged()) ); + connect( ui.kcbBackgroundFirstColor, SIGNAL(changed(QColor)), this, SLOT(backgroundFirstColorChanged(QColor)) ); + connect( ui.kcbBackgroundSecondColor, SIGNAL(changed(QColor)), this, SLOT(backgroundSecondColorChanged(QColor)) ); + connect( ui.sbBackgroundOpacity, SIGNAL(valueChanged(int)), this, SLOT(backgroundOpacityChanged(int)) ); + + //Border + connect( ui.cbBorderStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(borderStyleChanged(int)) ); + connect( ui.kcbBorderColor, SIGNAL(changed(QColor)), this, SLOT(borderColorChanged(QColor)) ); + connect( ui.sbBorderWidth, SIGNAL(valueChanged(double)), this, SLOT(borderWidthChanged(double)) ); + connect( ui.sbBorderCornerRadius, SIGNAL(valueChanged(double)), this, SLOT(borderCornerRadiusChanged(double)) ); + connect( ui.sbBorderOpacity, SIGNAL(valueChanged(int)), this, SLOT(borderOpacityChanged(int)) ); + + //Padding + connect( ui.sbPaddingHorizontal, SIGNAL(valueChanged(double)), this, SLOT(horizontalPaddingChanged(double)) ); + connect( ui.sbPaddingVertical, SIGNAL(valueChanged(double)), this, SLOT(verticalPaddingChanged(double)) ); ++>>>>>>> origin/master TemplateHandler* templateHandler = new TemplateHandler(this, TemplateHandler::CartesianPlot); ui.verticalLayout->addWidget(templateHandler); @@@ -249,50 -248,52 +355,52 @@@ void CartesianPlotDock::setPlots(QList< //show the properties of the first plot this->load(); - //update active widgets - backgroundTypeChanged(ui.cbBackgroundType->currentIndex()); - - //Deactivate the geometry related widgets, if the worksheet layout is active. - //Currently, a plot can only be a child of the worksheet itself, so we only need to ask the parent aspect (=worksheet). - //TODO redesign this, if the hierarchy will be changend in future (a plot is a child of a new object group/container or so) - Worksheet* w = dynamic_cast<Worksheet*>(m_plot->parentAspect()); - if (w){ - bool b = (w->layout()==Worksheet::NoLayout); - ui.sbTop->setEnabled(b); - ui.sbLeft->setEnabled(b); - ui.sbWidth->setEnabled(b); - ui.sbHeight->setEnabled(b); - connect(w, SIGNAL(layoutChanged(Worksheet::Layout)), this, SLOT(layoutChanged(Worksheet::Layout))); - } - - //SIGNALs/SLOTs - connect( m_plot, SIGNAL(aspectDescriptionChanged(const AbstractAspect*)), this, SLOT(plotDescriptionChanged(const AbstractAspect*)) ); - connect( m_plot, SIGNAL(rectChanged(QRectF&)), this, SLOT(plotRectChanged(QRectF&)) ); - connect( m_plot, SIGNAL(xAutoScaleChanged(bool)), this, SLOT(plotXAutoScaleChanged(bool)) ); - connect( m_plot, SIGNAL(xMinChanged(float)), this, SLOT(plotXMinChanged(float)) ); - connect( m_plot, SIGNAL(xMaxChanged(float)), this, SLOT(plotXMaxChanged(float)) ); - connect( m_plot, SIGNAL(xScaleChanged(int)), this, SLOT(plotXScaleChanged(int)) ); - connect( m_plot, SIGNAL(yAutoScaleChanged(bool)), this, SLOT(plotYAutoScaleChanged(bool)) ); - connect( m_plot, SIGNAL(yMinChanged(float)), this, SLOT(plotYMinChanged(float)) ); - connect( m_plot, SIGNAL(yMaxChanged(float)), this, SLOT(plotYMaxChanged(float)) ); - connect( m_plot, SIGNAL(yScaleChanged(int)), this, SLOT(plotYScaleChanged(int)) ); - connect( m_plot, SIGNAL(xScaleBreakingsChanged(CartesianPlot::ScaleBreakings)), this, SLOT(plotXScaleBreakingChanged(CartesianPlot::ScaleBreakings)) ); - connect( m_plot, SIGNAL(yScaleBreakingsChanged(CartesianPlot::ScaleBreakings)), this, SLOT(plotYScaleBreakingChanged(CartesianPlot::ScaleBreakings)) ); - connect( m_plot, SIGNAL(visibleChanged(bool)), this, SLOT(plotVisibleChanged(bool)) ); - - // Plot Area - connect( m_plot->plotArea(), SIGNAL(backgroundTypeChanged(PlotArea::BackgroundType)), this, SLOT(plotBackgroundTypeChanged(PlotArea::BackgroundType)) ); - connect( m_plot->plotArea(), SIGNAL(backgroundColorStyleChanged(PlotArea::BackgroundColorStyle)), this, SLOT(plotBackgroundColorStyleChanged(PlotArea::BackgroundColorStyle)) ); - connect( m_plot->plotArea(), SIGNAL(backgroundImageStyleChanged(PlotArea::BackgroundImageStyle)), this, SLOT(plotBackgroundImageStyleChanged(PlotArea::BackgroundImageStyle)) ); - connect( m_plot->plotArea(), SIGNAL(backgroundBrushStyleChanged(Qt::BrushStyle)), this, SLOT(plotBackgroundBrushStyleChanged(Qt::BrushStyle)) ); - connect( m_plot->plotArea(), SIGNAL(backgroundFirstColorChanged(QColor&)), this, SLOT(plotBackgroundFirstColorChanged(QColor&)) ); - connect( m_plot->plotArea(), SIGNAL(backgroundSecondColorChanged(QColor&)), this, SLOT(plotBackgroundSecondColorChanged(QColor&)) ); - connect( m_plot->plotArea(), SIGNAL(backgroundFileNameChanged(QString&)), this, SLOT(plotBackgroundFileNameChanged(QString&)) ); - connect( m_plot->plotArea(), SIGNAL(backgroundOpacityChanged(float)), this, SLOT(plotBackgroundOpacityChanged(float)) ); - connect( m_plot->plotArea(), SIGNAL(borderPenChanged(QPen&)), this, SLOT(plotBorderPenChanged(QPen&)) ); - connect( m_plot->plotArea(), SIGNAL(borderOpacityChanged(float)), this, SLOT(plotBorderOpacityChanged(float)) ); - connect( m_plot, SIGNAL(horizontalPaddingChanged(float)), this, SLOT(plotHorizontalPaddingChanged(float)) ); - connect( m_plot, SIGNAL(verticalPaddingChanged(float)), this, SLOT(plotVerticalPaddingChanged(float)) ); - - m_initializing = false; + //update active widgets + backgroundTypeChanged(ui.cbBackgroundType->currentIndex()); + + //Deactivate the geometry related widgets, if the worksheet layout is active. + //Currently, a plot can only be a child of the worksheet itself, so we only need to ask the parent aspect (=worksheet). + //TODO redesign this, if the hierarchy will be changend in future (a plot is a child of a new object group/container or so) + Worksheet* w = dynamic_cast<Worksheet*>(m_plot->parentAspect()); + if (w){ + bool b = (w->layout()==Worksheet::NoLayout); + ui.sbTop->setEnabled(b); + ui.sbLeft->setEnabled(b); + ui.sbWidth->setEnabled(b); + ui.sbHeight->setEnabled(b); + connect(w, SIGNAL(layoutChanged(Worksheet::Layout)), this, SLOT(layoutChanged(Worksheet::Layout))); + } + + //SIGNALs/SLOTs + connect( m_plot, SIGNAL(aspectDescriptionChanged(const AbstractAspect*)), this, SLOT(plotDescriptionChanged(const AbstractAspect*)) ); + connect( m_plot, SIGNAL(rectChanged(QRectF&)), this, SLOT(plotRectChanged(QRectF&)) ); + connect( m_plot, SIGNAL(xMinChanged(float)), this, SLOT(plotXMinChanged(float)) ); + connect( m_plot, SIGNAL(xMaxChanged(float)), this, SLOT(plotXMaxChanged(float)) ); + connect( m_plot, SIGNAL(xScaleChanged(int)), this, SLOT(plotXScaleChanged(int)) ); ++ connect( m_plot, SIGNAL(xAutoScaleChanged(bool)), this, SLOT(plotXAutoScaleChanged(bool)) ); + connect( m_plot, SIGNAL(yMinChanged(float)), this, SLOT(plotYMinChanged(float)) ); + connect( m_plot, SIGNAL(yMaxChanged(float)), this, SLOT(plotYMaxChanged(float)) ); + connect( m_plot, SIGNAL(yScaleChanged(int)), this, SLOT(plotYScaleChanged(int)) ); ++ connect( m_plot, SIGNAL(yAutoScaleChanged(bool)), this, SLOT(plotYAutoScaleChanged(bool)) ); + connect( m_plot, SIGNAL(xScaleBreakingsChanged(CartesianPlot::ScaleBreakings)), this, SLOT(plotXScaleBreakingChanged(CartesianPlot::ScaleBreakings)) ); + connect( m_plot, SIGNAL(yScaleBreakingsChanged(CartesianPlot::ScaleBreakings)), this, SLOT(plotYScaleBreakingChanged(CartesianPlot::ScaleBreakings)) ); + connect( m_plot, SIGNAL(visibleChanged(bool)), this, SLOT(plotVisibleChanged(bool)) ); + + // Plot Area + connect( m_plot->plotArea(), SIGNAL(backgroundTypeChanged(PlotArea::BackgroundType)), this, SLOT(plotBackgroundTypeChanged(PlotArea::BackgroundType)) ); + connect( m_plot->plotArea(), SIGNAL(backgroundColorStyleChanged(PlotArea::BackgroundColorStyle)), this, SLOT(plotBackgroundColorStyleChanged(PlotArea::BackgroundColorStyle)) ); + connect( m_plot->plotArea(), SIGNAL(backgroundImageStyleChanged(PlotArea::BackgroundImageStyle)), this, SLOT(plotBackgroundImageStyleChanged(PlotArea::BackgroundImageStyle)) ); + connect( m_plot->plotArea(), SIGNAL(backgroundBrushStyleChanged(Qt::BrushStyle)), this, SLOT(plotBackgroundBrushStyleChanged(Qt::BrushStyle)) ); + connect( m_plot->plotArea(), SIGNAL(backgroundFirstColorChanged(QColor&)), this, SLOT(plotBackgroundFirstColorChanged(QColor&)) ); + connect( m_plot->plotArea(), SIGNAL(backgroundSecondColorChanged(QColor&)), this, SLOT(plotBackgroundSecondColorChanged(QColor&)) ); + connect( m_plot->plotArea(), SIGNAL(backgroundFileNameChanged(QString&)), this, SLOT(plotBackgroundFileNameChanged(QString&)) ); + connect( m_plot->plotArea(), SIGNAL(backgroundOpacityChanged(float)), this, SLOT(plotBackgroundOpacityChanged(float)) ); + connect( m_plot->plotArea(), SIGNAL(borderPenChanged(QPen&)), this, SLOT(plotBorderPenChanged(QPen&)) ); + connect( m_plot->plotArea(), SIGNAL(borderOpacityChanged(float)), this, SLOT(plotBorderOpacityChanged(float)) ); + connect( m_plot, SIGNAL(horizontalPaddingChanged(float)), this, SLOT(plotHorizontalPaddingChanged(float)) ); + connect( m_plot, SIGNAL(verticalPaddingChanged(float)), this, SLOT(plotVerticalPaddingChanged(float)) ); + + m_initializing = false; } void CartesianPlotDock::activateTitleTab(){ @@@ -365,14 -366,12 +473,12 @@@ void CartesianPlotDock::commentChanged( m_plot->setComment(ui.leComment->text()); } - void CartesianPlotDock::visibilityChanged(int state){ - if (m_initializing) - return; + void CartesianPlotDock::visibilityChanged(bool state){ - if (m_initializing) - return; ++ if (m_initializing) ++ return; - bool b = (state==Qt::Checked); - foreach(CartesianPlot* plot, m_plotList){ - plot->setVisible(b); - } - foreach(CartesianPlot* plot, m_plotList) - plot->setVisible(state); ++ foreach(CartesianPlot* plot, m_plotList) ++ plot->setVisible(state); } void CartesianPlotDock::geometryChanged(){ @@@ -872,18 -871,24 +978,24 @@@ void CartesianPlotDock::plotDescription } void CartesianPlotDock::plotRectChanged(QRectF& rect){ - m_initializing = true; - ui.sbLeft->setValue(Worksheet::convertFromSceneUnits(rect.x(), Worksheet::Centimeter)); - ui.sbTop->setValue(Worksheet::convertFromSceneUnits(rect.y(), Worksheet::Centimeter)); - ui.sbWidth->setValue(Worksheet::convertFromSceneUnits(rect.width(), Worksheet::Centimeter)); - ui.sbHeight->setValue(Worksheet::convertFromSceneUnits(rect.height(), Worksheet::Centimeter)); - m_initializing = false; + m_initializing = true; + ui.sbLeft->setValue(Worksheet::convertFromSceneUnits(rect.x(), Worksheet::Centimeter)); + ui.sbTop->setValue(Worksheet::convertFromSceneUnits(rect.y(), Worksheet::Centimeter)); + ui.sbWidth->setValue(Worksheet::convertFromSceneUnits(rect.width(), Worksheet::Centimeter)); + ui.sbHeight->setValue(Worksheet::convertFromSceneUnits(rect.height(), Worksheet::Centimeter)); + m_initializing = false; } + void CartesianPlotDock::plotXAutoScaleChanged(bool value) { + m_initializing = true; + ui.chkAutoScaleX->setChecked(value); + m_initializing = false; + } + void CartesianPlotDock::plotXMinChanged(float value){ - m_initializing = true; - ui.kleXMin->setText( QString::number(value) ); - m_initializing = false; + m_initializing = true; + ui.kleXMin->setText( QString::number(value) ); + m_initializing = false; } void CartesianPlotDock::plotXMaxChanged(float value){ @@@ -893,15 -898,22 +1005,22 @@@ } void CartesianPlotDock::plotXScaleChanged(int scale){ - m_initializing = true; - ui.cbXScaling->setCurrentIndex( scale ); - m_initializing = false; + m_initializing = true; + ui.cbXScaling->setCurrentIndex( scale ); + m_initializing = false; } + + void CartesianPlotDock::plotYAutoScaleChanged(bool value) { + m_initializing = true; + ui.chkAutoScaleY->setChecked(value); + m_initializing = false; + } + void CartesianPlotDock::plotYMinChanged(float value){ - m_initializing = true; - ui.kleYMin->setText( QString::number(value) ); - m_initializing = false; + m_initializing = true; + ui.kleYMin->setText( QString::number(value) ); + m_initializing = false; } void CartesianPlotDock::plotYMaxChanged(float value){ diff --cc src/kdefrontend/dockwidgets/XYCurveDock.cpp index a9d3c7a,c402798..16fb3cd --- a/src/kdefrontend/dockwidgets/XYCurveDock.cpp +++ b/src/kdefrontend/dockwidgets/XYCurveDock.cpp @@@ -392,9 -390,9 +392,10 @@@ void XYCurveDock::init() pa.begin(&pm); pa.setRenderHint(QPainter::Antialiasing); pa.translate(iconSize/2,iconSize/2); - pa.drawPath(trafo.map(XYCurve::symbolsPathFromStyle(style))); + pa.drawPath(trafo.map(Symbol::pathFromStyle(style))); pa.end(); - ui.cbSymbolStyle->addItem(QIcon(pm), XYCurve::symbolsNameFromStyle(style)); - ui.cbSymbolStyle->addItem(QIcon(pm), Symbol::nameFromStyle(style)); ++ ui.cbSymbolStyle->addItem(QIcon(pm), XYCurve::symbolsNameFromStyle(style)); ++ //ui.cbSymbolStyle->addItem(QIcon(pm), Symbol::nameFromStyle(style)); // Origin/master version } GuiTools::updateBrushStyles(ui.cbSymbolFillingStyle, Qt::black); _______________________________________________ kde-doc-english mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-doc-english
