Skip to content

Commit 7127e58

Browse files
committed
fix customwidgets build on windows
1 parent d522059 commit 7127e58

16 files changed

+52
-38
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ ADD_DEFINITIONS("-DGUI_EXPORT=${DLLIMPORT}")
509509
ADD_DEFINITIONS("-DPYTHON_EXPORT=${DLLIMPORT}")
510510
ADD_DEFINITIONS("-DANALYSIS_EXPORT=${DLLIMPORT}")
511511
ADD_DEFINITIONS("-DAPP_EXPORT=${DLLIMPORT}")
512+
ADD_DEFINITIONS("-DCUSTOMWIDGETS_EXPORT=${DLLIMPORT}")
512513

513514
#############################################################
514515
# user-changeable settings which can be used to customize
@@ -535,7 +536,6 @@ SET (QGIS_LIBEXEC_DIR ${QGIS_LIBEXEC_SUBDIR})
535536
SET (QGIS_DATA_DIR ${QGIS_DATA_SUBDIR})
536537
SET (QGIS_PLUGIN_DIR ${QGIS_PLUGIN_SUBDIR})
537538
SET (QGIS_INCLUDE_DIR ${QGIS_INCLUDE_SUBDIR})
538-
SET (QGIS_CUSTOMWIDGETS_DIR ${QT_PLUGINS_DIR}/designer)
539539

540540
# set the default locations where the targets (executables, libraries) will land when compiled
541541
# this is to allow running qgis from the source tree without having to actually do a "make install"

ms-windows/osgeo4w/package-nightly.cmd

+1
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%/%PACKAGENAME%-%VERS
230230
bin/%PACKAGENAME%-browser.bat.tmpl ^
231231
apps/qt4/plugins/sqldrivers/qsqlocispatial.dll ^
232232
apps/qt4/plugins/sqldrivers/qsqlspatialite.dll ^
233+
apps/qt4/plugins/designer/qgis_customwidgets.dll ^
233234
etc/postinstall/%PACKAGENAME%.bat ^
234235
etc/preremove/%PACKAGENAME%.bat
235236
if errorlevel 1 (echo tar failed & goto error)

src/app/CMakeLists.txt

+13-15
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,19 @@ ENDIF (WIN32)
406406

407407
IF(PEDANTIC)
408408
# disable deprecation warnings
409-
IF(NOT MSVC)
410-
SET_SOURCE_FILES_PROPERTIES(qgisappinterface.cpp PROPERTIES COMPILE_FLAGS -Wno-deprecated)
411-
ENDIF(NOT MSVC)
409+
IF(MSVC)
410+
SET_SOURCE_FILES_PROPERTIES(
411+
qgisappinterface.cpp
412+
${CMAKE_BINARY_DIR}/src/app/moc_qgisappinterface.cxx
413+
PROPERTIES COMPILE_FLAGS "/wd4996"
414+
)
415+
ELSE(MSVC)
416+
SET_SOURCE_FILES_PROPERTIES(
417+
qgisappinterface.cpp
418+
${CMAKE_BINARY_DIR}/src/app/moc_qgisappinterface.cxx
419+
PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations"
420+
)
421+
ENDIF(MSVC)
412422
ENDIF(PEDANTIC)
413423

