Skip to content

Commit 08ab4d4

Browse files
committed
Ensure all classes derived from QObject include the Q_OBJECT macro
1 parent 6127851 commit 08ab4d4

File tree

73 files changed

+1190
-851
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1190
-851
lines changed

src/analysis/network/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ INCLUDE_DIRECTORIES(BEFORE raster)
1515

1616
SET(QGIS_NETWORK_ANALYSIS_MOC_HDRS
1717
qgsgraphdirector.h
18+
qgslinevectorlayerdirector.h
1819
)
1920

2021
QT4_WRAP_CPP(QGIS_NETWORK_ANALYSIS_MOC_SRCS ${QGIS_NETWORK_ANALYSIS_MOC_HDRS})

src/analysis/network/qgslinevectorlayerdirector.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ class QgsVectorLayer;
3333
*/
3434
class ANALYSIS_EXPORT QgsLineVectorLayerDirector : public QgsGraphDirector
3535
{
36+
Q_OBJECT
37+
3638
public:
3739
/**
3840
* @param myLayer source vector layer

src/app/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ SET (QGIS_APP_MOC_HDRS
210210
qgslabeldialog.h
211211
qgslabelengineconfigdialog.h
212212
qgslabelinggui.h
213+
qgslabelpreview.h
213214
qgslabelingwidget.h
214215
qgslabelpropertydialog.h
215216
qgsloadstylefromdbdialog.h
@@ -223,6 +224,7 @@ SET (QGIS_APP_MOC_HDRS
223224
qgswelcomepage.h
224225

225226
qgsmaptooladdfeature.h
227+
qgsmaptoolannotation.h
226228
qgsmaptoolcircularstringradius.h
227229
qgsmaptooladdpart.h
228230
qgsmaptooladdring.h
@@ -231,12 +233,15 @@ SET (QGIS_APP_MOC_HDRS
231233
qgsmaptooldeletepart.h
232234
qgsmaptooldeletering.h
233235
qgsmaptoolfeatureaction.h
236+
qgsmaptoolformannotation.h
237+
qgsmaptoolhtmlannotation.h
234238
qgsmaptoolpinlabels.h
235239
qgsmaptoolshowhidelabels.h
236240
qgsmaptoolidentifyaction.h
237241
qgsmaptoolmeasureangle.h
238242
qgsmaptoolmovefeature.h
239243
qgsmaptoolmovelabel.h
244+
qgsmaptoollabel.h
240245
qgsmaptooloffsetcurve.h
241246
qgsmaptoolreshape.h
242247
qgsmaptoolrotatefeature.h
@@ -250,7 +255,10 @@ SET (QGIS_APP_MOC_HDRS
250255
qgsmaptoolsimplify.h
251256
qgsmaptoolsplitfeatures.h
252257
qgsmaptoolsplitparts.h
258+
qgsmaptoolsvgannotation.h
259+
qgsmaptooltextannotation.h
253260
qgsmaptooladdcircularstring.h
261+
qgsmaptoolcircularstringcurvepoint.h
254262

255263
nodetool/qgsmaptoolnodetool.h
256264
nodetool/qgsselectedfeature.h
@@ -285,6 +293,8 @@ SET (QGIS_APP_MOC_HDRS
285293
composer/qgscomposeritemwidget.h
286294
composer/qgscomposerlabelwidget.h
287295
composer/qgscomposerlegendwidget.h
296+
composer/qgscomposerlegenditemdialog.h
297+
composer/qgscomposerlegendlayersdialog.h
288298
composer/qgscomposermanager.h
289299
composer/qgscomposermapwidget.h
290300
composer/qgscomposerpicturewidget.h

src/app/composer/qgscomposerlegenditemdialog.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,18 @@
1818
#ifndef QGSCOMPOSERLEGENDITEMDIALOG_H
1919
#define QGSCOMPOSERLEGENDITEMDIALOG_H
2020

21+
#include <QDialog>
2122
#include "ui_qgscomposerlegenditemdialogbase.h"
2223

2324
class QStandardItem;
2425

2526
/** \ingroup MapComposer
2627
* A dialog to enter properties of composer legend items (currently only item text)
2728
* */
28-
class QgsComposerLegendItemDialog: private Ui::QgsComposerLegendItemDialogBase, public QDialog
29+
class QgsComposerLegendItemDialog: public QDialog, private Ui::QgsComposerLegendItemDialogBase
2930
{
31+
Q_OBJECT
32+
3033
public:
3134
QgsComposerLegendItemDialog( const QStandardItem* item, QWidget* parent = 0 );
3235
~QgsComposerLegendItemDialog();

src/app/composer/qgscomposerlegendlayersdialog.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
/** \ingroup MapComposer
2222
* A dialog to add new layers to the legend.
2323
* */
24-
class QgsComposerLegendLayersDialog: private Ui::QgsComposerLegendLayersDialogBase, public QDialog
24+
class QgsComposerLegendLayersDialog: public QDialog, private Ui::QgsComposerLegendLayersDialogBase
2525
{
26+
Q_OBJECT
27+
2628
public:
2729
QgsComposerLegendLayersDialog( QList<QgsMapLayer*> layers, QWidget* parent = 0 );
2830
~QgsComposerLegendLayersDialog();

src/app/composer/qgscomposerlegendwidget.cpp

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -43,50 +43,6 @@
4343
#include <QInputDialog>
4444

4545

46-
47-
class QgsComposerLegendMenuProvider : public QObject, public QgsLayerTreeViewMenuProvider
48-
{
49-
public:
50-
QgsComposerLegendMenuProvider( QgsLayerTreeView* view, QgsComposerLegendWidget* w ) : mView( view ), mWidget( w ) {}
51-
52-
virtual QMenu* createContextMenu() override
53-
{
54-
if ( !mView->currentNode() )
55-
return 0;
56-
57-
if ( mWidget->legend()->autoUpdateModel() )
58-
return 0; // no editing allowed
59-
60-
QMenu* menu = new QMenu();
61-
62-
if ( QgsLayerTree::isLayer( mView->currentNode() ) )
63-
{
64-
menu->addAction( tr( "Reset to defaults" ), mWidget, SLOT( resetLayerNodeToDefaults() ) );
65-
menu->addSeparator();
66-
}
67-
68-
QgsComposerLegendStyle::Style currentStyle = QgsLegendRenderer::nodeLegendStyle( mView->currentNode(), mView->layerTreeModel() );
69-
70-
QList<QgsComposerLegendStyle::Style> lst;
71-
lst << QgsComposerLegendStyle::Hidden << QgsComposerLegendStyle::Group << QgsComposerLegendStyle::Subgroup;
72-
Q_FOREACH ( QgsComposerLegendStyle::Style style, lst )
73-
{
74-
QAction* action = menu->addAction( QgsComposerLegendStyle::styleLabel( style ), mWidget, SLOT( setCurrentNodeStyleFromAction() ) );
75-
action->setCheckable( true );
76-
action->setChecked( currentStyle == style );
77-
action->setData(( int ) style );
78-
}
79-
80-
return menu;
81-
}
82-
83-
protected:
84-
QgsLayerTreeView* mView;
85-
QgsComposerLegendWidget* mWidget;
86-
};
87-
88-
89-
9046
QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend )
9147
: QgsComposerItemBaseWidget( 0, legend )
9248
, mLegend( legend )
@@ -1096,3 +1052,44 @@ void QgsComposerLegendWidget::updateFilterLegendByAtlasButton()
10961052
const QgsAtlasComposition& atlas = mLegend->composition()->atlasComposition();
10971053
mFilterLegendByAtlasCheckBox->setEnabled( atlas.enabled() && atlas.coverageLayer() && atlas.coverageLayer()->geometryType() == QGis::Polygon );
10981054
}
1055+
1056+
1057+
//
1058+
// QgsComposerLegendMenuProvider
1059+
//
1060+
1061+
QgsComposerLegendMenuProvider::QgsComposerLegendMenuProvider( QgsLayerTreeView* view, QgsComposerLegendWidget* w )
1062+
: mView( view )
1063+
, mWidget( w )
1064+
{}
1065+
1066+
QMenu*QgsComposerLegendMenuProvider::createContextMenu()
1067+
{
1068+
if ( !mView->currentNode() )
1069+
return 0;
1070+
1071+
if ( mWidget->legend()->autoUpdateModel() )
1072+
return 0; // no editing allowed
1073+
1074+
QMenu* menu = new QMenu();
1075+
1076+
if ( QgsLayerTree::isLayer( mView->currentNode() ) )
1077+
{
1078+
menu->addAction( tr( "Reset to defaults" ), mWidget, SLOT( resetLayerNodeToDefaults() ) );
1079+
menu->addSeparator();
1080+
}
1081+
1082+
QgsComposerLegendStyle::Style currentStyle = QgsLegendRenderer::nodeLegendStyle( mView->currentNode(), mView->layerTreeModel() );
1083+
1084+
QList<QgsComposerLegendStyle::Style> lst;
1085+
lst << QgsComposerLegendStyle::Hidden << QgsComposerLegendStyle::Group << QgsComposerLegendStyle::Subgroup;
1086+
Q_FOREACH ( QgsComposerLegendStyle::Style style, lst )
1087+
{
1088+
QAction* action = menu->addAction( QgsComposerLegendStyle::styleLabel( style ), mWidget, SLOT( setCurrentNodeStyleFromAction() ) );
1089+
action->setCheckable( true );
1090+
action->setChecked( currentStyle == style );
1091+
action->setData(( int ) style );
1092+
}
1093+
1094+
return menu;
1095+
}

src/app/composer/qgscomposerlegendwidget.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,21 @@ class QgsComposerLegendWidget: public QgsComposerItemBaseWidget, private Ui::Qgs
111111
QgsComposerLegend* mLegend;
112112
};
113113

114+
115+
class QgsComposerLegendMenuProvider : public QObject, public QgsLayerTreeViewMenuProvider
116+
{
117+
Q_OBJECT
118+
119+
public:
120+
QgsComposerLegendMenuProvider( QgsLayerTreeView* view, QgsComposerLegendWidget* w );
121+
122+
virtual QMenu* createContextMenu() override;
123+
124+
protected:
125+
QgsLayerTreeView* mView;
126+
QgsComposerLegendWidget* mWidget;
127+
};
128+
129+
114130
#endif
115131

src/app/nodetool/qgsnodeeditor.cpp

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,35 +33,6 @@
3333
static const int MinRadiusRole = Qt::UserRole + 1;
3434

3535

36-
class CoordinateItemDelegate : public QStyledItemDelegate
37-
{
38-
public:
39-
QString displayText( const QVariant & value, const QLocale & locale ) const override
40-
{
41-
return locale.toString( value.toDouble(), 'f', 4 );
42-
}
43-
44-
protected:
45-
QWidget* createEditor( QWidget * parent, const QStyleOptionViewItem & /*option*/, const QModelIndex & index ) const override
46-
{
47-
QLineEdit* lineEdit = new QLineEdit( parent );
48-
QDoubleValidator* validator = new QDoubleValidator();
49-
if ( !index.data( MinRadiusRole ).isNull() )
50-
validator->setBottom( index.data( MinRadiusRole ).toDouble() );
51-
lineEdit->setValidator( validator );
52-
return lineEdit;
53-
}
54-
void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override
55-
{
56-
QLineEdit* lineEdit = qobject_cast<QLineEdit*>( editor );
57-
if ( lineEdit->hasAcceptableInput() )
58-
{
59-
QStyledItemDelegate::setModelData( editor, model, index );
60-
}
61-
}
62-
};
63-
64-
6536
QgsNodeEditorModel::QgsNodeEditorModel( QgsVectorLayer* layer, QgsSelectedFeature* selectedFeature, QgsMapCanvas* canvas, QObject* parent )
6637
: QAbstractTableModel( parent )
6738
, mLayer( layer )
@@ -410,3 +381,30 @@ void QgsNodeEditor::zoomToNode( int idx )
410381
}
411382

412383

384+
//
385+
// CoordinateItemDelegate
386+
//
387+
388+
QString CoordinateItemDelegate::displayText( const QVariant& value, const QLocale& locale ) const
389+
{
390+
return locale.toString( value.toDouble(), 'f', 4 );
391+
}
392+
393+
QWidget*CoordinateItemDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem&, const QModelIndex& index ) const
394+
{
395+
QLineEdit* lineEdit = new QLineEdit( parent );
396+
QDoubleValidator* validator = new QDoubleValidator();
397+
if ( !index.data( MinRadiusRole ).isNull() )
398+
validator->setBottom( index.data( MinRadiusRole ).toDouble() );
399+
lineEdit->setValidator( validator );
400+
return lineEdit;
401+
}
402+
403+
void CoordinateItemDelegate::setModelData( QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const
404+
{
405+
QLineEdit* lineEdit = qobject_cast<QLineEdit*>( editor );
406+
if ( lineEdit->hasAcceptableInput() )
407+
{
408+
QStyledItemDelegate::setModelData( editor, model, index );
409+
}
410+
}

src/app/nodetool/qgsnodeeditor.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <QDockWidget>
2323
#include <QAbstractTableModel>
2424
#include <QItemSelection>
25+
#include <QStyledItemDelegate>
2526

2627
class QgsMapCanvas;
2728
class QgsRubberBand;
@@ -94,4 +95,17 @@ class QgsNodeEditor : public QDockWidget
9495
bool mUpdatingNodeSelection;
9596
};
9697

