Update indentation

This commit is contained in:
Nyall Dawson 2017-11-24 14:57:39 +10:00
parent 6ec96d6d8e
commit 32834e9bf1
10 changed files with 233 additions and 193 deletions

View File

@ -221,9 +221,9 @@ class QgsLayoutItemHtml: QgsLayoutMultiFrame
%Docstring %Docstring
Recalculates the frame sizes for the current viewport dimensions Recalculates the frame sizes for the current viewport dimensions
%End %End
void refreshExpressionContext();
void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties ); virtual void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties );
protected: protected:

View File

@ -266,6 +266,12 @@ class QgsLayoutMultiFrame: QgsLayoutObject, QgsLayoutUndoObjectInterface
public slots: public slots:
virtual void refresh();
%Docstring
Refreshes the multiframe, causing a recalculation of any property overrides.
%End
void update(); void update();
%Docstring %Docstring
Forces a redraw of all child frames. Forces a redraw of all child frames.
@ -290,6 +296,14 @@ class QgsLayoutMultiFrame: QgsLayoutObject, QgsLayoutUndoObjectInterface
.. seealso:: recalculateFrameSizes .. seealso:: recalculateFrameSizes
%End %End
virtual void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties );
%Docstring
Refreshes a data defined ``property`` for the multi frame by reevaluating the property's value
and redrawing the item with this new value. If ``property`` is set to
QgsLayoutObject.AllProperties then all data defined properties for the item will be
refreshed.
%End
signals: signals:
void changed(); void changed();

View File

