Fix use uninitialized, detected by GCC 4.8

If the widget \a field is not present on this form, getWidgetPosition
might not fill in the role variable. GCC is correct.

qformlayout.cpp:1690:19: error: ‘role’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

Change-Id: Ia67991a71e8f1ceacb9d6370c7028c454ef630c6
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
bb10
Thiago Macieira 2014-03-01 10:18:56 -08:00 committed by The Qt Project
parent 7e872de76e
commit 380de7f8e7
1 changed files with 1 additions and 1 deletions

View File

@ -1683,7 +1683,7 @@ QWidget *QFormLayout::labelForField(QWidget *field) const
Q_D(const QFormLayout);
int row;
ItemRole role;
ItemRole role = LabelRole;
getWidgetPosition(field, &row, &role);