Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Used for representing information about of QgsHistoryEntry in a hierarchical tree structure
- Loading branch information
1 parent
aa7535f
commit dd25f39
Showing
6 changed files
with
447 additions
and
1 deletion.
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
python/gui/auto_generated/history/qgshistoryentrynode.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/history/qgshistoryentrynode.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsHistoryEntryNode | ||
{ | ||
%Docstring(signature="appended") | ||
Base class for nodes representing a :py:class:`QgsHistoryEntry`. | ||
|
||
.. versionadded:: 3.32 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgshistoryentrynode.h" | ||
%End | ||
public: | ||
|
||
QgsHistoryEntryNode(); | ||
virtual ~QgsHistoryEntryNode(); | ||
|
||
|
||
QgsHistoryEntryGroup *parent(); | ||
%Docstring | ||
Returns the node's parent node. | ||
|
||
If parent is ``None``, the node is a root node | ||
%End | ||
|
||
virtual QVariant data( int role = Qt::DisplayRole ) const = 0; | ||
%Docstring | ||
Returns the node's data for the specified model ``role``. | ||
%End | ||
|
||
virtual int childCount() const; | ||
%Docstring | ||
Returns the number of child nodes owned by this node. | ||
%End | ||
|
||
|
||
private: | ||
QgsHistoryEntryNode( const QgsHistoryEntryNode &other ); | ||
}; | ||
|
||
|
||
class QgsHistoryEntryGroup : QgsHistoryEntryNode | ||
{ | ||
%Docstring(signature="appended") | ||
Base class for history entry "group" nodes, which contain children of their own. | ||
|
||
.. versionadded:: 3.32 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgshistoryentrynode.h" | ||
%End | ||
public: | ||
|
||
QgsHistoryEntryGroup(); | ||
~QgsHistoryEntryGroup(); | ||
|
||
void addChild( QgsHistoryEntryNode *child /Transfer/ ); | ||
%Docstring | ||
Adds a ``child`` node to this node. | ||
|
||
Ownership is transferred to the group. | ||
%End | ||
|
||
int indexOf( QgsHistoryEntryNode *child ) const; | ||
%Docstring | ||
Returns the index of the specified ``child`` node. | ||
|
||
.. warning:: | ||
|
||
``child`` must be a valid child of this node. | ||
%End | ||
|
||
QgsHistoryEntryNode *childAt( int index ); | ||
%Docstring | ||
Returns the child at the specified ``index``. | ||
%End | ||
|
||
void removeChildAt( int index ); | ||
%Docstring | ||
Removes the child at the specified ``index``. | ||
%End | ||
|
||
void clear(); | ||
%Docstring | ||
Clears the group, removing all its children. | ||
%End | ||
|
||
virtual int childCount() const ${SIP_FINAL}; | ||
|
||
|
||
private: | ||
QgsHistoryEntryGroup( const QgsHistoryEntryGroup &other ); | ||
}; | ||
|
||
|
||
|
||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/history/qgshistoryentrynode.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/*************************************************************************** | ||
qgshistoryentrynode.cpp | ||
-------------------------- | ||
begin : Aprial 2023 | ||
copyright : (C) 2023 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
/*************************************************************************** | ||
* * | ||
* 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 * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
#include "qgshistoryentrynode.h" | ||
|
||
// | ||
// QgsHistoryEntryNode | ||
// | ||
|
||
QgsHistoryEntryNode::~QgsHistoryEntryNode() = default; | ||
|
||
int QgsHistoryEntryNode::childCount() const | ||
{ | ||
return 0; | ||
} | ||
|
||
#if 0 | ||
QString QgsHistoryEntryNode::html() const | ||
{ | ||
return QString(); | ||
} | ||
|
||
QWidget *QgsHistoryEntryNode::createWidget() | ||
{ | ||
return nullptr; | ||
} | ||
|
||
QList<QAction *> QgsHistoryEntryNode::actions( QWidget * ) | ||
{ | ||
return {}; | ||
} | ||
|
||
bool QgsHistoryEntryNode::matchesString( const QString & ) | ||
{ | ||
return false; | ||
} | ||
#endif | ||
|
||
// | ||
// QgsHistoryEntryGroup | ||
// | ||
|
||
QgsHistoryEntryGroup::~QgsHistoryEntryGroup() = default; | ||
|
||
void QgsHistoryEntryGroup::addChild( QgsHistoryEntryNode *child ) | ||
{ | ||
if ( !child ) | ||
return; | ||
|
||
Q_ASSERT( !child->mParent ); | ||
child->mParent = this; | ||
|
||
mChildren.emplace_back( child ); | ||
} | ||
|
||
int QgsHistoryEntryGroup::indexOf( QgsHistoryEntryNode *child ) const | ||
{ | ||
if ( child->mParent != this ) | ||
return -1; | ||
|
||
auto it = std::find_if( mChildren.begin(), mChildren.end(), [&]( const std::unique_ptr<QgsHistoryEntryNode> &p ) | ||
{ | ||
return p.get() == child; | ||
} ); | ||
if ( it != mChildren.end() ) | ||
return std::distance( mChildren.begin(), it ); | ||
return -1; | ||
} | ||
|
||
QgsHistoryEntryNode *QgsHistoryEntryGroup::childAt( int index ) | ||
{ | ||
if ( static_cast< std::size_t >( index ) >= mChildren.size() ) | ||
return nullptr; | ||
|
||
return mChildren[ index ].get(); | ||
|
||
} | ||
|
||
void QgsHistoryEntryGroup::removeChildAt( int index ) | ||
{ | ||
if ( static_cast< std::size_t >( index ) >= mChildren.size() ) | ||
return; | ||
|
||
mChildren.erase( mChildren.begin() + index ); | ||
} | ||
|
||
void QgsHistoryEntryGroup::clear() | ||
{ | ||
mChildren.clear(); | ||
} | ||
|
||
int QgsHistoryEntryGroup::childCount() const | ||
{ | ||
return mChildren.size(); | ||
} |
Oops, something went wrong.