diff --git a/examples/DesignerWidget.cpp b/examples/DesignerWidget.cpp --- a/examples/DesignerWidget.cpp +++ b/examples/DesignerWidget.cpp @@ -111,7 +111,7 @@ void ReportDesignerWidget::slotDesignerPropertySetChanged() { if (m_propertyEditor) { - m_propertyEditor->changeSet(m_reportDesigner->itemPropertySet()); + m_propertyEditor->changeSet(m_reportDesigner->selectedItemPropertySet()); } } diff --git a/src/items/check/KReportItemCheck.h b/src/items/check/KReportItemCheck.h --- a/src/items/check/KReportItemCheck.h +++ b/src/items/check/KReportItemCheck.h @@ -51,7 +51,7 @@ KProperty* m_staticValue; bool value() const; - void setValue(bool); + void setValue(bool v); KReportLineStyle lineStyle(); private: diff --git a/src/plugins/chart/KReportItemChart.h b/src/plugins/chart/KReportItemChart.h --- a/src/plugins/chart/KReportItemChart.h +++ b/src/plugins/chart/KReportItemChart.h @@ -96,12 +96,12 @@ KDChart::Widget *m_chartWidget; - void set3D(bool); - void setAA(bool); - void setColorScheme(const QString &); - void setAxis(const QString&, const QString&); + void set3D(bool td); + void setAA(bool aa); + void setColorScheme(const QString &cs); + void setAxis(const QString &xa, const QString &ya); void setBackgroundColor(const QColor&); - void setLegend(bool, const QStringList &legends = QStringList()); + void setLegend(bool le, const QStringList &legends = QStringList()); private: virtual void createProperties(); diff --git a/src/plugins/chart/KReportScriptChart.h b/src/plugins/chart/KReportScriptChart.h --- a/src/plugins/chart/KReportScriptChart.h +++ b/src/plugins/chart/KReportScriptChart.h @@ -86,7 +86,7 @@ * Set the 3d status of the chart * @param 3d */ - void setThreeD(bool); + void setThreeD(bool td); /** * The visibility status of the legend @@ -98,7 +98,7 @@ * Sets the visibility of the legend * @param visible */ - void setLegendVisible(bool); + void setLegendVisible(bool v); /** * The color scheme used by the chart diff --git a/src/renderer/KReportPreRenderer.cpp b/src/renderer/KReportPreRenderer.cpp --- a/src/renderer/KReportPreRenderer.cpp +++ b/src/renderer/KReportPreRenderer.cpp @@ -73,7 +73,7 @@ { //kreportDebug(); if (m_pageCounter > 0) - finishCurPage(); + finishCurPage(false); m_pageCounter++; @@ -231,7 +231,7 @@ grp = detailData->m_groupList[shownGroups.at(i)]; if (grp->m_groupFooter) { - if (renderSectionSize(*(grp->m_groupFooter)) + finishCurPageSize() + m_bottomMargin + m_yOffset >= m_maxHeight) + if (renderSectionSize(*(grp->m_groupFooter)) + finishCurPageSize(false) + m_bottomMargin + m_yOffset >= m_maxHeight) createNewPage(); renderSection(*(grp->m_groupFooter)); } @@ -249,7 +249,7 @@ grp = detailData->m_groupList[shownGroups.at(i)]; if (grp->m_groupHeader) { - if (renderSectionSize(*(grp->m_groupHeader)) + finishCurPageSize() + m_bottomMargin + m_yOffset >= m_maxHeight) { + if (renderSectionSize(*(grp->m_groupHeader)) + finishCurPageSize(false) + m_bottomMargin + m_yOffset >= m_maxHeight) { m_dataSource->movePrevious(); createNewPage(); m_dataSource->moveNext(); @@ -277,7 +277,7 @@ grp = detailData->m_groupList[shownGroups.at(i)]; if (grp->m_groupFooter) { - if (renderSectionSize(*(grp->m_groupFooter)) + finishCurPageSize() + m_bottomMargin + m_yOffset >= m_maxHeight) + if (renderSectionSize(*(grp->m_groupFooter)) + finishCurPageSize(false) + m_bottomMargin + m_yOffset >= m_maxHeight) createNewPage(); renderSection(*(grp->m_groupFooter)); emit(exitedGroup(keys[i], keyValues[i])); diff --git a/src/renderer/KReportPreRenderer_p.h b/src/renderer/KReportPreRenderer_p.h --- a/src/renderer/KReportPreRenderer_p.h +++ b/src/renderer/KReportPreRenderer_p.h @@ -69,8 +69,8 @@ #endif void createNewPage(); - qreal finishCurPage(bool = false); - qreal finishCurPageSize(bool = false); + qreal finishCurPage(bool lastPage); + qreal finishCurPageSize(bool lastPage); void renderDetailSection(KReportDetailSectionData *detailData); qreal renderSection(const KReportSectionData &); diff --git a/src/wrtembed/KReportDesigner.h b/src/wrtembed/KReportDesigner.h --- a/src/wrtembed/KReportDesigner.h +++ b/src/wrtembed/KReportDesigner.h @@ -1,7 +1,7 @@ /* This file is part of the KDE project * Copyright (C) 2001-2007 by OpenMFG, LLC * Copyright (C) 2007-2008 by Adam Pigg - * Copyright (C) 2011 Jarosław Staniek + * Copyright (C) 2011-2017 Jarosław Staniek * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -34,7 +34,6 @@ class QGraphicsSceneContextMenuEvent; class QString; -class KReportZoomHandler; class KReportDesignerSectionDetail; class KReportDesignerSection; class KReportUnit; @@ -90,6 +89,13 @@ KReportDesignerSection* section(KReportSectionData::Section) const; /** + @brief Creates new section + @return Pointer to a new report section section object, ownership is transferred to + the caller + */ + KReportDesignerSection* createSection() Q_REQUIRED_RESULT; + + /** @brief Deletes the section specified @param section KReportSectionData::Section enum value of the section to return */ @@ -177,11 +183,6 @@ virtual QSize sizeHint() const; /** - @brief Return a pointer to the zoom handler - */ - KReportZoomHandler* zoomHandler() const; - - /** @brief Return the current unit assigned to the report */ KReportUnit pageUnit() const; @@ -208,13 +209,13 @@ /** @brief Return the property set for the curently selected item */ - KPropertySet* itemPropertySet() const; + KPropertySet* selectedItemPropertySet() const; /** @brief Sets the modified status, defaulting to true for modified @param modified Modified status */ - void setModified(bool = true); + void setModified(bool modified); /** @brief Return a unique name that can be used by the entity diff --git a/src/wrtembed/KReportDesigner.cpp b/src/wrtembed/KReportDesigner.cpp --- a/src/wrtembed/KReportDesigner.cpp +++ b/src/wrtembed/KReportDesigner.cpp @@ -1,7 +1,7 @@ /* This file is part of the KDE project * Copyright (C) 2001-2007 by OpenMFG, LLC * Copyright (C) 2007-2010 by Adam Pigg - * Copyright (C) 2011 Jarosław Staniek + * Copyright (C) 2011-2017 Jarosław Staniek * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -96,7 +96,7 @@ int selected_y_offset; MouseAction mouseAction; - QString insertItem; + QString itemToInsert; QList copy_list; QList cut_list; @@ -110,21 +110,18 @@ ~Private() { - delete zoom; - delete sectionData; - delete set; delete dataSource; } QGridLayout *grid; KReportRuler *hruler; - KReportZoomHandler *zoom; + KReportZoomHandler zoomHandler; QVBoxLayout *vboxlayout; KReportPropertiesButton *pageButton; QGraphicsScene *activeScene = nullptr; - ReportWriterSectionData *sectionData; + ReportWriterSectionData sectionData; KReportDesignerSection *reportHeader = nullptr; KReportDesignerSection *pageHeaderFirst = nullptr; @@ -142,8 +139,8 @@ KReportDesignerSectionDetail *detail = nullptr; //Properties - KPropertySet *set; - KPropertySet *itmset; + KPropertySet set; + KPropertySet *itemSet; KProperty *title; KProperty *pageSize; KProperty *orientation; @@ -195,7 +192,6 @@ { KReportPluginManager::self(); // this loads icons early enough - d->sectionData = new ReportWriterSectionData(); createProperties(); createActions(); @@ -212,8 +208,7 @@ d->vboxlayout->setSizeConstraint(QLayout::SetFixedSize); //Create nice rulers - d->zoom = new KReportZoomHandler(); - d->hruler = new KReportRuler(this, Qt::Horizontal, d->zoom); + d->hruler = new KReportRuler(this, Qt::Horizontal, d->zoomHandler); d->pageButton = new KReportPropertiesButton(this); @@ -232,12 +227,12 @@ setLayout(d->grid); connect(d->pageButton, SIGNAL(released()), this, SLOT(slotPageButton_Pressed())); - emit pagePropertyChanged(*d->set); + emit pagePropertyChanged(d->set); - connect(d->set, SIGNAL(propertyChanged(KPropertySet&,KProperty&)), + connect(&d->set, SIGNAL(propertyChanged(KPropertySet&,KProperty&)), this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&))); - changeSet(d->set); + changeSet(&d->set); } KReportDesigner::~KReportDesigner() @@ -343,7 +338,7 @@ } this->slotPageButton_Pressed(); emit reportDataChanged(); - slotPropertyChanged(*d->set, *d->unit); // set unit for all items + slotPropertyChanged(d->set, *d->unit); // set unit for all items setModified(false); } @@ -499,6 +494,12 @@ } return sec; } + +KReportDesignerSection* KReportDesigner::createSection() +{ + return new KReportDesignerSection(this, d->zoomHandler); +} + void KReportDesigner::removeSection(KReportSectionData::Section s) { KReportDesignerSection* sec = section(s); @@ -563,7 +564,7 @@ if (s > KReportSectionData::ReportHeader) idx++; //kreportDebug() << idx; - KReportDesignerSection *rs = new KReportDesignerSection(this); + KReportDesignerSection *rs = createSection(); d->vboxlayout->insertWidget(idx, rs); switch (s) { @@ -626,7 +627,7 @@ rs->show(); setModified(true); adjustSize(); - emit pagePropertyChanged(*d->set); + emit pagePropertyChanged(d->set); } } @@ -638,14 +639,14 @@ } } -KPropertySet * KReportDesigner::propertySet() const +KPropertySet* KReportDesigner::propertySet() const { - return d->set; + return &d->set; } -KPropertySet* KReportDesigner::itemPropertySet() const +KPropertySet* KReportDesigner::selectedItemPropertySet() const { - return d->itmset; + return d->itemSet; } KReportDataSource *KReportDesigner::reportDataSource() const @@ -668,9 +669,9 @@ return d->modified; } -void KReportDesigner::setModified(bool mod) +void KReportDesigner::setModified(bool modified) { - d->modified = mod; + d->modified = modified; if (d->modified) { emit dirty(); @@ -700,11 +701,10 @@ void KReportDesigner::createProperties() { QStringList keys, strings; - d->set = new KPropertySet; - KReportDesigner::addMetaProperties(d->set, + KReportDesigner::addMetaProperties(&d->set, tr("Report", "Main report element"), QLatin1String("kreport-report-element")); - connect(d->set, SIGNAL(propertyChanged(KPropertySet&,KProperty&)), + connect(&d->set, SIGNAL(propertyChanged(KPropertySet&,KProperty&)), this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&))); d->title = new KProperty("title", QLatin1String("Report"), tr("Title"), tr("Report Title")); @@ -748,21 +748,21 @@ d->topMargin->setOption("unit", QLatin1String("cm")); d->bottomMargin->setOption("unit", QLatin1String("cm")); - d->set->addProperty(d->title); - d->set->addProperty(d->pageSize); - d->set->addProperty(d->orientation); - d->set->addProperty(d->unit); - d->set->addProperty(d->gridSnap); - d->set->addProperty(d->showGrid); - d->set->addProperty(d->gridDivisions); - d->set->addProperty(d->leftMargin); - d->set->addProperty(d->rightMargin); - d->set->addProperty(d->topMargin); - d->set->addProperty(d->bottomMargin); + d->set.addProperty(d->title); + d->set.addProperty(d->pageSize); + d->set.addProperty(d->orientation); + d->set.addProperty(d->unit); + d->set.addProperty(d->gridSnap); + d->set.addProperty(d->showGrid); + d->set.addProperty(d->gridDivisions); + d->set.addProperty(d->leftMargin); + d->set.addProperty(d->rightMargin); + d->set.addProperty(d->topMargin); + d->set.addProperty(d->bottomMargin); #ifdef KREPORT_SCRIPTING d->script = new KProperty("script", QStringList(), QStringList(), QString(), tr("Object Script")); - d->set->addProperty(d->script); + d->set.addProperty(d->script); #endif // KProperty* _customHeight; @@ -780,12 +780,12 @@ if (p.name() == "page-unit") { d->hruler->setUnit(pageUnit()); - QString newstr = d->set->property("page-unit").value().toString(); + QString newstr = d->set.property("page-unit").value().toString(); - d->set->property("margin-left").setOption("unit", newstr); - d->set->property("margin-right").setOption("unit", newstr); - d->set->property("margin-top").setOption("unit", newstr); - d->set->property("margin-bottom").setOption("unit", newstr); + d->set.property("margin-left").setOption("unit", newstr); + d->set.property("margin-right").setOption("unit", newstr); + d->set.property("margin-top").setOption("unit", newstr); + d->set.property("margin-bottom").setOption("unit", newstr); } } @@ -797,7 +797,7 @@ sl.prepend(QLatin1String("")); d->script->setListData(sl, sl); } - changeSet(d->set); + changeSet(&d->set); #endif } @@ -844,13 +844,16 @@ int KReportDesigner::pageWidthPx() const { - QPageLayout layout = QPageLayout(QPageSize(KReportPageSize::pageSize(d->set->property("page-size").value().toString())), d->set->property("print-orientation").value().toString() == QLatin1String("portrait") ? QPageLayout::Portrait : QPageLayout::Landscape, QMarginsF(0,0,0,0));; + QPageLayout layout = QPageLayout( + QPageSize(KReportPageSize::pageSize(d->set.property("page-size").value().toString())), + d->set.property("print-orientation").value().toString() + == QLatin1String("portrait") ? QPageLayout::Portrait : QPageLayout::Landscape, QMarginsF(0,0,0,0)); QSize pageSizePx = layout.fullRectPixels(KReportPrivate::dpiX()).size(); int width = pageSizePx.width(); - width = width - POINT_TO_INCH(d->set->property("margin-left").value().toDouble()) * KReportPrivate::dpiX(); - width = width - POINT_TO_INCH(d->set->property("margin-right").value().toDouble()) * KReportPrivate::dpiX(); + width = width - POINT_TO_INCH(d->set.property("margin-left").value().toDouble()) * KReportPrivate::dpiX(); + width = width - POINT_TO_INCH(d->set.property("margin-right").value().toDouble()) * KReportPrivate::dpiX(); return width; } @@ -922,7 +925,7 @@ connect(a, SIGNAL(triggered()), this, SLOT(slotEditCopy())); pop.addAction(a); } - if (!d->sectionData->copy_list.isEmpty()) { + if (!d->sectionData.copy_list.isEmpty()) { QAction *a = new QAction(QIcon::fromTheme(QLatin1String("edit-paste")), tr("Paste"), this); connect(a, SIGNAL(triggered()), this, SLOT(slotEditPaste())); pop.addAction(a); @@ -970,18 +973,18 @@ end.setX(v->scene()->width()); } - if (d->sectionData->mouseAction == ReportWriterSectionData::MA_Insert) { + if (d->sectionData.mouseAction == ReportWriterSectionData::MA_Insert) { QGraphicsItem * item = 0; QString classString; QString iconName; - if (d->sectionData->insertItem == QLatin1String("org.kde.kreport.line")) { + if (d->sectionData.itemToInsert == QLatin1String("org.kde.kreport.line")) { item = new KReportDesignerItemLine(v->designer(), v->scene(), pos, end); classString = tr("Line", "Report line element"); iconName = QLatin1String("kreport-line-element"); } else { KReportPluginManager* pluginManager = KReportPluginManager::self(); - KReportPluginInterface *plug = pluginManager->plugin(d->sectionData->insertItem); + KReportPluginInterface *plug = pluginManager->plugin(d->sectionData.itemToInsert); if (plug) { QObject *obj = plug->createDesignerInstance(v->designer(), v->scene(), pos); if (obj) { @@ -1006,12 +1009,12 @@ if (v && v->designer()) { v->designer()->setModified(true); } - emit itemInserted(d->sectionData->insertItem); + emit itemInserted(d->sectionData.itemToInsert); } } - d->sectionData->mouseAction = ReportWriterSectionData::MA_None; - d->sectionData->insertItem.clear(); + d->sectionData.mouseAction = ReportWriterSectionData::MA_None; + d->sectionData.itemToInsert.clear(); unsetSectionCursor(); } } @@ -1028,12 +1031,12 @@ void KReportDesigner::changeSet(KPropertySet *s) { //Set the checked state of the report properties button - if (s == d->set) + if (s == &d->set) d->pageButton->setCheckState(Qt::Checked); else d->pageButton->setCheckState(Qt::Unchecked); - d->itmset = s; + d->itemSet = s; emit propertySetChanged(); } @@ -1044,8 +1047,8 @@ void KReportDesigner::slotItem(const QString &entity) { //kreportDebug() << entity; - d->sectionData->mouseAction = ReportWriterSectionData::MA_Insert; - d->sectionData->insertItem = entity; + d->sectionData.mouseAction = ReportWriterSectionData::MA_Insert; + d->sectionData.itemToInsert = entity; setSectionCursor(QCursor(Qt::CrossCursor)); } @@ -1059,7 +1062,7 @@ QGraphicsScene * scene = item->scene(); delete item; scene->update(); - d->sectionData->mouseAction = ReportWriterSectionData::MA_None; + d->sectionData.mouseAction = ReportWriterSectionData::MA_None; modified = true; } } @@ -1069,8 +1072,8 @@ if weve deleted something in the list should really check if an item is in the list first and remove it. */ - d->sectionData->cut_list.clear(); - d->sectionData->copy_list.clear(); + d->sectionData.cut_list.clear(); + d->sectionData.copy_list.clear(); if (modified) { setModified(true); } @@ -1081,24 +1084,24 @@ if (selectionCount() > 0) { //First delete any items that are curerntly in the list //so as not to leak memory - qDeleteAll(d->sectionData->cut_list); - d->sectionData->cut_list.clear(); + qDeleteAll(d->sectionData.cut_list); + d->sectionData.cut_list.clear(); QGraphicsItem * item = activeScene()->selectedItems().first(); bool modified = false; if (item) { - d->sectionData->copy_list.clear(); + d->sectionData.copy_list.clear(); foreach(QGraphicsItem *item, activeScene()->selectedItems()) { - d->sectionData->cut_list.append(dynamic_cast(item)); - d->sectionData->copy_list.append(dynamic_cast(item)); + d->sectionData.cut_list.append(dynamic_cast(item)); + d->sectionData.copy_list.append(dynamic_cast(item)); } foreach(QGraphicsItem *item, activeScene()->selectedItems()) { activeScene()->removeItem(item); activeScene()->update(); modified = true; } - d->sectionData->selected_x_offset = 10; - d->sectionData->selected_y_offset = 10; + d->sectionData.selected_x_offset = 10; + d->sectionData.selected_y_offset = 10; } if (modified) { setModified(true); @@ -1113,12 +1116,12 @@ QGraphicsItem * item = activeScene()->selectedItems().first(); if (item) { - d->sectionData->copy_list.clear(); + d->sectionData.copy_list.clear(); foreach(QGraphicsItem *item, activeScene()->selectedItems()) { - d->sectionData->copy_list.append(dynamic_cast(item)); + d->sectionData.copy_list.append(dynamic_cast(item)); } - d->sectionData->selected_x_offset = 10; - d->sectionData->selected_y_offset = 10; + d->sectionData.selected_x_offset = 10; + d->sectionData.selected_y_offset = 10; } } @@ -1132,19 +1135,19 @@ { // paste a new item of the copy we have in the specified location - if (!d->sectionData->copy_list.isEmpty()) { + if (!d->sectionData.copy_list.isEmpty()) { QList activeItems = canvas->selectedItems(); QGraphicsItem *activeItem = 0; if (activeItems.count() == 1) { activeItem = activeItems.first(); } canvas->clearSelection(); - d->sectionData->mouseAction = ReportWriterSectionData::MA_None; + d->sectionData.mouseAction = ReportWriterSectionData::MA_None; //! @todo this code sucks :) //! The setPos calls only work AFTER the name has been set ?!?!? - foreach(KReportDesignerItemBase *item, d->sectionData->copy_list) { + foreach(KReportDesignerItemBase *item, d->sectionData.copy_list) { KReportItemBase *obj = dynamic_cast(item); const QString type = obj ? obj->typeName() : QLatin1String("object"); //kreportDebug() << type; @@ -1164,7 +1167,7 @@ pasted_ent->setSelected(true); canvas->addItem(pasted_ent); pasted_ent->show(); - d->sectionData->mouseAction = ReportWriterSectionData::MA_Grab; + d->sectionData.mouseAction = ReportWriterSectionData::MA_Grab; setModified(true); } } @@ -1195,11 +1198,6 @@ update(); } -KReportZoomHandler* KReportDesigner::zoomHandler() const -{ - return d->zoom; -} - QString KReportDesigner::suggestEntityName(const QString &n) const { KReportDesignerSection *sec; diff --git a/src/wrtembed/KReportDesignerSection.h b/src/wrtembed/KReportDesignerSection.h --- a/src/wrtembed/KReportDesignerSection.h +++ b/src/wrtembed/KReportDesignerSection.h @@ -35,6 +35,7 @@ class KProperty; class KReportDesigner; +class KReportZoomHandler; // // Class ReportSection @@ -46,7 +47,6 @@ { Q_OBJECT public: - explicit KReportDesignerSection(KReportDesigner * rptdes); virtual ~KReportDesignerSection(); void setTitle(const QString & s); @@ -70,6 +70,10 @@ protected Q_SLOTS: void slotResizeBarDragged(int delta); +protected: + explicit KReportDesignerSection(KReportDesigner * rptdes, + const KReportZoomHandler &zoomHandler); + private Q_SLOTS: void slotPageOptionsChanged(KPropertySet &); void slotSceneClicked(); @@ -79,6 +83,7 @@ Q_DISABLE_COPY(KReportDesignerSection) class Private; Private * const d; + friend class KReportDesigner; friend class KReportDesignerSectionTitle; }; diff --git a/src/wrtembed/KReportDesignerSection.cpp b/src/wrtembed/KReportDesignerSection.cpp --- a/src/wrtembed/KReportDesignerSection.cpp +++ b/src/wrtembed/KReportDesignerSection.cpp @@ -97,7 +97,8 @@ }; -KReportDesignerSection::KReportDesignerSection(KReportDesigner * rptdes) +KReportDesignerSection::KReportDesignerSection(KReportDesigner * rptdes, + const KReportZoomHandler &zoomHandler) : QWidget(rptdes) , d(new Private()) { @@ -123,7 +124,7 @@ d->title->setObjectName(QLatin1String("detail")); d->title->setText(tr("Detail")); - d->sectionRuler = new KReportRuler(this, Qt::Vertical, d->reportDesigner->zoomHandler()); + d->sectionRuler = new KReportRuler(this, Qt::Vertical, zoomHandler); d->sectionRuler->setUnit(d->reportDesigner->pageUnit()); d->scene = new KReportDesignerSectionScene(d->reportDesigner->pageWidthPx(), d->dpiY, rptdes); d->scene->setBackgroundBrush(d->sectionData->backgroundColor()); diff --git a/src/wrtembed/KReportDesignerSectionDetail.cpp b/src/wrtembed/KReportDesignerSectionDetail.cpp --- a/src/wrtembed/KReportDesignerSectionDetail.cpp +++ b/src/wrtembed/KReportDesignerSectionDetail.cpp @@ -53,7 +53,7 @@ d->vboxlayout->setSpacing(0); d->vboxlayout->setMargin(0); d->reportDesigner = rptdes; - d->detail = new KReportDesignerSection(rptdes /*, this*/); + d->detail = d->reportDesigner->createSection(); d->vboxlayout->addWidget(d->detail); this->setLayout(d->vboxlayout); diff --git a/src/wrtembed/KReportDesignerSectionDetailGroup.cpp b/src/wrtembed/KReportDesignerSectionDetailGroup.cpp --- a/src/wrtembed/KReportDesignerSectionDetailGroup.cpp +++ b/src/wrtembed/KReportDesignerSectionDetailGroup.cpp @@ -59,8 +59,8 @@ return; } KReportDesigner * rd = rsd->reportDesigner(); - d->groupHeader = new KReportDesignerSection(rd /*, _rsd*/); - d->groupFooter = new KReportDesignerSection(rd /*, _rsd*/); + d->groupHeader = rd->createSection(); + d->groupFooter = rd->createSection(); setGroupHeaderVisible(false); setGroupFooterVisible(false); setColumn(column); diff --git a/src/wrtembed/KReportRuler.cpp b/src/wrtembed/KReportRuler.cpp --- a/src/wrtembed/KReportRuler.cpp +++ b/src/wrtembed/KReportRuler.cpp @@ -662,10 +662,11 @@ } } -KReportRulerPrivate::KReportRulerPrivate(KReportRuler *parent, const KReportZoomHandler *vc, Qt::Orientation o) +KReportRulerPrivate::KReportRulerPrivate(KReportRuler *parent, + const KReportZoomHandler &zoomHandler, Qt::Orientation o) : unit(KReportUnit(KReportUnit::Point)), orientation(o), - viewConverter(vc), + viewConverter(&zoomHandler), offset(0), rulerLength(0), activeRangeStart(0), @@ -821,9 +822,10 @@ } -KReportRuler::KReportRuler(QWidget* parent, Qt::Orientation orientation, const KReportZoomHandler* viewConverter) +KReportRuler::KReportRuler(QWidget* parent, Qt::Orientation orientation, + const KReportZoomHandler &zoomHandler) : QWidget(parent) - , d( new KReportRulerPrivate( this, viewConverter, orientation) ) + , d(new KReportRulerPrivate(this, zoomHandler, orientation)) { setMouseTracking( true ); } diff --git a/src/wrtembed/KReportRuler_p.h b/src/wrtembed/KReportRuler_p.h --- a/src/wrtembed/KReportRuler_p.h +++ b/src/wrtembed/KReportRuler_p.h @@ -144,7 +144,8 @@ * @param orientation the orientation of the ruler * @param viewConverter the view converter used to convert from point to pixel */ - KReportRuler(QWidget* parent, Qt::Orientation orientation, const KReportZoomHandler* viewConverter); + KReportRuler(QWidget* parent, Qt::Orientation orientation, + const KReportZoomHandler &zoomHandler); ~KReportRuler(); /// For paragraphs each tab definition is represented by this struct. @@ -365,7 +366,7 @@ class KReportRulerPrivate { public: - KReportRulerPrivate(KReportRuler *parent, const KReportZoomHandler *vc, Qt::Orientation orientation); + KReportRulerPrivate(KReportRuler *parent, const KReportZoomHandler &zoomHandler, Qt::Orientation orientation); ~KReportRulerPrivate(); void emitTabChanged();