~adamreichold/qpdfview/trunk

« back to all changes in this revision

Viewing changes to sources/searchitemdelegate.cpp

  • Committer: Adam Reichold
  • Date: 2018-05-04 17:49:20 UTC
  • Revision ID: adam.reichold@t-online.de-20180504174920-mqn268i0h46fq311
Add static_resources configuration option to embed translations and online help into binary to facilitate single binary builds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 
3
 
Copyright 2018 S. Razi Alavizadeh
4
3
Copyright 2015 Adam Reichold
5
4
 
6
5
This file is part of qpdfview.
99
98
    textLayout.setFont(font);
100
99
 
101
100
 
102
 
#if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
103
 
 
104
 
    QVector< QTextLayout::FormatRange > formats;
105
 
 
106
 
#else
107
 
 
108
 
    QList< QTextLayout::FormatRange > formats;
109
 
 
110
 
#endif // QT_VERSION
111
 
 
112
 
    for(int index = 0; (index = surroundingText.indexOf(matchedText, index)) != -1; index += matchedText.length())
 
101
    QList< QTextLayout::FormatRange > additionalFormats;
 
102
 
 
103
    for(int index = 0; (index = elidedText.indexOf(matchedText, index)) != -1; index += matchedText.length())
113
104
    {
114
105
        QTextLayout::FormatRange formatRange;
115
106
        formatRange.start = index;
116
107
        formatRange.length = matchedText.length();
117
108
        formatRange.format.setFontWeight(QFont::Bold);
118
109
 
119
 
        formats.append(formatRange);
 
110
        additionalFormats.append(formatRange);
120
111
    }
121
112
 
122
 
#if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
123
 
 
124
 
    textLayout.setFormats(formats);
125
 
 
126
 
#else
127
 
 
128
 
    textLayout.setAdditionalFormats(formats);
129
 
 
130
 
#endif // QT_VERSION
 
113
    textLayout.setAdditionalFormats(additionalFormats);
131
114
 
132
115
 
133
116
    textLayout.beginLayout();