Krita Source Code Documentation
Loading...
Searching...
No Matches
KisDlgImportImageSequence::ListItem Class Reference
+ Inheritance diagram for KisDlgImportImageSequence::ListItem:

Public Member Functions

 ListItem (const QString &text, QListWidget *view, QCollator *collator)
 
bool operator< (const QListWidgetItem &other) const override
 

Private Attributes

QCollator * collator
 

Detailed Description

Definition at line 19 of file kis_dlg_import_image_sequence.cpp.

Constructor & Destructor Documentation

◆ ListItem()

KisDlgImportImageSequence::ListItem::ListItem ( const QString & text,
QListWidget * view,
QCollator * collator )
inline

Definition at line 22 of file kis_dlg_import_image_sequence.cpp.

23 : QListWidgetItem(text, view)
25 {}

Member Function Documentation

◆ operator<()

bool KisDlgImportImageSequence::ListItem::operator< ( const QListWidgetItem & other) const
inlineoverride

Definition at line 27 of file kis_dlg_import_image_sequence.cpp.

28 {
29 if (collator->numericMode()) {
30 const QRegularExpression rx(QLatin1String("[^0-9]+"));
31 QStringList ours = text().split(rx, Qt::SkipEmptyParts);
32 QStringList theirs = other.text().split(rx, Qt::SkipEmptyParts);
33
34 // Let's compare the last numbers -- they are most likely to be the serial numbers
35 if (ours.size() > 0 && theirs.size() > 0) {
36 return (ours.last().toInt() < theirs.last().toInt());
37 }
38
39 }
40 return collator->compare(this->text(), other.text()) < 0;
41 }

References collator.

Member Data Documentation

◆ collator

QCollator* KisDlgImportImageSequence::ListItem::collator
private

Definition at line 44 of file kis_dlg_import_image_sequence.cpp.


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