Add Qt5 support

This commit is contained in:
Matthias Kuhn 2014-11-07 09:46:59 +01:00
parent 97e796906f
commit 78c519546a
107 changed files with 462 additions and 130 deletions

View File

@ -219,20 +219,44 @@ SET (HAVE_MSSQL TRUE)
#############################################################
# search for Qt4
SET(QT_MIN_VERSION 4.7.0)
FIND_PACKAGE(Qt4 ${QT_MIN_VERSION} REQUIRED)
MESSAGE(STATUS "Found Qt version: ${QTVERSION}")
SET(QT_USE_QTXML 1)
SET(QT_USE_QTNETWORK 1)
SET(QT_USE_QTSVG 1)
SET(QT_USE_QTSQL 1)
SET(QT_USE_QTWEBKIT 1)
IF (WITH_CUSTOM_WIDGETS)
SET(QT_USE_QTDESIGNER 1)
ENDIF (WITH_CUSTOM_WIDGETS)
SET (ENABLE_QT5 FALSE CACHE BOOL "If enabled will try to find Qt5 before looking for Qt4")
IF (ENABLE_QT5)
FIND_PACKAGE(Qt5Core QUIET)
FIND_PACKAGE(Qt5Gui REQUIRED)
FIND_PACKAGE(Qt5Widgets REQUIRED)
FIND_PACKAGE(Qt5Network REQUIRED)
FIND_PACKAGE(Qt5Xml REQUIRED)
FIND_PACKAGE(Qt5Svg REQUIRED)
FIND_PACKAGE(Qt5Concurrent REQUIRED)
FIND_PACKAGE(Qt5PrintSupport REQUIRED)
FIND_PACKAGE(Qt5WebKit REQUIRED)
FIND_PACKAGE(Qt5WebKitWidgets REQUIRED)
FIND_PACKAGE(Qt5Test REQUIRED)
FIND_PACKAGE(Qt5UiTools REQUIRED)
FIND_PACKAGE(Qt5Script REQUIRED)
FIND_PACKAGE(Qt5Sql REQUIRED)
SET(QT5_BUILD TRUE)
IF (NOT QT_QTXML_FOUND OR NOT QT_QTNETWORK_FOUND OR NOT QT_QTSVG_FOUND OR NOT QT_QTSQL_FOUND OR NOT QT_QTWEBKIT_FOUND OR (WITH_CUSTOM_WIDGETS AND NOT QT_QTDESIGNER_FOUND))
MESSAGE(SEND_ERROR "Some Qt4 modules haven't been found!")
ENDIF (NOT QT_QTXML_FOUND OR NOT QT_QTNETWORK_FOUND OR NOT QT_QTSVG_FOUND OR NOT QT_QTSQL_FOUND OR NOT QT_QTWEBKIT_FOUND OR (WITH_CUSTOM_WIDGETS AND NOT QT_QTDESIGNER_FOUND))
INCLUDE("cmake/modules/ECMQt4To5Porting.cmake")
ELSE()
FIND_PACKAGE(Qt4 ${QT_MIN_VERSION} REQUIRED)
SET(QT_USE_QTXML 1)
SET(QT_USE_QTNETWORK 1)
SET(QT_USE_QTSVG 1)
SET(QT_USE_QTSQL 1)
SET(QT_USE_QTWEBKIT 1)
IF (WITH_CUSTOM_WIDGETS)
SET(QT_USE_QTDESIGNER 1)
ENDIF (WITH_CUSTOM_WIDGETS)
IF (NOT QT_QTXML_FOUND OR NOT QT_QTNETWORK_FOUND OR NOT QT_QTSVG_FOUND OR NOT QT_QTSQL_FOUND OR NOT QT_QTWEBKIT_FOUND OR (WITH_CUSTOM_WIDGETS AND NOT QT_QTDESIGNER_FOUND))
MESSAGE(SEND_ERROR "Some Qt4 modules haven't been found!")
ENDIF (NOT QT_QTXML_FOUND OR NOT QT_QTNETWORK_FOUND OR NOT QT_QTSVG_FOUND OR NOT QT_QTSQL_FOUND OR NOT QT_QTWEBKIT_FOUND OR (WITH_CUSTOM_WIDGETS AND NOT QT_QTDESIGNER_FOUND))
INCLUDE( ${QT_USE_FILE} )
ENDIF()
MESSAGE(STATUS "Found Qt version: ${QTVERSION}")
IF (WITH_QTMOBILITY)
FIND_PACKAGE(QtMobility 1.1.0)
@ -282,8 +306,6 @@ IF (SUPPRESS_QT_WARNINGS)
INCLUDE_DIRECTORIES(SYSTEM ${QT_INCLUDE_DIR})
ENDIF (SUPPRESS_QT_WARNINGS)
INCLUDE( ${QT_USE_FILE} )
# Disable automatic conversion from QString to ASCII 8-bit strings (char *)
# (Keeps code compatible with Qt/Mac/64bit)
ADD_DEFINITIONS(-DQT_NO_CAST_TO_ASCII)

View File

@ -0,0 +1,245 @@
#=============================================================================
# Copyright 2005-2011 Kitware, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the name of Kitware, Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
# The automoc_qt4 macro is superceded by CMAKE_AUTOMOC from CMake 2.8.6
# A Qt 5 version is not provided by CMake or Qt.
include(MacroAddFileDependencies)
MACRO (QT4_GET_MOC_FLAGS _moc_flags)
SET(${_moc_flags})
GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES)
FOREACH(_current ${_inc_DIRS})
IF("${_current}" MATCHES "\\.framework/?$")
STRING(REGEX REPLACE "/[^/]+\\.framework" "" framework_path "${_current}")
SET(${_moc_flags} ${${_moc_flags}} "-F${framework_path}")
ELSE("${_current}" MATCHES "\\.framework/?$")
SET(${_moc_flags} ${${_moc_flags}} "-I${_current}")
ENDIF("${_current}" MATCHES "\\.framework/?$")
ENDFOREACH(_current ${_inc_DIRS})
GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS)
FOREACH(_current ${_defines})
SET(${_moc_flags} ${${_moc_flags}} "-D${_current}")
ENDFOREACH(_current ${_defines})
IF(Q_OS_WIN)
SET(${_moc_flags} ${${_moc_flags}} -DWIN32)
ENDIF(Q_OS_WIN)
ENDMACRO(QT4_GET_MOC_FLAGS)
# helper macro to set up a moc rule
MACRO (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options)
# For Windows, create a parameters file to work around command line length limit
IF (WIN32)
# Pass the parameters in a file. Set the working directory to
# be that containing the parameters file and reference it by
# just the file name. This is necessary because the moc tool on
# MinGW builds does not seem to handle spaces in the path to the
# file given with the @ syntax.
GET_FILENAME_COMPONENT(_moc_outfile_name "${outfile}" NAME)
GET_FILENAME_COMPONENT(_moc_outfile_dir "${outfile}" PATH)
IF(_moc_outfile_dir)
SET(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir})
ENDIF(_moc_outfile_dir)
SET (_moc_parameters_file ${outfile}_parameters)
SET (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}")
STRING (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}")
FILE (WRITE ${_moc_parameters_file} "${_moc_parameters}")
ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
COMMAND ${QT_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters
DEPENDS ${infile}
${_moc_working_dir}
VERBATIM)
ELSE (WIN32)
ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
COMMAND ${QT_MOC_EXECUTABLE}
ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile}
DEPENDS ${infile} VERBATIM)
ENDIF (WIN32)
ENDMACRO (QT4_CREATE_MOC_COMMAND)
MACRO(QT4_AUTOMOC)
QT4_GET_MOC_FLAGS(_moc_INCS)
SET(_matching_FILES )
FOREACH (_current_FILE ${ARGN})
GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE)
# if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
# This is required to make uic work correctly:
# we need to add generated .cpp files to the sources (to compile them),
# but we cannot let automoc handle them, as the .cpp files don't exist yet when
# cmake is run for the very first time on them -> however the .cpp files might
# exist at a later run. at that time we need to skip them, so that we don't add two
# different rules for the same moc file
GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC)
IF ( NOT _skip AND EXISTS ${_abs_FILE} )
FILE(READ ${_abs_FILE} _contents)
GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH)
STRING(REGEX MATCHALL "# *include +[^ ]+\\.moc[\">]" _match "${_contents}")
IF(_match)
FOREACH (_current_MOC_INC ${_match})
STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}")
GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE)
IF(EXISTS ${_abs_PATH}/${_basename}.hpp)
SET(_header ${_abs_PATH}/${_basename}.hpp)
ELSE(EXISTS ${_abs_PATH}/${_basename}.hpp)
SET(_header ${_abs_PATH}/${_basename}.h)
ENDIF(EXISTS ${_abs_PATH}/${_basename}.hpp)
SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
QT4_CREATE_MOC_COMMAND(${_header} ${_moc} "${_moc_INCS}" "")
MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc})
ENDFOREACH (_current_MOC_INC)
ENDIF(_match)
ENDIF ( NOT _skip AND EXISTS ${_abs_FILE} )
ENDFOREACH (_current_FILE)
ENDMACRO(QT4_AUTOMOC)
# Portability helpers.
set(QT_QTGUI_LIBRARIES
${Qt5Gui_LIBRARIES}
${Qt5Widgets_LIBRARIES}
${Qt5PrintSupport_LIBRARIES}
${Qt5Svg_LIBRARIES}
)
set(QT_INCLUDES
${Qt5Gui_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
${Qt5PrintSupport_INCLUDE_DIRS}
${Qt5Svg_INCLUDE_DIRS}
)
set(QT_QTGUI_LIBRARY ${QT_QTGUI_LIBRARIES})
set(_qt_modules
Core
Declarative
Widgets
Script
ScriptTools
Network
Test
Designer
Concurrent
Xml
XmlPatterns
UiTools
Qml
Quick1
WebKit
WebKitWidgets
Sql
OpenGL
)
foreach(_module ${_qt_modules})
string(TOUPPER ${_module} _module_upper)
set(QT_QT${_module_upper}_LIBRARIES ${Qt5${_module}_LIBRARIES})
set(QT_QT${_module_upper}_LIBRARY ${QT_QT${_module_upper}_LIBRARIES})
list(APPEND QT_INCLUDES ${Qt5${_module}_INCLUDE_DIRS})
set(QT_QT${_module_upper}_FOUND ${Qt5${_module}_FOUND})
endforeach()
list(APPEND QT_QTCORE_LIBRARIES ${Qt5Concurrent_LIBRARIES})
list(APPEND QT_QTCORE_LIBRARY ${Qt5Concurrent_LIBRARIES})
list(APPEND QT_QTWEBKIT_LIBRARIES ${Qt5WebKitWidgets_LIBRARIES})
list(APPEND QT_QTWEBKIT_LIBRARY ${Qt5WebKitWidgets_LIBRARIES})
set(QT_QTDECLARATIVE_LIBRARIES ${Qt5Quick1_LIBRARIES})
set(QT_QTDECLARATIVE_LIBRARY ${Qt5Quick1_LIBRARIES})
set(QT_LRELEASE_EXECUTABLE lrelease-qt5)
set(QT_LUPDATE_EXECUTABLE lupdate-qt5)
set(QT_INSTALL_PREFIX ${_qt5Core_install_prefix})
get_target_property(QT_QMAKE_EXECUTABLE Qt5::qmake LOCATION)
set(QT_RCC_EXECUTABLE Qt5::rcc LOCATION)
if (TARGET Qt5::uic)
get_target_property(QT_UIC_EXECUTABLE Qt5::uic LOCATION)
endif()
if (TARGET Qt5::qdbuscpp2xml)
get_target_property(QT_QDBUSCPP2XML_EXECUTABLE Qt5::qdbuscpp2xml LOCATION)
endif()
if (TARGET Qt5::qdbusxml2cpp)
get_target_property(QT_QDBUSXML2CPP_EXECUTABLE Qt5::qdbusxml2cpp LOCATION)
endif()
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0)
macro(qt4_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()
macro(qt4_wrap_cpp)
qt5_wrap_cpp(${ARGN})
endmacro()
macro(qt4_generate_moc)
qt5_generate_moc(${ARGN})
endmacro()
macro(qt4_add_dbus_adaptor)
qt5_add_dbus_adaptor(${ARGN})
endmacro()
macro(qt4_add_dbus_interfaces)
qt5_add_dbus_interfaces(${ARGN})
endmacro()
macro(qt4_add_dbus_interface)
qt5_add_dbus_interface(${ARGN})
endmacro()
macro(qt4_generate_dbus_interface)
qt5_generate_dbus_interface(${ARGN})
endmacro()
macro(qt4_add_resources)
qt5_add_resources(${ARGN})
endmacro()

View File

@ -29,7 +29,6 @@
#include <QString>
#include <QStringList>
#include <QStyle>
#include <QPlastiqueStyle>
#include <QTranslator>
#include <QImageReader>
#include <QMessageBox>

View File

@ -94,7 +94,6 @@ SET(QGIS_CORE_SRCS
qgsgeometryvalidator.cpp
qgsgml.cpp
qgsgmlschema.cpp
qgshttptransaction.cpp
qgslabel.cpp
qgslabelattributes.cpp
qgslabelsearchtree.cpp
@ -268,9 +267,14 @@ SET(QGIS_CORE_SRCS
raster/qgssinglebandpseudocolorrenderer.cpp
raster/qgsbrightnesscontrastfilter.cpp
raster/qgshuesaturationfilter.cpp
)
IF (NOT QT5_BUILD)
SET(QGIS_CORE_SRCS ${QGIS_CORE_SRCS}
qgshttptransaction.cpp
)
ENDIF (NOT QT5_BUILD)
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# spatialindex headers produce warnings
SET_SOURCE_FILES_PROPERTIES(qgsspatialindex.cpp PROPERTIES COMPILE_FLAGS -Wno-overloaded-virtual)
@ -351,7 +355,6 @@ SET(QGIS_CORE_MOC_HDRS
qgsdataprovider.h
qgsgml.h
qgsgmlschema.h
qgshttptransaction.h
qgsmaplayer.h
qgsmaplayerlegend.h
qgsmaplayerregistry.h
@ -428,6 +431,12 @@ SET(QGIS_CORE_MOC_HDRS
layertree/qgslayertreeregistrybridge.h
)
IF (NOT QT5_BUILD)
SET(QGIS_CORE_MOC_HDRS ${QGIS_CORE_MOC_HDRS}
qgshttptransaction.h
)
ENDIF (NOT QT5_BUILD)
IF (WITH_INTERNAL_QEXTSERIALPORT)
SET(QGIS_CORE_MOC_HDRS ${QGIS_CORE_MOC_HDRS}
gps/qextserialport/qextserialport.h
@ -493,7 +502,6 @@ SET(QGIS_CORE_HDRS
qgsgml.h
qgsgmlschema.h
qgsgeometrycache.h
qgshttptransaction.h
qgslabel.h
qgslabelattributes.h
qgslabelsearchtree.h
@ -664,6 +672,12 @@ SET(QGIS_CORE_HDRS
layertree/qgslayertreeutils.h
)
IF (NOT QT5_BUILD)
SET(QGIS_CORE_HDRS ${QGIS_CORE_HDRS}
qgshttptransaction.h
)
ENDIF (NOT QT5_BUILD)
IF (QT_MOBILITY_LOCATION_FOUND)
SET(QGIS_CORE_HDRS ${QGIS_CORE_HDRS}
gps/qgsqtlocationconnection.h

View File

@ -188,7 +188,7 @@ bool QgsComposerAttributeTableColumnModel::setData( const QModelIndex& index, co
if ( column->heading().isEmpty() || ( column->heading() == column->attribute() ) )
{
column->setHeading( value.toString() );
emit dataChanged( createIndex( index.row(), 1, 0 ), createIndex( index.row(), 1, 0 ) );
emit dataChanged( createIndex( index.row(), 1 ), createIndex( index.row(), 1 ) );
}
column->setAttribute( value.toString() );
emit dataChanged( index, index );

View File

@ -202,7 +202,7 @@ bool QgsComposerAttributeTableColumnModelV2::setData( const QModelIndex& index,
if ( column->heading().isEmpty() || ( column->heading() == column->attribute() ) )
{
column->setHeading( value.toString() );
emit dataChanged( createIndex( index.row(), 1, 0 ), createIndex( index.row(), 1, 0 ) );
emit dataChanged( createIndex( index.row(), 1 ), createIndex( index.row(), 1 ) );
}
column->setAttribute( value.toString() );
emit dataChanged( index, index );

View File

@ -295,6 +295,9 @@ class CORE_EXPORT QGis
// retrieved from QLibrary::resolve to function pointers.
// It's assumed that this works on all systems supporting
// QLibrary
#if QT_VERSION >= 0x050000
#define cast_to_fptr(f) f
#else
inline void ( *cast_to_fptr( void *p ) )()
{
union
@ -306,6 +309,7 @@ inline void ( *cast_to_fptr( void *p ) )()
u.p = p;
return u.f;
}
#endif
//
// return a string representation of a double

View File

@ -162,7 +162,7 @@ string "'"{str_char}*"'"
{num_float} { yylval->numberFloat = cLocale.toDouble( QString::fromAscii(yytext) ); return NUMBER_FLOAT; }
{num_int} {
bool ok;
yylval->numberInt = cLocale.toInt( QString::fromAscii(yytext), &ok, 10 );
yylval->numberInt = cLocale.toInt( QString::fromAscii(yytext), &ok );
if( ok )
return NUMBER_INT;

View File

@ -19,6 +19,8 @@
#include "qgsmaplayerrenderer.h"
#include "qgspallabeling.h"
#include <QtConcurrentMap>
QgsMapRendererParallelJob::QgsMapRendererParallelJob( const QgsMapSettings& settings )
: QgsMapRendererQImageJob( settings )

View File

@ -403,6 +403,25 @@ QWidget* QgsProviderRegistry::selectWidget( const QString & providerKey,
return selectFactory( parent, fl );
}
#if QT_VERSION >= 0x050000
QFunctionPointer QgsProviderRegistry::function( QString const & providerKey,
QString const & functionName )
{
QLibrary myLib( library( providerKey ) );
QgsDebugMsg( "Library name is " + myLib.fileName() );
if ( myLib.load() )
{
return myLib.resolve( functionName.toAscii().data() );
}
else
{
QgsDebugMsg( "Cannot load library: " + myLib.errorString() );
return 0;
}
}
#else
void *QgsProviderRegistry::function( QString const & providerKey,
QString const & functionName )
{
@ -420,6 +439,7 @@ void *QgsProviderRegistry::function( QString const & providerKey,
return 0;
}
}
#endif
QLibrary *QgsProviderRegistry::providerLibrary( QString const & providerKey ) const
{

View File

@ -77,6 +77,15 @@ class CORE_EXPORT QgsProviderRegistry
QWidget *selectWidget( const QString & providerKey,
QWidget * parent = 0, Qt::WindowFlags fl = 0 );
#if QT_VERSION >= 0x050000
/** Get pointer to provider function
@param providerKey identificator of the provider
@param functionName name of function
@return pointer to function or NULL on error
*/
QFunctionPointer function( const QString & providerKey,
const QString & functionName );
#else
/** Get pointer to provider function
@param providerKey identificator of the provider
@param functionName name of function
@ -84,6 +93,7 @@ class CORE_EXPORT QgsProviderRegistry
*/
void *function( const QString & providerKey,
const QString & functionName );
#endif
QLibrary *providerLibrary( const QString & providerKey ) const;

View File

@ -241,7 +241,7 @@ QList<QgsFeatureId> QgsSpatialIndex::nearestNeighbor( QgsPoint point, int neighb
return list;
}
int QgsSpatialIndex::refs() const
QAtomicInt QgsSpatialIndex::refs() const
{
return d->ref;
}

View File

@ -80,7 +80,7 @@ class CORE_EXPORT QgsSpatialIndex
/* debugging */
//! get reference count - just for debugging!
int refs() const;
QAtomicInt refs() const;
protected:
// @note not available in python bindings

View File

@ -811,7 +811,7 @@ QIcon QgsCptCityColorRampItem::icon( const QSize& size )
return icon;
}
QIcon icon( size );
QIcon icon;
init();

View File

@ -17,8 +17,7 @@
#include <Qt>
#include <QPair>
class QStringList;
#include <QStringList>
/** \ingroup gui
* /namespace QgisGui
@ -81,7 +80,7 @@ namespace QgisGui
* @return QPair<QString, QString> where first is the file name and second is
* the file type
*/
QPair<QString, QString> GUI_EXPORT getSaveAsImageName( QWidget * theParent, QString theMessage, QString defaultFilename = QString::null );
QPair<QString, QString> getSaveAsImageName( QWidget * theParent, QString theMessage, QString defaultFilename = QString::null );
/**
Convenience function for readily creating file filters.

View File

@ -16,8 +16,6 @@
#include "qgsactionmenu.h"
#include "qgsvectorlayer.h"
#include <QMenuItem>
QgsActionMenu::QgsActionMenu( QgsVectorLayer* layer, const QgsFeature* feature, QWidget* parent )
: QMenu( parent )
, mLayer( layer )

View File

@ -26,6 +26,7 @@
#include <QToolButton>
#include <QMenu>
#include <QSettings>
#include <QDrag>
#include <cmath>

View File

@ -18,6 +18,7 @@
#include <QFileInfo>
#include <QPainter>
#include <QUrl>
#include <QMimeData>
/*!
\class QgsFileDropEdit

View File

@ -27,7 +27,7 @@
#include "qgslogger.h"
QgsMapCanvasItem::QgsMapCanvasItem( QgsMapCanvas* mapCanvas )
: QGraphicsItem( 0, mapCanvas->scene() ), mMapCanvas( mapCanvas ),
: QGraphicsItem(), mMapCanvas( mapCanvas ),
mPanningOffset( 0, 0 ), mItemSize( 0, 0 )
{
}

View File

@ -141,7 +141,7 @@ void CharacterWidget::mousePressEvent( QMouseEvent *event )
if ( event->button() == Qt::LeftButton )
{
lastKey = ( event->y() / squareSize ) * columns + event->x() / squareSize;
if ( QChar( lastKey ).category() != QChar::NoCategory )
if ( QChar( lastKey ).category() != QChar::Other_NotAssigned )
emit characterSelected( QChar( lastKey ) );
update();
}

View File

@ -48,7 +48,7 @@ QgsBrushStyleComboBox::QgsBrushStyleComboBox( QWidget* parent )
{
Qt::BrushStyle style = styles.at( i ).first;
QString name = styles.at( i ).second;
addItem( iconForBrush( style ), name, QVariant( style ) );
addItem( iconForBrush( style ), name, QVariant( (int)style ) );
}
setCurrentIndex( 1 );
@ -63,7 +63,7 @@ Qt::BrushStyle QgsBrushStyleComboBox::brushStyle() const
void QgsBrushStyleComboBox::setBrushStyle( Qt::BrushStyle style )
{
int idx = findData( QVariant( style ) );
int idx = findData( QVariant( (int)style ) );
setCurrentIndex( idx == -1 ? 0 : idx );
}

View File

@ -222,7 +222,7 @@ QModelIndex QgsCategorizedSymbolRendererV2Model::index( int row, int column, con
{
if ( hasIndex( row, column, parent ) )
{
return createIndex( row, column, 0 );
return createIndex( row, column );
}
return QModelIndex();
}
@ -297,7 +297,7 @@ bool QgsCategorizedSymbolRendererV2Model::dropMimeData( const QMimeData *data, Q
// removed under 'to' so the target shifted down
if ( rows[i] < to ) to--;
}
emit dataChanged( createIndex( 0, 0, 0 ), createIndex( mRenderer->categories().size(), 0 ) );
emit dataChanged( createIndex( 0, 0 ), createIndex( mRenderer->categories().size(), 0 ) );
emit rowsMoved();
return false;
}
@ -334,13 +334,13 @@ void QgsCategorizedSymbolRendererV2Model::sort( int column, Qt::SortOrder order
{
mRenderer->sortByLabel( order );
}
emit dataChanged( createIndex( 0, 0, 0 ), createIndex( mRenderer->categories().size(), 0 ) );
emit dataChanged( createIndex( 0, 0 ), createIndex( mRenderer->categories().size(), 0 ) );
QgsDebugMsg( "Done" );
}
void QgsCategorizedSymbolRendererV2Model::updateSymbology()
{
emit dataChanged( createIndex( 0, 0, 0 ), createIndex( mRenderer->categories().size(), 0 ) );
emit dataChanged( createIndex( 0, 0 ), createIndex( mRenderer->categories().size(), 0 ) );
}
// ------------------------------ View style --------------------------------

View File

@ -218,7 +218,7 @@ QModelIndex QgsGraduatedSymbolRendererV2Model::index( int row, int column, const
{
if ( hasIndex( row, column, parent ) )
{
return createIndex( row, column, 0 );
return createIndex( row, column );
}
return QModelIndex();
}
@ -293,7 +293,7 @@ bool QgsGraduatedSymbolRendererV2Model::dropMimeData( const QMimeData *data, Qt:
// removed under 'to' so the target shifted down
if ( rows[i] < to ) to--;
}
emit dataChanged( createIndex( 0, 0, 0 ), createIndex( mRenderer->ranges().size(), 0 ) );
emit dataChanged( createIndex( 0, 0 ), createIndex( mRenderer->ranges().size(), 0 ) );
emit rowsMoved();
return false;
}
@ -331,13 +331,13 @@ void QgsGraduatedSymbolRendererV2Model::sort( int column, Qt::SortOrder order )
mRenderer->sortByLabel( order );
}
emit rowsMoved();
emit dataChanged( createIndex( 0, 0, 0 ), createIndex( mRenderer->ranges().size(), 0 ) );
emit dataChanged( createIndex( 0, 0 ), createIndex( mRenderer->ranges().size(), 0 ) );
QgsDebugMsg( "Done" );
}
void QgsGraduatedSymbolRendererV2Model::updateSymbology()
{
emit dataChanged( createIndex( 0, 0, 0 ), createIndex( mRenderer->ranges().size(), 0 ) );
emit dataChanged( createIndex( 0, 0 ), createIndex( mRenderer->ranges().size(), 0 ) );
}
void QgsGraduatedSymbolRendererV2Model::updateLabels()

View File

@ -40,7 +40,7 @@ QgsPenStyleComboBox::QgsPenStyleComboBox( QWidget* parent )
{
Qt::PenStyle style = styles.at( i ).first;
QString name = styles.at( i ).second;
addItem( iconForPen( style ), name, QVariant( style ) );
addItem( iconForPen( style ), name, QVariant( (int) style ) );
}
}
@ -51,7 +51,7 @@ Qt::PenStyle QgsPenStyleComboBox::penStyle() const
void QgsPenStyleComboBox::setPenStyle( Qt::PenStyle style )
{
int idx = findData( QVariant( style ) );
int idx = findData( QVariant( (int) style ) );
setCurrentIndex( idx == -1 ? 0 : idx );
}

View File

@ -91,9 +91,14 @@ eVisImageDisplayWidget::eVisImageDisplayWidget( QWidget* parent, Qt::WindowFlags
//setup http connection
mHttpBuffer = new QBuffer();
#if QT_VERSION < 0x050000
mHttpConnection = new QHttp();
#endif
mHttpBuffer->open( QBuffer::ReadWrite );
// TODO
#if QT_VERSION < 0x050000
connect( mHttpConnection, SIGNAL( requestFinished( int, bool ) ), this, SLOT( displayUrlImage( int, bool ) ) );
#endif
//initialize remaining variables
mScaleByHeight = false;
@ -108,7 +113,9 @@ eVisImageDisplayWidget::~eVisImageDisplayWidget()
delete mImageLabel;
delete mImage;
delete mHttpBuffer;
#if QT_VERSION < 0x050000
delete mHttpConnection;
#endif
delete pbtnZoomIn;
delete pbtnZoomOut;
delete pbtnZoomFull;
@ -186,8 +193,10 @@ void eVisImageDisplayWidget::displayImage()
void eVisImageDisplayWidget::displayUrlImage( QString url )
{
QUrl myUrl( url );
#if QT_VERSION < 0x050000
mHttpConnection->setHost( myUrl.host() );
mCurrentHttpImageRequestId = mHttpConnection->get( myUrl.path().replace( "\\", "/" ), mHttpBuffer );
#endif
}
/**

View File

@ -32,7 +32,11 @@
#include <QScrollArea>
#include <QPushButton>
#include <QBuffer>
// TODO: Update to QNetworkAccessManager
#if QT_VERSION < 0x050000
#include <QHttp>
#endif
#include <QResizeEvent>
/**
@ -90,8 +94,11 @@ class eVisImageDisplayWidget : public QWidget
/** \brief Pointer to the http buffer */
QBuffer* mHttpBuffer;
// TODO: Update to QNetworkAccessManager
#if QT_VERSION < 0x050000
/** \brief Pointer to the http connection if needed */
QHttp* mHttpConnection;
#endif
/** \brief This is a point to the actual image being displayed */
QPixmap* mImage;

View File

@ -248,7 +248,8 @@ QString QgsPostgresProvider::storageType() const
return "PostgreSQL database with PostGIS extension";
}
// Qt5 has that built in
#if QT_VERSION < 0x050000
static bool operator<( const QVariant &a, const QVariant &b )
{
if ( a.isNull() || b.isNull() )
@ -325,7 +326,7 @@ static bool operator<( const QVariant &a, const QVariant &b )
return a.canConvert( QVariant::String ) && b.canConvert( QVariant::String ) && a.toString() < b.toString();
}
#endif
QgsFeatureIterator QgsPostgresProvider::getFeatures( const QgsFeatureRequest& request )
{

View File

@ -21,7 +21,7 @@
#include <QSettings>
#include <QString>
#include <QStringList>
#include <QTest>
#include <QtTest/QTest>
#include <cstdio>
#include <stdio.h>

View File

@ -13,8 +13,8 @@
* *
***************************************************************************/
#include <QtTest>
#include <QSignalSpy>
#include <QtTest/QtTest>
#include <QtTest/QSignalSpy>
#include <qgsapplication.h>
//#include <qgsproviderregistry.h>

View File

@ -12,7 +12,7 @@ Email : sherman at mrcc dot com
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
//header for class being tested
#include <qgsgeometryanalyzer.h>

View File

@ -14,7 +14,7 @@
***************************************************************************/
#include <QDir>
#include <QtTest>
#include <QtTest/QtTest>
#include "qgsapplication.h"
#include "qgsvectorlayer.h"

View File

@ -20,7 +20,7 @@
#include <QSplashScreen>
#include <QString>
#include <QStringList>
#include <QtTest>
#include <QtTest/QtTest>
#include <qgisapp.h>
#include <qgsapplication.h>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QObject>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QApplication>
#include <QDesktopServices>

View File

@ -1,5 +1,5 @@
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include "qgsapplication.h"

View File

@ -12,7 +12,7 @@ Email : sherman at mrcc dot com
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <iostream>
#include <QPixmap>

View File

@ -30,8 +30,8 @@
#include "qgssinglesymbolrendererv2.h"
#include "qgsfontutils.h"
#include <QObject>
#include <QSignalSpy>
#include <QtTest>
#include <QtTest/QSignalSpy>
#include <QtTest/QtTest>
class TestQgsAtlasComposition: public QObject
{

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QFile>
#include <QTextStream>
#include <QObject>

View File

@ -17,7 +17,7 @@
#include "qgscolorscheme.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
//dummy color scheme for testing
class DummyColorScheme : public QgsColorScheme

View File

@ -18,7 +18,7 @@
#include "qgscolorschemeregistry.h"
#include "qgscolorscheme.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
//dummy color scheme for testing
class DummyColorScheme : public QgsColorScheme

View File

@ -30,7 +30,7 @@
#include "qgsdatadefined.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
class TestQgsComposerDD: public QObject
{

View File

@ -21,7 +21,7 @@
#include "qgscomposershape.h"
#include "qgsmaprenderer.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
#include <QColor>
#include <QPainter>

View File

@ -20,7 +20,7 @@
#include "qgscomposition.h"
#include "qgscompositionchecker.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
class TestQgsComposerGroup: public QObject
{

View File

@ -22,7 +22,7 @@
#include "qgscompositionchecker.h"
#include "qgsfontutils.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
class TestQgsComposerHtml: public QObject
{

View File

@ -24,7 +24,7 @@
#include "qgsvectordataprovider.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
class TestQgsComposerLabel: public QObject
{

View File

@ -24,7 +24,7 @@
#include "qgsmultibandcolorrenderer.h"
#include "qgsrasterlayer.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
class TestQgsComposerMap: public QObject
{

View File

@ -24,7 +24,7 @@
#include "qgsmaprenderer.h"
#include "qgsfontutils.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
class TestQgsComposerMapGrid: public QObject
{

View File

@ -26,7 +26,7 @@
#include "qgsrasterlayer.h"
#include "qgsfontutils.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
class TestQgsComposerMapOverview: public QObject
{

View File

@ -19,7 +19,7 @@
#include "qgscomposermodel.h"
#include "qgscomposerlabel.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
#include <QList>
class TestQgsComposerModel: public QObject

View File

@ -21,7 +21,7 @@
#include "qgscomposition.h"
#include "qgscompositionchecker.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
class TestQgsComposerMultiFrame: public QObject
{

View File

@ -20,7 +20,7 @@
#include "qgscompositionchecker.h"
#include "qgsdatadefined.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
class TestQgsComposerObject: public QObject
{

View File

@ -25,7 +25,7 @@
#include "qgslinesymbollayerv2.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
#include <QColor>
#include <QPainter>

View File

@ -20,7 +20,7 @@
#include "qgscompositionchecker.h"
#include "qgscomposerpicture.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
#include <QColor>
#include <QPainter>

View File

@ -27,7 +27,7 @@
#include "qgsmaplayerregistry.h"
#include "qgsfontutils.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
#include <QColor>
#include <QPainter>

View File

@ -26,7 +26,7 @@
#include "qgsrasterlayer.h"
#include "qgsfontutils.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
class TestQgsComposerScaleBar: public QObject
{

View File

@ -24,7 +24,7 @@
#include "qgssinglesymbolrendererv2.h"
#include "qgsfillsymbollayerv2.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
#include <QColor>
#include <QPainter>

View File

@ -26,7 +26,7 @@
#include "qgsfeature.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
class TestQgsComposerTable: public QObject
{

View File

@ -32,7 +32,7 @@
#include "qgsrelationmanager.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
class TestQgsComposerTableV2: public QObject
{

View File

@ -22,7 +22,7 @@
#include "qgsdatadefined.h"
#include "qgsfontutils.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
#include <QMap>
class TestQgsComposerUtils: public QObject

View File

@ -25,7 +25,7 @@
#include "qgsmapsettings.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
class TestQgsComposition: public QObject
{

View File

@ -12,7 +12,7 @@ Email : sherman at mrcc dot com
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <iostream>
#include <QPixmap>

View File

@ -17,7 +17,7 @@
#include "qgscoordinatetransform.h"
#include "qgsapplication.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
class TestQgsCoordinateTransform: public QObject
{

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QFile>
#include <QTextStream>
#include <QObject>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QObject>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -18,7 +18,7 @@
#include "qgspoint.h"
#include <QPolygonF>
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
class TestQgsGeometryImport: public QObject

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -1,5 +1,5 @@
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include "qgsapplication.h"

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -18,7 +18,7 @@
#include "qgsnetworkcontentfetcher.h"
#include "qgsapplication.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
#include <QNetworkReply>
class TestQgsNetworkContentFetcher: public QObject

View File

@ -14,7 +14,7 @@
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
//qgis includes...
#include <qgsgeometry.h>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QObject>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <qgsapplication.h>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QObject>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QDomDocument>
#include <QFile>
//header for class being tested

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -13,7 +13,7 @@
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QObject>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QStringList>
#include <QObject>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QObject>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QStringList>

View File

@ -14,7 +14,7 @@
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QTemporaryFile>

View File

@ -14,7 +14,7 @@
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
//qgis includes...

View File

@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <QObject>
#include <QString>
#include <QObject>

View File

@ -22,7 +22,7 @@
#include "qgsmultibandcolorrenderer.h"
#include "qgsrasterlayer.h"
#include <QObject>
#include <QtTest>
#include <QtTest/QtTest>
class TestProjectionIssues: public QObject
{

View File

@ -14,7 +14,7 @@
***************************************************************************/
#include <QtTest>
#include <QtTest/QtTest>
#include <editorwidgets/core/qgseditorwidgetregistry.h>
#include <attributetable/qgsattributetableview.h>

Some files were not shown because too many files have changed in this diff Show More