Merge branch 'stable' into dev
Change-Id: I76c7081cbba6201c6de4d958c201a5aac913a328bb10
commit
3e346b869c
|
|
@ -27,13 +27,9 @@ equals(TEMPLATE, app):contains(QT, gui(-private)?) {
|
|||
# get rid of this step completely and just pass -e _qtmn to the
|
||||
# linker, taking advantage of the new LC_MAIN load command.
|
||||
|
||||
# We use xcodebuild to resolve the location of the crt1 object file
|
||||
# as we know that it lives in the same location as the c library.
|
||||
c_library_path = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -find-library c 2>/dev/null")
|
||||
|
||||
# We also know that iOS 3.1 and up uses crt1.3.1.o (technically not
|
||||
# We know that iOS 3.1 and up uses crt1.3.1.o (technically not
|
||||
# true for simulator, but the SDK has a symlink to the correct file).
|
||||
original_crt_path = $$dirname(c_library_path)/crt1.3.1.o
|
||||
original_crt_path = "$(SDK_DIR)/usr/lib/crt1.3.1.o"
|
||||
|
||||
xcode_objects_path = "$(OBJECT_FILE_DIR_$(CURRENT_VARIANT))/$(CURRENT_ARCH)"
|
||||
custom_crt_filename = "crt1_qt.o"
|
||||
|
|
|
|||
|
|
@ -1804,7 +1804,10 @@ ProjectBuilderMakefileGenerator::writeSettings(const QString &var, const ProStri
|
|||
for(int i = 0; i < indent_level; ++i)
|
||||
newline += "\t";
|
||||
|
||||
ret += var + " = ";
|
||||
static QRegExp allowedVariableCharacters("^[a-zA-Z0-9_]*$");
|
||||
ret += var.contains(allowedVariableCharacters) ? var : quotedStringLiteral(var);
|
||||
|
||||
ret += " = ";
|
||||
|
||||
if(flags & SettingsAsList) {
|
||||
ret += "(" + newline;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ enum ExpandFunc {
|
|||
E_INVALID = 0, E_MEMBER, E_FIRST, E_LAST, E_SIZE, E_CAT, E_FROMFILE, E_EVAL, E_LIST,
|
||||
E_SPRINTF, E_FORMAT_NUMBER, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION,
|
||||
E_FIND, E_SYSTEM, E_UNIQUE, E_REVERSE, E_QUOTE, E_ESCAPE_EXPAND,
|
||||
E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_VAL_ESCAPE,
|
||||
E_UPPER, E_LOWER, E_TITLE, E_FILES, E_PROMPT, E_RE_ESCAPE, E_VAL_ESCAPE,
|
||||
E_REPLACE, E_SORT_DEPENDS, E_RESOLVE_DEPENDS, E_ENUMERATE_VARS,
|
||||
E_SHADOWED, E_ABSOLUTE_PATH, E_RELATIVE_PATH, E_CLEAN_PATH,
|
||||
E_SYSTEM_PATH, E_SHELL_PATH, E_SYSTEM_QUOTE, E_SHELL_QUOTE
|
||||
|
|
@ -134,6 +134,7 @@ void QMakeEvaluator::initFunctionStatics()
|
|||
{ "escape_expand", E_ESCAPE_EXPAND },
|
||||
{ "upper", E_UPPER },
|
||||
{ "lower", E_LOWER },
|
||||
{ "title", E_TITLE },
|
||||
{ "re_escape", E_RE_ESCAPE },
|
||||
{ "val_escape", E_VAL_ESCAPE },
|
||||
{ "files", E_FILES },
|
||||
|
|
@ -803,9 +804,16 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
|
|||
break;
|
||||
case E_UPPER:
|
||||
case E_LOWER:
|
||||
case E_TITLE:
|
||||
for (int i = 0; i < args.count(); ++i) {
|
||||
QString rstr = args.at(i).toQString(m_tmp1);
|
||||
rstr = (func_t == E_UPPER) ? rstr.toUpper() : rstr.toLower();
|
||||
if (func_t == E_UPPER) {
|
||||
rstr = rstr.toUpper();
|
||||
} else {
|
||||
rstr = rstr.toLower();
|
||||
if (func_t == E_TITLE && rstr.length() > 0)
|
||||
rstr[0] = rstr.at(0).toTitleCase();
|
||||
}
|
||||
ret << (rstr.isSharedWith(m_tmp1) ? args.at(i) : ProString(rstr).setSource(args.at(i)));
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -204,9 +204,9 @@ public class QtNative
|
|||
m_displayMetricsXDpi,
|
||||
m_displayMetricsYDpi,
|
||||
m_displayMetricsScaledDensity);
|
||||
if (params.length() > 0)
|
||||
if (params.length() > 0 && !params.startsWith("\t"))
|
||||
params = "\t" + params;
|
||||
startQtApplication(f.getAbsolutePath() + "\t" + params, environment);
|
||||
startQtApplication(f.getAbsolutePath() + params, environment);
|
||||
m_started = true;
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -310,8 +310,8 @@ void QVariantAnimationPrivate::setCurrentValueForProgress(const qreal progress)
|
|||
QVariant QVariantAnimationPrivate::valueAt(qreal step) const
|
||||
{
|
||||
QVariantAnimation::KeyValues::const_iterator result =
|
||||
qBinaryFind(keyValues.begin(), keyValues.end(), qMakePair(step, QVariant()), animationValueLessThan);
|
||||
if (result != keyValues.constEnd())
|
||||
std::lower_bound(keyValues.constBegin(), keyValues.constEnd(), qMakePair(step, QVariant()), animationValueLessThan);
|
||||
if (result != keyValues.constEnd() && !animationValueLessThan(qMakePair(step, QVariant()), *result))
|
||||
return result->second;
|
||||
|
||||
return QVariant();
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@
|
|||
#include "qeuckrcodec_p.h"
|
||||
#include "cp949codetbl_p.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_BIG_CODECS
|
||||
|
|
@ -3383,8 +3385,8 @@ QByteArray QCP949Codec::convertFromUnicode(const QChar *uc, int len, ConverterSt
|
|||
*cursor++ = (j >> 8) | 0x80;
|
||||
*cursor++ = (j & 0xff) | 0x80;
|
||||
} else {
|
||||
const unsigned short *ptr = qBinaryFind(cp949_icode_to_unicode, cp949_icode_to_unicode + 8822, ch);
|
||||
if (ptr == cp949_icode_to_unicode + 8822) {
|
||||
const unsigned short *ptr = std::lower_bound(cp949_icode_to_unicode, cp949_icode_to_unicode + 8822, ch);
|
||||
if (ptr == cp949_icode_to_unicode + 8822 || ch < *ptr) {
|
||||
// Error
|
||||
*cursor++ = replacement;
|
||||
++invalid;
|
||||
|
|
|
|||
|
|
@ -115,6 +115,9 @@
|
|||
// Image Text
|
||||
//#define QT_NO_IMAGE_TEXT
|
||||
|
||||
// QKeySequenceEdit
|
||||
//#define QT_NO_KEYSEQUENCEEDIT
|
||||
|
||||
// QLCDNumber
|
||||
//#define QT_NO_LCDNUMBER
|
||||
|
||||
|
|
@ -306,6 +309,11 @@
|
|||
#define QT_NO_IMAGEFORMATPLUGIN
|
||||
#endif
|
||||
|
||||
// QKeySequenceEdit
|
||||
#if !defined(QT_NO_KEYSEQUENCEEDIT) && (defined(QT_NO_SHORTCUT))
|
||||
#define QT_NO_KEYSEQUENCEEDIT
|
||||
#endif
|
||||
|
||||
// QLocalServer
|
||||
#if !defined(QT_NO_LOCALSERVER) && (defined(QT_NO_TEMPORARYFILE))
|
||||
#define QT_NO_LOCALSERVER
|
||||
|
|
|
|||
|
|
@ -184,14 +184,14 @@ static void qEmergencyOut(QtMsgType msgType, const char *msg, va_list ap) Q_DECL
|
|||
OutputDebugStringW(emergency_bufL);
|
||||
# else
|
||||
if (qWinLogToStderr()) {
|
||||
fprintf(stderr, "%s", emergency_buf);
|
||||
fprintf(stderr, "%s\n", emergency_buf);
|
||||
fflush(stderr);
|
||||
} else {
|
||||
OutputDebugStringA(emergency_buf);
|
||||
}
|
||||
# endif
|
||||
#else
|
||||
fprintf(stderr, "%s", emergency_buf);
|
||||
fprintf(stderr, "%s\n", emergency_buf);
|
||||
fflush(stderr);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#include "qurl_p.h"
|
||||
|
||||
#include <QtCore/qstringlist.h>
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -1461,10 +1462,10 @@ static void mapToLowerCase(QString *str, int from)
|
|||
++i;
|
||||
}
|
||||
}
|
||||
const NameprepCaseFoldingEntry *entry = qBinaryFind(NameprepCaseFolding,
|
||||
NameprepCaseFolding + N,
|
||||
uc);
|
||||
if ((entry - NameprepCaseFolding) != N) {
|
||||
const NameprepCaseFoldingEntry *entry = std::lower_bound(NameprepCaseFolding,
|
||||
NameprepCaseFolding + N,
|
||||
uc);
|
||||
if ((entry != NameprepCaseFolding + N) && !(uc < *entry)) {
|
||||
int l = 1;
|
||||
while (l < 4 && entry->mapping[l])
|
||||
++l;
|
||||
|
|
|
|||
|
|
@ -1680,6 +1680,8 @@ struct UCS2Pair {
|
|||
ushort u2;
|
||||
};
|
||||
|
||||
inline bool operator<(const UCS2Pair &ligature1, const UCS2Pair &ligature2)
|
||||
{ return ligature1.u1 < ligature2.u1; }
|
||||
inline bool operator<(ushort u1, const UCS2Pair &ligature)
|
||||
{ return u1 < ligature.u1; }
|
||||
inline bool operator<(const UCS2Pair &ligature, ushort u1)
|
||||
|
|
@ -1690,6 +1692,8 @@ struct UCS2SurrogatePair {
|
|||
UCS2Pair p2;
|
||||
};
|
||||
|
||||
inline bool operator<(const UCS2SurrogatePair &ligature1, const UCS2SurrogatePair &ligature2)
|
||||
{ return QChar::surrogateToUcs4(ligature1.p1.u1, ligature1.p1.u2) < QChar::surrogateToUcs4(ligature2.p1.u1, ligature2.p1.u2); }
|
||||
inline bool operator<(uint u1, const UCS2SurrogatePair &ligature)
|
||||
{ return u1 < QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2); }
|
||||
inline bool operator<(const UCS2SurrogatePair &ligature, uint u1)
|
||||
|
|
|
|||
|
|
@ -4898,7 +4898,7 @@ QDebug operator<<(QDebug dbg, const QDateTime &date)
|
|||
break;
|
||||
case Qt::TimeZone:
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
spec = QStringLiteral(" Qt::TimeZone ") + date.timeZone().id();
|
||||
spec = QStringLiteral(" Qt::TimeZone ") + QString::fromLatin1(date.timeZone().id());
|
||||
break;
|
||||
#endif // QT_BOOTSTRAPPED
|
||||
case Qt::LocalTime:
|
||||
|
|
|
|||
|
|
@ -2883,6 +2883,8 @@ static const struct CategoriesRangeMapEntry {
|
|||
{ "YijingHexagramSymbols", 0x4DC0, 0x4DFF }
|
||||
};
|
||||
|
||||
inline bool operator<(const CategoriesRangeMapEntry &entry1, const CategoriesRangeMapEntry &entry2)
|
||||
{ return qstrcmp(entry1.name, entry2.name) < 0; }
|
||||
inline bool operator<(const char *name, const CategoriesRangeMapEntry &entry)
|
||||
{ return qstrcmp(name, entry.name) < 0; }
|
||||
inline bool operator<(const CategoriesRangeMapEntry &entry, const char *name)
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@
|
|||
|
||||
#include <qdebug.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// Create default time zone using appropriate backend
|
||||
|
|
@ -781,7 +783,7 @@ QList<QByteArray> QTimeZone::availableTimeZoneIds()
|
|||
QSet<QByteArray> set = QUtcTimeZonePrivate().availableTimeZoneIds()
|
||||
+ global_tz->backend->availableTimeZoneIds();
|
||||
QList<QByteArray> list = set.toList();
|
||||
qSort(list);
|
||||
std::sort(list.begin(), list.end());
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
@ -801,7 +803,7 @@ QList<QByteArray> QTimeZone::availableTimeZoneIds(QLocale::Country country)
|
|||
QSet<QByteArray> set = QUtcTimeZonePrivate().availableTimeZoneIds(country)
|
||||
+ global_tz->backend->availableTimeZoneIds(country);
|
||||
QList<QByteArray> list = set.toList();
|
||||
qSort(list);
|
||||
std::sort(list.begin(), list.end());
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
@ -817,7 +819,7 @@ QList<QByteArray> QTimeZone::availableTimeZoneIds(int offsetSeconds)
|
|||
QSet<QByteArray> set = QUtcTimeZonePrivate().availableTimeZoneIds(offsetSeconds)
|
||||
+ global_tz->backend->availableTimeZoneIds(offsetSeconds);
|
||||
QList<QByteArray> list = set.toList();
|
||||
qSort(list);
|
||||
std::sort(list.begin(), list.end());
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ SOURCES += \
|
|||
tools/qstring_mac.mm
|
||||
}
|
||||
else:blackberry {
|
||||
SOURCES += tools/qelapsedtimer_unix.cpp tools/qlocale_blackberry.cpp
|
||||
SOURCES += tools/qelapsedtimer_unix.cpp tools/qlocale_blackberry.cpp tools/qtimezoneprivate_tz.cpp
|
||||
HEADERS += tools/qlocale_blackberry.h
|
||||
}
|
||||
else:unix:SOURCES += tools/qelapsedtimer_unix.cpp tools/qlocale_unix.cpp tools/qtimezoneprivate_tz.cpp
|
||||
|
|
|
|||
|
|
@ -49,10 +49,7 @@
|
|||
#include <qtextstream.h>
|
||||
#include <qvariant.h>
|
||||
|
||||
#if defined(Q_CC_BOR)
|
||||
// needed for qsort() because of a std namespace problem on Borland
|
||||
#include "qplatformdefs.h"
|
||||
#endif
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -752,8 +749,8 @@ inline bool operator<(const XPMRGBData &data, const char *name)
|
|||
|
||||
static inline bool qt_get_named_xpm_rgb(const char *name_no_space, QRgb *rgb)
|
||||
{
|
||||
const XPMRGBData *r = qBinaryFind(xpmRgbTbl, xpmRgbTbl + xpmRgbTblSize, name_no_space);
|
||||
if (r != xpmRgbTbl + xpmRgbTblSize) {
|
||||
const XPMRGBData *r = std::lower_bound(xpmRgbTbl, xpmRgbTbl + xpmRgbTblSize, name_no_space);
|
||||
if ((r != xpmRgbTbl + xpmRgbTblSize) && !(name_no_space < *r)) {
|
||||
*rgb = r->value;
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@
|
|||
#include <Carbon/Carbon.h>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if defined(Q_OS_MACX)
|
||||
|
|
@ -107,8 +109,8 @@ static const MacSpecialKey * const MacSpecialKeyEntriesEnd = entries + NumEntrie
|
|||
|
||||
QChar qt_macSymbolForQtKey(int key)
|
||||
{
|
||||
const MacSpecialKey *i = qBinaryFind(entries, MacSpecialKeyEntriesEnd, key);
|
||||
if (i == MacSpecialKeyEntriesEnd)
|
||||
const MacSpecialKey *i = std::lower_bound(entries, MacSpecialKeyEntriesEnd, key);
|
||||
if ((i == MacSpecialKeyEntriesEnd) || (key < *i))
|
||||
return QChar();
|
||||
ushort macSymbol = i->macSymbol;
|
||||
if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)
|
||||
|
|
|
|||
|
|
@ -40,15 +40,11 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "qglobal.h"
|
||||
|
||||
#if defined(Q_CC_BOR)
|
||||
// needed for qsort() because of a std namespace problem on Borland
|
||||
#include "qplatformdefs.h"
|
||||
#endif
|
||||
|
||||
#include "qrgb.h"
|
||||
#include "qstringlist.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static inline int h2i(char hex)
|
||||
|
|
@ -301,8 +297,8 @@ inline bool operator<(const RGBData &data, const char *name)
|
|||
static bool get_named_rgb(const char *name_no_space, QRgb *rgb)
|
||||
{
|
||||
QByteArray name = QByteArray(name_no_space).toLower();
|
||||
const RGBData *r = qBinaryFind(rgbTbl, rgbTbl + rgbTblSize, name.constData());
|
||||
if (r != rgbTbl + rgbTblSize) {
|
||||
const RGBData *r = std::lower_bound(rgbTbl, rgbTbl + rgbTblSize, name.constData());
|
||||
if ((r != rgbTbl + rgbTblSize) && !(name.constData() < *r)) {
|
||||
*rgb = r->value;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@
|
|||
#include <qimagereader.h>
|
||||
#include "private/qfunctions_p.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef QT_NO_CSSPARSER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
|
@ -358,8 +360,8 @@ Q_STATIC_GLOBAL_OPERATOR bool operator<(const QCssKnownValue &prop, const QStrin
|
|||
static quint64 findKnownValue(const QString &name, const QCssKnownValue *start, int numValues)
|
||||
{
|
||||
const QCssKnownValue *end = &start[numValues - 1];
|
||||
const QCssKnownValue *prop = qBinaryFind(start, end, name);
|
||||
if (prop == end)
|
||||
const QCssKnownValue *prop = std::lower_bound(start, end, name);
|
||||
if ((prop == end) || (name < *prop))
|
||||
return 0;
|
||||
return prop->id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1880,4 +1880,13 @@ QImage QFontEngineMulti::alphaRGBMapForGlyph(glyph_t glyph, QFixed subPixelPosit
|
|||
return engine(which)->alphaRGBMapForGlyph(stripped(glyph), subPixelPosition, t);
|
||||
}
|
||||
|
||||
QTestFontEngine::QTestFontEngine(int size)
|
||||
: QFontEngineBox(size)
|
||||
{}
|
||||
|
||||
QFontEngine::Type QTestFontEngine::type() const
|
||||
{
|
||||
return TestFontEngine;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -434,8 +434,8 @@ protected:
|
|||
class QTestFontEngine : public QFontEngineBox
|
||||
{
|
||||
public:
|
||||
QTestFontEngine(int size) : QFontEngineBox(size) {}
|
||||
virtual Type type() const { return TestFontEngine; }
|
||||
QTestFontEngine(int size);
|
||||
virtual Type type() const;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ QByteArray QFontSubset::glyphName(unsigned short unicode, bool symbol)
|
|||
// map from latin1 to symbol
|
||||
unicode = symbol_map[unicode];
|
||||
|
||||
const AGLEntry *r = qBinaryFind(unicode_to_agl_map, unicode_to_agl_map + unicode_to_agl_map_size, unicode);
|
||||
if (r != unicode_to_agl_map + unicode_to_agl_map_size)
|
||||
const AGLEntry *r = std::lower_bound(unicode_to_agl_map, unicode_to_agl_map + unicode_to_agl_map_size, unicode);
|
||||
if ((r != unicode_to_agl_map + unicode_to_agl_map_size) && !(unicode < *r))
|
||||
return glyph_names + r->index;
|
||||
|
||||
char buffer[8];
|
||||
|
|
|
|||
|
|
@ -2969,7 +2969,10 @@ void QTextEngine::resolveAdditionalFormats() const
|
|||
}
|
||||
while (endIt != addFormatSortedByEnd.constEnd() &&
|
||||
specialData->addFormats.at(*endIt).start + specialData->addFormats.at(*endIt).length < end) {
|
||||
currentFormats.remove(qBinaryFind(currentFormats, *endIt) - currentFormats.begin());
|
||||
int *currentFormatIterator = std::lower_bound(currentFormats.begin(), currentFormats.end(), *endIt);
|
||||
if (*endIt < *currentFormatIterator)
|
||||
currentFormatIterator = currentFormats.end();
|
||||
currentFormats.remove(currentFormatIterator - currentFormats.begin());
|
||||
++endIt;
|
||||
}
|
||||
QTextCharFormat format;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@
|
|||
#include "qfont_p.h"
|
||||
#include "private/qfunctions_p.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef QT_NO_TEXTHTMLPARSER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
|
@ -336,8 +338,8 @@ static QChar resolveEntity(const QString &entity)
|
|||
{
|
||||
const QTextHtmlEntity *start = &entities[0];
|
||||
const QTextHtmlEntity *end = &entities[MAX_ENTITY];
|
||||
const QTextHtmlEntity *e = qBinaryFind(start, end, entity);
|
||||
if (e == end)
|
||||
const QTextHtmlEntity *e = std::lower_bound(start, end, entity);
|
||||
if (e == end || (entity < *e))
|
||||
return QChar();
|
||||
return e->code;
|
||||
}
|
||||
|
|
@ -456,8 +458,8 @@ static const QTextHtmlElement *lookupElementHelper(const QString &element)
|
|||
{
|
||||
const QTextHtmlElement *start = &elements[0];
|
||||
const QTextHtmlElement *end = &elements[Html_NumElements];
|
||||
const QTextHtmlElement *e = qBinaryFind(start, end, element);
|
||||
if (e == end)
|
||||
const QTextHtmlElement *e = std::lower_bound(start, end, element);
|
||||
if ((e == end) || (element < *e))
|
||||
return 0;
|
||||
return e;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -393,10 +393,10 @@ int QTextTablePrivate::findCellIndex(int fragment) const
|
|||
{
|
||||
QFragmentFindHelper helper(pieceTable->fragmentMap().position(fragment),
|
||||
pieceTable->fragmentMap());
|
||||
QList<int>::ConstIterator it = qBinaryFind(cells.begin(), cells.end(), helper);
|
||||
if (it == cells.end())
|
||||
QList<int>::ConstIterator it = std::lower_bound(cells.constBegin(), cells.constEnd(), helper);
|
||||
if ((it == cells.constEnd()) || (helper < *it))
|
||||
return -1;
|
||||
return it - cells.begin();
|
||||
return it - cells.constBegin();
|
||||
}
|
||||
|
||||
void QTextTablePrivate::fragmentAdded(QChar type, uint fragment)
|
||||
|
|
@ -1048,8 +1048,9 @@ void QTextTable::mergeCells(int row, int column, int numRows, int numCols)
|
|||
|
||||
// find the position at which to insert the contents of the merged cells
|
||||
QFragmentFindHelper helper(origCellPosition, p->fragmentMap());
|
||||
QList<int>::Iterator it = qBinaryFind(d->cells.begin(), d->cells.end(), helper);
|
||||
QList<int>::Iterator it = std::lower_bound(d->cells.begin(), d->cells.end(), helper);
|
||||
Q_ASSERT(it != d->cells.end());
|
||||
Q_ASSERT(!(helper < *it));
|
||||
Q_ASSERT(*it == cellFragment);
|
||||
const int insertCellIndex = it - d->cells.begin();
|
||||
int insertFragment = d->cells.value(insertCellIndex + 1, d->fragment_end);
|
||||
|
|
@ -1080,8 +1081,9 @@ void QTextTable::mergeCells(int row, int column, int numRows, int numCols)
|
|||
|
||||
if (firstCellIndex == -1) {
|
||||
QFragmentFindHelper helper(pos, p->fragmentMap());
|
||||
QList<int>::Iterator it = qBinaryFind(d->cells.begin(), d->cells.end(), helper);
|
||||
QList<int>::Iterator it = std::lower_bound(d->cells.begin(), d->cells.end(), helper);
|
||||
Q_ASSERT(it != d->cells.end());
|
||||
Q_ASSERT(!(helper < *it));
|
||||
Q_ASSERT(*it == fragment);
|
||||
firstCellIndex = cellIndex = it - d->cells.begin();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -325,16 +325,16 @@ QChar qt_mac_qtKey2CocoaKey(Qt::Key key)
|
|||
std::sort(rev_entries.begin(), rev_entries.end(), qtKey2CocoaKeySortLessThan);
|
||||
}
|
||||
const QVector<KeyPair>::iterator i
|
||||
= qBinaryFind(rev_entries.begin(), rev_entries.end(), key);
|
||||
if (i == rev_entries.end())
|
||||
= std::lower_bound(rev_entries.begin(), rev_entries.end(), key);
|
||||
if ((i == rev_entries.end()) || (key < *i))
|
||||
return QChar();
|
||||
return i->cocoaKey;
|
||||
}
|
||||
|
||||
Qt::Key qt_mac_cocoaKey2QtKey(QChar keyCode)
|
||||
{
|
||||
const KeyPair *i = qBinaryFind(entries, end, keyCode);
|
||||
if (i == end)
|
||||
const KeyPair *i = std::lower_bound(entries, end, keyCode);
|
||||
if ((i == end) || (keyCode < *i))
|
||||
return Qt::Key(keyCode.toUpper().unicode());
|
||||
return i->qtKey;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,6 +200,7 @@ public: // for QNSView
|
|||
bool m_frameStrutEventsEnabled;
|
||||
bool m_isExposed;
|
||||
int m_registerTouchCount;
|
||||
bool m_resizableTransientParent;
|
||||
|
||||
static const int NoAlertRequest;
|
||||
NSInteger m_alertRequest;
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
|
|||
, m_frameStrutEventsEnabled(false)
|
||||
, m_isExposed(false)
|
||||
, m_registerTouchCount(0)
|
||||
, m_resizableTransientParent(false)
|
||||
, m_alertRequest(NoAlertRequest)
|
||||
{
|
||||
#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
|
||||
|
|
@ -317,12 +318,14 @@ void QCocoaWindow::setVisible(bool visible)
|
|||
parentCocoaWindow->m_activePopupWindow = window();
|
||||
// QTBUG-30266: a window should not be resizable while a transient popup is open
|
||||
// Since this isn't a native popup, the window manager doesn't close the popup when you click outside
|
||||
NSUInteger parentStyleMask = [parentCocoaWindow->m_nsWindow styleMask];
|
||||
if ((m_resizableTransientParent = (parentStyleMask & NSResizableWindowMask))
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7
|
||||
&& !([parentCocoaWindow->m_nsWindow styleMask] & NSFullScreenWindowMask))
|
||||
&& QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7
|
||||
&& !([parentCocoaWindow->m_nsWindow styleMask] & NSFullScreenWindowMask)
|
||||
#endif
|
||||
[parentCocoaWindow->m_nsWindow setStyleMask:
|
||||
(parentCocoaWindow->windowStyleMask(parentCocoaWindow->m_windowFlags) & ~NSResizableWindowMask)];
|
||||
)
|
||||
[parentCocoaWindow->m_nsWindow setStyleMask:parentStyleMask & ~NSResizableWindowMask];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -398,13 +401,14 @@ void QCocoaWindow::setVisible(bool visible)
|
|||
[m_contentView setHidden:YES];
|
||||
}
|
||||
if (parentCocoaWindow && window()->type() == Qt::Popup
|
||||
&& m_resizableTransientParent
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
&& QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7
|
||||
&& !([parentCocoaWindow->m_nsWindow styleMask] & NSFullScreenWindowMask)
|
||||
#endif
|
||||
)
|
||||
// QTBUG-30266: a window should not be resizable while a transient popup is open
|
||||
[parentCocoaWindow->m_nsWindow setStyleMask:parentCocoaWindow->windowStyleMask(parentCocoaWindow->m_windowFlags)];
|
||||
[parentCocoaWindow->m_nsWindow setStyleMask:[parentCocoaWindow->m_nsWindow styleMask] | NSResizableWindowMask];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -150,9 +150,9 @@
|
|||
|
||||
- (void)updateTouchList:(NSSet *)touches withState:(Qt::TouchPointState)state
|
||||
{
|
||||
QPlatformScreen *screen = QGuiApplication::primaryScreen()->handle();
|
||||
QRect applicationRect = fromPortraitToPrimary(fromCGRect(self.window.screen.applicationFrame), screen);
|
||||
|
||||
// We deliver touch events with global coordinates. But global in this respect means
|
||||
// the coordinate system where this QWindow lives. And that is our superview.
|
||||
CGSize parentSize = self.superview.frame.size;
|
||||
foreach (UITouch *uiTouch, m_activeTouches.keys()) {
|
||||
QWindowSystemInterface::TouchPoint &touchPoint = m_activeTouches[uiTouch];
|
||||
if (![touches containsObject:uiTouch]) {
|
||||
|
|
@ -160,15 +160,9 @@
|
|||
} else {
|
||||
touchPoint.state = state;
|
||||
touchPoint.pressure = (state == Qt::TouchPointReleased) ? 0.0 : 1.0;
|
||||
|
||||
// Find the touch position relative to the window. Then calculate the screen
|
||||
// position by subtracting the position of the applicationRect (since UIWindow
|
||||
// does not take that into account when reporting its own frame):
|
||||
QRect touchInWindow = QRect(fromCGPoint([uiTouch locationInView:nil]), QSize(0, 0));
|
||||
QRect touchInScreen = fromPortraitToPrimary(touchInWindow, screen);
|
||||
QPoint touchPos = touchInScreen.topLeft() - applicationRect.topLeft();
|
||||
QPoint touchPos = fromCGPoint([uiTouch locationInView:self.superview]);
|
||||
touchPoint.area = QRectF(touchPos, QSize(0, 0));
|
||||
touchPoint.normalPosition = QPointF(touchPos.x() / applicationRect.width(), touchPos.y() / applicationRect.height());
|
||||
touchPoint.normalPosition = QPointF(touchPos.x() / parentSize.width, touchPos.y() / parentSize.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -955,7 +955,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowDescription(long row, BS
|
|||
|
||||
*description = 0;
|
||||
if (QAccessibleTableInterface *tableIface = tableInterface()) {
|
||||
const QString qtDesc = tableIface->columnDescription(row);
|
||||
const QString qtDesc = tableIface->rowDescription(row);
|
||||
if (!qtDesc.isEmpty())
|
||||
*description = QStringToBSTR(qtDesc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@
|
|||
#endif
|
||||
#include <qtextcodec.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
extern double qt_multiplierForUnit(QPrinter::Unit unit, int resolution);
|
||||
|
|
@ -517,15 +519,15 @@ void QCUPSSupport::setPagesPerSheetLayout(QPrinter *printer, const PagesPerShee
|
|||
QStringList cupsOptions = cupsOptionsList(printer);
|
||||
static const char *pagesPerSheetData[] = { "1", "2", "4", "6", "9", "16", 0 };
|
||||
static const char *pageLayoutData[] = {"lrtb", "lrbt", "rlbt", "rltb", "btlr", "btrl", "tblr", "tbrl", 0};
|
||||
setCupsOption(cupsOptions, QStringLiteral("number-up"), pagesPerSheetData[pagesPerSheet]);
|
||||
setCupsOption(cupsOptions, QStringLiteral("number-up-layout"), pageLayoutData[pagesPerSheetLayout]);
|
||||
setCupsOption(cupsOptions, QStringLiteral("number-up"), QLatin1String(pagesPerSheetData[pagesPerSheet]));
|
||||
setCupsOption(cupsOptions, QStringLiteral("number-up-layout"), QLatin1String(pageLayoutData[pagesPerSheetLayout]));
|
||||
setCupsOptions(printer, cupsOptions);
|
||||
}
|
||||
|
||||
void QCUPSSupport::setPageRange(QPrinter *printer, int pageFrom, int pageTo)
|
||||
{
|
||||
QStringList cupsOptions = cupsOptionsList(printer);
|
||||
setCupsOption(cupsOptions, QStringLiteral("page-ranges"), QString("%1-%2").arg(pageFrom).arg(pageTo));
|
||||
setCupsOption(cupsOptions, QStringLiteral("page-ranges"), QStringLiteral("%1-%2").arg(pageFrom).arg(pageTo));
|
||||
setCupsOptions(printer, cupsOptions);
|
||||
}
|
||||
|
||||
|
|
@ -659,8 +661,8 @@ inline bool operator<(const NamedPaperSize &data, const char *name)
|
|||
|
||||
static inline QPrinter::PaperSize string2PaperSize(const char *name)
|
||||
{
|
||||
const NamedPaperSize *r = qBinaryFind(named_sizes_map, named_sizes_map + QPrinter::NPageSize, name);
|
||||
if (r - named_sizes_map != QPrinter::NPageSize)
|
||||
const NamedPaperSize *r = std::lower_bound(named_sizes_map, named_sizes_map + QPrinter::NPageSize, name);
|
||||
if ((r != named_sizes_map + QPrinter::NPageSize) && !(name < *r))
|
||||
return r->size;
|
||||
return QPrinter::Custom;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,6 +127,28 @@ Q_PRINTSUPPORT_EXPORT double qt_multiplierForUnit(QPrinter::Unit unit, int resol
|
|||
return 1.0;
|
||||
}
|
||||
|
||||
/// return the QSize from the specified in unit as millimeters
|
||||
Q_PRINTSUPPORT_EXPORT QSizeF qt_SizeFromUnitToMillimeter(const QSizeF &size, QPrinter::Unit unit, double resolution)
|
||||
{
|
||||
switch (unit) {
|
||||
case QPrinter::Millimeter:
|
||||
return size;
|
||||
case QPrinter::Point:
|
||||
return size * 0.352777778;
|
||||
case QPrinter::Inch:
|
||||
return size * 25.4;
|
||||
case QPrinter::Pica:
|
||||
return size * 4.23333333334;
|
||||
case QPrinter::Didot:
|
||||
return size * 0.377;
|
||||
case QPrinter::Cicero:
|
||||
return size * 4.511666667;
|
||||
case QPrinter::DevicePixel:
|
||||
return size * (0.352777778 * 72.0 / resolution);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
// not static: it's needed in qpagesetupdialog_unix.cpp
|
||||
Q_PRINTSUPPORT_EXPORT QSizeF qt_printerPaperSize(QPrinter::Orientation orientation,
|
||||
QPrinter::PaperSize paperSize,
|
||||
|
|
@ -983,9 +1005,7 @@ void QPrinter::setPaperSize(const QSizeF &paperSize, QPrinter::Unit unit)
|
|||
Q_D(QPrinter);
|
||||
if (d->paintEngine->type() != QPaintEngine::Pdf)
|
||||
ABORT_IF_ACTIVE("QPrinter::setPaperSize");
|
||||
const qreal multiplier = qt_multiplierForUnit(unit, resolution());
|
||||
QSizeF size(paperSize.width() * multiplier * 25.4/72., paperSize.height() * multiplier * 25.4/72.);
|
||||
setPageSizeMM(size);
|
||||
setPageSizeMM(qt_SizeFromUnitToMillimeter(paperSize, unit, resolution()));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@
|
|||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/qmath.h>
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
# include <android/log.h>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QTest {
|
||||
|
|
@ -206,6 +210,8 @@ void QPlainTestLogger::outputMessage(const char *str)
|
|||
if (stream != stdout)
|
||||
#elif defined(Q_OS_WIN)
|
||||
OutputDebugStringA(str);
|
||||
#elif defined(Q_OS_ANDROID)
|
||||
__android_log_print(ANDROID_LOG_INFO, "QTestLib", str);
|
||||
#endif
|
||||
outputString(str);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -199,6 +199,7 @@ int runMoc(int argc, char **argv)
|
|||
dummyVariadicFunctionMacro.isVariadic = true;
|
||||
dummyVariadicFunctionMacro.arguments += Symbol(0, PP_IDENTIFIER, "__VA_ARGS__");
|
||||
pp.macros["__attribute__"] = dummyVariadicFunctionMacro;
|
||||
pp.macros["__declspec"] = dummyVariadicFunctionMacro;
|
||||
|
||||
QString filename;
|
||||
QString output;
|
||||
|
|
|
|||
|
|
@ -1120,17 +1120,10 @@ void Generator::generateSince(const Node *node, CodeMarker *marker)
|
|||
|
||||
QStringList since = node->since().split(QLatin1Char(' '));
|
||||
if (since.count() == 1) {
|
||||
// Handle legacy use of \since <version>.
|
||||
if (project.isEmpty())
|
||||
text << "version";
|
||||
else
|
||||
text << Atom(Atom::Link, project)
|
||||
<< Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
|
||||
<< Atom(Atom::String, project)
|
||||
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
|
||||
text << " " << since[0];
|
||||
// If there is only one argument, assume it is the Qt version number.
|
||||
text << " Qt " << since[0];
|
||||
} else {
|
||||
// Reconstruct the <project> <version> string.
|
||||
// Otherwise, reconstruct the <project> <version> string.
|
||||
text << " " << since.join(' ');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1868,18 +1868,11 @@ void HtmlGenerator::generateRequisites(InnerNode *inner, CodeMarker *marker)
|
|||
text.clear();
|
||||
QStringList since = inner->since().split(QLatin1Char(' '));
|
||||
if (since.count() == 1) {
|
||||
// Handle legacy use of \since <version>.
|
||||
if (project.isEmpty())
|
||||
text << "version";
|
||||
else
|
||||
text << Atom(Atom::Link, project)
|
||||
<< Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
|
||||
<< Atom(Atom::String, project)
|
||||
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
|
||||
text << " " << since[0];
|
||||
// If there is only one argument, assume it is the Qt version number.
|
||||
text << " Qt " << since[0];
|
||||
}
|
||||
else {
|
||||
// Reconstruct the <project> <version> string.
|
||||
//Otherwise, reconstruct the <project> <version> string.
|
||||
text << " " << since.join(' ');
|
||||
}
|
||||
text << Atom::ParaRight;
|
||||
|
|
@ -1998,10 +1991,16 @@ void HtmlGenerator::generateQmlRequisites(QmlClassNode *qcn, CodeMarker *marker)
|
|||
<< inheritedBytext;
|
||||
|
||||
//add the module name and version to the map
|
||||
QString qmlModuleVersion;
|
||||
DocNode* dn = qdb_->findQmlModule(qcn->qmlModuleName());
|
||||
if (dn)
|
||||
qmlModuleVersion = dn->qmlModuleVersion();
|
||||
else
|
||||
qmlModuleVersion = qcn->qmlModuleVersion();
|
||||
text.clear();
|
||||
text << formattingRightMap()[ATOM_FORMATTING_BOLD]
|
||||
<< formattingLeftMap()[ATOM_FORMATTING_TELETYPE]
|
||||
<< "import " + qcn->qmlModuleName() + " " + qcn->qmlModuleVersion()
|
||||
<< "import " + qcn->qmlModuleName() + " " + qmlModuleVersion
|
||||
<< formattingRightMap()[ATOM_FORMATTING_TELETYPE];
|
||||
requisites.insert(importText, text);
|
||||
|
||||
|
|
@ -2010,19 +2009,11 @@ void HtmlGenerator::generateQmlRequisites(QmlClassNode *qcn, CodeMarker *marker)
|
|||
text.clear();
|
||||
QStringList since = qcn->since().split(QLatin1Char(' '));
|
||||
if (since.count() == 1) {
|
||||
// Handle legacy use of \since <version>.
|
||||
if (project.isEmpty())
|
||||
text << "version";
|
||||
else
|
||||
text << Atom(Atom::Link, project)
|
||||
<< Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
|
||||
<< Atom(Atom::String, project)
|
||||
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
|
||||
|
||||
text << " " << since[0];
|
||||
// If there is only one argument, assume it is the Qt version number.
|
||||
text << " Qt " << since[0];
|
||||
}
|
||||
else {
|
||||
// Reconstruct the <project> <version> string.
|
||||
//Otherwise, reconstruct the <project> <version> string.
|
||||
text << " " << since.join(' ');
|
||||
}
|
||||
text << Atom::ParaRight;
|
||||
|
|
@ -3605,8 +3596,10 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative)
|
|||
back down into the other subdirectory.
|
||||
*/
|
||||
if (node && relative && (node != relative)) {
|
||||
if (useOutputSubdirs() && node->outputSubdirectory() != relative->outputSubdirectory())
|
||||
if (useOutputSubdirs() && !node->isExternalPage() &&
|
||||
node->outputSubdirectory() != relative->outputSubdirectory()) {
|
||||
link.prepend(QString("../" + node->outputSubdirectory() + QLatin1Char('/')));
|
||||
}
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@ public:
|
|||
virtual bool isWrapper() const;
|
||||
virtual bool isReadOnly() const { return false; }
|
||||
virtual bool isDefault() const { return false; }
|
||||
virtual bool isExternalPage() const { return false; }
|
||||
virtual void addMember(Node* ) { }
|
||||
virtual bool hasMembers() const { return false; }
|
||||
virtual bool hasNamespaces() const { return false; }
|
||||
|
|
@ -514,6 +515,7 @@ public:
|
|||
virtual bool isGroup() const { return (subType() == Node::Group); }
|
||||
virtual bool isExample() const { return (subType() == Node::Example); }
|
||||
virtual bool isExampleFile() const { return (parent() && parent()->isExample()); }
|
||||
virtual bool isExternalPage() const { return nodeSubtype_ == ExternalPage; }
|
||||
|
||||
protected:
|
||||
SubType nodeSubtype_;
|
||||
|
|
|
|||
|
|
@ -499,9 +499,10 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
|
|||
QString moduleName = element.attribute("module");
|
||||
if (!moduleName.isEmpty())
|
||||
node->setModuleName(moduleName);
|
||||
if (!indexUrl.isEmpty()) {
|
||||
if (node->isExternalPage())
|
||||
node->setUrl(href);
|
||||
else if (!indexUrl.isEmpty())
|
||||
node->setUrl(indexUrl + QLatin1Char('/') + href);
|
||||
}
|
||||
|
||||
QString since = element.attribute("since");
|
||||
if (!since.isEmpty()) {
|
||||
|
|
@ -776,15 +777,20 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
|
|||
if (!qmlFullBaseName.isEmpty())
|
||||
writer.writeAttribute("qml-base-type", qmlFullBaseName);
|
||||
}
|
||||
QString fullName = node->fullDocumentName();
|
||||
if (fullName != objName)
|
||||
writer.writeAttribute("fullname", fullName);
|
||||
|
||||
QString href;
|
||||
if (Generator::useOutputSubdirs())
|
||||
href = node->outputSubdirectory();
|
||||
if (!href.isEmpty())
|
||||
href.append(QLatin1Char('/'));
|
||||
href.append(gen_->fullDocumentLocation(node));
|
||||
if (!node->isExternalPage()) {
|
||||
QString fullName = node->fullDocumentName();
|
||||
if (fullName != objName)
|
||||
writer.writeAttribute("fullname", fullName);
|
||||
if (Generator::useOutputSubdirs())
|
||||
href = node->outputSubdirectory();
|
||||
if (!href.isEmpty())
|
||||
href.append(QLatin1Char('/'));
|
||||
href.append(gen_->fullDocumentLocation(node));
|
||||
}
|
||||
else
|
||||
href = node->name();
|
||||
writer.writeAttribute("href", href);
|
||||
|
||||
writer.writeAttribute("location", node->location().fileName());
|
||||
|
|
|
|||
|
|
@ -931,6 +931,7 @@ QT_CLASS_LIB(QFocusFrame, QtWidgets, qfocusframe.h)
|
|||
QT_CLASS_LIB(QFontComboBox, QtWidgets, qfontcombobox.h)
|
||||
QT_CLASS_LIB(QFrame, QtWidgets, qframe.h)
|
||||
QT_CLASS_LIB(QGroupBox, QtWidgets, qgroupbox.h)
|
||||
QT_CLASS_LIB(QKeySequenceEdit, QtWidgets, qkeysequenceedit.h)
|
||||
QT_CLASS_LIB(QLabel, QtWidgets, qlabel.h)
|
||||
QT_CLASS_LIB(QLCDNumber, QtWidgets, qlcdnumber.h)
|
||||
QT_CLASS_LIB(QLineEdit, QtWidgets, qlineedit.h)
|
||||
|
|
|
|||
|
|
@ -201,7 +201,9 @@ bool QFileSystemModel::remove(const QModelIndex &aindex)
|
|||
{
|
||||
const QString path = filePath(aindex);
|
||||
QFileSystemModelPrivate * d = const_cast<QFileSystemModelPrivate*>(d_func());
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
d->fileInfoGatherer.removePath(path);
|
||||
#endif
|
||||
return QDir(path).removeRecursively();
|
||||
}
|
||||
|
||||
|
|
@ -423,7 +425,9 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
|
|||
return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
|
||||
QFileSystemModelPrivate *p = const_cast<QFileSystemModelPrivate*>(this);
|
||||
node = p->addNode(parent, element,info);
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
node->populate(fileInfoGatherer.getInfo(info));
|
||||
#endif
|
||||
} else {
|
||||
node = parent->children.value(element);
|
||||
}
|
||||
|
|
@ -610,7 +614,9 @@ void QFileSystemModel::fetchMore(const QModelIndex &parent)
|
|||
if (indexNode->populatedChildren)
|
||||
return;
|
||||
indexNode->populatedChildren = true;
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
d->fileInfoGatherer.list(filePath(parent));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -648,8 +654,10 @@ QVariant QFileSystemModel::myComputer(int role) const
|
|||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
return d->myComputer();
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
case Qt::DecorationRole:
|
||||
return d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::Computer);
|
||||
#endif
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
|
@ -683,12 +691,14 @@ QVariant QFileSystemModel::data(const QModelIndex &index, int role) const
|
|||
case Qt::DecorationRole:
|
||||
if (index.column() == 0) {
|
||||
QIcon icon = d->icon(index);
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
if (icon.isNull()) {
|
||||
if (d->node(index)->isDir())
|
||||
icon = d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::Folder);
|
||||
else
|
||||
icon = d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::File);
|
||||
}
|
||||
#endif // QT_NO_FILESYSTEMWATCHER
|
||||
return icon;
|
||||
}
|
||||
break;
|
||||
|
|
@ -778,7 +788,11 @@ QString QFileSystemModelPrivate::name(const QModelIndex &index) const
|
|||
if (!index.isValid())
|
||||
return QString();
|
||||
QFileSystemNode *dirNode = node(index);
|
||||
if (fileInfoGatherer.resolveSymlinks() && !resolvedSymLinks.isEmpty() && dirNode->isSymLink(/* ignoreNtfsSymLinks = */ true)) {
|
||||
if (
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
fileInfoGatherer.resolveSymlinks() &&
|
||||
#endif
|
||||
!resolvedSymLinks.isEmpty() && dirNode->isSymLink(/* ignoreNtfsSymLinks = */ true)) {
|
||||
QString fullPath = QDir::fromNativeSeparators(filePath(index));
|
||||
if (resolvedSymLinks.contains(fullPath))
|
||||
return resolvedSymLinks[fullPath];
|
||||
|
|
@ -859,7 +873,9 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in
|
|||
QFileInfo info(d->rootDir, newName);
|
||||
oldValue->fileName = newName;
|
||||
oldValue->parent = parentNode;
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
oldValue->populate(d->fileInfoGatherer.getInfo(info));
|
||||
#endif
|
||||
oldValue->isVisible = true;
|
||||
|
||||
parentNode->children.remove(oldName);
|
||||
|
|
@ -1278,7 +1294,10 @@ QString QFileSystemModel::filePath(const QModelIndex &index) const
|
|||
Q_D(const QFileSystemModel);
|
||||
QString fullPath = d->filePath(index);
|
||||
QFileSystemModelPrivate::QFileSystemNode *dirNode = d->node(index);
|
||||
if (dirNode->isSymLink() && d->fileInfoGatherer.resolveSymlinks()
|
||||
if (dirNode->isSymLink()
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
&& d->fileInfoGatherer.resolveSymlinks()
|
||||
#endif
|
||||
&& d->resolvedSymLinks.contains(fullPath)
|
||||
&& dirNode->isDir()) {
|
||||
QFileInfo resolvedInfo(fullPath);
|
||||
|
|
@ -1333,7 +1352,9 @@ QModelIndex QFileSystemModel::mkdir(const QModelIndex &parent, const QString &na
|
|||
d->addNode(parentNode, name, QFileInfo());
|
||||
Q_ASSERT(parentNode->children.contains(name));
|
||||
QFileSystemModelPrivate::QFileSystemNode *node = parentNode->children[name];
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
node->populate(d->fileInfoGatherer.getInfo(QFileInfo(dir.absolutePath() + QDir::separator() + name)));
|
||||
#endif
|
||||
d->addVisibleFiles(parentNode, QStringList(name));
|
||||
return d->index(node);
|
||||
}
|
||||
|
|
@ -1395,7 +1416,9 @@ QModelIndex QFileSystemModel::setRootPath(const QString &newPath)
|
|||
//We remove the watcher on the previous path
|
||||
if (!rootPath().isEmpty() && rootPath() != QLatin1String(".")) {
|
||||
//This remove the watcher for the old rootPath
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
d->fileInfoGatherer.removePath(rootPath());
|
||||
#endif
|
||||
//This line "marks" the node as dirty, so the next fetchMore
|
||||
//call on the path will ask the gatherer to install a watcher again
|
||||
//But it doesn't re-fetch everything
|
||||
|
|
@ -1449,7 +1472,9 @@ QDir QFileSystemModel::rootDirectory() const
|
|||
void QFileSystemModel::setIconProvider(QFileIconProvider *provider)
|
||||
{
|
||||
Q_D(QFileSystemModel);
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
d->fileInfoGatherer.setIconProvider(provider);
|
||||
#endif
|
||||
d->root.updateIcon(provider, QString());
|
||||
}
|
||||
|
||||
|
|
@ -1458,8 +1483,12 @@ void QFileSystemModel::setIconProvider(QFileIconProvider *provider)
|
|||
*/
|
||||
QFileIconProvider *QFileSystemModel::iconProvider() const
|
||||
{
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
Q_D(const QFileSystemModel);
|
||||
return d->fileInfoGatherer.iconProvider();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -1506,14 +1535,20 @@ QDir::Filters QFileSystemModel::filter() const
|
|||
*/
|
||||
void QFileSystemModel::setResolveSymlinks(bool enable)
|
||||
{
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
Q_D(QFileSystemModel);
|
||||
d->fileInfoGatherer.setResolveSymlinks(enable);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool QFileSystemModel::resolveSymlinks() const
|
||||
{
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
Q_D(const QFileSystemModel);
|
||||
return d->fileInfoGatherer.resolveSymlinks();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -1620,7 +1655,9 @@ bool QFileSystemModel::event(QEvent *event)
|
|||
{
|
||||
Q_D(QFileSystemModel);
|
||||
if (event->type() == QEvent::LanguageChange) {
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
d->root.retranslateStrings(d->fileInfoGatherer.iconProvider(), QString());
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return QAbstractItemModel::event(event);
|
||||
|
|
@ -1630,7 +1667,9 @@ bool QFileSystemModel::rmdir(const QModelIndex &aindex)
|
|||
{
|
||||
QString path = filePath(aindex);
|
||||
QFileSystemModelPrivate * d = const_cast<QFileSystemModelPrivate*>(d_func());
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
d->fileInfoGatherer.removePath(path);
|
||||
#endif
|
||||
return QDir().rmdir(path);
|
||||
}
|
||||
|
||||
|
|
@ -1650,12 +1689,10 @@ void QFileSystemModelPrivate::_q_directoryChanged(const QString &directory, cons
|
|||
std::sort(newFiles.begin(), newFiles.end());
|
||||
QHash<QString, QFileSystemNode*>::const_iterator i = parentNode->children.constBegin();
|
||||
while (i != parentNode->children.constEnd()) {
|
||||
QStringList::iterator iterator;
|
||||
iterator = qBinaryFind(newFiles.begin(), newFiles.end(),
|
||||
i.value()->fileName);
|
||||
if (iterator == newFiles.end()) {
|
||||
QStringList::iterator iterator = std::lower_bound(newFiles.begin(), newFiles.end(), i.value()->fileName);
|
||||
if ((iterator == newFiles.end()) || (i.value()->fileName < *iterator))
|
||||
toRemove.append(i.value()->fileName);
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
for (int i = 0 ; i < toRemove.count() ; ++i )
|
||||
|
|
@ -1798,6 +1835,7 @@ void QFileSystemModelPrivate::removeVisibleFile(QFileSystemNode *parentNode, int
|
|||
*/
|
||||
void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QList<QPair<QString, QFileInfo> > &updates)
|
||||
{
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
Q_Q(QFileSystemModel);
|
||||
QVector<QString> rowsToUpdate;
|
||||
QStringList newFiles;
|
||||
|
|
@ -1894,6 +1932,7 @@ void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QL
|
|||
forceSort = true;
|
||||
delayedSort();
|
||||
}
|
||||
#endif // !QT_NO_FILESYSTEMWATCHER
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -1911,6 +1950,7 @@ void QFileSystemModelPrivate::init()
|
|||
{
|
||||
Q_Q(QFileSystemModel);
|
||||
qRegisterMetaType<QList<QPair<QString,QFileInfo> > >();
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
q->connect(&fileInfoGatherer, SIGNAL(newListOfFiles(QString,QStringList)),
|
||||
q, SLOT(_q_directoryChanged(QString,QStringList)));
|
||||
q->connect(&fileInfoGatherer, SIGNAL(updates(QString,QList<QPair<QString,QFileInfo> >)),
|
||||
|
|
@ -1919,6 +1959,7 @@ void QFileSystemModelPrivate::init()
|
|||
q, SLOT(_q_resolvedName(QString,QString)));
|
||||
q->connect(&fileInfoGatherer, SIGNAL(directoryLoaded(QString)),
|
||||
q, SIGNAL(directoryLoaded(QString)));
|
||||
#endif // !QT_NO_FILESYSTEMWATCHER
|
||||
q->connect(&delayedSortTimer, SIGNAL(timeout()), q, SLOT(_q_performDelayedSort()), Qt::QueuedConnection);
|
||||
|
||||
roleNames.insertMulti(QFileSystemModel::FileIconRole, QByteArrayLiteral("fileIcon")); // == Qt::decoration
|
||||
|
|
|
|||
|
|
@ -176,8 +176,8 @@ void QGraphicsItemAnimationPrivate::insertUniquePair(qreal step, qreal value, QL
|
|||
|
||||
Pair pair(step, value);
|
||||
|
||||
QList<Pair>::iterator result = qBinaryFind(binList->begin(), binList->end(), pair);
|
||||
if (result != binList->end())
|
||||
QList<Pair>::iterator result = std::lower_bound(binList->begin(), binList->end(), pair);
|
||||
if ((result != binList->end()) && !(pair < *result))
|
||||
result->value = value;
|
||||
else {
|
||||
*binList << pair;
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ void QSystemTrayIconSys::setIconContents(NOTIFYICONDATA &tnd)
|
|||
tnd.hIcon = hIcon;
|
||||
const QString tip = q->toolTip();
|
||||
if (!tip.isNull())
|
||||
qStringToLimitedWCharArray(tip, tnd.szTip, 64);
|
||||
qStringToLimitedWCharArray(tip, tnd.szTip, sizeof(tnd.szTip)/sizeof(wchar_t));
|
||||
}
|
||||
|
||||
static int iconFlag( QSystemTrayIcon::MessageIcon icon )
|
||||
|
|
|
|||
|
|
@ -0,0 +1,333 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Copyright (C) 2013 Ivan Komissarov.
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtWidgets module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qkeysequenceedit.h"
|
||||
#include "qkeysequenceedit_p.h"
|
||||
|
||||
#include "qboxlayout.h"
|
||||
#include "qlineedit.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_KEYSEQUENCEEDIT
|
||||
|
||||
void QKeySequenceEditPrivate::init()
|
||||
{
|
||||
Q_Q(QKeySequenceEdit);
|
||||
|
||||
lineEdit = new QLineEdit(q);
|
||||
keyNum = 0;
|
||||
prevKey = -1;
|
||||
releaseTimer = 0;
|
||||
|
||||
layout = new QVBoxLayout(q);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(lineEdit);
|
||||
|
||||
key[0] = key[1] = key[2] = key[3] = 0;
|
||||
|
||||
lineEdit->setFocusProxy(q);
|
||||
lineEdit->installEventFilter(q);
|
||||
resetState();
|
||||
|
||||
q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
q->setFocusPolicy(Qt::StrongFocus);
|
||||
q->setAttribute(Qt::WA_MacShowFocusRect, true);
|
||||
q->setAttribute(Qt::WA_InputMethodEnabled, false);
|
||||
|
||||
// TODO: add clear button
|
||||
}
|
||||
|
||||
int QKeySequenceEditPrivate::translateModifiers(Qt::KeyboardModifiers state, const QString &text)
|
||||
{
|
||||
int result = 0;
|
||||
// The shift modifier only counts when it is not used to type a symbol
|
||||
// that is only reachable using the shift key anyway
|
||||
if ((state & Qt::ShiftModifier) && (text.isEmpty() ||
|
||||
!text.at(0).isPrint() ||
|
||||
text.at(0).isLetterOrNumber() ||
|
||||
text.at(0).isSpace()))
|
||||
result |= Qt::SHIFT;
|
||||
|
||||
if (state & Qt::ControlModifier)
|
||||
result |= Qt::CTRL;
|
||||
if (state & Qt::MetaModifier)
|
||||
result |= Qt::META;
|
||||
if (state & Qt::AltModifier)
|
||||
result |= Qt::ALT;
|
||||
return result;
|
||||
}
|
||||
|
||||
void QKeySequenceEditPrivate::resetState()
|
||||
{
|
||||
Q_Q(QKeySequenceEdit);
|
||||
|
||||
if (releaseTimer) {
|
||||
q->killTimer(releaseTimer);
|
||||
releaseTimer = 0;
|
||||
}
|
||||
prevKey = -1;
|
||||
lineEdit->setText(keySequence.toString(QKeySequence::NativeText));
|
||||
lineEdit->setPlaceholderText(QKeySequenceEdit::tr("Press shortcut"));
|
||||
}
|
||||
|
||||
void QKeySequenceEditPrivate::finishEditing()
|
||||
{
|
||||
Q_Q(QKeySequenceEdit);
|
||||
|
||||
resetState();
|
||||
emit q->keySequenceChanged(keySequence);
|
||||
emit q->editingFinished();
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QKeySequenceEdit
|
||||
\brief The QKeySequenceEdit widget allows to input a QKeySequence.
|
||||
|
||||
\inmodule QtWidgets
|
||||
|
||||
\since 5.2
|
||||
|
||||
This widget lets the user choose a QKeySequence, which is usually used as
|
||||
a shortcut. The recording is initiated when the widget receives the focus
|
||||
and ends one second after the user releases the last key.
|
||||
|
||||
\sa QKeySequenceEdit::keySequence
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a QKeySequenceEdit widget with the given \a parent.
|
||||
*/
|
||||
QKeySequenceEdit::QKeySequenceEdit(QWidget *parent) :
|
||||
QWidget(*new QKeySequenceEditPrivate, parent, 0)
|
||||
{
|
||||
Q_D(QKeySequenceEdit);
|
||||
d->init();
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a QKeySequenceEdit widget with the given \a keySequence and \a parent.
|
||||
*/
|
||||
QKeySequenceEdit::QKeySequenceEdit(const QKeySequence &keySequence, QWidget *parent) :
|
||||
QWidget(*new QKeySequenceEditPrivate, parent, 0)
|
||||
{
|
||||
Q_D(QKeySequenceEdit);
|
||||
d->init();
|
||||
setKeySequence(keySequence);
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
QKeySequenceEdit::QKeySequenceEdit(QKeySequenceEditPrivate &dd, QWidget *parent, Qt::WindowFlags f) :
|
||||
QWidget(dd, parent, f)
|
||||
{
|
||||
Q_D(QKeySequenceEdit);
|
||||
d->init();
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the QKeySequenceEdit object.
|
||||
*/
|
||||
QKeySequenceEdit::~QKeySequenceEdit()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QKeySequenceEdit::keySequence
|
||||
|
||||
\brief This property contains the currently chosen key sequence.
|
||||
|
||||
The shortcut can be changed by the user or via setter function.
|
||||
*/
|
||||
QKeySequence QKeySequenceEdit::keySequence() const
|
||||
{
|
||||
Q_D(const QKeySequenceEdit);
|
||||
|
||||
return d->keySequence;
|
||||
}
|
||||
|
||||
void QKeySequenceEdit::setKeySequence(const QKeySequence &keySequence)
|
||||
{
|
||||
Q_D(QKeySequenceEdit);
|
||||
|
||||
d->resetState();
|
||||
|
||||
if (d->keySequence == keySequence)
|
||||
return;
|
||||
|
||||
d->keySequence = keySequence;
|
||||
|
||||
d->key[0] = d->key[1] = d->key[2] = d->key[3] = 0;
|
||||
d->keyNum = keySequence.count();
|
||||
for (int i = 0; i < d->keyNum; ++i)
|
||||
d->key[i] = keySequence[i];
|
||||
|
||||
d->lineEdit->setText(keySequence.toString(QKeySequence::NativeText));
|
||||
|
||||
emit keySequenceChanged(keySequence);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void QKeySequenceEdit::editingFinished()
|
||||
|
||||
This signal is emitted when the user finishes entering the shortcut.
|
||||
|
||||
\note there is a one second delay before releasing the last key and
|
||||
emitting this signal.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\brief Clears the current key sequence.
|
||||
*/
|
||||
void QKeySequenceEdit::clear()
|
||||
{
|
||||
Q_D(QKeySequenceEdit);
|
||||
|
||||
d->resetState();
|
||||
|
||||
d->lineEdit->clear();
|
||||
d->keySequence = QKeySequence();
|
||||
d->keyNum = d->key[0] = d->key[1] = d->key[2] = d->key[3] = 0;
|
||||
d->prevKey = -1;
|
||||
emit keySequenceChanged(d->keySequence);
|
||||
}
|
||||
|
||||
/*!
|
||||
\reimp
|
||||
*/
|
||||
bool QKeySequenceEdit::event(QEvent *e)
|
||||
{
|
||||
switch (e->type()) {
|
||||
case QEvent::Shortcut:
|
||||
return true;
|
||||
case QEvent::ShortcutOverride:
|
||||
e->accept();
|
||||
return true;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
return QWidget::event(e);
|
||||
}
|
||||
|
||||
/*!
|
||||
\reimp
|
||||
*/
|
||||
void QKeySequenceEdit::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
Q_D(QKeySequenceEdit);
|
||||
|
||||
int nextKey = e->key();
|
||||
|
||||
if (d->prevKey == -1) {
|
||||
clear();
|
||||
d->prevKey = nextKey;
|
||||
}
|
||||
|
||||
d->lineEdit->setPlaceholderText(QString());
|
||||
if (nextKey == Qt::Key_Control
|
||||
|| nextKey == Qt::Key_Shift
|
||||
|| nextKey == Qt::Key_Meta
|
||||
|| nextKey == Qt::Key_Alt) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString selectedText = d->lineEdit->selectedText();
|
||||
if (!selectedText.isEmpty() && selectedText == d->lineEdit->text()) {
|
||||
clear();
|
||||
if (nextKey == Qt::Key_Backspace)
|
||||
return;
|
||||
}
|
||||
|
||||
if (d->keyNum >= QKeySequenceEditPrivate::MaxKeyCount)
|
||||
return;
|
||||
|
||||
nextKey |= d->translateModifiers(e->modifiers(), e->text());
|
||||
|
||||
d->key[d->keyNum] = nextKey;
|
||||
d->keyNum++;
|
||||
|
||||
QKeySequence key(d->key[0], d->key[1], d->key[2], d->key[3]);
|
||||
d->keySequence = key;
|
||||
QString text = key.toString(QKeySequence::NativeText);
|
||||
if (d->keyNum < QKeySequenceEditPrivate::MaxKeyCount) {
|
||||
//: This text is an "unfinished" shortcut, expands like "Ctrl+A, ..."
|
||||
text = tr("%1, ...").arg(text);
|
||||
}
|
||||
d->lineEdit->setText(text);
|
||||
e->accept();
|
||||
}
|
||||
|
||||
/*!
|
||||
\reimp
|
||||
*/
|
||||
void QKeySequenceEdit::keyReleaseEvent(QKeyEvent *e)
|
||||
{
|
||||
Q_D(QKeySequenceEdit);
|
||||
|
||||
if (d->prevKey == e->key()) {
|
||||
if (d->keyNum < QKeySequenceEditPrivate::MaxKeyCount)
|
||||
d->releaseTimer = startTimer(1000);
|
||||
else
|
||||
d->finishEditing();
|
||||
}
|
||||
e->accept();
|
||||
}
|
||||
|
||||
/*!
|
||||
\reimp
|
||||
*/
|
||||
void QKeySequenceEdit::timerEvent(QTimerEvent *e)
|
||||
{
|
||||
Q_D(QKeySequenceEdit);
|
||||
if (e->timerId() == d->releaseTimer) {
|
||||
d->finishEditing();
|
||||
return;
|
||||
}
|
||||
|
||||
QWidget::timerEvent(e);
|
||||
}
|
||||
|
||||
#endif // QT_NO_KEYSEQUENCEEDIT
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Copyright (C) 2013 Ivan Komissarov.
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtWidgets module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QKEYSEQUENCEEDIT_H
|
||||
#define QKEYSEQUENCEEDIT_H
|
||||
|
||||
#include <QtWidgets/qwidget.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_KEYSEQUENCEEDIT
|
||||
|
||||
class QKeySequenceEditPrivate;
|
||||
class Q_WIDGETS_EXPORT QKeySequenceEdit : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QKeySequence keySequence READ keySequence WRITE setKeySequence RESET clear NOTIFY keySequenceChanged USER true)
|
||||
|
||||
public:
|
||||
explicit QKeySequenceEdit(QWidget *parent = 0);
|
||||
explicit QKeySequenceEdit(const QKeySequence &keySequence, QWidget *parent = 0);
|
||||
~QKeySequenceEdit();
|
||||
|
||||
QKeySequence keySequence() const;
|
||||
void setKeySequence(const QKeySequence &keySequence);
|
||||
|
||||
public Q_SLOTS:
|
||||
void clear();
|
||||
|
||||
Q_SIGNALS:
|
||||
void editingFinished();
|
||||
void keySequenceChanged(const QKeySequence &keySequence);
|
||||
|
||||
protected:
|
||||
QKeySequenceEdit(QKeySequenceEditPrivate &d, QWidget *parent, Qt::WindowFlags f);
|
||||
|
||||
bool event(QEvent *) Q_DECL_OVERRIDE;
|
||||
void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
|
||||
void keyReleaseEvent(QKeyEvent *) Q_DECL_OVERRIDE;
|
||||
void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QKeySequenceEdit)
|
||||
Q_DECLARE_PRIVATE(QKeySequenceEdit)
|
||||
};
|
||||
|
||||
#endif // QT_NO_KEYSEQUENCEEDIT
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QKEYSEQUENCEEDIT_H
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Copyright (C) 2013 Ivan Komissarov.
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtWidgets module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QKEYSEQUENCEEDIT_P_H
|
||||
#define QKEYSEQUENCEEDIT_P_H
|
||||
|
||||
#include "qkeysequenceedit.h"
|
||||
|
||||
#include <private/qwidget_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_KEYSEQUENCEEDIT
|
||||
|
||||
class QLineEdit;
|
||||
class QVBoxLayout;
|
||||
|
||||
class QKeySequenceEditPrivate : public QWidgetPrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(QKeySequenceEdit)
|
||||
public:
|
||||
enum { MaxKeyCount = 4 };
|
||||
|
||||
void init();
|
||||
int translateModifiers(Qt::KeyboardModifiers state, const QString &text);
|
||||
void resetState();
|
||||
void finishEditing();
|
||||
|
||||
QLineEdit *lineEdit;
|
||||
QVBoxLayout *layout;
|
||||
QKeySequence keySequence;
|
||||
int keyNum;
|
||||
int key[MaxKeyCount];
|
||||
int prevKey;
|
||||
int releaseTimer;
|
||||
};
|
||||
|
||||
#endif // QT_NO_KEYSEQUENCEEDIT
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QKEYSEQUENCEEDIT_P_H
|
||||
|
|
@ -2370,8 +2370,20 @@ void CloseButton::paintEvent(QPaintEvent *)
|
|||
style()->drawPrimitive(QStyle::PE_IndicatorTabClose, &opt, &p, this);
|
||||
}
|
||||
|
||||
void QTabBarPrivate::Tab::TabBarAnimation::updateCurrentValue(const QVariant ¤t)
|
||||
{
|
||||
priv->moveTab(priv->tabList.indexOf(*tab), current.toInt());
|
||||
}
|
||||
|
||||
void QTabBarPrivate::Tab::TabBarAnimation::updateState(QAbstractAnimation::State, QAbstractAnimation::State newState)
|
||||
{
|
||||
if (newState == Stopped) priv->moveTabFinished(priv->tabList.indexOf(*tab));
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qtabbar.cpp"
|
||||
|
||||
#endif // QT_NO_TABBAR
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -126,11 +126,9 @@ public:
|
|||
TabBarAnimation(Tab *t, QTabBarPrivate *_priv) : tab(t), priv(_priv)
|
||||
{ setEasingCurve(QEasingCurve::InOutQuad); }
|
||||
|
||||
void updateCurrentValue(const QVariant ¤t)
|
||||
{ priv->moveTab(priv->tabList.indexOf(*tab), current.toInt()); }
|
||||
void updateCurrentValue(const QVariant ¤t);
|
||||
|
||||
void updateState(State, State newState)
|
||||
{ if (newState == Stopped) priv->moveTabFinished(priv->tabList.indexOf(*tab)); }
|
||||
void updateState(State, State newState);
|
||||
private:
|
||||
//these are needed for the callbacks
|
||||
Tab *tab;
|
||||
|
|
|
|||
|
|
@ -1525,6 +1525,7 @@ void QWidgetLineControl::processShortcutOverrideEvent(QKeyEvent *ke)
|
|||
|| ke == QKeySequence::Undo
|
||||
|| ke == QKeySequence::MoveToNextWord
|
||||
|| ke == QKeySequence::MoveToPreviousWord
|
||||
|| ke == QKeySequence::MoveToEndOfLine
|
||||
|| ke == QKeySequence::MoveToStartOfDocument
|
||||
|| ke == QKeySequence::MoveToEndOfDocument
|
||||
|| ke == QKeySequence::SelectNextWord
|
||||
|
|
@ -1535,7 +1536,8 @@ void QWidgetLineControl::processShortcutOverrideEvent(QKeyEvent *ke)
|
|||
|| ke == QKeySequence::SelectEndOfBlock
|
||||
|| ke == QKeySequence::SelectStartOfDocument
|
||||
|| ke == QKeySequence::SelectAll
|
||||
|| ke == QKeySequence::SelectEndOfDocument) {
|
||||
|| ke == QKeySequence::SelectEndOfDocument
|
||||
|| ke == QKeySequence::DeleteCompleteLine) {
|
||||
ke->accept();
|
||||
} else if (ke->modifiers() == Qt::NoModifier || ke->modifiers() == Qt::ShiftModifier
|
||||
|| ke->modifiers() == Qt::KeypadModifier) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ HEADERS += \
|
|||
widgets/qframe.h \
|
||||
widgets/qframe_p.h \
|
||||
widgets/qgroupbox.h \
|
||||
widgets/qkeysequenceedit.h \
|
||||
widgets/qkeysequenceedit_p.h \
|
||||
widgets/qlabel.h \
|
||||
widgets/qlabel_p.h \
|
||||
widgets/qlcdnumber.h \
|
||||
|
|
@ -99,6 +101,7 @@ SOURCES += \
|
|||
widgets/qfontcombobox.cpp \
|
||||
widgets/qframe.cpp \
|
||||
widgets/qgroupbox.cpp \
|
||||
widgets/qkeysequenceedit.cpp \
|
||||
widgets/qlabel.cpp \
|
||||
widgets/qlcdnumber.cpp \
|
||||
widgets/qlineedit_p.cpp \
|
||||
|
|
|
|||
|
|
@ -3481,8 +3481,13 @@ void tst_QAccessibility::bridgeTest()
|
|||
BSTR bstrDescription;
|
||||
hr = ia2Table->get_columnDescription(0, &bstrDescription);
|
||||
QVERIFY(SUCCEEDED(hr));
|
||||
const QString description((QChar*)bstrDescription);
|
||||
QCOMPARE(description, QLatin1String("h1"));
|
||||
QCOMPARE(QString::fromWCharArray(bstrDescription), QLatin1String("h1"));
|
||||
::SysFreeString(bstrDescription);
|
||||
|
||||
hr = ia2Table->get_rowDescription(1, &bstrDescription);
|
||||
QVERIFY(SUCCEEDED(hr));
|
||||
QCOMPARE(QString::fromWCharArray(bstrDescription), QLatin1String("v2"));
|
||||
::SysFreeString(bstrDescription);
|
||||
|
||||
IAccessible *accTableCell = 0;
|
||||
hr = ia2Table->get_cellAt(1, 2, (IUnknown**)&accTableCell);
|
||||
|
|
|
|||
|
|
@ -590,6 +590,7 @@ void tst_QPrinter::setGetPaperSize()
|
|||
QSizeF size(500, 10);
|
||||
p.setPaperSize(size, QPrinter::Millimeter);
|
||||
QCOMPARE(p.paperSize(QPrinter::Millimeter), size);
|
||||
QCOMPARE(p.pageSizeMM(), size);
|
||||
QSizeF ptSize = p.paperSize(QPrinter::Point);
|
||||
//qDebug() << ptSize;
|
||||
QVERIFY(qAbs(ptSize.width() - size.width() * (72/25.4)) < 1E-4);
|
||||
|
|
|
|||
|
|
@ -43,15 +43,22 @@
|
|||
// test support for gcc attributes with functions
|
||||
|
||||
#if defined(Q_CC_GNU) || defined(Q_MOC_RUN)
|
||||
#define DEPRECATED __attribute__ ((__deprecated__))
|
||||
#define DEPRECATED1 __attribute__ ((__deprecated__))
|
||||
#else
|
||||
#define DEPRECATED
|
||||
#define DEPRECATED1
|
||||
#endif
|
||||
|
||||
#if defined(Q_CC_MSVC) || defined(Q_MOC_RUN)
|
||||
#define DEPRECATED2 __declspec(deprecated)
|
||||
#else
|
||||
#define DEPRECATED2
|
||||
#endif
|
||||
|
||||
class FunctionWithAttributes : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public slots:
|
||||
DEPRECATED void test() {}
|
||||
DEPRECATED1 void test1() {}
|
||||
DEPRECATED2 void test2() {}
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
tst_qshortcutedit
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
CONFIG += testcase
|
||||
CONFIG += parallel_test
|
||||
TARGET = tst_qkeysequenceedit
|
||||
QT += widgets testlib
|
||||
SOURCES += tst_qkeysequenceedit.cpp
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#include <QKeySequenceEdit>
|
||||
|
||||
Q_DECLARE_METATYPE(Qt::Key)
|
||||
Q_DECLARE_METATYPE(Qt::KeyboardModifiers)
|
||||
|
||||
class tst_QKeySequenceEdit : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void testSetters();
|
||||
void testKeys_data();
|
||||
void testKeys();
|
||||
};
|
||||
|
||||
void tst_QKeySequenceEdit::testSetters()
|
||||
{
|
||||
QKeySequenceEdit edit;
|
||||
QSignalSpy spy(&edit, SIGNAL(keySequenceChanged(QKeySequence)));
|
||||
QCOMPARE(edit.keySequence(), QKeySequence());
|
||||
|
||||
edit.setKeySequence(QKeySequence::New);
|
||||
QCOMPARE(edit.keySequence(), QKeySequence(QKeySequence::New));
|
||||
|
||||
edit.clear();
|
||||
QCOMPARE(edit.keySequence(), QKeySequence());
|
||||
|
||||
QCOMPARE(spy.count(), 2);
|
||||
}
|
||||
|
||||
void tst_QKeySequenceEdit::testKeys_data()
|
||||
{
|
||||
QTest::addColumn<Qt::Key>("key");
|
||||
QTest::addColumn<Qt::KeyboardModifiers>("modifiers");
|
||||
QTest::addColumn<QKeySequence>("keySequence");
|
||||
|
||||
QTest::newRow("1") << Qt::Key_N << Qt::KeyboardModifiers(Qt::ControlModifier) << QKeySequence("Ctrl+N");
|
||||
QTest::newRow("2") << Qt::Key_N << Qt::KeyboardModifiers(Qt::AltModifier) << QKeySequence("Alt+N");
|
||||
QTest::newRow("3") << Qt::Key_N << Qt::KeyboardModifiers(Qt::ShiftModifier) << QKeySequence("Shift+N");
|
||||
QTest::newRow("4") << Qt::Key_N << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << QKeySequence("Ctrl+Shift+N");
|
||||
}
|
||||
|
||||
void tst_QKeySequenceEdit::testKeys()
|
||||
{
|
||||
QFETCH(Qt::Key, key);
|
||||
QFETCH(Qt::KeyboardModifiers, modifiers);
|
||||
QFETCH(QKeySequence, keySequence);
|
||||
QKeySequenceEdit edit;
|
||||
|
||||
QSignalSpy spy(&edit, SIGNAL(editingFinished()));
|
||||
QTest::keyPress(&edit, key, modifiers);
|
||||
QTest::keyRelease(&edit, key, modifiers);
|
||||
|
||||
QCOMPARE(spy.count(), 0);
|
||||
QCOMPARE(edit.keySequence(), keySequence);
|
||||
QTRY_COMPARE(spy.count(), 1);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QKeySequenceEdit)
|
||||
#include "tst_qkeysequenceedit.moc"
|
||||
|
|
@ -17,6 +17,7 @@ SUBDIRS=\
|
|||
qfocusframe \
|
||||
qfontcombobox \
|
||||
qgroupbox \
|
||||
qkeysequenceedit \
|
||||
qlabel \
|
||||
qlcdnumber \
|
||||
qlineedit \
|
||||
|
|
|
|||
Loading…
Reference in New Issue