digiKam
Loading...
Searching...
No Matches
Digikam::GeoModelHelper Class Referenceabstract

Helper class to access data in models. More...

#include <geomodelhelper.h>

+ Inheritance diagram for Digikam::GeoModelHelper:

Public Types

enum  PropertyFlag { FlagNull = 0 , FlagVisible = 1 , FlagMovable = 2 , FlagSnaps = 4 }
 

Signals

void signalModelChangedDrastically ()
 
void signalThumbnailAvailableForIndex (const QPersistentModelIndex &index, const QPixmap &pixmap)
 
void signalVisibilityChanged ()
 

Public Member Functions

virtual QPersistentModelIndex bestRepresentativeIndexFromList (const QList< QPersistentModelIndex > &list, const int sortKey)
 
 GeoModelHelper (QObject *const parent=nullptr)
 
virtual bool itemCoordinates (const QModelIndex &index, GeoCoordinates *const coordinates) const =0
 
virtual PropertyFlags itemFlags (const QModelIndex &index) const
 
virtual bool itemIcon (const QModelIndex &index, QPoint *const offset, QSize *const size, QPixmap *const pixmap, QUrl *const url) const
 these are necessary for ungrouped models
 
virtual QAbstractItemModel * model () const =0
 these are necessary for grouped and ungrouped models
 
virtual PropertyFlags modelFlags () const
 
virtual void onIndicesClicked (const QList< QPersistentModelIndex > &clickedIndices)
 
virtual void onIndicesMoved (const QList< QPersistentModelIndex > &movedIndices, const GeoCoordinates &targetCoordinates, const QPersistentModelIndex &targetSnapIndex)
 
virtual QPixmap pixmapFromRepresentativeIndex (const QPersistentModelIndex &index, const QSize &size)
 these are used by MarkerModel for grouped models
 
virtual QItemSelectionModel * selectionModel () const =0
 
virtual void snapItemsTo (const QModelIndex &targetIndex, const QList< QModelIndex > &snappedIndices)
 
void snapItemsTo (const QModelIndex &targetIndex, const QList< QPersistentModelIndex > &snappedIndices)
 
 ~GeoModelHelper () override=default
 

Detailed Description

Helper class to access data in models.

GeoModelHelper is used to access data held in models, which is not suitable for transfer using the the Qt-style API, like coordinates or custom sized thumbnails.

The basic functions which have to be implemented are:

  • model(): Returns a pointer to the model
  • selectionModel(): Returns a pointer to the selection model. It may return a null-pointer if no selection model is used.
  • itemCoordinates(): Returns the coordinates for a given item index, if it has any.
  • modelFlags(): Returns flags for the model.

For ungrouped models, the following functions should also be implemented:

  • itemIcon(): Returns an icon for an index, and an offset to the 'center' of the item.
  • itemFlags(): Returns flags for individual items.
  • snapItemsTo(): Grouped items have been moved and should snap to an index.

For grouped models which are accessed by MarkerModel, the following functions should be implemented:

Member Enumeration Documentation

◆ PropertyFlag

Enumerator
FlagNull 
FlagVisible 
FlagMovable 
FlagSnaps 

Constructor & Destructor Documentation

◆ GeoModelHelper()

Digikam::GeoModelHelper::GeoModelHelper ( QObject *const  parent = nullptr)
explicit

◆ ~GeoModelHelper()

Digikam::GeoModelHelper::~GeoModelHelper ( )
overridedefault

Member Function Documentation

◆ bestRepresentativeIndexFromList()

QPersistentModelIndex Digikam::GeoModelHelper::bestRepresentativeIndexFromList ( const QList< QPersistentModelIndex > &  list,
const int  sortKey 
)
virtual

◆ itemCoordinates()

virtual bool Digikam::GeoModelHelper::itemCoordinates ( const QModelIndex &  index,
GeoCoordinates *const  coordinates 
) const
pure virtual

◆ itemFlags()

GeoModelHelper::PropertyFlags Digikam::GeoModelHelper::itemFlags ( const QModelIndex &  index) const
virtual

◆ itemIcon()

bool Digikam::GeoModelHelper::itemIcon ( const QModelIndex &  index,
QPoint *const  offset,
QSize *const  size,
QPixmap *const  pixmap,
QUrl *const  url 
) const
virtual

these are necessary for ungrouped models

Returns the icon for an ungrouped marker.

The icon can either be returned as a URL to an image, or as a QPixmap. If the caller can handle URLs (for example, to display them in HTML), he can provide the URL parameter. However, the GeoModelHelper may still choose to return a QPixmap instead, if no URL is available.

Parameters
indexModelindex of the marker.
offsetOffset of the zero point in the icon, given from the top-left.
sizethe size of the icon, only populated if a URL is returned.
pixmapHolder for the pixmap of the icon.
urlURL of the icon if available.

Reimplemented in Digikam::GPSBookmarkModelHelper.

Referenced by Digikam::BackendMarble::marbleCustomPaint(), and Digikam::BackendGoogleMaps::slotUngroupedModelChanged().

◆ model()

◆ modelFlags()

GeoModelHelper::PropertyFlags Digikam::GeoModelHelper::modelFlags ( ) const
virtual

◆ onIndicesClicked()

void Digikam::GeoModelHelper::onIndicesClicked ( const QList< QPersistentModelIndex > &  clickedIndices)
virtual

Reimplemented in Digikam::MapViewModelHelper.

◆ onIndicesMoved()

void Digikam::GeoModelHelper::onIndicesMoved ( const QList< QPersistentModelIndex > &  movedIndices,
const GeoCoordinates targetCoordinates,
const QPersistentModelIndex &  targetSnapIndex 
)
virtual

◆ pixmapFromRepresentativeIndex()

QPixmap Digikam::GeoModelHelper::pixmapFromRepresentativeIndex ( const QPersistentModelIndex &  index,
const QSize &  size 
)
virtual

these are used by MarkerModel for grouped models

Reimplemented in Digikam::MapViewModelHelper, Digikam::ItemGPSModelHelper, and Digikam::GPSGeoIfaceModelHelper.

◆ selectionModel()

◆ signalModelChangedDrastically

◆ signalThumbnailAvailableForIndex

void Digikam::GeoModelHelper::signalThumbnailAvailableForIndex ( const QPersistentModelIndex &  index,
const QPixmap &  pixmap 
)
signal

◆ signalVisibilityChanged

void Digikam::GeoModelHelper::signalVisibilityChanged ( )
signal

◆ snapItemsTo() [1/2]

void Digikam::GeoModelHelper::snapItemsTo ( const QModelIndex &  targetIndex,
const QList< QModelIndex > &  snappedIndices 
)
virtual

◆ snapItemsTo() [2/2]

void Digikam::GeoModelHelper::snapItemsTo ( const QModelIndex &  targetIndex,
const QList< QPersistentModelIndex > &  snappedIndices 
)

The documentation for this class was generated from the following files: