Skip to content

Commit

Permalink
Change QDockWidgets to QgsDockWidgets
Browse files Browse the repository at this point in the history
No benefit as yet, but future proofing for when QgsDockWidget
gains additional fixes/tweaks over QDockWidget
  • Loading branch information
nyalldawson committed Jun 10, 2016
1 parent 3afb05c commit 7af6d24
Show file tree
Hide file tree
Showing 47 changed files with 121 additions and 100 deletions.
10 changes: 9 additions & 1 deletion python/gui/qgsdockwidget.sip
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ class QgsDockWidget : QDockWidget

/** Constructor for QgsDockWidget.
* @param parent parent widget
* @param flags window flags
*/
explicit QgsDockWidget( QWidget* parent /TransferThis/ = nullptr );
explicit QgsDockWidget( QWidget* parent /TransferThis/ = nullptr, Qt::WindowFlags flags = 0 );

/** Constructor for QgsDockWidget.
* @param title dock title
* @param parent parent widget
* @param flags window flags
*/
explicit QgsDockWidget( const QString &title, QWidget* parent /TransferThis/ = nullptr, Qt::WindowFlags flags = 0 );

public slots:

Expand Down
10 changes: 5 additions & 5 deletions src/app/composer/qgscomposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,21 +572,21 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
int minDockWidth( 335 );

setTabPosition( Qt::AllDockWidgetAreas, QTabWidget::North );
mGeneralDock = new QDockWidget( tr( "Composition" ), this );
mGeneralDock = new QgsDockWidget( tr( "Composition" ), this );
mGeneralDock->setObjectName( "CompositionDock" );
mGeneralDock->setMinimumWidth( minDockWidth );
mPanelMenu->addAction( mGeneralDock->toggleViewAction() );
mItemDock = new QDockWidget( tr( "Item properties" ), this );
mItemDock = new QgsDockWidget( tr( "Item properties" ), this );
mItemDock->setObjectName( "ItemDock" );
mItemDock->setMinimumWidth( minDockWidth );
mPanelMenu->addAction( mItemDock->toggleViewAction() );
mUndoDock = new QDockWidget( tr( "Command history" ), this );
mUndoDock = new QgsDockWidget( tr( "Command history" ), this );
mUndoDock->setObjectName( "CommandDock" );
mPanelMenu->addAction( mUndoDock->toggleViewAction() );
mAtlasDock = new QDockWidget( tr( "Atlas generation" ), this );
mAtlasDock = new QgsDockWidget( tr( "Atlas generation" ), this );
mAtlasDock->setObjectName( "AtlasDock" );
mPanelMenu->addAction( mAtlasDock->toggleViewAction() );
mItemsDock = new QDockWidget( tr( "Items" ), this );
mItemsDock = new QgsDockWidget( tr( "Items" ), this );
mItemsDock->setObjectName( "ItemsDock" );
mPanelMenu->addAction( mItemsDock->toggleViewAction() );

Expand Down
12 changes: 6 additions & 6 deletions src/app/composer/qgscomposer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "ui_qgscomposerbase.h"
#include "qgscomposermap.h"
#include "qgscontexthelp.h"
#include <QDockWidget>
#include "qgsdockwidget.h"

class QgisApp;
class QgsComposerArrow;
Expand Down Expand Up @@ -592,11 +592,11 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
//! We load composer map content from project xml only on demand. Therefore we need to store the real preview mode type
QMap< QgsComposerMap*, int > mMapsToRestore;

QDockWidget* mItemDock;
QDockWidget* mUndoDock;
QDockWidget* mGeneralDock;
QDockWidget* mAtlasDock;
QDockWidget* mItemsDock;
QgsDockWidget* mItemDock;
QgsDockWidget* mUndoDock;
QgsDockWidget* mGeneralDock;
QgsDockWidget* mAtlasDock;
QgsDockWidget* mItemsDock;

QTreeView* mItemsTreeView;

Expand Down
4 changes: 2 additions & 2 deletions src/app/nodetool/qgsnodeeditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef QGSNODEEDITOR_H
#define QGSNODEEDITOR_H

#include <QDockWidget>
#include "qgsdockwidget.h"
#include <QAbstractTableModel>
#include <QItemSelection>
#include <QStyledItemDelegate>
Expand Down Expand Up @@ -69,7 +69,7 @@ class QgsNodeEditorModel : public QAbstractTableModel
void featureChanged();
};

class QgsNodeEditor : public QDockWidget
class QgsNodeEditor : public QgsDockWidget
{
Q_OBJECT
public:
Expand Down
15 changes: 7 additions & 8 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <QDesktopWidget>
#include <QDialog>
#include <QDir>
#include <QDockWidget>
#include <QEvent>
#include <QFile>
#include <QFileInfo>
Expand Down Expand Up @@ -707,7 +706,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh

// create undo widget
startProfile( "Undo dock" );
mUndoDock = new QDockWidget( tr( "Undo/Redo Panel" ), this );
mUndoDock = new QgsDockWidget( tr( "Undo/Redo Panel" ), this );
mUndoWidget = new QgsUndoWidget( mUndoDock, mMapCanvas );
mUndoWidget->setObjectName( "Undo" );
mUndoDock->setWidget( mUndoWidget );
Expand Down Expand Up @@ -813,7 +812,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
// create the GPS tool on starting QGIS - this is like the browser
mpGpsWidget = new QgsGPSInformationWidget( mMapCanvas );
//create the dock widget
mpGpsDock = new QDockWidget( tr( "GPS Information Panel" ), this );
mpGpsDock = new QgsDockWidget( tr( "GPS Information Panel" ), this );
mpGpsDock->setObjectName( "GPSInformation" );
mpGpsDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
addDockWidget( Qt::LeftDockWidgetArea, mpGpsDock );
Expand All @@ -826,7 +825,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh

mLogViewer = new QgsMessageLogViewer( statusBar(), this );

mLogDock = new QDockWidget( tr( "Log Messages Panel" ), this );
mLogDock = new QgsDockWidget( tr( "Log Messages Panel" ), this );
mLogDock->setObjectName( "MessageLog" );
mLogDock->setAllowedAreas( Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea );
addDockWidget( Qt::BottomDockWidgetArea, mLogDock );
Expand Down Expand Up @@ -2833,7 +2832,7 @@ void QgisApp::createOverview()
// QVBoxLayout *myOverviewLayout = new QVBoxLayout;
// myOverviewLayout->addWidget(overviewCanvas);
// overviewFrame->setLayout(myOverviewLayout);
mOverviewDock = new QDockWidget( tr( "Overview Panel" ), this );
mOverviewDock = new QgsDockWidget( tr( "Overview Panel" ), this );
mOverviewDock->setObjectName( "Overview" );
mOverviewDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
mOverviewDock->setWidget( mOverviewCanvas );
Expand All @@ -2858,7 +2857,7 @@ void QgisApp::createOverview()
mMapCanvas->setMapUpdateInterval( mySettings.value( "/qgis/map_update_interval", 250 ).toInt() );
}

void QgisApp::addDockWidget( Qt::DockWidgetArea theArea, QDockWidget * thepDockWidget )
void QgisApp::addDockWidget( Qt::DockWidgetArea theArea, QDockWidget* thepDockWidget )
{
QMainWindow::addDockWidget( theArea, thepDockWidget );
// Make the right and left docks consume all vertical space and top
Expand Down Expand Up @@ -2948,7 +2947,7 @@ void QgisApp::initLayerTreeView()
{
mLayerTreeView->setWhatsThis( tr( "Map legend that displays all the layers currently on the map canvas. Click on the check box to turn a layer on or off. Double click on a layer in the legend to customize its appearance and set other properties." ) );

mLayerTreeDock = new QDockWidget( tr( "Layers Panel" ), this );
mLayerTreeDock = new QgsDockWidget( tr( "Layers Panel" ), this );
mLayerTreeDock->setObjectName( "Layers" );
mLayerTreeDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );

Expand Down Expand Up @@ -3052,7 +3051,7 @@ void QgisApp::initLayerTreeView()
mMapLayerOrder->setObjectName( "theMapLayerOrder" );

mMapLayerOrder->setWhatsThis( tr( "Map layer list that displays all layers in drawing order." ) );
mLayerOrderDock = new QDockWidget( tr( "Layer Order Panel" ), this );
mLayerOrderDock = new QgsDockWidget( tr( "Layer Order Panel" ), this );
mLayerOrderDock->setObjectName( "LayerOrder" );
mLayerOrderDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );

