diff options
-rw-r--r-- | examples/tutorials/addressbook/part3/addressbook.cpp | 1 | ||||
-rw-r--r-- | examples/tutorials/addressbook/part4/addressbook.cpp | 1 | ||||
-rw-r--r-- | examples/tutorials/addressbook/part5/addressbook.cpp | 1 | ||||
-rw-r--r-- | examples/tutorials/addressbook/part6/addressbook.cpp | 1 | ||||
-rw-r--r-- | examples/tutorials/addressbook/part7/addressbook.cpp | 1 | ||||
-rw-r--r-- | src/corelib/global/qendian.h | 26 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine_win.cpp | 10 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_glib.cpp | 3 | ||||
-rw-r--r-- | src/gui/text/qtextoption.cpp | 10 | ||||
-rw-r--r-- | src/gui/text/qtextoption.h | 2 | ||||
-rw-r--r-- | tests/auto/qtextformat/tst_qtextformat.cpp | 5 | ||||
-rw-r--r-- | tests/auto/qtextlayout/tst_qtextlayout.cpp | 9 | ||||
-rw-r--r-- | tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp | 9 |
13 files changed, 58 insertions, 21 deletions
diff --git a/examples/tutorials/addressbook/part3/addressbook.cpp b/examples/tutorials/addressbook/part3/addressbook.cpp index adb87ef..28a570a 100644 --- a/examples/tutorials/addressbook/part3/addressbook.cpp +++ b/examples/tutorials/addressbook/part3/addressbook.cpp @@ -125,6 +125,7 @@ void AddressBook::submitContact() if (name == "" || address == "") { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); + return; } if (!contacts.contains(name)) { diff --git a/examples/tutorials/addressbook/part4/addressbook.cpp b/examples/tutorials/addressbook/part4/addressbook.cpp index 1b7a6c4..55d551f 100644 --- a/examples/tutorials/addressbook/part4/addressbook.cpp +++ b/examples/tutorials/addressbook/part4/addressbook.cpp @@ -134,6 +134,7 @@ void AddressBook::submitContact() if (name == "" || address == "") { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); + return; } //! [submitContact() function part1] if (currentMode == AddingMode) { diff --git a/examples/tutorials/addressbook/part5/addressbook.cpp b/examples/tutorials/addressbook/part5/addressbook.cpp index 80c18c3..1b3f451 100644 --- a/examples/tutorials/addressbook/part5/addressbook.cpp +++ b/examples/tutorials/addressbook/part5/addressbook.cpp @@ -141,6 +141,7 @@ void AddressBook::submitContact() if (name == "" || address == "") { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); + return; } if (currentMode == AddingMode) { diff --git a/examples/tutorials/addressbook/part6/addressbook.cpp b/examples/tutorials/addressbook/part6/addressbook.cpp index fc41190..724971c 100644 --- a/examples/tutorials/addressbook/part6/addressbook.cpp +++ b/examples/tutorials/addressbook/part6/addressbook.cpp @@ -147,6 +147,7 @@ void AddressBook::submitContact() if (name == "" || address == "") { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); + return; } if (currentMode == AddingMode) { diff --git a/examples/tutorials/addressbook/part7/addressbook.cpp b/examples/tutorials/addressbook/part7/addressbook.cpp index 3ab8702..bf00298 100644 --- a/examples/tutorials/addressbook/part7/addressbook.cpp +++ b/examples/tutorials/addressbook/part7/addressbook.cpp @@ -149,6 +149,7 @@ void AddressBook::submitContact() if (name == "" || address == "") { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); + return; } if (currentMode == AddingMode) { diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 107854c..353e8b9 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -42,6 +42,16 @@ #ifndef QENDIAN_H #define QENDIAN_H +#ifdef Q_OS_LINUX +QT_BEGIN_INCLUDE_NAMESPACE +# include <features.h> +QT_END_INCLUDE_NAMESPACE +#endif + +#ifdef __GLIBC__ +#include <byteswap.h> +#endif + #include <QtCore/qglobal.h> QT_BEGIN_HEADER @@ -264,6 +274,21 @@ template <> inline qint16 qFromBigEndian<qint16>(const uchar *src) * and it is therefore a bit more convenient and in most cases more efficient. */ template <typename T> T qbswap(T source); + +#ifdef __GLIBC__ +template <> inline quint64 qbswap<quint64>(quint64 source) +{ + return bswap_64(source); +} +template <> inline quint32 qbswap<quint32>(quint32 source) +{ + return bswap_32(source); +} +template <> inline quint16 qbswap<quint16>(quint16 source) +{ + return bswap_16(source); +} +#else template <> inline quint64 qbswap<quint64>(quint64 source) { return 0 @@ -292,6 +317,7 @@ template <> inline quint16 qbswap<quint16>(quint16 source) | ((source & 0x00ff) << 8) | ((source & 0xff00) >> 8) ); } +#endif // __GLIBC__ // signed specializations template <> inline qint64 qbswap<qint64>(qint64 source) diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index ec49f1a..21930e1 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -1162,7 +1162,15 @@ bool QFSFileEnginePrivate::doStat() const if (filePath.isEmpty()) return could_stat; - QString fname = filePath.endsWith(QLatin1String(".lnk")) ? readLink(filePath) : filePath; + QString fname; + if(filePath.endsWith(QLatin1String(".lnk"))) { + fname = readLink(filePath); + if(fname.isEmpty()) + return could_stat; + } + else + fname = filePath; + fname = fixIfRelativeUncPath(fname); UINT oldmode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp index fd36be4..9c1c827 100644 --- a/src/corelib/kernel/qeventdispatcher_glib.cpp +++ b/src/corelib/kernel/qeventdispatcher_glib.cpp @@ -246,6 +246,7 @@ struct GPostEventSource GSource source; QAtomicInt serialNumber; int lastSerialNumber; + QEventDispatcherGlibPrivate *d; }; static gboolean postEventSourcePrepare(GSource *s, gint *timeout) @@ -274,6 +275,7 @@ static gboolean postEventSourceDispatch(GSource *s, GSourceFunc, gpointer) GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s); source->lastSerialNumber = source->serialNumber; QCoreApplication::sendPostedEvents(); + source->d->runTimersOnceWithNormalPriority(); return true; // i dunno, george... } @@ -313,6 +315,7 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context) postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs, sizeof(GPostEventSource))); postEventSource->serialNumber = 1; + postEventSource->d = this; g_source_set_can_recurse(&postEventSource->source, true); g_source_attach(&postEventSource->source, mainContext); diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp index c1e254c..a2b8022 100644 --- a/src/gui/text/qtextoption.cpp +++ b/src/gui/text/qtextoption.cpp @@ -145,7 +145,7 @@ QTextOption &QTextOption::operator=(const QTextOption &o) \sa tabArray(), setTabStop(), setTabs() */ -void QTextOption::setTabArray(QList<qreal> tabStops) +void QTextOption::setTabArray(QList<qreal> tabStops) // Qt5: const ref { if (!d) d = new QTextOptionPrivate; @@ -165,7 +165,7 @@ void QTextOption::setTabArray(QList<qreal> tabStops) \sa tabStops() */ -void QTextOption::setTabs(QList<QTextOption::Tab> tabStops) +void QTextOption::setTabs(QList<QTextOption::Tab> tabStops) // Qt5: const ref { if (!d) d = new QTextOptionPrivate; @@ -391,6 +391,12 @@ QList<QTextOption::Tab> QTextOption::tabs() const */ /*! + \fn Tab::Tab(qreal pos, TabType tabType, QChar delim = QChar()) + Creates a tab with the given position, tab type, and (for DelimiterTab) delimiter + \since 4.6 +*/ + +/*! \fn bool Tab::operator==(const Tab &other) const Returns true if tab \a other is equal to this tab; diff --git a/src/gui/text/qtextoption.h b/src/gui/text/qtextoption.h index 1381ed1..5af7834 100644 --- a/src/gui/text/qtextoption.h +++ b/src/gui/text/qtextoption.h @@ -68,6 +68,8 @@ public: struct Q_GUI_EXPORT Tab { inline Tab() : position(80), type(QTextOption::LeftTab) { } + inline Tab(qreal pos, TabType tabType, QChar delim = QChar()) + : position(pos), type(tabType), delimiter(delim) {} inline bool operator==(const Tab &other) const { return type == other.type diff --git a/tests/auto/qtextformat/tst_qtextformat.cpp b/tests/auto/qtextformat/tst_qtextformat.cpp index ee1f4b5..9b71481 100644 --- a/tests/auto/qtextformat/tst_qtextformat.cpp +++ b/tests/auto/qtextformat/tst_qtextformat.cpp @@ -308,10 +308,7 @@ void tst_QTextFormat::getSetTabs() format.setTabPositions(tabs); Comparator c2(tabs, format.tabPositions()); - QTextOption::Tab tab2; - tab2.position = 3456; - tab2.type = QTextOption::RightTab; - tab2.delimiter = QChar('x'); + QTextOption::Tab tab2(3456, QTextOption::RightTab, QChar('x')); tabs.append(tab2); format.setTabPositions(tabs); Comparator c3(tabs, format.tabPositions()); diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index 1a5f493..a631f3d 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -980,9 +980,7 @@ void tst_QTextLayout::testCenteredTab() // test if centering the tab works. We expect the center of 'Bar.' to be at the tab point. QTextOption option = layout.textOption(); QList<QTextOption::Tab> tabs; - QTextOption::Tab tab; - tab.type = QTextOption::CenterTab; - tab.position = 150; + QTextOption::Tab tab(150, QTextOption::CenterTab); tabs.append(tab); option.setTabs(tabs); layout.setTextOption(option); @@ -1002,10 +1000,7 @@ void tst_QTextLayout::testDelimiterTab() // try the different delimiter characters to see if the alignment works there. QTextOption option = layout.textOption(); QList<QTextOption::Tab> tabs; - QTextOption::Tab tab; - tab.type = QTextOption::DelimiterTab; - tab.delimiter = QChar('.'); - tab.position = 100; + QTextOption::Tab tab(100, QTextOption::DelimiterTab, QChar('.')); tabs.append(tab); option.setTabs(tabs); layout.setTextOption(option); diff --git a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp index 64c42bb..a463d86 100644 --- a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp +++ b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp @@ -198,14 +198,9 @@ void tst_QTextOdfWriter::testWriteStyle2() { QTextBlockFormat bf; // = cursor.blockFormat(); QList<QTextOption::Tab> tabs; - QTextOption::Tab tab1; - tab1.position = 40; - tab1.type = QTextOption::RightTab; + QTextOption::Tab tab1(40, QTextOption::RightTab); tabs << tab1; - QTextOption::Tab tab2; - tab2.position = 80; - tab2.type = QTextOption::DelimiterTab; - tab2.delimiter = 'o'; + QTextOption::Tab tab2(80, QTextOption::DelimiterTab, 'o'); tabs << tab2; bf.setTabPositions(tabs); |