@ -31,6 +31,7 @@ class APP_EXPORT QgsCrashHandler
{ {
public: public:
/** /**
* This class doesn't need to be created by anyone as is only used to handle * This class doesn't need to be created by anyone as is only used to handle
* crashes in the application. * crashes in the application.

View File

@ -224,9 +224,8 @@ class CORE_EXPORT QgsLayoutItemHtml: public QgsLayoutMultiFrame
//! Recalculates the frame sizes for the current viewport dimensions //! Recalculates the frame sizes for the current viewport dimensions
void recalculateFrameSizes() override; void recalculateFrameSizes() override;
void refreshExpressionContext();
void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties ); void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties ) override;
protected: protected:
@ -273,6 +272,8 @@ class CORE_EXPORT QgsLayoutItemHtml: public QgsLayoutMultiFrame
//! Calculates the max width of frames in the html multiframe //! Calculates the max width of frames in the html multiframe
double maxFrameWidth() const; double maxFrameWidth() const;
void refreshExpressionContext();
}; };
#endif // QGSLAYOUTITEMHTML_H #endif // QGSLAYOUTITEMHTML_H

View File

@ -233,6 +233,11 @@ void QgsLayoutMultiFrame::recalculateFrameRects()
} }
} }
void QgsLayoutMultiFrame::refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty )
{
}
QgsLayoutFrame *QgsLayoutMultiFrame::createNewFrame( QgsLayoutFrame *currentFrame, QPointF pos, QSizeF size ) QgsLayoutFrame *QgsLayoutMultiFrame::createNewFrame( QgsLayoutFrame *currentFrame, QPointF pos, QSizeF size )
{ {
if ( !currentFrame ) if ( !currentFrame )
@ -289,6 +294,12 @@ void QgsLayoutMultiFrame::cancelCommand()
mLayout->undoStack()->cancelCommand(); mLayout->undoStack()->cancelCommand();
} }
void QgsLayoutMultiFrame::refresh()
{
QgsLayoutObject::refresh();
refreshDataDefinedProperty();
}
void QgsLayoutMultiFrame::handleFrameRemoval() void QgsLayoutMultiFrame::handleFrameRemoval()
{ {
if ( mBlockUpdates ) if ( mBlockUpdates )

View File

@ -278,6 +278,11 @@ class CORE_EXPORT QgsLayoutMultiFrame: public QgsLayoutObject, public QgsLayoutU
public slots: public slots:
/**
* Refreshes the multiframe, causing a recalculation of any property overrides.
*/
void refresh() override;
/** /**
* Forces a redraw of all child frames. * Forces a redraw of all child frames.
*/ */
@ -302,6 +307,14 @@ class CORE_EXPORT QgsLayoutMultiFrame: public QgsLayoutObject, public QgsLayoutU
*/ */
void recalculateFrameRects(); void recalculateFrameRects();
/**
* Refreshes a data defined \a property for the multi frame by reevaluating the property's value
* and redrawing the item with this new value. If \a property is set to
* QgsLayoutObject::AllProperties then all data defined properties for the item will be
* refreshed.
*/
virtual void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties );
signals: signals:
/** /**

View File

@ -1,32 +1,32 @@
INCLUDE_DIRECTORIES(SYSTEM INCLUDE_DIRECTORIES(SYSTEM
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
) )
QT5_WRAP_UI(CRASH_UIS_H qgscrashdialog.ui) QT5_WRAP_UI(CRASH_UIS_H qgscrashdialog.ui)
QT5_WRAP_CPP(CRASH_HDR_MOC qgscrashdialog.h) QT5_WRAP_CPP(CRASH_HDR_MOC qgscrashdialog.h)
SET(IMAGE_RCCS ../../images/images.qrc) SET(IMAGE_RCCS ../../images/images.qrc)
QT5_ADD_RESOURCES(IMAGE_RCC_SRCS ${IMAGE_RCCS}) QT5_ADD_RESOURCES(IMAGE_RCC_SRCS ${IMAGE_RCCS})
# -wd4091 Avoid 'typedef' ignored on left of '' when no variable is declared warning in DbgHelp.h # -wd4091 Avoid 'typedef' ignored on left of '' when no variable is declared warning in DbgHelp.h
SET_SOURCE_FILES_PROPERTIES(qgsstacktrace.cpp PROPERTIES COMPILE_FLAGS -wd4091) SET_SOURCE_FILES_PROPERTIES(qgsstacktrace.cpp PROPERTIES COMPILE_FLAGS -wd4091)
ADD_EXECUTABLE(qgiscrashhandler WIN32 ADD_EXECUTABLE(qgiscrashhandler WIN32
main.cpp main.cpp
${CRASH_UIS_H} ${CRASH_UIS_H}
${CRASH_HDR_MOC} ${CRASH_HDR_MOC}
${IMAGE_RCC_SRCS} ${IMAGE_RCC_SRCS}
qgscrashdialog.cpp qgscrashdialog.cpp
qgsstacktrace.cpp qgsstacktrace.cpp
qgscrashreport.cpp qgscrashreport.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../app/qgis_win32.rc ${CMAKE_CURRENT_SOURCE_DIR}/../app/qgis_win32.rc
) )
TARGET_LINK_LIBRARIES(qgiscrashhandler TARGET_LINK_LIBRARIES(qgiscrashhandler
${QT_QTCORE_LIBRARY} ${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY} ${QT_QTGUI_LIBRARY}
DbgHelp DbgHelp
) )
INSTALL(CODE "MESSAGE(\"Installing crashhandler ...\")") INSTALL(CODE "MESSAGE(\"Installing crashhandler ...\")")
INSTALL(TARGETS qgiscrashhandler RUNTIME DESTINATION ${QGIS_LIBEXEC_DIR}) INSTALL(TARGETS qgiscrashhandler RUNTIME DESTINATION ${QGIS_LIBEXEC_DIR})

View File

@ -1,55 +1,55 @@
/*************************************************************************** /***************************************************************************
qgscrashdialog.h - QgsCrashDialog qgscrashdialog.h - QgsCrashDialog
--------------------- ---------------------
begin : 11.4.2017 begin : 11.4.2017
copyright : (C) 2017 by Nathan Woodrow copyright : (C) 2017 by Nathan Woodrow
email : woodrow.nathan@gmail.com email : woodrow.nathan@gmail.com
*************************************************************************** ***************************************************************************
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
***************************************************************************/ ***************************************************************************/
#ifndef QGSCRASHDIALOG_H #ifndef QGSCRASHDIALOG_H
#define QGSCRASHDIALOG_H #define QGSCRASHDIALOG_H
#include <QDialog> #include <QDialog>
#include <QFormLayout> #include <QFormLayout>
#include <QPlainTextEdit> #include <QPlainTextEdit>
#include <QPushButton> #include <QPushButton>
#include "ui_qgscrashdialog.h" #include "ui_qgscrashdialog.h"
/** /**
* A dialog to show a nicer crash dialog to the user. * A dialog to show a nicer crash dialog to the user.
*/ */
class QgsCrashDialog : public QDialog, private Ui::QgsCrashDialog class QgsCrashDialog : public QDialog, private Ui::QgsCrashDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
/** /**
* A dialog to show a nicer crash dialog to the user. * A dialog to show a nicer crash dialog to the user.
*/ */
QgsCrashDialog( QWidget *parent = nullptr ); QgsCrashDialog( QWidget *parent = nullptr );
void setBugReport( const QString &reportData ); void setBugReport( const QString &reportData );
void setReloadArgs( const QString &reloadArgs ); void setReloadArgs( const QString &reloadArgs );
static QString htmlToMarkdown( const QString &html ); static QString htmlToMarkdown( const QString &html );
private slots: private slots:
void showReportWidget(); void showReportWidget();
void createBugReport(); void createBugReport();
void reloadQGIS(); void reloadQGIS();
private: private:
QString mReportData; QString mReportData;
QString mReloadArgs; QString mReloadArgs;
}; };
#endif // QGSCRASHDIALOG_H #endif // QGSCRASHDIALOG_H

View File