Expand Down
14 changes: 7 additions & 7 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
* After adding the dock widget to the ui (by delegating to the QMainWindow
* parent class, it will also add it to the View menu list of docks.*/
void addDockWidget( Qt::DockWidgetArea area, QDockWidget *dockwidget );
void removeDockWidget( QDockWidget *dockwidget );
void removeDockWidget( QDockWidget* dockwidget );
/** Add a toolbar to the main window. Overloaded from QMainWindow.
* After adding the toolbar to the ui (by delegating to the QMainWindow
* parent class, it will also add it to the View menu list of toolbars.*/
Expand Down Expand Up @@ -1505,11 +1505,11 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QMenu *mToolbarMenu;

// docks ------------------------------------------
QDockWidget *mLayerTreeDock;
QDockWidget *mLayerOrderDock;
QDockWidget *mOverviewDock;
QDockWidget *mpGpsDock;
QDockWidget *mLogDock;
QgsDockWidget *mLayerTreeDock;
QgsDockWidget *mLayerOrderDock;
QgsDockWidget *mOverviewDock;
QgsDockWidget *mpGpsDock;
QgsDockWidget *mLogDock;

#ifdef Q_OS_MAC
//! Window menu action to select this window
Expand Down Expand Up @@ -1722,7 +1722,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
static QgisApp *smInstance;

QgsUndoWidget *mUndoWidget;
QDockWidget *mUndoDock;
QgsDockWidget *mUndoDock;

QgsBrowserDockWidget *mBrowserWidget;
QgsBrowserDockWidget *mBrowserWidget2;
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsattributetabledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* *
***************************************************************************/

#include <QDockWidget>
#include <QMessageBox>
#include <QGridLayout>
#include <QDialogButtonBox>
Expand All @@ -33,6 +32,7 @@
#include "qgisapp.h"
#include "qgsaddattrdialog.h"
#include "qgsdelattrdialog.h"
#include "qgsdockwidget.h"
#include "qgssearchquerybuilder.h"
#include "qgslogger.h"
#include "qgsmapcanvas.h"
Expand Down Expand Up @@ -946,7 +946,7 @@ void QgsAttributeTableDialog::setFilterExpression( const QString& filterString,
//

QgsAttributeTableDock::QgsAttributeTableDock( const QString& title, QWidget* parent, Qt::WindowFlags flags )
: QDockWidget( title, parent, flags )
: QgsDockWidget( title, parent, flags )
{
setObjectName( "AttributeTable" ); // set object name so the position can be saved
}
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsattributetabledialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "qgsvectorlayer.h" //QgsFeatureIds
#include "qgsfieldmodel.h"
#include "qgssearchwidgetwrapper.h"
#include <QDockWidget>
#include "qgsdockwidget.h"

class QDialogButtonBox;
class QPushButton;
Expand Down Expand Up @@ -214,7 +214,7 @@ class APP_EXPORT QgsAttributeTableDialog : public QDialog, private Ui::QgsAttrib
QMenu* mMenuActions;
QAction* mActionToggleEditing;

QDockWidget* mDock;
QgsDockWidget* mDock;
QgsDistanceArea* myDa;


Expand All @@ -235,7 +235,7 @@ class APP_EXPORT QgsAttributeTableDialog : public QDialog, private Ui::QgsAttrib
};


class QgsAttributeTableDock : public QDockWidget
class QgsAttributeTableDock : public QgsDockWidget
{
Q_OBJECT

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsbookmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@


QgsBookmarks::QgsBookmarks( QWidget *parent )
: QDockWidget( parent )
: QgsDockWidget( parent )
{
setupUi( this );
restorePosition();
Expand Down
5 changes: 2 additions & 3 deletions src/app/qgsbookmarks.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
#ifndef QGSBOOKMARKS_H
#define QGSBOOKMARKS_H

#include <QDockWidget>
#include <QSqlTableModel>
#include <QScopedPointer>

#include "ui_qgsbookmarksbase.h"
#include "qgscontexthelp.h"

#include "qgsdockwidget.h"

/*
* Model for project bookmarks
Expand Down Expand Up @@ -100,7 +99,7 @@ class QgsMergedBookmarksTableModel: public QAbstractTableModel
};


class APP_EXPORT QgsBookmarks : public QDockWidget, private Ui::QgsBookmarksBase
class APP_EXPORT QgsBookmarks : public QgsDockWidget, private Ui::QgsBookmarksBase
{
Q_OBJECT

Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsbrowserdockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void QgsBrowserPropertiesDialog::setItem( QgsDataItem* item )
}

QgsBrowserDockWidget::QgsBrowserDockWidget( const QString& name, QWidget * parent )
: QDockWidget( parent )
: QgsDockWidget( parent )
, mModel( nullptr )
, mProxyModel( nullptr )
, mPropertiesWidgetEnabled( false )
Expand Down Expand Up @@ -365,7 +365,7 @@ void QgsBrowserDockWidget::showEvent( QShowEvent * e )
mSplitter->setSizes( sizes );
}

QDockWidget::showEvent( e );
QgsDockWidget::showEvent( e );
}

void QgsBrowserDockWidget::showContextMenu( QPoint pt )
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsbrowserdockwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
#ifndef QGSBROWSERDOCKWIDGET_H
#define QGSBROWSERDOCKWIDGET_H

#include <QDockWidget>
#include <ui_qgsbrowserdockwidgetbase.h>
#include <ui_qgsbrowserlayerpropertiesbase.h>
#include <ui_qgsbrowserdirectorypropertiesbase.h>
#include <ui_qgsbrowserpropertiesdialogbase.h>

#include "qgsdataitem.h"
#include "qgsbrowsertreeview.h"
#include "qgsdockwidget.h"
#include <QSortFilterProxyModel>

class QgsBrowserModel;
Expand Down Expand Up @@ -100,7 +100,7 @@ class QgsBrowserPropertiesDialog : public QDialog , private Ui::QgsBrowserProper
QString mSettingsSection;
};

class APP_EXPORT QgsBrowserDockWidget : public QDockWidget, private Ui::QgsBrowserDockWidgetBase
class APP_EXPORT QgsBrowserDockWidget : public QgsDockWidget, private Ui::QgsBrowserDockWidgetBase
{
Q_OBJECT
public:
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsidentifyresultsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "qgsapplication.h"
#include "qgsactionmanager.h"
#include "qgsattributedialog.h"
#include "qgsdockwidget.h"
#include "qgseditorwidgetregistry.h"
#include "qgsfeatureaction.h"
#include "qgsgeometry.h"
Expand All @@ -44,7 +45,6 @@
#include <QSettings>
#include <QMenu>
#include <QClipboard>
#include <QDockWidget>
#include <QMenuBar>
#include <QPushButton>
#include <QPrinter>
Expand Down Expand Up @@ -258,7 +258,7 @@ QgsIdentifyResultsDialog::QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidge
mOpenFormAction->setDisabled( true );

QSettings mySettings;
mDock = new QDockWidget( tr( "Identify Results" ), QgisApp::instance() );
mDock = new QgsDockWidget( tr( "Identify Results" ), QgisApp::instance() );
mDock->setObjectName( "IdentifyResultsDock" );
mDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
mDock->setWidget( this );
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsidentifyresultsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class QgsVectorLayer;
class QgsRasterLayer;
class QgsHighlight;
class QgsMapCanvas;
class QDockWidget;
class QgsDockWidget;

class QwtPlotCurve;

Expand Down Expand Up @@ -253,7 +253,7 @@ class APP_EXPORT QgsIdentifyResultsDialog: public QDialog, private Ui::QgsIdenti

void doMapLayerAction( QTreeWidgetItem *item, QgsMapLayerAction* action );

QDockWidget *mDock;
QgsDockWidget *mDock;

QVector<QgsIdentifyPlotCurve *> mPlotCurves;
};
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgssnappingdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
#include "qgisapp.h"
#include "qgsproject.h"
#include "qgslogger.h"
#include "qgsdockwidget.h"

#include <QCheckBox>
#include <QDoubleValidator>
#include <QComboBox>
#include <QLineEdit>
#include <QDockWidget>
#include <QPushButton>
#include <QDoubleSpinBox>

Expand Down Expand Up @@ -503,7 +503,7 @@ void QgsSnappingDialog::setSnappingMode()
//

QgsSnappingDock::QgsSnappingDock( const QString& title, QWidget* parent, Qt::WindowFlags flags )
: QDockWidget( title, parent, flags )
: QgsDockWidget( title, parent, flags )
{
setObjectName( "Snapping and Digitizing Options" ); // set object name so the position can be saved
}
Expand Down
Loading

0 comments on commit 7af6d24

Please sign in to comment.