Pages
API Documentation
On this page

KSortableList Class

KSortableList is a QList which associates a key with each item in the list. This key is used for sorting when calling sort(). More...

  • Header: #include <KSortableList>
  • CMake: find_package(KF6 REQUIRED COMPONENTS Completion)
    target_link_libraries(mytarget PRIVATE KF6::Completion)
  • Inherits: QList

List of all members, including inherited members

Public Functions

Detailed Description

This allows to temporarily calculate a key and use it for sorting, without having to store that key in the items, or calculate that key many times for the same item during sorting if that calculation is expensive.

Member Function Documentation

void KSortableList::insert(Key i, const T &t)

Insert a KSortableItem with the given values.

i the first value

t the second value

void KSortableList::sort()

Sorts the KSortableItems.

T &KSortableList::operator[](Key i)

Returns the first value of the KSortableItem at the given position.

const T &KSortableList::operator[](Key i) const

Returns the first value of the KSortableItem at the given position.

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.