KFileFilter

Search for usage in LXR

#include <kfilefilter.h>

Public Member Functions

 KFileFilter ()
 
 KFileFilter (const KFileFilter &other)
 
 KFileFilter (const QString &label, const QStringList &filePatterns, const QStringList &mimePatterns)
 
QStringList filePatterns () const
 
bool isEmpty () const
 
QString label () const
 
QStringList mimePatterns () const
 
KFileFilteroperator= (const KFileFilter &other)
 
bool operator== (const KFileFilter &other) const
 
QString toFilterString () const
 

Static Public Member Functions

static KFileFilter fromMimeType (const QString &mimeType)
 

Detailed Description

Encapsulates rules to filter a list of files.

Files can be filtered based on name patterns (e.g. *.cpp), MIME types, or both. Filters also optionally have a user-facing label.

Since
5.101

Definition at line 26 of file kfilefilter.h.

Constructor & Destructor Documentation

◆ KFileFilter() [1/2]

KFileFilter::KFileFilter ( )
explicit

Creates an empty filter.

Definition at line 90 of file kfilefilter.cpp.

◆ KFileFilter() [2/2]

KFileFilter::KFileFilter ( const QString label,
const QStringList filePatterns,
const QStringList mimePatterns 
)
explicit

Creates a filter with a given label, name patterns, and MIME types.

Parameters
labelThe user-facing label for this filter.
filePatternsA list of file name patterns that should be included, e.g. ("*.cpp", "*.cxx").
mimePatternsA list of MIME types that should be included, e.g. ("text/plain", "image/png").

Definition at line 95 of file kfilefilter.cpp.

Member Function Documentation

◆ filePatterns()

QStringList KFileFilter::filePatterns ( ) const

List of file name patterns that are included by this filter.

Definition at line 124 of file kfilefilter.cpp.

◆ isEmpty()

bool KFileFilter::isEmpty ( ) const

Whether the filer is empty, i.e.

matches all files.

Definition at line 139 of file kfilefilter.cpp.

◆ label()

QString KFileFilter::label ( ) const

The user-facing label for this filter.

If no label is passed on creation one is created based on the patterns.

Definition at line 119 of file kfilefilter.cpp.

◆ mimePatterns()

QStringList KFileFilter::mimePatterns ( ) const

List of MIME types that are included by this filter;.

Definition at line 129 of file kfilefilter.cpp.

◆ toFilterString()

QString KFileFilter::toFilterString ( ) const

Converts this filter to a string representation understood by KFileWidget.

Definition at line 144 of file kfilefilter.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Jan 30 2023 04:00:34 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.