11 changes: 7 additions & 4 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
SET(QGIS_APP_SRCS
main.cpp
qgisapp.cpp
qgisappinterface.cpp
qgisappstylesheet.cpp
Expand Down Expand Up @@ -452,13 +451,17 @@ ENDIF (POSTGRES_FOUND)

#############
IF (ANDROID)
ADD_LIBRARY(${QGIS_APP_NAME} SHARED ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${QGIS_APP_HDRS} ${QGIS_APP_MOC_HDRS} ${IMAGE_RCC_SRCS} ${TEST_RCC_SRCS})
ADD_LIBRARY(${QGIS_APP_NAME} SHARED main.cpp ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${QGIS_APP_HDRS} ${QGIS_APP_MOC_HDRS} ${IMAGE_RCC_SRCS} ${TEST_RCC_SRCS})
ELSE (ANDROID)
ADD_EXECUTABLE(${QGIS_APP_NAME} MACOSX_BUNDLE WIN32 ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${IMAGE_RCC_SRCS} ${TEST_RCC_SRCS})
ADD_EXECUTABLE(${QGIS_APP_NAME} MACOSX_BUNDLE WIN32 main.cpp ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${IMAGE_RCC_SRCS} ${TEST_RCC_SRCS})
ENDIF (ANDROID)

# shared library used by tests - TODO: use it also for qgis executable?
ADD_LIBRARY(qgis_app SHARED ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${QGIS_APP_HDRS} ${QGIS_APP_MOC_HDRS} ${IMAGE_RCC_SRCS})
ADD_LIBRARY(qgis_app STATIC ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${QGIS_APP_HDRS} ${QGIS_APP_MOC_HDRS} ${IMAGE_RCC_SRCS})

if(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
SET_TARGET_PROPERTIES(qgis_app PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64")
ENDIF(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)

TARGET_LINK_LIBRARIES(${QGIS_APP_NAME}
${QWT_LIBRARY}
Expand Down
8 changes: 4 additions & 4 deletions src/app/composer/qgscomposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
QProgressDialog progress( tr( "Rendering maps..." ), tr( "Abort" ), 0, atlasMap->numFeatures(), this );
QApplication::setOverrideCursor( Qt::BusyCursor );

for ( size_t featureI = 0; featureI < atlasMap->numFeatures(); ++featureI )
for ( int featureI = 0; featureI < atlasMap->numFeatures(); ++featureI )
{
progress.setValue( featureI );
// process input events in order to allow aborting
Expand Down Expand Up @@ -880,7 +880,7 @@ void QgsComposer::on_mActionPrint_triggered()
}
QProgressDialog progress( tr( "Rendering maps..." ), tr( "Abort" ), 0, atlasMap->numFeatures(), this );

for ( size_t i = 0; i < atlasMap->numFeatures(); ++i )
for ( int i = 0; i < atlasMap->numFeatures(); ++i )
{
progress.setValue( i );
// process input events in order to allow cancelling
Expand Down Expand Up @@ -1095,7 +1095,7 @@ void QgsComposer::on_mActionExportAsImage_triggered()

QProgressDialog progress( tr( "Rendering maps..." ), tr( "Abort" ), 0, atlasMap->numFeatures(), this );

for ( size_t feature = 0; feature < atlasMap->numFeatures(); ++feature )
for ( int feature = 0; feature < atlasMap->numFeatures(); ++feature )
{
progress.setValue( feature );
// process input events in order to allow cancelling
Expand Down Expand Up @@ -1246,7 +1246,7 @@ void QgsComposer::on_mActionExportAsSVG_triggered()

mView->setPaintingEnabled( false );

size_t featureI = 0;
int featureI = 0;
if ( hasAnAtlas )
{
try
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8864,12 +8864,14 @@ void QgisApp::keyPressEvent( QKeyEvent * e )
{
stopRendering();
}
#if 0
#if defined(Q_OS_WIN)&& defined(QGISDEBUG)
else if ( e->key() == Qt::Key_Backslash && e->modifiers() & Qt::ControlModifier )
{
extern LONG WINAPI qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo );
qgisCrashDump( 0 );
}
#endif
#endif
else
{
Expand Down
6 changes: 3 additions & 3 deletions src/core/composer/qgsatlascomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void QgsAtlasComposition::beginRender()

if ( mSortFeatures )
{
mFeatureKeys.insert( std::make_pair( feat.id(), feat.attributes()[ mSortKeyAttributeIdx ] ) );
mFeatureKeys.insert( feat.id(), feat.attributes()[ mSortKeyAttributeIdx ] );
}
}

Expand Down Expand Up @@ -211,12 +211,12 @@ void QgsAtlasComposition::endRender()
mComposerMap->setNewExtent( mOrigExtent );
}

size_t QgsAtlasComposition::numFeatures() const
int QgsAtlasComposition::numFeatures() const
{
return mFeatureIds.size();
}

void QgsAtlasComposition::prepareForFeature( size_t featureI )
void QgsAtlasComposition::prepareForFeature( int featureI )
{
if ( !mComposerMap || !mCoverageLayer )
{
Expand Down
12 changes: 6 additions & 6 deletions src/core/composer/qgsatlascomposition.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,19 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
QString featureFilter() const { return mFeatureFilter; }
void setFeatureFilter( const QString& expression ) { mFeatureFilter = expression; }

size_t sortKeyAttributeIndex() const { return mSortKeyAttributeIdx; }
void setSortKeyAttributeIndex( size_t idx ) { mSortKeyAttributeIdx = idx; }
int sortKeyAttributeIndex() const { return mSortKeyAttributeIdx; }
void setSortKeyAttributeIndex( int idx ) { mSortKeyAttributeIdx = idx; }

/** Begins the rendering. */
void beginRender();
/** Ends the rendering. Restores original extent */
void endRender();

/** Returns the number of features in the coverage layer */
size_t numFeatures() const;
int numFeatures() const;

/** Prepare the atlas map for the given feature. Sets the extent and context variables */
void prepareForFeature( size_t i );
void prepareForFeature( int i );

/** Returns the current filename. Must be called after prepareForFeature( i ) */
const QString& currentFilename() const;
Expand Down Expand Up @@ -123,12 +123,12 @@ class CORE_EXPORT QgsAtlasComposition : public QObject
// sort direction
bool mSortAscending;
public:
typedef std::map< QgsFeatureId, QVariant > SorterKeys;
typedef QMap< QgsFeatureId, QVariant > SorterKeys;
private:
// value of field that is used for ordering of features
SorterKeys mFeatureKeys;
// key (attribute index) used for ordering
size_t mSortKeyAttributeIdx;
int mSortKeyAttributeIdx;

// feature filtering
bool mFilterFeatures;
Expand Down
4 changes: 4 additions & 0 deletions tests/src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ MACRO (ADD_QGIS_TEST testname testsrc)
qgis_gui
qgis_analysis
qgis_app)
IF(WIN32)
ADD_DEFINITIONS(-DQWT_DLL)
TARGET_LINK_LIBRARIES(qgis_${testname} DbgHelp)
ENDIF(WIN32)
ADD_TEST(qgis_${testname} ${CMAKE_CURRENT_BINARY_DIR}/../../../output/bin/qgis_${testname})
#SET_TARGET_PROPERTIES(qgis_${testname} PROPERTIES
# INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${QGIS_LIB_DIR}
Expand Down
12 changes: 6 additions & 6 deletions tests/src/core/testqgsatlascomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void TestQgsAtlasComposition::filename()
{
mAtlas->setFilenamePattern( "'output_' || $feature" );
mAtlas->beginRender();
for ( size_t fi = 0; fi < mAtlas->numFeatures(); ++fi )
for ( int fi = 0; fi < mAtlas->numFeatures(); ++fi )
{
mAtlas->prepareForFeature( fi );
QString expected = QString( "output_%1" ).arg(( int )( fi + 1 ) );
Expand All @@ -170,7 +170,7 @@ void TestQgsAtlasComposition::autoscale_render()

mAtlas->beginRender();

for ( size_t fit = 0; fit < 2; ++fit )
for ( int fit = 0; fit < 2; ++fit )
{
mAtlas->prepareForFeature( fit );
mLabel1->adjustSizeToText();
Expand All @@ -191,7 +191,7 @@ void TestQgsAtlasComposition::fixedscale_render()

mAtlas->beginRender();

for ( size_t fit = 0; fit < 2; ++fit )
for ( int fit = 0; fit < 2; ++fit )
{
mAtlas->prepareForFeature( fit );
mLabel1->adjustSizeToText();
Expand All @@ -214,7 +214,7 @@ void TestQgsAtlasComposition::hiding_render()

mAtlas->beginRender();

for ( size_t fit = 0; fit < 2; ++fit )
for ( int fit = 0; fit < 2; ++fit )
{
mAtlas->prepareForFeature( fit );
mLabel1->adjustSizeToText();
Expand All @@ -240,7 +240,7 @@ void TestQgsAtlasComposition::sorting_render()

mAtlas->beginRender();

for ( size_t fit = 0; fit < 2; ++fit )
for ( int fit = 0; fit < 2; ++fit )
{
mAtlas->prepareForFeature( fit );
mLabel1->adjustSizeToText();
Expand All @@ -267,7 +267,7 @@ void TestQgsAtlasComposition::filtering_render()

mAtlas->beginRender();

for ( size_t fit = 0; fit < 1; ++fit )
for ( int fit = 0; fit < 1; ++fit )
{
mAtlas->prepareForFeature( fit );
mLabel1->adjustSizeToText();
Expand Down