Git commit ace936ed5e3cad7050216a50b3117e5cb343e9dd by Garvit Khatri. Committed on 04/01/2016 at 12:33. Pushed by garvitkhatri into branch 'frameworks'.
Merge branch 'master' into frameworks M +23 -23 doc/index.docbook R +1 -1 org.kde.labplot.appdata.xml M +12 -6 src/backend/core/AspectTreeModel.cpp M +9 -3 src/backend/matrix/Matrix.cpp M +10 -18 src/backend/spreadsheet/SpreadsheetModel.cpp M +8 -0 src/backend/worksheet/plots/cartesian/CartesianPlot.cpp M +31 -24 src/commonfrontend/datapicker/DatapickerImageView.cpp M +9 -1 src/commonfrontend/spreadsheet/SpreadsheetView.cpp M +9 -11 src/commonfrontend/worksheet/WorksheetView.cpp M +4 -1 src/kdefrontend/MainWin.cpp M +5 -4 src/kdefrontend/widgets/ImageWidget.cpp http://commits.kde.org/labplot/ace936ed5e3cad7050216a50b3117e5cb343e9dd diff --cc src/commonfrontend/datapicker/DatapickerImageView.cpp index d24210e,c70389f..05757bb --- a/src/commonfrontend/datapicker/DatapickerImageView.cpp +++ b/src/commonfrontend/datapicker/DatapickerImageView.cpp @@@ -457,25 -461,34 +461,36 @@@ void DatapickerImageView::mouseMoveEven if ( magnificationFactor && m_mouseMode == SelectAndEditMode && m_image->isLoaded && sceneRect().contains(pos) && m_image->plotPointsType() != DatapickerImage::SegmentPoints ) { - if (!m_image->m_magnificationWindow) { - m_image->m_magnificationWindow = new QGraphicsPixmapItem(0, scene()); + if (!m_image->m_magnificationWindow) { +// m_image->m_magnificationWindow = new QGraphicsPixmapItem(0, scene()); + m_image->m_magnificationWindow = new QGraphicsPixmapItem; + scene()->addItem(m_image->m_magnificationWindow); - m_image->m_magnificationWindow->setZValue(-1); + m_image->m_magnificationWindow->setZValue(std::numeric_limits<int>::max()); } - int size = 200/transform().m11(); - QImage imageSection = m_image->originalPlotImage.scaled(scene()->width(), scene()->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - imageSection = imageSection.copy(pos.x() - size/2, pos.y() - size/2, size, size); - imageSection = imageSection.scaled(size*magnificationFactor, size*magnificationFactor, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - imageSection = imageSection.copy(imageSection.width()/2 - size/2, imageSection.height()/2 - size/2, size, size); - QPainter painter(&imageSection); - painter.setPen(QPen(Qt::lightGray, 2/transform().m11())); - painter.drawRect(imageSection.rect()); + m_image->m_magnificationWindow->setVisible(false); + + //copy the part of the view to be shown magnified + int size = Worksheet::convertToSceneUnits(2.0, Worksheet::Centimeter)/transform().m11(); + QRectF copyRect(pos.x() - size/2, pos.y() - size/2, size, size); + QPixmap px = QPixmap::grabWidget(this, mapFromScene(copyRect).boundingRect()); + px = px.scaled(size*magnificationFactor, size*magnificationFactor, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + px = px.copy(px.width()/2 - size/2, px.height()/2 - size/2, size, size); + + //draw the bounding rect + QPainter painter(&px); + QPen pen = QPen(Qt::lightGray, 2/transform().m11()); + painter.setPen(pen); + QRect rect = px.rect(); + rect.setWidth(rect.width()-pen.widthF()/2); + rect.setHeight(rect.height()-pen.widthF()/2); + painter.drawRect(rect); + + //set the pixmap + m_image->m_magnificationWindow->setPixmap(px); + m_image->m_magnificationWindow->setPos(pos.x()- px.width()/2, pos.y()- px.height()/2); m_image->m_magnificationWindow->setVisible(true); - m_image->m_magnificationWindow->setPixmap(QPixmap::fromImage(imageSection)); - m_image->m_magnificationWindow->setPos(pos.x()- imageSection.width()/2, pos.y()- imageSection.height()/2); } else if (m_image->m_magnificationWindow) { m_image->m_magnificationWindow->setVisible(false); } diff --cc src/commonfrontend/worksheet/WorksheetView.cpp index d2c7086,24f44a0..7f9015a --- a/src/commonfrontend/worksheet/WorksheetView.cpp +++ b/src/commonfrontend/worksheet/WorksheetView.cpp @@@ -59,58 -59,56 +59,56 @@@ Creates a view for the Worksheet \c worksheet and initializes the internal model. */ WorksheetView::WorksheetView(Worksheet* worksheet) : QGraphicsView(), - m_worksheet(worksheet), - m_mouseMode(SelectionMode), - m_cartesianPlotActionMode(ApplyActionToSelection), - m_cartesianPlotMouseMode(CartesianPlot::SelectionMode), - m_selectionBandIsShown(false), - m_suppressSelectionChangedEvent(false), - lastAddedWorksheetElement(0), - m_fadeInTimeLine(0), - m_fadeOutTimeLine(0), - tbNewCartesianPlot(0), - tbZoom(0) { - - setScene(m_worksheet->scene()); - - setRenderHint(QPainter::Antialiasing); - setRubberBandSelectionMode(Qt::ContainsItemBoundingRect); - setTransformationAnchor(QGraphicsView::AnchorUnderMouse); - setResizeAnchor(QGraphicsView::AnchorViewCenter); - setMinimumSize(16, 16); - setFocusPolicy(Qt::StrongFocus); - - if (m_worksheet->useViewSize()) { - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - } + m_worksheet(worksheet), + m_mouseMode(SelectionMode), + m_cartesianPlotActionMode(ApplyActionToSelection), + m_cartesianPlotMouseMode(CartesianPlot::SelectionMode), + m_selectionBandIsShown(false), + m_suppressSelectionChangedEvent(false), + lastAddedWorksheetElement(0), + m_fadeInTimeLine(0), + m_fadeOutTimeLine(0), + tbNewCartesianPlot(0), + tbZoom(0) { + + setScene(m_worksheet->scene()); + + setRenderHint(QPainter::Antialiasing); + setRubberBandSelectionMode(Qt::ContainsItemBoundingRect); + setTransformationAnchor(QGraphicsView::AnchorUnderMouse); + setResizeAnchor(QGraphicsView::AnchorViewCenter); + setMinimumSize(16, 16); + setFocusPolicy(Qt::StrongFocus); + + if (m_worksheet->useViewSize()) { + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + } - viewport()->setAttribute( Qt::WA_OpaquePaintEvent ); - viewport()->setAttribute( Qt::WA_NoSystemBackground ); + viewport()->setAttribute( Qt::WA_OpaquePaintEvent ); + viewport()->setAttribute( Qt::WA_NoSystemBackground ); // setAcceptDrops( true ); - setCacheMode(QGraphicsView::CacheBackground); + setCacheMode(QGraphicsView::CacheBackground); - m_gridSettings.style = WorksheetView::NoGrid; + m_gridSettings.style = WorksheetView::NoGrid; - initActions(); - initMenus(); - selectionModeAction->setChecked(true); - handleCartesianPlotActions(); + initActions(); + initMenus(); + selectionModeAction->setChecked(true); + handleCartesianPlotActions(); - changeZoom(zoomOriginAction); - currentZoomAction=zoomInViewAction; + changeZoom(zoomOriginAction); + currentZoomAction=zoomInViewAction; - //signal/slot connections - connect(m_worksheet, SIGNAL(requestProjectContextMenu(QMenu*)), this, SLOT(createContextMenu(QMenu*))); - connect(m_worksheet, SIGNAL(itemSelected(QGraphicsItem*)), this, SLOT(selectItem(QGraphicsItem*)) ); - connect(m_worksheet, SIGNAL(itemDeselected(QGraphicsItem*)), this, SLOT(deselectItem(QGraphicsItem*)) ); - connect(m_worksheet, SIGNAL(itemSelected(QGraphicsItem*)), this, SLOT(selectItem(QGraphicsItem*)) ); - connect(m_worksheet, SIGNAL(itemDeselected(QGraphicsItem*)), this, SLOT(deselectItem(QGraphicsItem*)) ); - connect(m_worksheet, SIGNAL(requestUpdate()), this, SLOT(updateBackground()) ); - connect(m_worksheet, SIGNAL(aspectAboutToBeRemoved(const AbstractAspect*)), this, SLOT(aspectAboutToBeRemoved(const AbstractAspect*))); - connect(m_worksheet, SIGNAL(useViewSizeRequested()), this, SLOT(useViewSizeRequested()) ); - connect(m_worksheet, SIGNAL(layoutChanged(Worksheet::Layout)), this, SLOT(layoutChanged(Worksheet::Layout)) ); - connect(scene(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged()) ); + //signal/slot connections + connect(m_worksheet, SIGNAL(requestProjectContextMenu(QMenu*)), this, SLOT(createContextMenu(QMenu*))); + connect(m_worksheet, SIGNAL(itemSelected(QGraphicsItem*)), this, SLOT(selectItem(QGraphicsItem*)) ); + connect(m_worksheet, SIGNAL(itemDeselected(QGraphicsItem*)), this, SLOT(deselectItem(QGraphicsItem*)) ); + connect(m_worksheet, SIGNAL(requestUpdate()), this, SLOT(updateBackground()) ); + connect(m_worksheet, SIGNAL(aspectAboutToBeRemoved(const AbstractAspect*)), this, SLOT(aspectAboutToBeRemoved(const AbstractAspect*))); + connect(m_worksheet, SIGNAL(useViewSizeRequested()), this, SLOT(useViewSizeRequested()) ); + connect(m_worksheet, SIGNAL(layoutChanged(Worksheet::Layout)), this, SLOT(layoutChanged(Worksheet::Layout)) ); + connect(scene(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged()) ); } void WorksheetView::initActions(){ diff --cc src/kdefrontend/MainWin.cpp index 695cbce,68c4f84..984e625 --- a/src/kdefrontend/MainWin.cpp +++ b/src/kdefrontend/MainWin.cpp @@@ -153,13 -153,16 +153,16 @@@ void MainWin::initGUI(const QString& fi setAttribute( Qt::WA_DeleteOnClose ); //make the status bar of a fixed size in order to avoid height changes when placing a ProgressBar there. - statusBar()->setFixedHeight(statusBar()->height()); + QFont font; + font.setFamily(font.defaultFamily()); + QFontMetrics fm(font); + statusBar()->setFixedHeight(fm.height()); //load recently used projects - m_recentProjectsAction->loadEntries( KGlobal::config()->group("Recent Files") ); + m_recentProjectsAction->loadEntries( KSharedConfig::openConfig()->group("Recent Files") ); //set the view mode of the mdi area - KConfigGroup group = KGlobal::config()->group("General"); + KConfigGroup group = KSharedConfig::openConfig()->group("General"); int viewMode = group.readEntry("ViewMode", 0); if (viewMode == 1) { m_mdiArea->setViewMode(QMdiArea::TabbedView); _______________________________________________ kde-doc-english mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-doc-english