@ -1,101 +1,101 @@
/*************************************************************************** /***************************************************************************
qgscrashreport.h - QgsCrashReport qgscrashreport.h - QgsCrashReport
--------------------- ---------------------
begin : 16.4.2017 begin : 16.4.2017
copyright : (C) 2017 by Nathan Woodrow copyright : (C) 2017 by Nathan Woodrow
email : woodrow.nathan@gmail.com email : woodrow.nathan@gmail.com
*************************************************************************** ***************************************************************************
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
***************************************************************************/ ***************************************************************************/
#ifndef QGSCRASHREPORT_H #ifndef QGSCRASHREPORT_H
#define QGSCRASHREPORT_H #define QGSCRASHREPORT_H
#include "qgsstacktrace.h" #include "qgsstacktrace.h"
#include <QObject> #include <QObject>
#include <QVector> #include <QVector>
/** /**
* Include information to generate user friendly crash report for QGIS. * Include information to generate user friendly crash report for QGIS.
*/ */
class QgsCrashReport class QgsCrashReport
{ {
public: public:
/** /**
* Include information to generate user friendly crash report for QGIS. * Include information to generate user friendly crash report for QGIS.
*/ */
QgsCrashReport(); QgsCrashReport();
public: public:
enum Flag enum Flag
{ {
Stack = 1 << 0, Stack = 1 << 0,
Plugins = 1 << 1, Plugins = 1 << 1,
ProjectDetails = 1 << 2, ProjectDetails = 1 << 2,
SystemInfo = 1 << 3, SystemInfo = 1 << 3,
QgisInfo = 1 << 4, QgisInfo = 1 << 4,
All = Stack | Plugins | ProjectDetails | SystemInfo | QgisInfo All = Stack | Plugins | ProjectDetails | SystemInfo | QgisInfo
}; };
Q_DECLARE_FLAGS( Flags, Flag ) Q_DECLARE_FLAGS( Flags, Flag )
/** /**
* Sets the stack trace for the crash report. * Sets the stack trace for the crash report.
* \param value A string list for each line in the stack trace. * \param value A string list for each line in the stack trace.
*/ */
void setStackTrace( QgsStackTrace *value ) { mStackTrace = value; } void setStackTrace( QgsStackTrace *value ) { mStackTrace = value; }
/** /**
* Returns the stack trace for this report. * Returns the stack trace for this report.
* \return A string list for each line in the stack trace. * \return A string list for each line in the stack trace.
*/ */
QgsStackTrace *StackTrace() const { return mStackTrace; } QgsStackTrace *StackTrace() const { return mStackTrace; }
/** /**
* Set the flags to mark which features are included in this crash report. * Set the flags to mark which features are included in this crash report.
* \param flags The flag for each feature. * \param flags The flag for each feature.
*/ */
void setFlags( QgsCrashReport::Flags flags ); void setFlags( QgsCrashReport::Flags flags );
/** /**
* Returns the include flags that have been set for this report. * Returns the include flags that have been set for this report.
* \return The flags marking what details are included in this report. * \return The flags marking what details are included in this report.
*/ */
Flags flags() const { return mFlags; } Flags flags() const { return mFlags; }
const QString toMarkdown(); const QString toMarkdown();
/** /**
* Generate a string version of the report. * Generate a string version of the report.
* \return A formatted string including all the information from the report. * \return A formatted string including all the information from the report.
*/ */
const QString toHtml() const; const QString toHtml() const;
/** /**
* Generates a crash ID for the crash report. * Generates a crash ID for the crash report.
* \return * \return
*/ */
const QString crashID() const; const QString crashID() const;
void exportToCrashFolder(); void exportToCrashFolder();
QString crashReportFolder(); QString crashReportFolder();
void setVersionInfo( const QStringList &versionInfo ) { mVersionInfo = versionInfo; } void setVersionInfo( const QStringList &versionInfo ) { mVersionInfo = versionInfo; }
private: private:
Flags mFlags; Flags mFlags;
QgsStackTrace *mStackTrace; QgsStackTrace *mStackTrace;
QStringList mVersionInfo; QStringList mVersionInfo;
}; };
Q_DECLARE_OPERATORS_FOR_FLAGS( QgsCrashReport::Flags ) Q_DECLARE_OPERATORS_FOR_FLAGS( QgsCrashReport::Flags )
#endif // QGSCRASHREPORT_H #endif // QGSCRASHREPORT_H

View File

@ -201,7 +201,7 @@ class TestQgsLayoutPageCollection(unittest.TestCase):
# add a page # add a page
page = QgsLayoutItemPage(l) page = QgsLayoutItemPage(l)
page.setPageSize(QgsLayoutSize(10,10)) page.setPageSize(QgsLayoutSize(10, 10))
collection.addPage(page) collection.addPage(page)
self.assertEqual(collection.pageCount(), 1) self.assertEqual(collection.pageCount(), 1)