Skip to content
Permalink
Browse files

Merge pull request #33844 from kadas-albireo/composergui

Move layout classes to GUI, except for QgsLayoutDesignerDialog
  • Loading branch information
manisandro committed Jan 20, 2020
2 parents d39b6ac + 6e7009a commit 1bf50cf0409e9bf5465d75eab870f5a0c9531434
Showing with 649 additions and 237 deletions.
  1. +1 −28 src/app/CMakeLists.txt
  2. +1 −0 src/app/layout/qgslayout3dmapwidget.h
  3. +1 −2 src/app/layout/qgslayoutdesignerdialog.cpp
  4. +18 −2 src/app/qgisapp.cpp
  5. +0 −17 src/app/qgsmapthemes.cpp
  6. +0 −6 src/app/qgsmapthemes.h
  7. +62 −1 src/gui/CMakeLists.txt
  8. 0 src/{app → gui}/layout/qgsgeopdflayertreemodel.cpp
  9. +13 −2 src/{app → gui}/layout/qgsgeopdflayertreemodel.h
  10. 0 src/{app → gui}/layout/qgslayoutaddpagesdialog.cpp
  11. +9 −1 src/{app → gui}/layout/qgslayoutaddpagesdialog.h
  12. 0 src/{app → gui}/layout/qgslayoutatlaswidget.cpp
  13. +18 −4 src/{app → gui}/layout/qgslayoutatlaswidget.h
  14. 0 src/{app → gui}/layout/qgslayoutattributeselectiondialog.cpp
  15. +62 −33 src/{app → gui}/layout/qgslayoutattributeselectiondialog.h
  16. 0 src/{app → gui}/layout/qgslayoutattributetablewidget.cpp
  17. +13 −1 src/{app → gui}/layout/qgslayoutattributetablewidget.h
  18. 0 src/{app → gui}/layout/qgslayoutguidewidget.cpp
  19. +31 −4 src/{app → gui}/layout/qgslayoutguidewidget.h
  20. +6 −22 src/{app/layout/qgslayoutapputils.cpp → gui/layout/qgslayoutguiutils.cpp}
  21. +17 −6 src/{app/layout/qgslayoutapputils.h → gui/layout/qgslayoutguiutils.h}
  22. 0 src/{app → gui}/layout/qgslayouthtmlwidget.cpp
  23. +13 −4 src/{app → gui}/layout/qgslayouthtmlwidget.h
  24. 0 src/{app → gui}/layout/qgslayoutimageexportoptionsdialog.cpp
  25. +8 −1 src/{app → gui}/layout/qgslayoutimageexportoptionsdialog.h
  26. +3 −2 src/{app → gui}/layout/qgslayoutitemslistview.cpp
  27. +26 −9 src/{app → gui}/layout/qgslayoutitemslistview.h
  28. 0 src/{app → gui}/layout/qgslayoutlabelwidget.cpp
  29. +12 −4 src/{app → gui}/layout/qgslayoutlabelwidget.h
  30. 0 src/{app → gui}/layout/qgslayoutlegendlayersdialog.cpp
  31. +12 −3 src/{app → gui}/layout/qgslayoutlegendlayersdialog.h
  32. +14 −12 src/{app → gui}/layout/qgslayoutlegendwidget.cpp
  33. +33 −10 src/{app → gui}/layout/qgslayoutlegendwidget.h
  34. 0 src/{app → gui}/layout/qgslayoutmanualtablewidget.cpp
  35. +12 −1 src/{app → gui}/layout/qgslayoutmanualtablewidget.h
  36. 0 src/{app → gui}/layout/qgslayoutmapgridwidget.cpp
  37. +13 −5 src/{app → gui}/layout/qgslayoutmapgridwidget.h
  38. +29 −12 src/{app → gui}/layout/qgslayoutmapwidget.cpp
  39. +36 −11 src/{app → gui}/layout/qgslayoutmapwidget.h
  40. +1 −0 src/gui/layout/qgslayoutmousehandles.h
  41. 0 src/{app → gui}/layout/qgslayoutpagepropertieswidget.cpp
  42. +9 −1 src/{app → gui}/layout/qgslayoutpagepropertieswidget.h
  43. 0 src/{app → gui}/layout/qgslayoutpdfexportoptionsdialog.cpp
  44. +32 −2 src/{app → gui}/layout/qgslayoutpdfexportoptionsdialog.h
  45. 0 src/{app → gui}/layout/qgslayoutpicturewidget.cpp
  46. +11 −3 src/{app → gui}/layout/qgslayoutpicturewidget.h
  47. 0 src/{app → gui}/layout/qgslayoutpolygonwidget.cpp
  48. +10 −1 src/{app → gui}/layout/qgslayoutpolygonwidget.h
  49. 0 src/{app → gui}/layout/qgslayoutpolylinewidget.cpp
  50. +10 −1 src/{app → gui}/layout/qgslayoutpolylinewidget.h
  51. 0 src/{app → gui}/layout/qgslayoutpropertieswidget.cpp
  52. +14 −1 src/{app → gui}/layout/qgslayoutpropertieswidget.h
  53. 0 src/{app → gui}/layout/qgslayoutqptdrophandler.cpp
  54. +13 −1 src/{app → gui}/layout/qgslayoutqptdrophandler.h
  55. +1 −0 src/gui/layout/qgslayoutreportsectionlabel.h
  56. 0 src/{app → gui}/layout/qgslayoutscalebarwidget.cpp
  57. +12 −4 src/{app → gui}/layout/qgslayoutscalebarwidget.h
  58. 0 src/{app → gui}/layout/qgslayoutshapewidget.cpp
  59. +12 −4 src/{app → gui}/layout/qgslayoutshapewidget.h
  60. 0 src/{app → gui}/layout/qgslayouttablebackgroundcolorsdialog.cpp
  61. +8 −1 src/{app → gui}/layout/qgslayouttablebackgroundcolorsdialog.h
  62. 0 src/{app → gui}/layout/qgslayoutvaliditychecks.cpp
  63. +47 −9 src/{app → gui}/layout/qgslayoutvaliditychecks.h
  64. +1 −1 src/ui/layout/qgslayoutimageexportoptions.ui
  65. +2 −2 src/ui/layout/qgslayoutitemwidgetbase.ui
  66. +3 −3 src/ui/layout/qgslayoutwidgetbase.ui