414424
INCLUDE_DIRECTORIES(
@@ -498,18 +508,6 @@ if(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
498508
SET_TARGET_PROPERTIES(qgis_app PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64")
499509
ENDIF(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
500510

501-
# disable deprecation warnings for classes re-exporting deprecated methods
502-
IF(MSVC)
503-
SET_SOURCE_FILES_PROPERTIES(
504-
${CMAKE_BINARY_DIR}/src/app/moc_qgisappinterface.cxx
505-
PROPERTIES COMPILE_FLAGS "-wd4996")
506-
ELSE(MSVC)
507-
SET_SOURCE_FILES_PROPERTIES(
508-
${CMAKE_BINARY_DIR}/src/app/moc_qgisappinterface.cxx
509-
PROPERTIES COMPILE_FLAGS "-w -Wno-deprecated-declarations")
510-
ENDIF(MSVC)
511-
512-
513511
TARGET_LINK_LIBRARIES(${QGIS_APP_NAME}
514512
${QWT_LIBRARY}
515513
${QT_QTSQL_LIBRARY}

src/core/CMakeLists.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,11 @@ ENDIF (QT_MOBILITY_LOCATION_FOUND)
392392

393393
QT4_WRAP_CPP(QGIS_CORE_MOC_SRCS ${QGIS_CORE_MOC_HDRS})
394394

395-
IF(UNIX)
395+
IF(MSVC)
396+
SET_SOURCE_FILES_PROPERTIES(${QGIS_CORE_MOC_SRCS} PROPERTIES COMPILE_FLAGS "/wd4996" )
397+
ELSE(MSVC)
396398
SET_SOURCE_FILES_PROPERTIES(${QGIS_CORE_MOC_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations" )
397-
ENDIF(UNIX)
399+
ENDIF(MSVC)
398400

399401
# install headers
400402
# install qgsconfig.h and plugin.h here so they can get into

src/core/composer/qgscomposerattributetablemodel.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ bool QgsComposerAttributeTableColumnModel::setData( const QModelIndex& index, co
210210
emit dataChanged( index, index );
211211
return true;
212212
default:
213-
return false;
213+
break;
214214
}
215215

216216
return false;
@@ -584,14 +584,11 @@ bool QgsComposerTableSortColumnsProxyModel::setData( const QModelIndex& index, c
584584
return false;
585585
}
586586

587-
switch ( index.column() )
587+
if ( index.column() == 1 )
588588
{
589-
case 1:
590589
column->setSortOrder(( Qt::SortOrder )value.toInt() );
591590
emit dataChanged( index, index );
592591
return true;
593-
default:
594-
return false;
595592
}
596593

597594
return false;

src/core/composer/qgscomposertable.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*
9999
cell = QRectF( currentX, currentY, mMaxColumnWidthMap[col], cellHeaderHeight );
100100

101101
//calculate alignment of header
102-
Qt::AlignmentFlag headerAlign;
102+
Qt::AlignmentFlag headerAlign = Qt::AlignLeft;
103103
switch ( mHeaderHAlignment )
104104
{
105105
case FollowColumn:

src/core/qgspallabeling.h

+5
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,9 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
737737

738738
//! called when we're going to start with rendering
739739
//! @deprecated since 2.4 - use override with QgsMapSettings
740+
Q_NOWARN_DEPRECATED_PUSH
740741
Q_DECL_DEPRECATED virtual void init( QgsMapRenderer* mr );
742+
Q_NOWARN_DEPRECATED_POP
741743
//! called when we're going to start with rendering
742744
virtual void init( const QgsMapSettings& mapSettings );
743745
//! called to find out whether the layer is used for labeling
@@ -765,12 +767,15 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
765767
virtual void drawLabeling( QgsRenderContext& context );
766768
//! called when we're done with rendering
767769
virtual void exit();
770+
771+
Q_NOWARN_DEPRECATED_PUSH
768772
//! return infos about labels at a given (map) position
769773
//! @deprecated since 2.4 - use takeResults() and methods of QgsLabelingResults
770774
Q_DECL_DEPRECATED virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p );
771775
//! return infos about labels within a given (map) rectangle
772776
//! @deprecated since 2.4 - use takeResults() and methods of QgsLabelingResults
773777
Q_DECL_DEPRECATED virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r );
778+
Q_NOWARN_DEPRECATED_POP
774779

775780
//! Return pointer to recently computed results (in drawLabeling()) and pass the ownership of results to the caller
776781
//! @note added in 2.4

src/customwidgets/CMakeLists.txt

+14-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ ADD_DEFINITIONS(-DQT_PLUGIN)
22
ADD_DEFINITIONS(-DQT_NO_DEBUG)
33
ADD_DEFINITIONS(-DQT_SHARED)
44

5+
IF (WIN32)
6+
IF (MSVC)
7+
ADD_DEFINITIONS("-DCUSTOMWIDGETS_EXPORT=${DLLEXPORT}")
8+
ELSE (MSVC)
9+
ADD_DEFINITIONS("-UCUSTOMWIDGETS_EXPORT \"-DCUSTOMWIDGETS_EXPORT=${DLLEXPORT}\"")
10+
ENDIF (MSVC)
11+
ENDIF (WIN32)
512

613
########################################################
714
# Files
@@ -30,9 +37,11 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
3037

3138
QT4_WRAP_CPP(QGIS_CUSTOMWIDGETS_MOC_SRCS ${QGIS_CUSTOMWIDGETS_MOC_HDRS})
3239

33-
IF(UNIX)
40+
IF(MSVC)
41+
SET_SOURCE_FILES_PROPERTIES(${QGIS_CUSTOMWIDGETS_MOC_SRCS} PROPERTIES COMPILE_FLAGS "/wd4996" )
42+
ELSE(MSVC)
3443
SET_SOURCE_FILES_PROPERTIES(${QGIS_CUSTOMWIDGETS_MOC_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations" )
35-
ENDIF(UNIX)
44+
ENDIF(MSVC)
3645

3746
SET(QGIS_CUSTOMWIDGETS_HDRS
3847
qgiscustomwidgets.h
@@ -78,6 +87,6 @@ TARGET_LINK_LIBRARIES(qgis_customwidgets qgis_gui)
7887

7988
# install
8089
INSTALL(TARGETS qgis_customwidgets
81-
LIBRARY DESTINATION ${QGIS_CUSTOMWIDGETS_DIR})
82-
83-
90+
RUNTIME DESTINATION ${QT_PLUGINS_DIR}/designer
91+
LIBRARY DESTINATION ${QT_PLUGINS_DIR}/designer
92+
)

src/customwidgets/qgscollapsiblegroupboxplugin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <QDesignerCustomWidgetInterface>
2121

2222

23-
class QDESIGNER_WIDGET_EXPORT QgsCollapsibleGroupBoxPlugin : public QObject, public QDesignerCustomWidgetInterface
23+
class CUSTOMWIDGETS_EXPORT QgsCollapsibleGroupBoxPlugin : public QObject, public QDesignerCustomWidgetInterface
2424
{
2525
Q_OBJECT
2626
Q_INTERFACES( QDesignerCustomWidgetInterface )

src/customwidgets/qgscolorbuttonplugin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <QDesignerCustomWidgetInterface>
2121

2222

23-
class QDESIGNER_WIDGET_EXPORT QgsColorButtonPlugin : public QObject, public QDesignerCustomWidgetInterface
23+
class CUSTOMWIDGETS_EXPORT QgsColorButtonPlugin : public QObject, public QDesignerCustomWidgetInterface
2424
{
2525
Q_OBJECT
2626
Q_INTERFACES( QDesignerCustomWidgetInterface )

src/customwidgets/qgsdatadefinedbuttonplugin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <QDesignerCustomWidgetInterface>
2121

2222

23-
class QDESIGNER_WIDGET_EXPORT QgsDataDefinedButtonPlugin : public QObject, public QDesignerCustomWidgetInterface
23+
class CUSTOMWIDGETS_EXPORT QgsDataDefinedButtonPlugin : public QObject, public QDesignerCustomWidgetInterface
2424
{
2525
Q_OBJECT
2626
Q_INTERFACES( QDesignerCustomWidgetInterface )

src/customwidgets/qgsfieldcomboboxplugin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <QDesignerCustomWidgetInterface>
2121

2222

23-
class QDESIGNER_WIDGET_EXPORT QgsFieldComboBoxPlugin : public QObject, public QDesignerCustomWidgetInterface
23+
class CUSTOMWIDGETS_EXPORT QgsFieldComboBoxPlugin : public QObject, public QDesignerCustomWidgetInterface
2424
{
2525
Q_OBJECT
2626
Q_INTERFACES( QDesignerCustomWidgetInterface )

src/customwidgets/qgsfieldexpressionwidgetplugin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <QDesignerCustomWidgetInterface>
2121

2222

23-
class QDESIGNER_WIDGET_EXPORT QgsFieldExpressionWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface
23+
class CUSTOMWIDGETS_EXPORT QgsFieldExpressionWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface
2424
{
2525
Q_OBJECT
2626
Q_INTERFACES( QDesignerCustomWidgetInterface )

src/customwidgets/qgsmaplayercomboboxplugin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <QDesignerCustomWidgetInterface>
2121

2222

23-
class QDESIGNER_WIDGET_EXPORT QgsMapLayerComboBoxPlugin : public QObject, public QDesignerCustomWidgetInterface
23+
class CUSTOMWIDGETS_EXPORT QgsMapLayerComboBoxPlugin : public QObject, public QDesignerCustomWidgetInterface
2424
{
2525
Q_OBJECT
2626
Q_INTERFACES( QDesignerCustomWidgetInterface )

src/customwidgets/qgsscalerangewidgetplugin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <QDesignerCustomWidgetInterface>
2121

2222

23-
class QDESIGNER_WIDGET_EXPORT QgsScaleRangeWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface
23+
class CUSTOMWIDGETS_EXPORT QgsScaleRangeWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface
2424
{
2525
Q_OBJECT
2626
Q_INTERFACES( QDesignerCustomWidgetInterface )

src/gui/CMakeLists.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,11 @@ qgsunitselectionwidget.h
287287

288288
QT4_WRAP_CPP(QGIS_GUI_MOC_SRCS ${QGIS_GUI_MOC_HDRS})
289289

290-
IF(UNIX)
290+
IF(MSVC)
291+
SET_SOURCE_FILES_PROPERTIES(${QGIS_GUI_MOC_SRCS} PROPERTIES COMPILE_FLAGS "/wd4996" )
292+
ELSE(MSVC)
291293
SET_SOURCE_FILES_PROPERTIES(${QGIS_GUI_MOC_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations" )
292-
ENDIF(UNIX)
294+
ENDIF(MSVC)
293295

294296
# for installing headers
295297

0 commit comments

Comments
 (0)