Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remaining properties needed to unlock beautiful dark theme support to the elevation profile canvas #5260

Merged
merged 1 commit into from
May 22, 2024

Conversation

nirvn
Copy link
Member

@nirvn nirvn commented May 21, 2024

Light theme:
Screenshot from 2024-05-21 16-39-39

Dark theme:
Screenshot from 2024-05-21 16-39-25

@qfield-fairy
Copy link
Collaborator

qfield-fairy commented May 21, 2024

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -18,7 +18,12 @@

#include "qgsabstractprofilegenerator.h"
#include "qgsabstractprofilesource.h"
#include "qgscolorutils.h"
#include "qgsexpressioncontextutils.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header qgscolorutils.h is not used directly [misc-include-cleaner]

Suggested change
#include "qgsexpressioncontextutils.h"
#include "qgsexpressioncontextutils.h"

void QgsQuickElevationProfileCanvas::setBackgroundColor( const QColor &color )
{
if ( mBackgroundColor == color )
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: statement should be inside braces [readability-braces-around-statements]

Suggested change
return;
if ( mBackgroundColor == color ) {
return;
}

void QgsQuickElevationProfileCanvas::setBorderColor( const QColor &color )
{
if ( mBorderColor == color )
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: statement should be inside braces [readability-braces-around-statements]

Suggested change
return;
if ( mBorderColor == color ) {
return;
}

@@ -775,6 +812,16 @@
textFormat.setSizeUnit( Qgis::RenderUnit::Points );
mPlotItem->yAxis().setTextFormat( textFormat );

std::unique_ptr<QgsSimpleLineSymbolLayer> lineSymbolLayer = std::make_unique<QgsSimpleLineSymbolLayer>( mBorderColor, 0.1 );
lineSymbolLayer->setPenCapStyle( Qt::FlatCap );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "Qt::FlatCap" is directly included [misc-include-cleaner]

    lineSymbolLayer->setPenCapStyle( Qt::FlatCap );
                                         ^

@@ -775,6 +812,16 @@
textFormat.setSizeUnit( Qgis::RenderUnit::Points );
mPlotItem->yAxis().setTextFormat( textFormat );

std::unique_ptr<QgsSimpleLineSymbolLayer> lineSymbolLayer = std::make_unique<QgsSimpleLineSymbolLayer>( mBorderColor, 0.1 );
lineSymbolLayer->setPenCapStyle( Qt::FlatCap );
mPlotItem->xAxis().setGridMinorSymbol( new QgsLineSymbol( QgsSymbolLayerList( { lineSymbolLayer->clone() } ) ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "QgsSymbolLayerList" is directly included [misc-include-cleaner]

src/core/qgsquick/qgsquickelevationprofilecanvas.cpp:40:

+ #include <qgssymbol.h>

*
* \see setBackgroundColor
*/
QColor backgroundColor() const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "QColor" is directly included [misc-include-cleaner]

src/core/qgsquick/qgsquickelevationprofilecanvas.h:25:

+ #include <qcolor.h>

@@ -292,6 +328,8 @@

bool mDirty = false;

QColor mBackgroundColor = QColor( 255, 255, 255 );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 255 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]

    QColor mBackgroundColor = QColor( 255, 255, 255 );
                                                ^

@@ -292,6 +328,8 @@

bool mDirty = false;

QColor mBackgroundColor = QColor( 255, 255, 255 );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 255 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]

    QColor mBackgroundColor = QColor( 255, 255, 255 );
                                           ^

@@ -292,6 +328,8 @@

bool mDirty = false;

QColor mBackgroundColor = QColor( 255, 255, 255 );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 255 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]

    QColor mBackgroundColor = QColor( 255, 255, 255 );
                                      ^

@nirvn nirvn merged commit 972c1e9 into master May 22, 2024
23 checks passed
@nirvn nirvn deleted the canvas_margins branch May 22, 2024 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants