Skip to content

Commit

Permalink
Clean up docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
domi4484 committed Apr 20, 2024
1 parent d7ce182 commit fb34418
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 33 deletions.
6 changes: 6 additions & 0 deletions src/core/valuemapmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#include <QSortFilterProxyModel>


/**
* A model that manages the key/value pairs for a ValueMap widget.
*/
class ValueMapModel : public QSortFilterProxyModel
{
Q_OBJECT
Expand All @@ -48,6 +51,9 @@ class ValueMapModel : public QSortFilterProxyModel

Q_ENUM( ValueMapRoles )

/**
* Create a new value map model base
*/
explicit ValueMapModel( QObject *parent = nullptr );

/**
Expand Down
2 changes: 0 additions & 2 deletions src/core/valuemapmodelbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include "valuemapmodel.h"
#include "valuemapmodelbase.h"

#include <QDebug>

ValueMapModelBase::ValueMapModelBase( QObject *parent )
: QAbstractListModel( parent )
{
Expand Down
44 changes: 13 additions & 31 deletions src/core/valuemapmodelbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,58 +22,40 @@
#include <QAbstractListModel>
#include <QVariant>

/**
* A model that manages the key/value pairs for a ValueMap widget.
*/
//! \copydoc ValueMapModel
class ValueMapModelBase : public QAbstractListModel
{
Q_OBJECT

/**
* A list of QVariantMap, wrapped in a QVariant.
*
* Like this:
*
* [{'CH': 'Switzerland'}, {'DE': 'Germany'}, {'FR': 'France'}]
*/
//! \copydoc ValueMapModel::valueMap
Q_PROPERTY( QVariant valueMap READ map WRITE setMap NOTIFY mapChanged )

public:
/**
* Create a new value map model
* Create a new value map model base
*/
explicit ValueMapModelBase( QObject *parent = nullptr );

/**
* The map, see the property description
*/

//! \copydoc ValueMapModel::map
QVariant map() const;
/**
* The map, see the property description
*/

//! \copydoc ValueMapModel::setMap
void setMap( const QVariant &map );

//! \copydoc ValueMapModel::keyToIndex
Q_INVOKABLE int keyToIndex( const QVariant &key ) const;

//! \copydoc ValueMapModel::keyForValue
Q_INVOKABLE QVariant keyForValue( const QString &value ) const;

int rowCount( const QModelIndex &parent = QModelIndex() ) const override;

QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;

QHash<int, QByteArray> roleNames() const override;

/**
* Returns the row (index) of a key or -1 if not found.
*/
Q_INVOKABLE int keyToIndex( const QVariant &key ) const;

/**
* Returns the key for a value or an invalid QVariant if not found.
*/
Q_INVOKABLE QVariant keyForValue( const QString &value ) const;

signals:
/**
* Emitted when the map changes.
*/
//! \copydoc ValueMapModel::mapChanged
void mapChanged();

private:
Expand Down

0 comments on commit fb34418

Please sign in to comment.