@@ -193,37 +193,10 @@ SET(QGIS_APP_SRCS
labeling/qgsmaptoolrotatelabel.cpp
labeling/qgsrulebasedlabelingwidget.cpp

layout/qgsgeopdflayertreemodel.cpp
layout/qgslayoutaddpagesdialog.cpp
layout/qgslayoutapputils.cpp
layout/qgslayoutatlaswidget.cpp
layout/qgslayoutattributeselectiondialog.cpp
layout/qgslayoutattributetablewidget.cpp
layout/qgslayoutappmenuprovider.cpp
layout/qgslayoutdesignerdialog.cpp
layout/qgslayoutguidewidget.cpp
layout/qgslayouthtmlwidget.cpp
layout/qgslayoutimagedrophandler.cpp
layout/qgslayoutimageexportoptionsdialog.cpp
layout/qgslayoutitemslistview.cpp
layout/qgslayoutappmenuprovider.cpp
layout/qgslayoutlabelwidget.cpp
layout/qgslayoutlegendlayersdialog.cpp
layout/qgslayoutlegendwidget.cpp
layout/qgslayoutmanagerdialog.cpp
layout/qgslayoutmanualtablewidget.cpp
layout/qgslayoutmapwidget.cpp
layout/qgslayoutmapgridwidget.cpp
layout/qgslayoutpagepropertieswidget.cpp
layout/qgslayoutpdfexportoptionsdialog.cpp
layout/qgslayoutpicturewidget.cpp
layout/qgslayoutpolygonwidget.cpp
layout/qgslayoutpolylinewidget.cpp
layout/qgslayoutpropertieswidget.cpp
layout/qgslayoutqptdrophandler.cpp
layout/qgslayoutscalebarwidget.cpp
layout/qgslayoutshapewidget.cpp
layout/qgslayouttablebackgroundcolorsdialog.cpp
layout/qgslayoutvaliditychecks.cpp
layout/qgsreportfieldgroupsectionwidget.cpp
layout/qgsreportlayoutsectionwidget.cpp
layout/qgsreportorganizerwidget.cpp
@@ -16,6 +16,7 @@
#ifndef QGSLAYOUT3DMAPWIDGET_H
#define QGSLAYOUT3DMAPWIDGET_H

#include "qgis_gui.h"
#include "qgslayoutitemwidget.h"
#include "ui_qgslayout3dmapwidgetbase.h"
#include "qgslayoutitem3dmap.h"
@@ -246,7 +246,6 @@ void QgsAppLayoutDesignerInterface::showRulers( bool visible )
mDesigner->showRulers( visible );
}


