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"
//! [0]
ButtonWidget::ButtonWidget(QStringList texts, QWidget *parent)
ButtonWidget::ButtonWidget(const QStringList &texts, QWidget *parent)
: QWidget(parent)
{
signalMapper = new QSignalMapper(this);

View File

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

View File

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

View File

@ -283,13 +283,13 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
#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;
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;
emit directoryChanged(path, removed);
@ -316,10 +316,10 @@ QFseventsFileSystemWatcherEngine::QFseventsFileSystemWatcherEngine(QObject *pare
// We cannot use signal-to-signal queued connections, because the
// QSignalSpy cannot spot signals fired from other/alien threads.
connect(this, SIGNAL(emitDirectoryChanged(const QString, bool)),
this, SLOT(doEmitDirectoryChanged(const QString, bool)), Qt::QueuedConnection);
connect(this, SIGNAL(emitFileChanged(const QString, bool)),
this, SLOT(doEmitFileChanged(const QString, bool)), Qt::QueuedConnection);
connect(this, SIGNAL(emitDirectoryChanged(QString,bool)),
this, SLOT(doEmitDirectoryChanged(QString,bool)), Qt::QueuedConnection);
connect(this, SIGNAL(emitFileChanged(QString,bool)),
this, SLOT(doEmitFileChanged(QString,bool)), Qt::QueuedConnection);
connect(this, SIGNAL(scheduleStreamRestart()),
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[]);
Q_SIGNALS:
void emitFileChanged(const QString path, bool removed);
void emitDirectoryChanged(const QString path, bool removed);
void emitFileChanged(const QString &path, bool removed);
void emitDirectoryChanged(const QString &path, bool removed);
void scheduleStreamRestart();
private slots:
void doEmitFileChanged(const QString path, bool removed);
void doEmitDirectoryChanged(const QString path, bool removed);
void doEmitFileChanged(const QString &path, bool removed);
void doEmitDirectoryChanged(const QString &path, bool removed);
void restartStream();
private:

View File

@ -281,7 +281,7 @@ class QWinRTSettingsPrivate : public QSettingsPrivate
public:
QWinRTSettingsPrivate(QSettings::Scope scope, const QString &organization,
const QString &application);
QWinRTSettingsPrivate(QString rKey);
QWinRTSettingsPrivate(const QString &rKey);
~QWinRTSettingsPrivate();
void remove(const QString &uKey);
@ -315,7 +315,7 @@ QWinRTSettingsPrivate::QWinRTSettingsPrivate(QSettings::Scope scope, const QStri
init(scope);
}
QWinRTSettingsPrivate::QWinRTSettingsPrivate(QString rPath)
QWinRTSettingsPrivate::QWinRTSettingsPrivate(const QString &rPath)
: QSettingsPrivate(QSettings::NativeFormat, QSettings::UserScope, rPath, QString())
, 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
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;
const QVector<QPersistentModelIndexData *>::const_iterator begin = indexes.constBegin();

View File

@ -72,7 +72,7 @@ class Q_CORE_EXPORT QAbstractItemModelPrivate : public QObjectPrivate
public:
QAbstractItemModelPrivate() : QObjectPrivate(), supportedDragActions(-1), roleNames(defaultRoleNames()) {}
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 rowsInserted(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);
#ifndef QT_NO_SYSTEMSEMAPHORE
bool tryLocker(QSharedMemoryLocker *locker, const QString function) {
bool tryLocker(QSharedMemoryLocker *locker, const QString &function) {
if (!locker->lock()) {
errorString = QSharedMemory::tr("%1: unable to lock").arg(function);
error = QSharedMemory::LockError;

View File

@ -343,7 +343,7 @@ static QDate calculateDowDate(int year, int month, int dayOfWeek, int week)
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
if (dateRule.at(0) == 'M') {

View File

@ -1213,7 +1213,7 @@ QList<QByteArray> QPicture::inputFormats()
return QPictureIO::inputFormats();
}
static QStringList qToStringList(const QList<QByteArray> arr)
static QStringList qToStringList(const QList<QByteArray> &arr)
{
QStringList list;
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,
const QtFontFamily *family, const QString &foundry_name,
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(script);

View File

@ -225,8 +225,8 @@ private:
class QFtpCommand
{
public:
QFtpCommand(QFtp::Command cmd, QStringList raw, const QByteArray &ba);
QFtpCommand(QFtp::Command cmd, QStringList raw, QIODevice *dev = 0);
QFtpCommand(QFtp::Command cmd, const QStringList &raw, const QByteArray &ba);
QFtpCommand(QFtp::Command cmd, const QStringList &raw, QIODevice *dev = 0);
~QFtpCommand();
int id;
@ -246,14 +246,14 @@ public:
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)
{
id = idCounter.fetchAndAddRelaxed(1);
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)
{
id = idCounter.fetchAndAddRelaxed(1);

View File

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

View File

@ -431,7 +431,7 @@ void QHostInfo::setErrorString(const QString &str)
\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);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -180,7 +180,7 @@ void QCocoaSystemTrayIcon::cleanup()
}
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;
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);
if (m_deviceDiscovery) {
QStringList devices = m_deviceDiscovery->scanConnectedDevices();
foreach (QString device, devices)
foreach (const QString &device, devices)
addDevice(device);
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
}
static QQnxWindow *findMultimediaWindow(const QList<QQnxWindow*> windows,
static QQnxWindow *findMultimediaWindow(const QList<QQnxWindow*> &windows,
const QByteArray &mmWindowId)
{
Q_FOREACH (QQnxWindow *sibling, windows) {
@ -128,7 +128,7 @@ static QQnxWindow *findMultimediaWindow(const QList<QQnxWindow*> windows,
return 0;
}
static QQnxWindow *findMultimediaWindow(const QList<QQnxWindow*> windows,
static QQnxWindow *findMultimediaWindow(const QList<QQnxWindow*> &windows,
screen_window_t mmWindowId)
{
Q_FOREACH (QQnxWindow *sibling, windows) {

View File

@ -140,7 +140,7 @@ QAbstractFileEngine *QWinRTFileEngineHandler::create(const QString &fileName) co
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)
{
HRESULT hr;

View File

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

View File

@ -680,7 +680,7 @@ void QXcbKeyboard::updateKeymap()
if (qEnvironmentVariableIsSet("QT_XKB_CONFIG_ROOT")) {
xkb_context = xkb_context_new((xkb_context_flags)XKB_CONTEXT_NO_DEFAULT_INCLUDES);
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());
} else {
xkb_context = xkb_context_new((xkb_context_flags)0);
@ -1045,7 +1045,7 @@ int QXcbKeyboard::keysymToQtKey(xcb_keysym_t key) const
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;
#ifndef QT_NO_TEXTCODEC

View File

@ -80,7 +80,7 @@ protected:
void resolveMaskConflicts();
QString lookupString(struct xkb_state *state, xcb_keycode_t code) 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 readXKBConfig();

View File

@ -48,7 +48,7 @@
QT_BEGIN_NAMESPACE
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)
, m_screen(scr)
, m_crtc(output ? output->crtc : 0)

View File

@ -55,7 +55,7 @@ class Q_XCB_EXPORT QXcbScreen : public QXcbObject, public QPlatformScreen
{
public:
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();
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);
}
static QString qCreateParamString(const QVector<QVariant> boundValues, const QSqlDriver *driver)
static QString qCreateParamString(const QVector<QVariant> &boundValues, const QSqlDriver *driver)
{
if (boundValues.isEmpty())
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) {
const PropertyDef &p = cdef->propertyList.at(i);
foreach (const QByteArray candidate, candidates) {
foreach (const QByteArray &candidate, candidates) {
if (p.type.contains(candidate + "<"))
requiredQtContainers->insert(candidate);
}
@ -829,7 +829,7 @@ static void findRequiredContainers(ClassDef *cdef, QSet<QByteArray> *requiredQtC
for (int i = 0; i < allFunctions.count(); ++i) {
const FunctionDef &f = allFunctions.at(i);
foreach (const ArgumentDef &arg, f.arguments) {
foreach (const QByteArray candidate, candidates) {
foreach (const QByteArray &candidate, candidates) {
if (arg.normalizedType.contains(candidate + "<"))
requiredQtContainers->insert(candidate);
}

View File

@ -64,7 +64,7 @@ struct Topic
QString topic;
QString args;
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(); }
void clear() { topic.clear(); args.clear(); }
};

View File

@ -136,7 +136,7 @@ void MainWindow::createActions()
openAct->setShortcuts(QKeySequence::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());
QAction *action = new QAction(text, this);

View File

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

View File

@ -104,7 +104,7 @@ protected:
virtual QString refForNode(const Node *node);
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 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
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 name = str.simplified();

View File

@ -305,7 +305,7 @@ public:
const QString& outputSubdirectory() const { return outSubDir_; }
void setOutputSubdirectory(const QString& t) { outSubDir_ = t; }
QString fullDocumentName() const;
static QString cleanId(QString str);
static QString cleanId(const QString &str);
QString idForNode() const;
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())
return;
QStringList keys = cnmm.uniqueKeys();
foreach (QString key, keys) {
foreach (const QString &key, keys) {
QList<CollectionNode*> values = cnmm.values(key);
CollectionNode* n = 0;
foreach (CollectionNode* v, values) {

View File

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

View File

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

View File

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

View File

@ -1214,7 +1214,7 @@ QList<QUrl> QFileDialogPrivate::userSelectedFiles() const
return files;
}
QStringList QFileDialogPrivate::addDefaultSuffixToFiles(const QStringList filesToFix) const
QStringList QFileDialogPrivate::addDefaultSuffixToFiles(const QStringList &filesToFix) const
{
QStringList files;
for (int i=0; i<filesToFix.size(); ++i) {
@ -3590,7 +3590,7 @@ void QFileDialogPrivate::_q_rowsInserted(const QModelIndex &parent)
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();
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_rowsInserted(const QModelIndex & parent))
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;
};

View File

@ -123,7 +123,7 @@ public:
static QString initialSelection(const QUrl &path);
QStringList typedFiles() 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;
bool removeDirectory(const QString &path);
void setLabelTextControl(QFileDialog::DialogLabel label, const QString &text);
@ -212,7 +212,7 @@ public:
void _q_goToUrl(const QUrl &url);
void _q_autoCompleteFileName(const QString &);
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
#ifndef QT_NO_PROXYMODEL

View File

@ -148,7 +148,7 @@ public:
}
// children shouldn't normally be accessed directly, use node()
inline int visibleLocation(QString childName) {
inline int visibleLocation(const QString &childName) {
return visibleChildren.indexOf(childName);
}
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
// for trunk...
QList<AnchorData *> getVariables(QList<QSimplexConstraint *> constraints)
QList<AnchorData *> getVariables(const QList<QSimplexConstraint *> &constraints)
{
QSet<AnchorData *> variableSet;
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
and runs the first simplex phase.
*/
bool QSimplex::setConstraints(const QList<QSimplexConstraint *> newConstraints)
bool QSimplex::setConstraints(const QList<QSimplexConstraint *> &newConstraints)
{
////////////////////////////
// Reset to initial state //

View File

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

View File

@ -1229,7 +1229,7 @@ const QAndroidStyle::AndroidDrawable * QAndroidStyle::AndroidStateDrawable::best
int QAndroidStyle::AndroidStateDrawable::extractState(const QVariantMap &value)
{
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");
if (key == QLatin1String("enabled")) {
if (val)

View File

@ -101,7 +101,7 @@ class QIndexMapper
public:
QIndexMapper() : v(false), f(0), t(-1) { }
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 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_cursorPositionChanged(int, int))
#ifndef QT_NO_COMPLETER
Q_PRIVATE_SLOT(d_func(), void _q_completionHighlighted(QString))
Q_PRIVATE_SLOT(d_func(), void _q_completionHighlighted(const QString &))
#endif
#ifdef QT_KEYPAD_NAVIGATION
Q_PRIVATE_SLOT(d_func(), void _q_editFocusChange(bool))

View File

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

View File

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