98+
99+
class CoordinateItemDelegate : public QStyledItemDelegate
100+
{
101+
Q_OBJECT
102+
103+
public:
104+
QString displayText( const QVariant & value, const QLocale & locale ) const override;
105+
106+
protected:
107+
QWidget* createEditor( QWidget * parent, const QStyleOptionViewItem & /*option*/, const QModelIndex & index ) const override;
108+
void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
109+
};
110+
97111
#endif // QGSNODEEDITOR_H

src/app/qgsattributetabledialog.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,6 @@
4545
#include "qgsfield.h"
4646
#include "qgseditorwidgetregistry.h"
4747

48-
class QgsAttributeTableDock : public QDockWidget
49-
{
50-
public:
51-
QgsAttributeTableDock( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 )
52-
: QDockWidget( title, parent, flags )
53-
{
54-
setObjectName( "AttributeTable" ); // set object name so the position can be saved
55-
}
56-
57-
virtual void closeEvent( QCloseEvent * ev ) override
58-
{
59-
Q_UNUSED( ev );
60-
deleteLater();
61-
}
62-
};
63-
6448
static QgsExpressionContext _getExpressionContext( const void* context )
6549
{
6650
QgsExpressionContext expContext;
@@ -857,3 +841,20 @@ void QgsAttributeTableDialog::setFilterExpression( const QString& filterString )
857841
}
858842
mMainView->setFilterMode( QgsAttributeTableFilterModel::ShowFilteredList );
859843
}
844+
845+
846+
//
847+
// QgsAttributeTableDock
848+
//
849+
850+
QgsAttributeTableDock::QgsAttributeTableDock( const QString& title, QWidget* parent, Qt::WindowFlags flags )
851+
: QDockWidget( title, parent, flags )
852+
{
853+
setObjectName( "AttributeTable" ); // set object name so the position can be saved
854+
}
855+
856+
void QgsAttributeTableDock::closeEvent( QCloseEvent* ev )
857+
{
858+
Q_UNUSED( ev );
859+
deleteLater();
860+
}

src/app/qgsattributetabledialog.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,14 @@
3030
#include "qgsvectorlayer.h" //QgsFeatureIds
3131
#include "qgsfieldmodel.h"
3232
#include "qgssearchwidgetwrapper.h"
33+
#include <QDockWidget>
3334

3435
class QDialogButtonBox;
3536
class QPushButton;
3637
class QLineEdit;
3738
class QComboBox;
3839
class QMenu;
39-
class QDockWidget;
4040
class QSignalMapper;
41-
4241
class QgsAttributeTableModel;
4342
class QgsAttributeTableFilterModel;
4443
class QgsRubberBand;
@@ -222,4 +221,16 @@ class APP_EXPORT QgsAttributeTableDialog : public QDialog, private Ui::QgsAttrib
222221
QgsSearchWidgetWrapper* mCurrentSearchWidgetWrapper;
223222
};
224223

224+
225+
class QgsAttributeTableDock : public QDockWidget
226+
{
227+
Q_OBJECT
228+
229+
public:
230+
QgsAttributeTableDock( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 );
231+
232+
virtual void closeEvent( QCloseEvent * ev ) override;
233+
};
234+
235+
225236
#endif

0 commit comments

Comments
 (0)