static bool cmpByText_( QAction *a, QAction *b )
{
return QString::localeAwareCompare( a->text(), b->text() ) < 0;
@@ -809,7 +808,7 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla
mPanelsMenu->addAction( mItemsDock->toggleViewAction() );

//items tree widget
mItemsTreeView = new QgsLayoutItemsListView( mItemsDock, this );
mItemsTreeView = new QgsLayoutItemsListView( mItemsDock, iface() );
mItemsDock->setWidget( mItemsTreeView );

mAtlasDock = new QgsDockWidget( tr( "Atlas" ), this );
@@ -108,6 +108,8 @@
#include "qgsmeshlayer3drenderer.h"
#include "processing/qgs3dalgorithms.h"
#include "qgs3dmaptoolmeasureline.h"
#include "layout/qgslayout3dmapwidget.h"
#include "layout/qgslayoutviewrubberband.h"
#endif

#include "qgsgui.h"
@@ -235,10 +237,11 @@ Q_GUI_EXPORT extern int qt_defaultDpiX();
#include "qgslayoutatlas.h"
#include "qgslayoutcustomdrophandler.h"
#include "qgslayoutdesignerdialog.h"
#include "qgslayoutitemguiregistry.h"
#include "qgslayoutmanager.h"
#include "qgslayoutqptdrophandler.h"
#include "qgslayoutimagedrophandler.h"
#include "qgslayoutapputils.h"
#include "qgslayoutguiutils.h"
#include "qgslocatorwidget.h"
#include "qgslocator.h"
#include "qgsinbuiltlocatorfilters.h"
@@ -11935,13 +11938,26 @@ void QgisApp::initNativeProcessing()

void QgisApp::initLayouts()
{
// 3D map item
#ifdef HAVE_3D
QgsApplication::layoutItemRegistry()->addLayoutItemType(
new QgsLayoutItemMetadata( QgsLayoutItemRegistry::Layout3DMap, QObject::tr( "3D Map" ), QObject::tr( "3D Maps" ), QgsLayoutItem3DMap::create )
);

auto createRubberBand = ( []( QgsLayoutView * view )->QgsLayoutViewRubberBand *
{
return new QgsLayoutViewRectangularRubberBand( view );
} );
std::unique_ptr< QgsLayoutItemGuiMetadata > map3dMetadata = qgis::make_unique< QgsLayoutItemGuiMetadata>(
QgsLayoutItemRegistry::Layout3DMap, QObject::tr( "3D Map" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAdd3DMap.svg" ) ),
[ = ]( QgsLayoutItem * item )->QgsLayoutItemBaseWidget *
{
return new QgsLayout3DMapWidget( qobject_cast< QgsLayoutItem3DMap * >( item ) );
}, createRubberBand );
QgsGui::layoutItemGuiRegistry()->addLayoutItemGuiMetadata( map3dMetadata.release() );
#endif

QgsLayoutAppUtils::registerGuiForKnownItemTypes();
QgsLayoutGuiUtils::registerGuiForKnownItemTypes( mMapCanvas );

mLayoutQptDropHandler = new QgsLayoutQptDropHandler( this );
registerCustomLayoutDropHandler( mLayoutQptDropHandler );
@@ -81,23 +81,6 @@ void QgsMapThemes::updatePreset( const QString &name )
QgsProject::instance()->mapThemeCollection()->update( name, currentState() );
}

QList<QgsMapLayer *> QgsMapThemes::orderedPresetVisibleLayers( const QString &name ) const
{
QStringList visibleIds = QgsProject::instance()->mapThemeCollection()->mapThemeVisibleLayerIds( name );

// also make sure to order the layers according to map canvas order
QList<QgsMapLayer *> lst;
const auto constLayerOrder = QgsProject::instance()->layerTreeRoot()->layerOrder();
for ( QgsMapLayer *layer : constLayerOrder )
{
if ( visibleIds.contains( layer->id() ) )
{
lst << layer;
}
}
return lst;
}

QMenu *QgsMapThemes::menu()
{
return mMenu;
@@ -48,12 +48,6 @@ class APP_EXPORT QgsMapThemes : public QObject
//! Update existing preset using the current state of project's layer tree
void updatePreset( const QString &name );

/**
* Returns list of layer IDs that should be visible for particular preset.
* The order will match the layer order from the map canvas
*/
QList<QgsMapLayer *> orderedPresetVisibleLayers( const QString &name ) const;

//! Convenience menu that lists available presets and actions for management
QMenu *menu();

@@ -175,16 +175,43 @@ SET(QGIS_GUI_SRCS
layertree/qgslayertreeviewindicator.cpp
layertree/qgslayertreeviewitemdelegate.cpp

layout/qgsgeopdflayertreemodel.cpp
layout/qgslayoutaddpagesdialog.cpp
layout/qgslayoutguiutils.cpp
layout/qgslayoutatlaswidget.cpp
layout/qgslayoutattributeselectiondialog.cpp
layout/qgslayoutattributetablewidget.cpp
layout/qgslayoutcombobox.cpp
layout/qgslayoutcustomdrophandler.cpp
layout/qgslayoutitemguiregistry.cpp
layout/qgslayoutguidewidget.cpp
layout/qgslayouthtmlwidget.cpp
layout/qgslayoutimageexportoptionsdialog.cpp
layout/qgslayoutitemcombobox.cpp
layout/qgslayoutitemguiregistry.cpp
layout/qgslayoutitemslistview.cpp
layout/qgslayoutitemwidget.cpp
layout/qgslayoutlabelwidget.cpp
layout/qgslayoutlegendlayersdialog.cpp
layout/qgslayoutlegendwidget.cpp
layout/qgslayoutmanualtablewidget.cpp
layout/qgslayoutmapgridwidget.cpp
layout/qgslayoutmapwidget.cpp
layout/qgslayoutmousehandles.cpp
layout/qgslayoutnewitempropertiesdialog.cpp
layout/qgslayoutpagepropertieswidget.cpp
layout/qgslayoutpdfexportoptionsdialog.cpp
layout/qgslayoutpicturewidget.cpp
layout/qgslayoutpolygonwidget.cpp
layout/qgslayoutpolylinewidget.cpp
layout/qgslayoutpropertieswidget.cpp
layout/qgslayoutqptdrophandler.cpp
layout/qgslayoutreportsectionlabel.cpp
layout/qgslayoutruler.cpp
layout/qgslayoutscalebarwidget.cpp
layout/qgslayoutshapewidget.cpp
layout/qgslayouttablebackgroundcolorsdialog.cpp
layout/qgslayoutunitscombobox.cpp
layout/qgslayoutvaliditychecks.cpp
layout/qgslayoutview.cpp
layout/qgslayoutviewmouseevent.cpp
layout/qgslayoutviewrubberband.cpp
@@ -771,16 +798,42 @@ SET(QGIS_GUI_HDRS
layertree/qgslayertreeviewindicator.h
layertree/qgslayertreeviewitemdelegate.h

layout/qgsgeopdflayertreemodel.h
layout/qgslayoutaddpagesdialog.h
layout/qgslayoutguiutils.h
layout/qgslayoutatlaswidget.h
layout/qgslayoutattributeselectiondialog.h
layout/qgslayoutattributetablewidget.h
layout/qgslayoutcombobox.h
layout/qgslayoutcustomdrophandler.h
layout/qgslayoutdesignerinterface.h
layout/qgslayoutguidewidget.h
layout/qgslayouthtmlwidget.h
layout/qgslayoutimageexportoptionsdialog.h
layout/qgslayoutitemcombobox.h
layout/qgslayoutitemguiregistry.h
layout/qgslayoutitemslistview.h
layout/qgslayoutitemwidget.h
layout/qgslayoutlabelwidget.h
layout/qgslayoutlegendlayersdialog.h
layout/qgslayoutlegendwidget.h
layout/qgslayoutmanualtablewidget.h
layout/qgslayoutmapgridwidget.h
layout/qgslayoutmapwidget.h
layout/qgslayoutmousehandles.h
layout/qgslayoutnewitempropertiesdialog.h
layout/qgslayoutpagepropertieswidget.h
layout/qgslayoutpdfexportoptionsdialog.h
layout/qgslayoutpicturewidget.h
layout/qgslayoutpolygonwidget.h
layout/qgslayoutpolylinewidget.h
layout/qgslayoutpropertieswidget.h
layout/qgslayoutqptdrophandler.h
layout/qgslayoutreportsectionlabel.h
layout/qgslayoutruler.h
layout/qgslayoutscalebarwidget.h
layout/qgslayoutshapewidget.h
layout/qgslayouttablebackgroundcolorsdialog.h
layout/qgslayoutunitscombobox.h
layout/qgslayoutview.h
layout/qgslayoutviewmouseevent.h
@@ -964,6 +1017,14 @@ SET(QGIS_GUI_UI_HDRS
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgstablewidgetuibase.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsrendererpropsdialogbase.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgseffectstackpropertieswidgetbase.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgslayoutnewpagedialog.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgslayoutguidewidgetbase.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgslayoutimageexportoptions.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgslayoutitemwidgetbase.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgslayoutpagepropertieswidget.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgspdfexportoptions.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgslayoutwidgetbase.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsrenderercontainerbase.h
)

IF(ENABLE_MODELTEST)
File renamed without changes.
@@ -15,21 +15,32 @@
#ifndef QGSGEOPDFLAYERTREEMODEL_H
#define QGSGEOPDFLAYERTREEMODEL_H

// We don't want to expose this in the public API
#define SIP_NO_FILE

#include <QSortFilterProxyModel>
#include <QItemDelegate>

#include "qgis_gui.h"
#include "qgslayertreemodel.h"
#include "qgis_app.h"

class QgsMapCanvas;
class QgsProject;


class APP_EXPORT QgsGeoPdfLayerTreeModel : public QgsLayerTreeModel
/**
* \ingroup gui
* Layer tree model for Geo-PDF layers
*
* \note This class is not a part of public API
* \since QGIS 3.12
*/
class GUI_EXPORT QgsGeoPdfLayerTreeModel : public QgsLayerTreeModel
{
Q_OBJECT

public:
//! constructor
QgsGeoPdfLayerTreeModel( QgsLayerTree *rootNode, QObject *parent = nullptr );

int columnCount( const QModelIndex &parent ) const override;
File renamed without changes.
@@ -16,6 +16,9 @@
#ifndef QGSLAYOUTADDPAGESDIALOG_H
#define QGSLAYOUTADDPAGESDIALOG_H

// We don't want to expose this in the public API
#define SIP_NO_FILE

#include "qgis_sip.h"
#include "qgis_gui.h"
#include "ui_qgslayoutnewpagedialog.h"
@@ -26,14 +29,19 @@
#include "qgslayoutmeasurementconverter.h"

/**
* \ingroup gui
* A dialog for configuring properties of new pages to be added to a layout
*
* \note This class is not a part of public API
* \since QGIS 3.12
*/
class QgsLayoutAddPagesDialog : public QDialog, private Ui::QgsLayoutNewPageDialog
class GUI_EXPORT QgsLayoutAddPagesDialog : public QDialog, private Ui::QgsLayoutNewPageDialog
{
Q_OBJECT

public:

//! Page insertion positions
enum PagePosition
{
BeforePage,
File renamed without changes.
@@ -14,21 +14,33 @@
* *
***************************************************************************/

#ifndef QGSLAYOUTATLASWIDGET_H
#define QGSLAYOUTATLASWIDGET_H

// We don't want to expose this in the public API
#define SIP_NO_FILE

#include "qgis_gui.h"
#include "ui_qgslayoutatlaswidgetbase.h"

class QgsPrintLayout;
class QgsLayoutAtlas;
class QgsMessageBar;

/**
* \ingroup app
* A widget for layout atlas settings.
*/
class QgsLayoutAtlasWidget: public QWidget, private Ui::QgsLayoutAtlasWidgetBase
* \ingroup gui
* Widget for configuring the properties of a layout atlas.
*
* \note This class is not a part of public API
* \since QGIS 3.12
*/
class GUI_EXPORT QgsLayoutAtlasWidget: public QWidget, private Ui::QgsLayoutAtlasWidgetBase
{
Q_OBJECT
public:
//! Constructor
QgsLayoutAtlasWidget( QWidget *parent, QgsPrintLayout *layout );
//! Sets the message bar to which to emit messages
void setMessageBar( QgsMessageBar *bar );

private slots:
@@ -58,3 +70,5 @@ class QgsLayoutAtlasWidget: public QWidget, private Ui::QgsLayoutAtlasWidgetBase
void blockAllSignals( bool b );
void checkLayerType( QgsVectorLayer *layer );
};

#endif // QGSLAYOUTATLASWIDGET_H

0 comments on commit 1bf50cf

Please sign in to comment.
You can’t perform that action at this time.