Skip to content

Commit

Permalink
Use enum instead of raw int
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 15, 2024
1 parent 1c23950 commit e7b8dc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/gui/codeeditors/qgscodeeditorwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
#include <QShortcut>
#include <QGridLayout>

constexpr int WARNING_HIGHLIGHT_CATEGORY = 48;

QgsCodeEditorWidget::QgsCodeEditorWidget(
QgsCodeEditor *editor,
QgsMessageBar *messageBar,
Expand Down Expand Up @@ -262,7 +260,7 @@ void QgsCodeEditorWidget::addWarning( int lineNumber, const QString &warning )

mHighlightController->addHighlight(
QgsScrollBarHighlight(
WARNING_HIGHLIGHT_CATEGORY,
HighlightCategory::Warning,
lineNumber,
QColor( 255, 0, 0 ),
QgsScrollBarHighlight::Priority::HighestPriority
Expand All @@ -275,7 +273,7 @@ void QgsCodeEditorWidget::clearWarnings()
mEditor->clearWarnings();

mHighlightController->removeHighlights(
WARNING_HIGHLIGHT_CATEGORY
HighlightCategory::Warning
);
}

Expand Down
3 changes: 2 additions & 1 deletion src/gui/codeeditors/qgscodeeditorwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ class GUI_EXPORT QgsCodeEditorWidget : public QgsPanelWidget

enum HighlightCategory
{
SearchMatch = 0
SearchMatch = 0,
Warning = 1
};

QgsCodeEditor *mEditor = nullptr;
Expand Down

0 comments on commit e7b8dc4

Please sign in to comment.