svgui
1.9
|
#include <TextAbbrev.h>
Public Types | |
enum | Policy { ElideEnd, ElideEndAndCommonPrefixes, ElideStart, ElideMiddle } |
Static Public Member Functions | |
static QString | abbreviate (QString text, int maxLength, Policy policy=ElideEnd, bool fuzzy=true, QString ellipsis="") |
Abbreviate the given text to the given maximum length (including ellipsis), using the given abbreviation policy. | |
static QString | abbreviate (QString text, const QFontMetrics &metrics, int &maxWidth, Policy policy=ElideEnd, QString ellipsis="") |
Abbreviate the given text to the given maximum painted width, using the given abbreviation policy. | |
static QStringList | abbreviate (const QStringList &texts, int maxLength, Policy policy=ElideEndAndCommonPrefixes, bool fuzzy=true, QString ellipsis="") |
Abbreviate all of the given texts to the given maximum length, using the given abbreviation policy. | |
static QStringList | abbreviate (const QStringList &texts, const QFontMetrics &metrics, int &maxWidth, Policy policy=ElideEndAndCommonPrefixes, QString ellipsis="") |
Abbreviate all of the given texts to the given maximum painted width, using the given abbreviation policy. | |
Static Protected Member Functions | |
static QString | getDefaultEllipsis () |
static int | getFuzzLength (QString ellipsis) |
static int | getFuzzWidth (const QFontMetrics &metrics, QString ellipsis) |
static QString | abbreviateTo (QString text, int characters, Policy policy, QString ellipsis) |
static QStringList | elidePrefixes (const QStringList &texts, int targetReduction, QString ellipsis) |
static QStringList | elidePrefixes (const QStringList &texts, const QFontMetrics &metrics, int targetWidthReduction, QString ellipsis) |
static int | getPrefixLength (const QStringList &texts) |
Definition at line 24 of file TextAbbrev.h.
enum TextAbbrev::Policy |
Definition at line 27 of file TextAbbrev.h.
QString TextAbbrev::abbreviate | ( | QString | text, |
int | maxLength, | ||
Policy | policy = ElideEnd , |
||
bool | fuzzy = true , |
||
QString | ellipsis = "" |
||
) | [static] |
Abbreviate the given text to the given maximum length (including ellipsis), using the given abbreviation policy.
If fuzzy is true, the text will be left alone if it is "not much more than" the maximum length.
If ellipsis is non-empty, it will be used to show elisions in preference to the default (which is "...").
Definition at line 74 of file TextAbbrev.cpp.
References abbreviateTo(), getDefaultEllipsis(), and getFuzzLength().
Referenced by abbreviate(), CSVFormatDialog::CSVFormatDialog(), Pane::drawLayerNames(), elidePrefixes(), NoteLayer::paintVerticalScale(), TimeValueLayer::paintVerticalScale(), FlexiNoteLayer::paintVerticalScale(), RegionLayer::paintVerticalScale(), and PluginParameterDialog::setCandidateInputModels().
QString TextAbbrev::abbreviate | ( | QString | text, |
const QFontMetrics & | metrics, | ||
int & | maxWidth, | ||
Policy | policy = ElideEnd , |
||
QString | ellipsis = "" |
||
) | [static] |
Abbreviate the given text to the given maximum painted width, using the given abbreviation policy.
maxWidth is also modified so as to return the painted width of the abbreviated text.
If ellipsis is non-empty, it will be used to show elisions in preference to the default (which is tr("...")).
Definition at line 87 of file TextAbbrev.cpp.
References abbreviateTo(), and getDefaultEllipsis().
QStringList TextAbbrev::abbreviate | ( | const QStringList & | texts, |
int | maxLength, | ||
Policy | policy = ElideEndAndCommonPrefixes , |
||
bool | fuzzy = true , |
||
QString | ellipsis = "" |
||
) | [static] |
Abbreviate all of the given texts to the given maximum length, using the given abbreviation policy.
If fuzzy is true, texts that are "not much more than" the maximum length will be left alone.
If ellipsis is non-empty, it will be used to show elisions in preference to the default (which is tr("...")).
Definition at line 121 of file TextAbbrev.cpp.
References abbreviate(), ElideEnd, ElideEndAndCommonPrefixes, elidePrefixes(), getDefaultEllipsis(), and getFuzzLength().
QStringList TextAbbrev::abbreviate | ( | const QStringList & | texts, |
const QFontMetrics & | metrics, | ||
int & | maxWidth, | ||
Policy | policy = ElideEndAndCommonPrefixes , |
||
QString | ellipsis = "" |
||
) | [static] |
Abbreviate all of the given texts to the given maximum painted width, using the given abbreviation policy.
maxWidth is also modified so as to return the maximum painted width of the abbreviated texts.
If ellipsis is non-empty, it will be used to show elisions in preference to the default (which is tr("...")).
Definition at line 152 of file TextAbbrev.cpp.
References abbreviate(), ElideEnd, ElideEndAndCommonPrefixes, elidePrefixes(), and getDefaultEllipsis().
QString TextAbbrev::getDefaultEllipsis | ( | ) | [static, protected] |
Definition at line 24 of file TextAbbrev.cpp.
Referenced by abbreviate().
int TextAbbrev::getFuzzLength | ( | QString | ellipsis | ) | [static, protected] |
Definition at line 30 of file TextAbbrev.cpp.
Referenced by abbreviate(), and elidePrefixes().
int TextAbbrev::getFuzzWidth | ( | const QFontMetrics & | metrics, |
QString | ellipsis | ||
) | [static, protected] |
Definition at line 39 of file TextAbbrev.cpp.
QString TextAbbrev::abbreviateTo | ( | QString | text, |
int | characters, | ||
Policy | policy, | ||
QString | ellipsis | ||
) | [static, protected] |
Definition at line 46 of file TextAbbrev.cpp.
References ElideEnd, ElideEndAndCommonPrefixes, ElideMiddle, and ElideStart.
Referenced by abbreviate().
QStringList TextAbbrev::elidePrefixes | ( | const QStringList & | texts, |
int | targetReduction, | ||
QString | ellipsis | ||
) | [static, protected] |
Definition at line 184 of file TextAbbrev.cpp.
References abbreviate(), ElideEnd, getFuzzLength(), and getPrefixLength().
Referenced by abbreviate().
QStringList TextAbbrev::elidePrefixes | ( | const QStringList & | texts, |
const QFontMetrics & | metrics, | ||
int | targetWidthReduction, | ||
QString | ellipsis | ||
) | [static, protected] |
Definition at line 211 of file TextAbbrev.cpp.
References abbreviate(), ElideEnd, getFuzzLength(), and getPrefixLength().
int TextAbbrev::getPrefixLength | ( | const QStringList & | texts | ) | [static, protected] |
Definition at line 245 of file TextAbbrev.cpp.
References havePrefix().
Referenced by elidePrefixes().