-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc9a451
commit 8eb6aa9
Showing
10 changed files
with
509 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/*************************************************************************** | ||
qgsreportfieldgroupsectionwidget.cpp | ||
------------------------ | ||
begin : December 2017 | ||
copyright : (C) 2017 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsreportfieldgroupsectionwidget.h" | ||
#include "qgsreportsectionfieldgroup.h" | ||
#include "qgslayout.h" | ||
#include "qgslayoutdesignerdialog.h" | ||
|
||
QgsReportSectionFieldGroupWidget::QgsReportSectionFieldGroupWidget( QWidget *parent, QgsLayoutDesignerDialog *designer, QgsReportSectionFieldGroup *section ) | ||
: QWidget( parent ) | ||
, mSection( section ) | ||
, mDesigner( designer ) | ||
{ | ||
setupUi( this ); | ||
|
||
mLayerComboBox->setFilters( QgsMapLayerProxyModel::VectorLayer ); | ||
connect( mLayerComboBox, &QgsMapLayerComboBox::layerChanged, mFieldComboBox, &QgsFieldComboBox::setLayer ); | ||
connect( mButtonEditBody, &QPushButton::clicked, this, &QgsReportSectionFieldGroupWidget::editBody ); | ||
|
||
mLayerComboBox->setLayer( section->layer() ); | ||
mFieldComboBox->setField( section->field() ); | ||
mSortAscendingCheckBox->setChecked( section->sortAscending() ); | ||
|
||
connect( mSortAscendingCheckBox, &QCheckBox::toggled, this, &QgsReportSectionFieldGroupWidget::sortAscendingToggled ); | ||
connect( mLayerComboBox, &QgsMapLayerComboBox::layerChanged, this, &QgsReportSectionFieldGroupWidget::setLayer ); | ||
connect( mFieldComboBox, &QgsFieldComboBox::fieldChanged, this, &QgsReportSectionFieldGroupWidget::setField ); | ||
} | ||
|
||
void QgsReportSectionFieldGroupWidget::editBody() | ||
{ | ||
if ( !mSection->body() ) | ||
{ | ||
std::unique_ptr< QgsLayout > body = qgis::make_unique< QgsLayout >( mSection->project() ); | ||
body->initializeDefaults(); | ||
mSection->setBody( body.release() ); | ||
} | ||
|
||
if ( mSection->body() ) | ||
{ | ||
mSection->body()->reportContext().setLayer( mSection->layer() ); | ||
mDesigner->setCurrentLayout( mSection->body() ); | ||
} | ||
} | ||
|
||
void QgsReportSectionFieldGroupWidget::sortAscendingToggled( bool checked ) | ||
{ | ||
mSection->setSortAscending( checked ); | ||
} | ||
|
||
void QgsReportSectionFieldGroupWidget::setLayer( QgsMapLayer *layer ) | ||
{ | ||
QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( layer ); | ||
if ( !vl ) | ||
return; | ||
|
||
mSection->setLayer( vl ); | ||
if ( mSection->body() ) | ||
mSection->body()->reportContext().setLayer( mSection->layer() ); | ||
} | ||
|
||
void QgsReportSectionFieldGroupWidget::setField( const QString &field ) | ||
{ | ||
mSection->setField( field ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/*************************************************************************** | ||
qgsreportfieldgroupsectionwidget.h | ||
---------------------- | ||
begin : December 2017 | ||
copyright : (C) 2017 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSREPORTFIELDGROUPSECTIONWIDGET_H | ||
#define QGSREPORTFIELDGROUPSECTIONWIDGET_H | ||
|
||
#include "ui_qgsreportwidgetfieldgroupsectionbase.h" | ||
|
||
class QgsLayoutDesignerDialog; | ||
class QgsReportSectionFieldGroup; | ||
|
||
class QgsReportSectionFieldGroupWidget: public QWidget, private Ui::QgsReportWidgetFieldGroupSectionBase | ||
{ | ||
Q_OBJECT | ||
public: | ||
QgsReportSectionFieldGroupWidget( QWidget *parent, QgsLayoutDesignerDialog *designer, QgsReportSectionFieldGroup *section ); | ||
|
||
private slots: | ||
|
||
void editBody(); | ||
void sortAscendingToggled( bool checked ); | ||
void setLayer( QgsMapLayer *layer ); | ||
void setField( const QString &field ); | ||
|
||
private: | ||
|
||
QgsReportSectionFieldGroup *mSection = nullptr; | ||
QgsLayoutDesignerDialog *mDesigner = nullptr; | ||
|
||
}; | ||
|
||
#endif // QGSREPORTFIELDGROUPSECTIONWIDGET_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/*************************************************************************** | ||
qgsreportlayoutsectionwidget.cpp | ||
------------------------ | ||
begin : December 2017 | ||
copyright : (C) 2017 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsreportlayoutsectionwidget.h" | ||
#include "qgsreportsectionlayout.h" | ||
#include "qgslayout.h" | ||
#include "qgslayoutdesignerdialog.h" | ||
|
||
QgsReportLayoutSectionWidget::QgsReportLayoutSectionWidget( QWidget *parent, QgsLayoutDesignerDialog *designer, QgsReportSectionLayout *section ) | ||
: QWidget( parent ) | ||
, mSection( section ) | ||
, mDesigner( designer ) | ||
{ | ||
setupUi( this ); | ||
|
||
connect( mButtonEditBody, &QPushButton::clicked, this, &QgsReportLayoutSectionWidget::editBody ); | ||
} | ||
|
||
void QgsReportLayoutSectionWidget::editBody() | ||
{ | ||
if ( !mSection->body() ) | ||
{ | ||
std::unique_ptr< QgsLayout > body = qgis::make_unique< QgsLayout >( mSection->project() ); | ||
body->initializeDefaults(); | ||
mSection->setBody( body.release() ); | ||
} | ||
|
||
mDesigner->setCurrentLayout( mSection->body() ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/*************************************************************************** | ||
qgsreportlayoutsectionwidget.h | ||
---------------------- | ||
begin : December 2017 | ||
copyright : (C) 2017 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSREPORTLAYOUTSECTIONWIDGET_H | ||
#define QGSREPORTLAYOUTSECTIONWIDGET_H | ||
|
||
#include "ui_qgsreportwidgetlayoutsectionbase.h" | ||
|
||
class QgsLayoutDesignerDialog; | ||
class QgsReportSectionLayout; | ||
|
||
class QgsReportLayoutSectionWidget: public QWidget, private Ui::QgsReportWidgetLayoutSectionBase | ||
{ | ||
Q_OBJECT | ||
public: | ||
QgsReportLayoutSectionWidget( QWidget *parent, QgsLayoutDesignerDialog *designer, QgsReportSectionLayout *section ); | ||
|
||
private slots: | ||
|
||
void editBody(); | ||
|
||
private: | ||
|
||
QgsReportSectionLayout *mSection = nullptr; | ||
QgsLayoutDesignerDialog *mDesigner = nullptr; | ||
|
||
}; | ||
|
||
#endif // QGSREPORTLAYOUTSECTIONWIDGET_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.