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

Port decorated scrollbar widget class from QtCreator #57370

Merged
merged 4 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions python/PyQt6/gui/auto_additions/qgsdecoratedscrollbar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# The following has been generated automatically from src/gui/qgsdecoratedscrollbar.h
# monkey patching scoped based enum
QgsScrollBarHighlight.Priority.Invalid.__doc__ = "Invalid"
QgsScrollBarHighlight.Priority.LowPriority.__doc__ = "Low priority, rendered below all other highlights"
QgsScrollBarHighlight.Priority.NormalPriority.__doc__ = "Normal priority"
QgsScrollBarHighlight.Priority.HighPriority.__doc__ = "High priority"
QgsScrollBarHighlight.Priority.HighestPriority.__doc__ = "Highest priority, rendered above all other highlights"
QgsScrollBarHighlight.Priority.__doc__ = "Priority, which dictates how overlapping highlights are rendered\n\n" + '* ``Invalid``: ' + QgsScrollBarHighlight.Priority.Invalid.__doc__ + '\n' + '* ``LowPriority``: ' + QgsScrollBarHighlight.Priority.LowPriority.__doc__ + '\n' + '* ``NormalPriority``: ' + QgsScrollBarHighlight.Priority.NormalPriority.__doc__ + '\n' + '* ``HighPriority``: ' + QgsScrollBarHighlight.Priority.HighPriority.__doc__ + '\n' + '* ``HighestPriority``: ' + QgsScrollBarHighlight.Priority.HighestPriority.__doc__
# --
157 changes: 157 additions & 0 deletions python/PyQt6/gui/auto_generated/qgsdecoratedscrollbar.sip.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsdecoratedscrollbar.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsScrollBarHighlight
{
%Docstring(signature="appended")
Encapsulates the details of a highlight in a scrollbar, used alongside :py:class:`QgsScrollBarHighlightController`.

.. versionadded:: 3.38
%End

%TypeHeaderCode
#include "qgsdecoratedscrollbar.h"
%End
public:

enum class Priority /BaseType=IntEnum/
{
Invalid,
LowPriority,
NormalPriority,
HighPriority,
HighestPriority
};

QgsScrollBarHighlight( int category, int position, const QColor &color, QgsScrollBarHighlight::Priority priority = QgsScrollBarHighlight::Priority::NormalPriority );
%Docstring
Constructor for QgsScrollBarHighlight.
%End

QgsScrollBarHighlight();
%Docstring
Default constructor for QgsScrollBarHighlight.
%End

int category;

int position;

QColor color;

QgsScrollBarHighlight::Priority priority;
};

class QgsScrollBarHighlightController
{
%Docstring(signature="appended")
Adds highlights (colored markers) to a scrollbar.

.. versionadded:: 3.38
%End

%TypeHeaderCode
#include "qgsdecoratedscrollbar.h"
%End
public:

QgsScrollBarHighlightController();
~QgsScrollBarHighlightController();

QScrollBar *scrollBar() const;
%Docstring
Returns the associated scroll bar.
%End

QAbstractScrollArea *scrollArea() const;
%Docstring
Returns the associated scroll area.

.. seealso:: :py:func:`setScrollArea`
%End

void setScrollArea( QAbstractScrollArea *scrollArea );
%Docstring
Sets the associated scroll bar.

.. seealso:: :py:func:`scrollArea`
%End

double lineHeight() const;
%Docstring
Returns the line height for text associated with the scroll area.

.. seealso:: :py:func:`setLineHeight`
%End

void setLineHeight( double height );
%Docstring
Sets the line ``height`` for text associated with the scroll area.

.. seealso:: :py:func:`lineHeight`
%End

double visibleRange() const;
%Docstring
Returns the visible range of the scroll area (i.e. the viewport's height).

.. seealso:: :py:func:`setVisibleRange`
%End

void setVisibleRange( double visibleRange );
%Docstring
Sets the visible range of the scroll area (i.e. the viewport's height).

.. seealso:: :py:func:`visibleRange`
%End

double margin() const;
%Docstring
Returns the document margins for the associated viewport.

.. seealso:: :py:func:`setMargin`
%End

void setMargin( double margin );
%Docstring
Sets the document ``margin`` for the associated viewport.

.. seealso:: :py:func:`margin`
%End


void addHighlight( const QgsScrollBarHighlight &highlight );
%Docstring
Adds a ``highlight`` to the scrollbar.
%End

void removeHighlights( int category );
%Docstring
Removes all highlights with matching ``category`` from the scrollbar.
%End

void removeAllHighlights();
%Docstring
Removes all highlights from the scroll bar.
%End

};


/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsdecoratedscrollbar.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
1 change: 1 addition & 0 deletions python/PyQt6/gui/gui_auto.sip
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
%Include auto_generated/qgsdataitemguiproviderregistry.sip
%Include auto_generated/qgsdatasourceselectdialog.sip
%Include auto_generated/qgsdbrelationshipwidget.sip
%Include auto_generated/qgsdecoratedscrollbar.sip
%Include auto_generated/qgsnewdatabasetablenamewidget.sip
%Include auto_generated/qgsdetaileditemdata.sip
%Include auto_generated/qgsdetaileditemdelegate.sip
Expand Down
9 changes: 9 additions & 0 deletions python/gui/auto_additions/qgsdecoratedscrollbar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# The following has been generated automatically from src/gui/qgsdecoratedscrollbar.h
# monkey patching scoped based enum
QgsScrollBarHighlight.Priority.Invalid.__doc__ = "Invalid"
QgsScrollBarHighlight.Priority.LowPriority.__doc__ = "Low priority, rendered below all other highlights"
QgsScrollBarHighlight.Priority.NormalPriority.__doc__ = "Normal priority"
QgsScrollBarHighlight.Priority.HighPriority.__doc__ = "High priority"
QgsScrollBarHighlight.Priority.HighestPriority.__doc__ = "Highest priority, rendered above all other highlights"
QgsScrollBarHighlight.Priority.__doc__ = "Priority, which dictates how overlapping highlights are rendered\n\n" + '* ``Invalid``: ' + QgsScrollBarHighlight.Priority.Invalid.__doc__ + '\n' + '* ``LowPriority``: ' + QgsScrollBarHighlight.Priority.LowPriority.__doc__ + '\n' + '* ``NormalPriority``: ' + QgsScrollBarHighlight.Priority.NormalPriority.__doc__ + '\n' + '* ``HighPriority``: ' + QgsScrollBarHighlight.Priority.HighPriority.__doc__ + '\n' + '* ``HighestPriority``: ' + QgsScrollBarHighlight.Priority.HighestPriority.__doc__
# --
157 changes: 157 additions & 0 deletions python/gui/auto_generated/qgsdecoratedscrollbar.sip.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsdecoratedscrollbar.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsScrollBarHighlight
{
%Docstring(signature="appended")
Encapsulates the details of a highlight in a scrollbar, used alongside :py:class:`QgsScrollBarHighlightController`.

.. versionadded:: 3.38
%End

%TypeHeaderCode
#include "qgsdecoratedscrollbar.h"
%End
public:

enum class Priority
{
Invalid,
LowPriority,
NormalPriority,
HighPriority,
HighestPriority
};

QgsScrollBarHighlight( int category, int position, const QColor &color, QgsScrollBarHighlight::Priority priority = QgsScrollBarHighlight::Priority::NormalPriority );
%Docstring
Constructor for QgsScrollBarHighlight.
%End

QgsScrollBarHighlight();
%Docstring
Default constructor for QgsScrollBarHighlight.
%End

int category;

int position;

QColor color;

QgsScrollBarHighlight::Priority priority;
};

class QgsScrollBarHighlightController
{
%Docstring(signature="appended")
Adds highlights (colored markers) to a scrollbar.

.. versionadded:: 3.38
%End

%TypeHeaderCode
#include "qgsdecoratedscrollbar.h"
%End
public:

QgsScrollBarHighlightController();
~QgsScrollBarHighlightController();

QScrollBar *scrollBar() const;
%Docstring
Returns the associated scroll bar.
%End

QAbstractScrollArea *scrollArea() const;
%Docstring
Returns the associated scroll area.

.. seealso:: :py:func:`setScrollArea`
%End

void setScrollArea( QAbstractScrollArea *scrollArea );
%Docstring
Sets the associated scroll bar.

.. seealso:: :py:func:`scrollArea`
%End

double lineHeight() const;
%Docstring
Returns the line height for text associated with the scroll area.

.. seealso:: :py:func:`setLineHeight`
%End

void setLineHeight( double height );
%Docstring
Sets the line ``height`` for text associated with the scroll area.

.. seealso:: :py:func:`lineHeight`
%End

double visibleRange() const;
%Docstring
Returns the visible range of the scroll area (i.e. the viewport's height).

.. seealso:: :py:func:`setVisibleRange`
%End

void setVisibleRange( double visibleRange );
%Docstring
Sets the visible range of the scroll area (i.e. the viewport's height).

.. seealso:: :py:func:`visibleRange`
%End

double margin() const;
%Docstring
Returns the document margins for the associated viewport.

.. seealso:: :py:func:`setMargin`
%End

void setMargin( double margin );
%Docstring
Sets the document ``margin`` for the associated viewport.

.. seealso:: :py:func:`margin`
%End


void addHighlight( const QgsScrollBarHighlight &highlight );
%Docstring
Adds a ``highlight`` to the scrollbar.
%End

void removeHighlights( int category );
%Docstring
Removes all highlights with matching ``category`` from the scrollbar.
%End

void removeAllHighlights();
%Docstring
Removes all highlights from the scroll bar.
%End

};


/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsdecoratedscrollbar.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
1 change: 1 addition & 0 deletions python/gui/gui_auto.sip
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
%Include auto_generated/qgsdataitemguiproviderregistry.sip
%Include auto_generated/qgsdatasourceselectdialog.sip
%Include auto_generated/qgsdbrelationshipwidget.sip
%Include auto_generated/qgsdecoratedscrollbar.sip
%Include auto_generated/qgsnewdatabasetablenamewidget.sip
%Include auto_generated/qgsdetaileditemdata.sip
%Include auto_generated/qgsdetaileditemdelegate.sip
Expand Down
2 changes: 2 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ set(QGIS_GUI_SRCS
qgsdatasourceselectdialog.cpp
qgsdbqueryhistoryprovider.cpp
qgsdbrelationshipwidget.cpp
qgsdecoratedscrollbar.cpp
qgsdetaileditemdata.cpp
qgsdetaileditemdelegate.cpp
qgsdetaileditemwidget.cpp
Expand Down Expand Up @@ -824,6 +825,7 @@ set(QGIS_GUI_HDRS
qgsdatasourceselectdialog.h
qgsdbqueryhistoryprovider.h
qgsdbrelationshipwidget.h
qgsdecoratedscrollbar.h
qgsnewdatabasetablenamewidget.h
qgsdetaileditemdata.h
qgsdetaileditemdelegate.h
Expand Down
Loading
Loading