widgets: Pass non-trivially-copyable or large types by const-ref

Change-Id: I912c6a9ee7b27350ac3d1fe147b697338e76f53c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
bb10
Sérgio Martins 2015-07-19 21:07:42 +01:00
parent 6cc79ad994
commit d6c2dea7da
10 changed files with 20 additions and 10 deletions

View File

@ -2796,7 +2796,7 @@ void QGraphicsAnchorLayoutPrivate::interpolateEdge(AnchorVertex *base, AnchorDat
}
bool QGraphicsAnchorLayoutPrivate::solveMinMax(const QList<QSimplexConstraint *> &constraints,
GraphPath path, qreal *min, qreal *max)
const GraphPath &path, qreal *min, qreal *max)
{
QSimplex simplex;
bool feasible = simplex.setConstraints(constraints);

View File

@ -522,7 +522,7 @@ public:
// Linear Programming solver methods
bool solveMinMax(const QList<QSimplexConstraint *> &constraints,
GraphPath path, qreal *min, qreal *max);
const GraphPath &path, qreal *min, qreal *max);
bool solvePreferred(const QList<QSimplexConstraint *> &constraints,
const QList<AnchorData *> &variables);
bool hasConflicts() const;

View File

@ -354,7 +354,7 @@ public:
struct ExtraStruct {
ExtraStruct() {} // for QVector, don't use
ExtraStruct(Extra type, QVariant value)
ExtraStruct(Extra type, const QVariant &value)
: type(type), value(value)
{ }

View File

@ -2056,7 +2056,11 @@ void QGraphicsWidget::insertAction(QAction *before, QAction *action)
\sa removeAction(), QMenu, insertAction(), QWidget::insertActions()
*/
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
void QGraphicsWidget::insertActions(QAction *before, const QList<QAction *> &actions)
#else
void QGraphicsWidget::insertActions(QAction *before, QList<QAction *> actions)
#endif
{
for (int i = 0; i < actions.count(); ++i)
insertAction(before, actions.at(i));

View File

@ -139,11 +139,12 @@ public:
void addAction(QAction *action);
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
void addActions(const QList<QAction*> &actions);
void insertActions(QAction *before, const QList<QAction*> &actions);
#else
void addActions(QList<QAction*> actions);
void insertActions(QAction *before, QList<QAction*> actions);
#endif
void insertAction(QAction *before, QAction *action);
void insertActions(QAction *before, QList<QAction*> actions);
void removeAction(QAction *action);
QList<QAction*> actions() const;
#endif

View File

@ -53,7 +53,7 @@ class QWidgetItemData
{
public:
inline QWidgetItemData() : role(-1) {}
inline QWidgetItemData(int r, QVariant v) : role(r), value(v) {}
inline QWidgetItemData(int r, const QVariant &v) : role(r), value(v) {}
int role;
QVariant value;
inline bool operator==(const QWidgetItemData &other) const { return role == other.role && value == other.value; }

View File

@ -3326,7 +3326,11 @@ void QWidget::insertAction(QAction *before, QAction *action)
\sa removeAction(), QMenu, insertAction(), contextMenuPolicy
*/
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
void QWidget::insertActions(QAction *before, const QList<QAction*> &actions)
#else
void QWidget::insertActions(QAction *before, QList<QAction*> actions)
#endif
{
for(int i = 0; i < actions.count(); ++i)
insertAction(before, actions.at(i));
@ -5018,7 +5022,7 @@ void QWidgetPrivate::unsetCursor_sys()
qt_qpa_set_cursor(q, false);
}
static inline void applyCursor(QWidget *w, QCursor c)
static inline void applyCursor(QWidget *w, const QCursor &c)
{
if (QWindow *window = w->windowHandle())
window->setCursor(c);

View File

@ -541,11 +541,12 @@ public:
void addAction(QAction *action);
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
void addActions(const QList<QAction*> &actions);
void insertActions(const QAction *before, const QList<QAction*> &actions);
#else
void addActions(QList<QAction*> actions);
void insertActions(QAction *before, QList<QAction*> actions);
#endif
void insertAction(QAction *before, QAction *action);
void insertActions(QAction *before, QList<QAction*> actions);
void removeAction(QAction *action);
QList<QAction*> actions() const;
#endif

View File

@ -1851,7 +1851,7 @@ void QPlainTextEditPrivate::relayoutDocument()
}
}
static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, QRectF gradientRect = QRectF())
static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, const QRectF &gradientRect = QRectF())
{
p->save();
if (brush.style() >= Qt::LinearGradientPattern && brush.style() <= Qt::ConicalGradientPattern) {

View File

@ -93,7 +93,7 @@ public:
HistoryEntry createHistoryEntry() const;
void restoreHistoryEntry(const HistoryEntry entry);
void restoreHistoryEntry(const HistoryEntry &entry);
QStack<HistoryEntry> stack;
QStack<HistoryEntry> forwardStack;
@ -554,7 +554,7 @@ QTextBrowserPrivate::HistoryEntry QTextBrowserPrivate::createHistoryEntry() cons
return entry;
}
void QTextBrowserPrivate::restoreHistoryEntry(const HistoryEntry entry)
void QTextBrowserPrivate::restoreHistoryEntry(const HistoryEntry &entry)
{
setSource(entry.url);
hbar->setValue(entry.hpos);