Pass params of shareable type by const-ref rather than by value

...where passing them by value was not intentional.

Change-Id: Ifd5036d57b41fddeeacfbd3f5890881605b80647
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Konstantin Ritt 2015-01-23 13:05:12 +04:00
parent 22b5c39e8e
commit 9b67d89c24
57 changed files with 82 additions and 82 deletions

View File

@ -43,7 +43,7 @@
#include "buttonwidget.h" #include "buttonwidget.h"
//! [0] //! [0]
ButtonWidget::ButtonWidget(QStringList texts, QWidget *parent) ButtonWidget::ButtonWidget(const QStringList &texts, QWidget *parent)
: QWidget(parent) : QWidget(parent)
{ {
signalMapper = new QSignalMapper(this); signalMapper = new QSignalMapper(this);

View File

@ -53,7 +53,7 @@ class ButtonWidget : public QWidget
Q_OBJECT Q_OBJECT
public: public:
ButtonWidget(QStringList texts, QWidget *parent = 0); ButtonWidget(const QStringList &texts, QWidget *parent = 0);
signals: signals:
void clicked(const QString &text); void clicked(const QString &text);

View File

@ -63,7 +63,7 @@ class Employee
//! [1] //! [1]
Employee() { d = new EmployeeData; } Employee() { d = new EmployeeData; }
//! [1] //! [2] //! [1] //! [2]
Employee(int id, QString name) { Employee(int id, const QString &name) {
d = new EmployeeData; d = new EmployeeData;
setId(id); setId(id);
setName(name); setName(name);
@ -77,7 +77,7 @@ class Employee
//! [3] //! [3]
void setId(int id) { d->id = id; } void setId(int id) { d->id = id; }
//! [3] //! [4] //! [3] //! [4]
void setName(QString name) { d->name = name; } void setName(const QString &name) { d->name = name; }
//! [4] //! [4]
//! [5] //! [5]

View File

@ -283,13 +283,13 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
#endif #endif
} }
void QFseventsFileSystemWatcherEngine::doEmitFileChanged(const QString path, bool removed) void QFseventsFileSystemWatcherEngine::doEmitFileChanged(const QString &path, bool removed)
{ {
DEBUG() << "emitting fileChanged for" << path << "with removed =" << removed; DEBUG() << "emitting fileChanged for" << path << "with removed =" << removed;
emit fileChanged(path, removed); emit fileChanged(path, removed);
} }
void QFseventsFileSystemWatcherEngine::doEmitDirectoryChanged(const QString path, bool removed) void QFseventsFileSystemWatcherEngine::doEmitDirectoryChanged(const QString &path, bool removed)
{ {
DEBUG() << "emitting directoryChanged for" << path << "with removed =" << removed; DEBUG() << "emitting directoryChanged for" << path << "with removed =" << removed;
emit directoryChanged(path, removed); emit directoryChanged(path, removed);
@ -316,10 +316,10 @@ QFseventsFileSystemWatcherEngine::QFseventsFileSystemWatcherEngine(QObject *pare
// We cannot use signal-to-signal queued connections, because the // We cannot use signal-to-signal queued connections, because the
// QSignalSpy cannot spot signals fired from other/alien threads. // QSignalSpy cannot spot signals fired from other/alien threads.
connect(this, SIGNAL(emitDirectoryChanged(const QString, bool)), connect(this, SIGNAL(emitDirectoryChanged(QString,bool)),
this, SLOT(doEmitDirectoryChanged(const QString, bool)), Qt::QueuedConnection); this, SLOT(doEmitDirectoryChanged(QString,bool)), Qt::QueuedConnection);
connect(this, SIGNAL(emitFileChanged(const QString, bool)), connect(this, SIGNAL(emitFileChanged(QString,bool)),
this, SLOT(doEmitFileChanged(const QString, bool)), Qt::QueuedConnection); this, SLOT(doEmitFileChanged(QString,bool)), Qt::QueuedConnection);
connect(this, SIGNAL(scheduleStreamRestart()), connect(this, SIGNAL(scheduleStreamRestart()),
this, SLOT(restartStream()), Qt::QueuedConnection); this, SLOT(restartStream()), Qt::QueuedConnection);

View File

@ -74,13 +74,13 @@ public:
void processEvent(ConstFSEventStreamRef streamRef, size_t numEvents, char **eventPaths, const FSEventStreamEventFlags eventFlags[], const FSEventStreamEventId eventIds[]); void processEvent(ConstFSEventStreamRef streamRef, size_t numEvents, char **eventPaths, const FSEventStreamEventFlags eventFlags[], const FSEventStreamEventId eventIds[]);
Q_SIGNALS: Q_SIGNALS:
void emitFileChanged(const QString path, bool removed); void emitFileChanged(const QString &path, bool removed);
void emitDirectoryChanged(const QString path, bool removed); void emitDirectoryChanged(const QString &path, bool removed);
void scheduleStreamRestart(); void scheduleStreamRestart();
private slots: private slots:
void doEmitFileChanged(const QString path, bool removed); void doEmitFileChanged(const QString &path, bool removed);
void doEmitDirectoryChanged(const QString path, bool removed); void doEmitDirectoryChanged(const QString &path, bool removed);
void restartStream(); void restartStream();
private: private:

View File

@ -281,7 +281,7 @@ class QWinRTSettingsPrivate : public QSettingsPrivate
public: public:
QWinRTSettingsPrivate(QSettings::Scope scope, const QString &organization, QWinRTSettingsPrivate(QSettings::Scope scope, const QString &organization,
const QString &application); const QString &application);
QWinRTSettingsPrivate(QString rKey); QWinRTSettingsPrivate(const QString &rKey);
~QWinRTSettingsPrivate(); ~QWinRTSettingsPrivate();
void remove(const QString &uKey); void remove(const QString &uKey);
@ -315,7 +315,7 @@ QWinRTSettingsPrivate::QWinRTSettingsPrivate(QSettings::Scope scope, const QStri
init(scope); init(scope);
} }
QWinRTSettingsPrivate::QWinRTSettingsPrivate(QString rPath) QWinRTSettingsPrivate::QWinRTSettingsPrivate(const QString &rPath)
: QSettingsPrivate(QSettings::NativeFormat, QSettings::UserScope, rPath, QString()) : QSettingsPrivate(QSettings::NativeFormat, QSettings::UserScope, rPath, QString())
, writeContainer(0) , writeContainer(0)
{ {

View File

@ -677,7 +677,7 @@ void QAbstractItemModelPrivate::itemsAboutToBeMoved(const QModelIndex &srcParent
column value depending on the value of \a orientation. The indexes may also be moved to a different parent if \a parent column value depending on the value of \a orientation. The indexes may also be moved to a different parent if \a parent
differs from the existing parent for the index. differs from the existing parent for the index.
*/ */
void QAbstractItemModelPrivate::movePersistentIndexes(QVector<QPersistentModelIndexData *> indexes, int change, const QModelIndex &parent, Qt::Orientation orientation) void QAbstractItemModelPrivate::movePersistentIndexes(const QVector<QPersistentModelIndexData *> &indexes, int change, const QModelIndex &parent, Qt::Orientation orientation)
{ {
QVector<QPersistentModelIndexData *>::const_iterator it; QVector<QPersistentModelIndexData *>::const_iterator it;
const QVector<QPersistentModelIndexData *>::const_iterator begin = indexes.constBegin(); const QVector<QPersistentModelIndexData *>::const_iterator begin = indexes.constBegin();

View File

@ -72,7 +72,7 @@ class Q_CORE_EXPORT QAbstractItemModelPrivate : public QObjectPrivate
public: public:
QAbstractItemModelPrivate() : QObjectPrivate(), supportedDragActions(-1), roleNames(defaultRoleNames()) {} QAbstractItemModelPrivate() : QObjectPrivate(), supportedDragActions(-1), roleNames(defaultRoleNames()) {}
void removePersistentIndexData(QPersistentModelIndexData *data); void removePersistentIndexData(QPersistentModelIndexData *data);
void movePersistentIndexes(QVector<QPersistentModelIndexData *> indexes, int change, const QModelIndex &parent, Qt::Orientation orientation); void movePersistentIndexes(const QVector<QPersistentModelIndexData *> &indexes, int change, const QModelIndex &parent, Qt::Orientation orientation);
void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last); void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last);
void rowsInserted(const QModelIndex &parent, int first, int last); void rowsInserted(const QModelIndex &parent, int first, int last);
void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last); void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last);

View File

@ -136,7 +136,7 @@ public:
void setErrorString(const QString &function); void setErrorString(const QString &function);
#ifndef QT_NO_SYSTEMSEMAPHORE #ifndef QT_NO_SYSTEMSEMAPHORE
bool tryLocker(QSharedMemoryLocker *locker, const QString function) { bool tryLocker(QSharedMemoryLocker *locker, const QString &function) {
if (!locker->lock()) { if (!locker->lock()) {
errorString = QSharedMemory::tr("%1: unable to lock").arg(function); errorString = QSharedMemory::tr("%1: unable to lock").arg(function);
error = QSharedMemory::LockError; error = QSharedMemory::LockError;

View File

@ -343,7 +343,7 @@ static QDate calculateDowDate(int year, int month, int dayOfWeek, int week)
return date; return date;
} }
static QDate calculatePosixDate(const QByteArray dateRule, int year) static QDate calculatePosixDate(const QByteArray &dateRule, int year)
{ {
// Can start with M, J, or a digit // Can start with M, J, or a digit
if (dateRule.at(0) == 'M') { if (dateRule.at(0) == 'M') {

View File

@ -1213,7 +1213,7 @@ QList<QByteArray> QPicture::inputFormats()
return QPictureIO::inputFormats(); return QPictureIO::inputFormats();
} }
static QStringList qToStringList(const QList<QByteArray> arr) static QStringList qToStringList(const QList<QByteArray> &arr)
{ {
QStringList list; QStringList list;
for (int i = 0; i < arr.count(); ++i) for (int i = 0; i < arr.count(); ++i)

View File

@ -974,7 +974,7 @@ static
unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
const QtFontFamily *family, const QString &foundry_name, const QtFontFamily *family, const QString &foundry_name,
QtFontStyle::Key styleKey, int pixelSize, char pitch, QtFontStyle::Key styleKey, int pixelSize, char pitch,
QtFontDesc *desc, int force_encoding_id, QString styleName = QString()) QtFontDesc *desc, int force_encoding_id, const QString &styleName = QString())
{ {
Q_UNUSED(force_encoding_id); Q_UNUSED(force_encoding_id);
Q_UNUSED(script); Q_UNUSED(script);

View File

@ -225,8 +225,8 @@ private:
class QFtpCommand class QFtpCommand
{ {
public: public:
QFtpCommand(QFtp::Command cmd, QStringList raw, const QByteArray &ba); QFtpCommand(QFtp::Command cmd, const QStringList &raw, const QByteArray &ba);
QFtpCommand(QFtp::Command cmd, QStringList raw, QIODevice *dev = 0); QFtpCommand(QFtp::Command cmd, const QStringList &raw, QIODevice *dev = 0);
~QFtpCommand(); ~QFtpCommand();
int id; int id;
@ -246,14 +246,14 @@ public:
QBasicAtomicInt QFtpCommand::idCounter = Q_BASIC_ATOMIC_INITIALIZER(1); QBasicAtomicInt QFtpCommand::idCounter = Q_BASIC_ATOMIC_INITIALIZER(1);
QFtpCommand::QFtpCommand(QFtp::Command cmd, QStringList raw, const QByteArray &ba) QFtpCommand::QFtpCommand(QFtp::Command cmd, const QStringList &raw, const QByteArray &ba)
: command(cmd), rawCmds(raw), is_ba(true) : command(cmd), rawCmds(raw), is_ba(true)
{ {
id = idCounter.fetchAndAddRelaxed(1); id = idCounter.fetchAndAddRelaxed(1);
data.ba = new QByteArray(ba); data.ba = new QByteArray(ba);
} }
QFtpCommand::QFtpCommand(QFtp::Command cmd, QStringList raw, QIODevice *dev) QFtpCommand::QFtpCommand(QFtp::Command cmd, const QStringList &raw, QIODevice *dev)
: command(cmd), rawCmds(raw), is_ba(false) : command(cmd), rawCmds(raw), is_ba(false)
{ {
id = idCounter.fetchAndAddRelaxed(1); id = idCounter.fetchAndAddRelaxed(1);

View File

@ -130,7 +130,7 @@ void QNetworkCookieJar::setAllCookies(const QList<QNetworkCookie> &cookieList)
d->allCookies = cookieList; d->allCookies = cookieList;
} }
static inline bool isParentPath(QString path, QString reference) static inline bool isParentPath(const QString &path, const QString &reference)
{ {
if (path.startsWith(reference)) { if (path.startsWith(reference)) {
//The cookie-path and the request-path are identical. //The cookie-path and the request-path are identical.
@ -149,7 +149,7 @@ static inline bool isParentPath(QString path, QString reference)
return false; return false;
} }
static inline bool isParentDomain(QString domain, QString reference) static inline bool isParentDomain(const QString &domain, const QString &reference)
{ {
if (!reference.startsWith(QLatin1Char('.'))) if (!reference.startsWith(QLatin1Char('.')))
return domain == reference; return domain == reference;

View File

@ -431,7 +431,7 @@ void QHostInfo::setErrorString(const QString &str)
\sa hostName() \sa hostName()
*/ */
QHostInfoRunnable::QHostInfoRunnable(QString hn, int i) : toBeLookedUp(hn), id(i) QHostInfoRunnable::QHostInfoRunnable(const QString &hn, int i) : toBeLookedUp(hn), id(i)
{ {
setAutoDelete(true); setAutoDelete(true);
} }

View File

@ -145,7 +145,7 @@ private:
class QHostInfoRunnable : public QRunnable class QHostInfoRunnable : public QRunnable
{ {
public: public:
QHostInfoRunnable (QString hn, int i); QHostInfoRunnable(const QString &hn, int i);
void run() Q_DECL_OVERRIDE; void run() Q_DECL_OVERRIDE;
QString toBeLookedUp; QString toBeLookedUp;

View File

@ -438,13 +438,13 @@ bool QSocks5Authenticator::continueAuthenticate(QTcpSocket *socket, bool *comple
return true; return true;
} }
bool QSocks5Authenticator::seal(const QByteArray buf, QByteArray *sealedBuf) bool QSocks5Authenticator::seal(const QByteArray &buf, QByteArray *sealedBuf)
{ {
*sealedBuf = buf; *sealedBuf = buf;
return true; return true;
} }
bool QSocks5Authenticator::unSeal(const QByteArray sealedBuf, QByteArray *buf) bool QSocks5Authenticator::unSeal(const QByteArray &sealedBuf, QByteArray *buf)
{ {
*buf = sealedBuf; *buf = sealedBuf;
return true; return true;

View File

@ -149,8 +149,8 @@ public:
virtual bool beginAuthenticate(QTcpSocket *socket, bool *completed); virtual bool beginAuthenticate(QTcpSocket *socket, bool *completed);
virtual bool continueAuthenticate(QTcpSocket *socket, bool *completed); virtual bool continueAuthenticate(QTcpSocket *socket, bool *completed);
virtual bool seal(const QByteArray buf, QByteArray *sealedBuf); virtual bool seal(const QByteArray &buf, QByteArray *sealedBuf);
virtual bool unSeal(const QByteArray sealedBuf, QByteArray *buf); virtual bool unSeal(const QByteArray &sealedBuf, QByteArray *buf);
virtual bool unSeal(QTcpSocket *sealedSocket, QByteArray *buf); virtual bool unSeal(QTcpSocket *sealedSocket, QByteArray *buf);
virtual QString errorString() { return QString(); } virtual QString errorString() { return QString(); }

View File

@ -72,7 +72,7 @@ static inline bool checkExecutable(const QString &candidate, QString *result)
return !result->isEmpty(); return !result->isEmpty();
} }
static inline bool detectWebBrowser(QByteArray desktop, static inline bool detectWebBrowser(const QByteArray &desktop,
bool checkBrowserVariable, bool checkBrowserVariable,
QString *browser) QString *browser)
{ {

View File

@ -565,7 +565,7 @@ class QGnomeThemePrivate : public QPlatformThemePrivate
{ {
public: public:
QGnomeThemePrivate() : fontsConfigured(false) { } QGnomeThemePrivate() : fontsConfigured(false) { }
void configureFonts(QString gtkFontName) const void configureFonts(const QString &gtkFontName) const
{ {
Q_ASSERT(!fontsConfigured); Q_ASSERT(!fontsConfigured);
const int split = gtkFontName.lastIndexOf(QChar::Space); const int split = gtkFontName.lastIndexOf(QChar::Space);

View File

@ -116,7 +116,7 @@ bool AndroidTrafficStats::isTrafficStatsSupported()
&& AndroidTrafficStats::getTotalRxBytes() != -1); && AndroidTrafficStats::getTotalRxBytes() != -1);
} }
static AndroidNetworkInfo::NetworkState stateForName(const QString stateName) static AndroidNetworkInfo::NetworkState stateForName(const QString &stateName)
{ {
if (stateName == QLatin1String("CONNECTED")) if (stateName == QLatin1String("CONNECTED"))
return AndroidNetworkInfo::Connected; return AndroidNetworkInfo::Connected;

View File

@ -259,7 +259,7 @@ QByteArray TableGenerator::readLocaleAliases(const QByteArray &locale)
return fullLocaleName; return fullLocaleName;
} }
bool TableGenerator::processFile(QString composeFileName) bool TableGenerator::processFile(const QString &composeFileName)
{ {
QFile composeFile(composeFileName); QFile composeFile(composeFileName);
if (composeFile.open(QIODevice::ReadOnly)) { if (composeFile.open(QIODevice::ReadOnly)) {

View File

@ -103,7 +103,7 @@ public:
TableState tableState() const { return m_state; } TableState tableState() const { return m_state; }
protected: protected:
bool processFile(QString composeFileName); bool processFile(const QString &composeFileName);
void parseKeySequence(char *line); void parseKeySequence(char *line);
void parseIncludeInstruction(QString line); void parseIncludeInstruction(QString line);

View File

@ -77,7 +77,7 @@ public:
// ---------------------------------------------------- // ----------------------------------------------------
// Additional methods // Additional methods
void setVirtualSiblings(QList<QPlatformScreen *> siblings) { m_siblings = siblings; } void setVirtualSiblings(const QList<QPlatformScreen *> &siblings) { m_siblings = siblings; }
NSScreen *osScreen() const; NSScreen *osScreen() const;
void updateGeometry(); void updateGeometry();

View File

@ -180,7 +180,7 @@ void QCocoaSystemTrayIcon::cleanup()
} }
static bool heightCompareFunction (QSize a, QSize b) { return (a.height() < b.height()); } static bool heightCompareFunction (QSize a, QSize b) { return (a.height() < b.height()); }
static QList<QSize> sortByHeight(const QList<QSize> sizes) static QList<QSize> sortByHeight(const QList<QSize> &sizes)
{ {
QList<QSize> sorted = sizes; QList<QSize> sorted = sizes;
std::sort(sorted.begin(), sorted.end(), heightCompareFunction); std::sort(sorted.begin(), sorted.end(), heightCompareFunction);

View File

@ -88,7 +88,7 @@ void QKmsIntegration::initialize()
m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_DRM | QDeviceDiscovery::Device_DRM_PrimaryGPU, 0); m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_DRM | QDeviceDiscovery::Device_DRM_PrimaryGPU, 0);
if (m_deviceDiscovery) { if (m_deviceDiscovery) {
QStringList devices = m_deviceDiscovery->scanConnectedDevices(); QStringList devices = m_deviceDiscovery->scanConnectedDevices();
foreach (QString device, devices) foreach (const QString &device, devices)
addDevice(device); addDevice(device);
connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addDevice(QString))); connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addDevice(QString)));

View File

@ -112,7 +112,7 @@ static QSize determineScreenSize(screen_display_t display, bool primaryScreen) {
#endif #endif
} }
static QQnxWindow *findMultimediaWindow(const QList<QQnxWindow*> windows, static QQnxWindow *findMultimediaWindow(const QList<QQnxWindow*> &windows,
const QByteArray &mmWindowId) const QByteArray &mmWindowId)
{ {
Q_FOREACH (QQnxWindow *sibling, windows) { Q_FOREACH (QQnxWindow *sibling, windows) {
@ -128,7 +128,7 @@ static QQnxWindow *findMultimediaWindow(const QList<QQnxWindow*> windows,
return 0; return 0;
} }
static QQnxWindow *findMultimediaWindow(const QList<QQnxWindow*> windows, static QQnxWindow *findMultimediaWindow(const QList<QQnxWindow*> &windows,
screen_window_t mmWindowId) screen_window_t mmWindowId)
{ {
Q_FOREACH (QQnxWindow *sibling, windows) { Q_FOREACH (QQnxWindow *sibling, windows) {

View File

@ -140,7 +140,7 @@ QAbstractFileEngine *QWinRTFileEngineHandler::create(const QString &fileName) co
return Q_NULLPTR; return Q_NULLPTR;
} }
static HRESULT getDestinationFolder(const QString &fileName, const QString newFileName, static HRESULT getDestinationFolder(const QString &fileName, const QString &newFileName,
IStorageItem *file, IStorageFolder **folder) IStorageItem *file, IStorageFolder **folder)
{ {
HRESULT hr; HRESULT hr;

View File

@ -484,7 +484,7 @@ xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape)
} }
#ifdef XCB_USE_XLIB #ifdef XCB_USE_XLIB
bool updateCursorTheme(void *dpy, const QByteArray theme) { bool updateCursorTheme(void *dpy, const QByteArray &theme) {
if (!ptrXcursorLibraryGetTheme if (!ptrXcursorLibraryGetTheme
|| !ptrXcursorLibrarySetTheme) || !ptrXcursorLibrarySetTheme)
return false; return false;

View File

@ -680,7 +680,7 @@ void QXcbKeyboard::updateKeymap()
if (qEnvironmentVariableIsSet("QT_XKB_CONFIG_ROOT")) { if (qEnvironmentVariableIsSet("QT_XKB_CONFIG_ROOT")) {
xkb_context = xkb_context_new((xkb_context_flags)XKB_CONTEXT_NO_DEFAULT_INCLUDES); xkb_context = xkb_context_new((xkb_context_flags)XKB_CONTEXT_NO_DEFAULT_INCLUDES);
QList<QByteArray> xkbRootList = QByteArray(qgetenv("QT_XKB_CONFIG_ROOT")).split(':'); QList<QByteArray> xkbRootList = QByteArray(qgetenv("QT_XKB_CONFIG_ROOT")).split(':');
foreach (QByteArray xkbRoot, xkbRootList) foreach (const QByteArray &xkbRoot, xkbRootList)
xkb_context_include_path_append(xkb_context, xkbRoot.constData()); xkb_context_include_path_append(xkb_context, xkbRoot.constData());
} else { } else {
xkb_context = xkb_context_new((xkb_context_flags)0); xkb_context = xkb_context_new((xkb_context_flags)0);
@ -1045,7 +1045,7 @@ int QXcbKeyboard::keysymToQtKey(xcb_keysym_t key) const
return code; return code;
} }
int QXcbKeyboard::keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, QString text) const int QXcbKeyboard::keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text) const
{ {
int code = 0; int code = 0;
#ifndef QT_NO_TEXTCODEC #ifndef QT_NO_TEXTCODEC

View File

@ -80,7 +80,7 @@ protected:
void resolveMaskConflicts(); void resolveMaskConflicts();
QString lookupString(struct xkb_state *state, xcb_keycode_t code) const; QString lookupString(struct xkb_state *state, xcb_keycode_t code) const;
int keysymToQtKey(xcb_keysym_t keysym) const; int keysymToQtKey(xcb_keysym_t keysym) const;
int keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, QString text) const; int keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text) const;
void printKeymapError(const char *error) const; void printKeymapError(const char *error) const;
void readXKBConfig(); void readXKBConfig();

View File

@ -48,7 +48,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr,
xcb_randr_get_output_info_reply_t *output, QString outputName, int number) xcb_randr_get_output_info_reply_t *output, const QString &outputName, int number)
: QXcbObject(connection) : QXcbObject(connection)
, m_screen(scr) , m_screen(scr)
, m_crtc(output ? output->crtc : 0) , m_crtc(output ? output->crtc : 0)

View File

@ -55,7 +55,7 @@ class Q_XCB_EXPORT QXcbScreen : public QXcbObject, public QPlatformScreen
{ {
public: public:
QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen,
xcb_randr_get_output_info_reply_t *output, QString outputName, int number); xcb_randr_get_output_info_reply_t *output, const QString &outputName, int number);
~QXcbScreen(); ~QXcbScreen();
QPixmap grabWindow(WId window, int x, int y, int width, int height) const Q_DECL_OVERRIDE; QPixmap grabWindow(WId window, int x, int y, int width, int height) const Q_DECL_OVERRIDE;

View File

@ -565,7 +565,7 @@ void QPSQLResult::virtual_hook(int id, void *data)
QSqlResult::virtual_hook(id, data); QSqlResult::virtual_hook(id, data);
} }
static QString qCreateParamString(const QVector<QVariant> boundValues, const QSqlDriver *driver) static QString qCreateParamString(const QVector<QVariant> &boundValues, const QSqlDriver *driver)
{ {
if (boundValues.isEmpty()) if (boundValues.isEmpty())
return QString(); return QString();

View File

@ -818,7 +818,7 @@ static void findRequiredContainers(ClassDef *cdef, QSet<QByteArray> *requiredQtC
for (int i = 0; i < cdef->propertyList.count(); ++i) { for (int i = 0; i < cdef->propertyList.count(); ++i) {
const PropertyDef &p = cdef->propertyList.at(i); const PropertyDef &p = cdef->propertyList.at(i);
foreach (const QByteArray candidate, candidates) { foreach (const QByteArray &candidate, candidates) {
if (p.type.contains(candidate + "<")) if (p.type.contains(candidate + "<"))
requiredQtContainers->insert(candidate); requiredQtContainers->insert(candidate);
} }
@ -829,7 +829,7 @@ static void findRequiredContainers(ClassDef *cdef, QSet<QByteArray> *requiredQtC
for (int i = 0; i < allFunctions.count(); ++i) { for (int i = 0; i < allFunctions.count(); ++i) {
const FunctionDef &f = allFunctions.at(i); const FunctionDef &f = allFunctions.at(i);
foreach (const ArgumentDef &arg, f.arguments) { foreach (const ArgumentDef &arg, f.arguments) {
foreach (const QByteArray candidate, candidates) { foreach (const QByteArray &candidate, candidates) {
if (arg.normalizedType.contains(candidate + "<")) if (arg.normalizedType.contains(candidate + "<"))
requiredQtContainers->insert(candidate); requiredQtContainers->insert(candidate);
} }

View File

@ -64,7 +64,7 @@ struct Topic
QString topic; QString topic;
QString args; QString args;
Topic() { } Topic() { }
Topic(QString& t, QString a) : topic(t), args(a) { } Topic(QString& t, const QString &a) : topic(t), args(a) { }
bool isEmpty() const { return topic.isEmpty(); } bool isEmpty() const { return topic.isEmpty(); }
void clear() { topic.clear(); args.clear(); } void clear() { topic.clear(); args.clear(); }
}; };

View File

@ -136,7 +136,7 @@ void MainWindow::createActions()
openAct->setShortcuts(QKeySequence::Open); openAct->setShortcuts(QKeySequence::Open);
connect(openAct, SIGNAL(triggered()), this, SLOT(open())); connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
foreach (QByteArray format, QImageWriter::supportedImageFormats()) { foreach (const QByteArray &format, QImageWriter::supportedImageFormats()) {
QString text = tr("%1...").arg(QString(format).toUpper()); QString text = tr("%1...").arg(QString(format).toUpper());
QAction *action = new QAction(text, this); QAction *action = new QAction(text, this);

View File

@ -3190,7 +3190,7 @@ void HtmlGenerator::generateList(const Node* relative, CodeMarker* marker, const
#if 0 #if 0
QStringList keys = groups.uniqueKeys(); QStringList keys = groups.uniqueKeys();
foreach (QString key, keys) { foreach (const QString &key, keys) {
GroupNode* gn = static_cast<GroupNode*>(groups.value(key)); GroupNode* gn = static_cast<GroupNode*>(groups.value(key));
if (gn) { if (gn) {
out() << QString("<h3><a href=\"%1\">%2</a></h3>\n").arg( out() << QString("<h3><a href=\"%1\">%2</a></h3>\n").arg(
@ -3217,7 +3217,7 @@ void HtmlGenerator::generateList(const Node* relative, CodeMarker* marker, const
out() << "<ul>\n"; out() << "<ul>\n";
QStringList titles = nm.keys(); QStringList titles = nm.keys();
foreach (QString t, titles) { foreach (const QString &t, titles) {
Node* member = nm.value(t); Node* member = nm.value(t);
QString title = member->fullTitle(); QString title = member->fullTitle();
if (title.startsWith("The ")) if (title.startsWith("The "))
@ -4484,7 +4484,7 @@ void HtmlGenerator::generateManifestFiles()
for each manifest file to be generated. \a manifest is the for each manifest file to be generated. \a manifest is the
type of manifest file. type of manifest file.
*/ */
void HtmlGenerator::generateManifestFile(QString manifest, QString element) void HtmlGenerator::generateManifestFile(const QString &manifest, const QString &element)
{ {
ExampleNodeMap& exampleNodeMap = qdb_->exampleNodeMap(); ExampleNodeMap& exampleNodeMap = qdb_->exampleNodeMap();
if (exampleNodeMap.isEmpty()) if (exampleNodeMap.isEmpty())

View File

@ -104,7 +104,7 @@ protected:
virtual QString refForNode(const Node *node); virtual QString refForNode(const Node *node);
virtual QString linkForNode(const Node *node, const Node *relative); virtual QString linkForNode(const Node *node, const Node *relative);
void generateManifestFile(QString manifest, QString element); void generateManifestFile(const QString &manifest, const QString &element);
void readManifestMetaContent(const Config &config); void readManifestMetaContent(const Config &config);
void generateKeywordAnchors(const Node* node); void generateKeywordAnchors(const Node* node);

View File

@ -2474,7 +2474,7 @@ QString Node::fullDocumentName() const
be used as the value of an \e id attribute. Search for NCName be used as the value of an \e id attribute. Search for NCName
on the internet for details of what can be an NCName. on the internet for details of what can be an NCName.
*/ */
QString Node::cleanId(QString str) QString Node::cleanId(const QString &str)
{ {
QString clean; QString clean;
QString name = str.simplified(); QString name = str.simplified();

View File

@ -305,7 +305,7 @@ public:
const QString& outputSubdirectory() const { return outSubDir_; } const QString& outputSubdirectory() const { return outSubDir_; }
void setOutputSubdirectory(const QString& t) { outSubDir_ = t; } void setOutputSubdirectory(const QString& t) { outSubDir_ = t; }
QString fullDocumentName() const; QString fullDocumentName() const;
static QString cleanId(QString str); static QString cleanId(const QString &str);
QString idForNode() const; QString idForNode() const;
static FlagValue toFlagValue(bool b); static FlagValue toFlagValue(bool b);

View File

@ -1549,7 +1549,7 @@ void QDocDatabase::mergeCollections(Node::Type nt, CNMap& cnm, const Node* relat
if (cnmm.isEmpty()) if (cnmm.isEmpty())
return; return;
QStringList keys = cnmm.uniqueKeys(); QStringList keys = cnmm.uniqueKeys();
foreach (QString key, keys) { foreach (const QString &key, keys) {
QList<CollectionNode*> values = cnmm.values(key); QList<CollectionNode*> values = cnmm.values(key);
CollectionNode* n = 0; CollectionNode* n = 0;
foreach (CollectionNode* v, values) { foreach (CollectionNode* v, values) {

View File

@ -542,7 +542,7 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
QString groupsAttr = element.attribute("groups"); QString groupsAttr = element.attribute("groups");
if (!groupsAttr.isEmpty()) { if (!groupsAttr.isEmpty()) {
QStringList groupNames = groupsAttr.split(","); QStringList groupNames = groupsAttr.split(",");
foreach (QString name, groupNames) { foreach (const QString &name, groupNames) {
qdb_->addToGroup(name, node); qdb_->addToGroup(name, node);
} }
} }

View File

@ -75,8 +75,7 @@ int main (int argc, char *argv[])
QStringList args = app.arguments (); QStringList args = app.arguments ();
args.removeFirst (); args.removeFirst ();
foreach (QString arg, args) foreach (const QString &arg, args) {
{
if (arg == QLatin1String ("-h") || arg == QLatin1String ("--help")) if (arg == QLatin1String ("-h") || arg == QLatin1String ("--help"))
help_me (); help_me ();

View File

@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE
namespace CPP { namespace CPP {
static QByteArray transformImageData(QString data) static QByteArray transformImageData(const QString &data)
{ {
int baSize = data.length() / 2; int baSize = data.length() / 2;
uchar *ba = new uchar[baSize]; uchar *ba = new uchar[baSize];
@ -66,7 +66,7 @@ static QByteArray transformImageData(QString data)
return ret; return ret;
} }
static QByteArray unzipXPM(QString data, ulong& length) static QByteArray unzipXPM(const QString &data, ulong &length)
{ {
#ifndef QT_NO_COMPRESS #ifndef QT_NO_COMPRESS
const int lengthOffset = 4; const int lengthOffset = 4;

View File

@ -1214,7 +1214,7 @@ QList<QUrl> QFileDialogPrivate::userSelectedFiles() const
return files; return files;
} }
QStringList QFileDialogPrivate::addDefaultSuffixToFiles(const QStringList filesToFix) const QStringList QFileDialogPrivate::addDefaultSuffixToFiles(const QStringList &filesToFix) const
{ {
QStringList files; QStringList files;
for (int i=0; i<filesToFix.size(); ++i) { for (int i=0; i<filesToFix.size(); ++i) {
@ -3590,7 +3590,7 @@ void QFileDialogPrivate::_q_rowsInserted(const QModelIndex &parent)
return; return;
} }
void QFileDialogPrivate::_q_fileRenamed(const QString &path, const QString oldName, const QString newName) void QFileDialogPrivate::_q_fileRenamed(const QString &path, const QString &oldName, const QString &newName)
{ {
const QFileDialog::FileMode fileMode = q_func()->fileMode(); const QFileDialog::FileMode fileMode = q_func()->fileMode();
if (fileMode == QFileDialog::Directory || fileMode == QFileDialog::DirectoryOnly) { if (fileMode == QFileDialog::Directory || fileMode == QFileDialog::DirectoryOnly) {

View File

@ -289,7 +289,8 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_autoCompleteFileName(const QString &text)) Q_PRIVATE_SLOT(d_func(), void _q_autoCompleteFileName(const QString &text))
Q_PRIVATE_SLOT(d_func(), void _q_rowsInserted(const QModelIndex & parent)) Q_PRIVATE_SLOT(d_func(), void _q_rowsInserted(const QModelIndex & parent))
Q_PRIVATE_SLOT(d_func(), void _q_fileRenamed(const QString &path, Q_PRIVATE_SLOT(d_func(), void _q_fileRenamed(const QString &path,
const QString oldName, const QString newName)) const QString &oldName,
const QString &newName))
friend class QPlatformDialogHelper; friend class QPlatformDialogHelper;
}; };

View File

@ -123,7 +123,7 @@ public:
static QString initialSelection(const QUrl &path); static QString initialSelection(const QUrl &path);
QStringList typedFiles() const; QStringList typedFiles() const;
QList<QUrl> userSelectedFiles() const; QList<QUrl> userSelectedFiles() const;
QStringList addDefaultSuffixToFiles(const QStringList filesToFix) const; QStringList addDefaultSuffixToFiles(const QStringList &filesToFix) const;
QList<QUrl> addDefaultSuffixToUrls(const QList<QUrl> &urlsToFix) const; QList<QUrl> addDefaultSuffixToUrls(const QList<QUrl> &urlsToFix) const;
bool removeDirectory(const QString &path); bool removeDirectory(const QString &path);
void setLabelTextControl(QFileDialog::DialogLabel label, const QString &text); void setLabelTextControl(QFileDialog::DialogLabel label, const QString &text);
@ -212,7 +212,7 @@ public:
void _q_goToUrl(const QUrl &url); void _q_goToUrl(const QUrl &url);
void _q_autoCompleteFileName(const QString &); void _q_autoCompleteFileName(const QString &);
void _q_rowsInserted(const QModelIndex & parent); void _q_rowsInserted(const QModelIndex & parent);
void _q_fileRenamed(const QString &path, const QString oldName, const QString newName); void _q_fileRenamed(const QString &path, const QString &oldName, const QString &newName);
// layout // layout
#ifndef QT_NO_PROXYMODEL #ifndef QT_NO_PROXYMODEL

View File

@ -148,7 +148,7 @@ public:
} }
// children shouldn't normally be accessed directly, use node() // children shouldn't normally be accessed directly, use node()
inline int visibleLocation(QString childName) { inline int visibleLocation(const QString &childName) {
return visibleChildren.indexOf(childName); return visibleChildren.indexOf(childName);
} }
void updateIcon(QFileIconProvider *iconProvider, const QString &path) { void updateIcon(QFileIconProvider *iconProvider, const QString &path) {

View File

@ -2049,7 +2049,7 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs()
// ### Maybe getGraphParts could return the variables when traversing, at least // ### Maybe getGraphParts could return the variables when traversing, at least
// for trunk... // for trunk...
QList<AnchorData *> getVariables(QList<QSimplexConstraint *> constraints) QList<AnchorData *> getVariables(const QList<QSimplexConstraint *> &constraints)
{ {
QSet<AnchorData *> variableSet; QSet<AnchorData *> variableSet;
for (int i = 0; i < constraints.count(); ++i) { for (int i = 0; i < constraints.count(); ++i) {

View File

@ -118,7 +118,7 @@ void QSimplex::clearDataStructures()
This method sets the new constraints, normalizes them, creates the simplex matrix This method sets the new constraints, normalizes them, creates the simplex matrix
and runs the first simplex phase. and runs the first simplex phase.
*/ */
bool QSimplex::setConstraints(const QList<QSimplexConstraint *> newConstraints) bool QSimplex::setConstraints(const QList<QSimplexConstraint *> &newConstraints)
{ {
//////////////////////////// ////////////////////////////
// Reset to initial state // // Reset to initial state //

View File

@ -149,7 +149,7 @@ public:
qreal solveMin(); qreal solveMin();
qreal solveMax(); qreal solveMax();
bool setConstraints(const QList<QSimplexConstraint *> constraints); bool setConstraints(const QList<QSimplexConstraint *> &constraints);
void setObjective(QSimplexConstraint *objective); void setObjective(QSimplexConstraint *objective);
void dumpMatrix(); void dumpMatrix();

View File

@ -1229,7 +1229,7 @@ const QAndroidStyle::AndroidDrawable * QAndroidStyle::AndroidStateDrawable::best
int QAndroidStyle::AndroidStateDrawable::extractState(const QVariantMap &value) int QAndroidStyle::AndroidStateDrawable::extractState(const QVariantMap &value)
{ {
int state = QStyle::State_Enabled | QStyle::State_Active;; int state = QStyle::State_Enabled | QStyle::State_Active;;
foreach (const QString key, value.keys()) { foreach (const QString &key, value.keys()) {
bool val = value.value(key).toString() == QLatin1String("true"); bool val = value.value(key).toString() == QLatin1String("true");
if (key == QLatin1String("enabled")) { if (key == QLatin1String("enabled")) {
if (val) if (val)

View File

@ -101,7 +101,7 @@ class QIndexMapper
public: public:
QIndexMapper() : v(false), f(0), t(-1) { } QIndexMapper() : v(false), f(0), t(-1) { }
QIndexMapper(int f, int t) : v(false), f(f), t(t) { } QIndexMapper(int f, int t) : v(false), f(f), t(t) { }
QIndexMapper(QVector<int> vec) : v(true), vector(vec), f(-1), t(-1) { } QIndexMapper(const QVector<int> &vec) : v(true), vector(vec), f(-1), t(-1) { }
inline int count() const { return v ? vector.count() : t - f + 1; } inline int count() const { return v ? vector.count() : t - f + 1; }
inline int operator[] (int index) const { return v ? vector[index] : f + index; } inline int operator[] (int index) const { return v ? vector[index] : f + index; }

View File

@ -240,7 +240,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_textEdited(const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_textEdited(const QString &))
Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged(int, int)) Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged(int, int))
#ifndef QT_NO_COMPLETER #ifndef QT_NO_COMPLETER
Q_PRIVATE_SLOT(d_func(), void _q_completionHighlighted(QString)) Q_PRIVATE_SLOT(d_func(), void _q_completionHighlighted(const QString &))
#endif #endif
#ifdef QT_KEYPAD_NAVIGATION #ifdef QT_KEYPAD_NAVIGATION
Q_PRIVATE_SLOT(d_func(), void _q_editFocusChange(bool)) Q_PRIVATE_SLOT(d_func(), void _q_editFocusChange(bool))

View File

@ -77,7 +77,7 @@ QRect QLineEditPrivate::cursorRect() const
#ifndef QT_NO_COMPLETER #ifndef QT_NO_COMPLETER
void QLineEditPrivate::_q_completionHighlighted(QString newText) void QLineEditPrivate::_q_completionHighlighted(const QString &newText)
{ {
Q_Q(QLineEdit); Q_Q(QLineEdit);
if (control->completer()->completionMode() != QCompleter::InlineCompletion) { if (control->completer()->completionMode() != QCompleter::InlineCompletion) {

View File

@ -183,7 +183,7 @@ public:
void _q_selectionChanged(); void _q_selectionChanged();
void _q_updateNeeded(const QRect &); void _q_updateNeeded(const QRect &);
#ifndef QT_NO_COMPLETER #ifndef QT_NO_COMPLETER
void _q_completionHighlighted(QString); void _q_completionHighlighted(const QString &);
#endif #endif
QPoint mousePressPos; QPoint mousePressPos;
#ifndef QT_NO_DRAGANDDROP #ifndef QT_NO_DRAGANDDROP