summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-08-14 12:35:44 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-08-14 12:35:44 (GMT)
commit05145be7e502d4330ced88d3e55207a99c0a841b (patch)
tree41a76a506b286cc1c0a6bbf317c89879be7a5079 /src/gui
parentb770651f19741907cd415ea9ad6e087cb32cc948 (diff)
downloadQt-05145be7e502d4330ced88d3e55207a99c0a841b.zip
Qt-05145be7e502d4330ced88d3e55207a99c0a841b.tar.gz
Qt-05145be7e502d4330ced88d3e55207a99c0a841b.tar.bz2
Fixed coverity warnings
Some dead code removed Some member not initialized missing
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qfiledialog.cpp2
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp2
-rw-r--r--src/gui/itemviews/qitemdelegate.cpp2
-rw-r--r--src/gui/itemviews/qitemselectionmodel_p.h2
-rw-r--r--src/gui/itemviews/qlistwidget_p.h1
-rw-r--r--src/gui/itemviews/qstandarditemmodel_p.h1
-rw-r--r--src/gui/itemviews/qtreewidget.cpp2
-rw-r--r--src/gui/itemviews/qtreewidgetitemiterator_p.h3
-rw-r--r--src/gui/kernel/qwidget.cpp5
-rw-r--r--src/gui/kernel/qx11info_x11.cpp3
-rw-r--r--src/gui/styles/qstyleoption.cpp6
-rw-r--r--src/gui/text/qcssparser_p.h14
-rw-r--r--src/gui/text/qzip.cpp2
-rw-r--r--src/gui/widgets/qcalendarwidget.cpp3
14 files changed, 24 insertions, 24 deletions
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 8299f69..f548912 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -2696,7 +2696,7 @@ void QFileDialogPrivate::_q_updateOkButton()
if (lineEditText.startsWith(QLatin1String("//")) || lineEditText.startsWith(QLatin1Char('\\'))) {
button->setEnabled(true);
if (acceptMode == QFileDialog::AcceptSave)
- button->setText(isOpenDirectory ? QFileDialog::tr("&Open") : acceptLabel);
+ button->setText(acceptLabel);
return;
}
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 4f32ecc..7b51483 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -584,7 +584,7 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
"QAbstractItemView::setModel",
"The parent of a top level index should be invalid");
- if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
+ if (d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
connect(d->model, SIGNAL(destroyed()),
this, SLOT(_q_modelDestroyed()));
connect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp
index 2cbde51..1e36f72 100644
--- a/src/gui/itemviews/qitemdelegate.cpp
+++ b/src/gui/itemviews/qitemdelegate.cpp
@@ -722,8 +722,6 @@ void QItemDelegate::drawDisplay(QPainter *painter, const QStyleOptionViewItem &o
//let's add the last line (after the last QChar::LineSeparator)
elided += option.fontMetrics.elidedText(text.mid(start),
option.textElideMode, textRect.width());
- if (end != -1)
- elided += QChar::LineSeparator;
}
d->textLayout.setText(elided);
textLayoutSize = d->doTextLayout(textRect.width());
diff --git a/src/gui/itemviews/qitemselectionmodel_p.h b/src/gui/itemviews/qitemselectionmodel_p.h
index 6e1046c..e9e6bb1 100644
--- a/src/gui/itemviews/qitemselectionmodel_p.h
+++ b/src/gui/itemviews/qitemselectionmodel_p.h
@@ -65,7 +65,7 @@ public:
QItemSelectionModelPrivate()
: model(0),
currentCommand(QItemSelectionModel::NoUpdate),
- tableSelected(false) {}
+ tableSelected(false), tableColCount(0), tableRowCount(0) {}
QItemSelection expandSelection(const QItemSelection &selection,
QItemSelectionModel::SelectionFlags command) const;
diff --git a/src/gui/itemviews/qlistwidget_p.h b/src/gui/itemviews/qlistwidget_p.h
index 124222c..0851e20 100644
--- a/src/gui/itemviews/qlistwidget_p.h
+++ b/src/gui/itemviews/qlistwidget_p.h
@@ -163,7 +163,6 @@ class QListWidgetItemPrivate
public:
QListWidgetItemPrivate(QListWidgetItem *item) : q(item), theid(-1) {}
QListWidgetItem *q;
- int id;
QVector<QWidgetItemData> values;
int theid;
};
diff --git a/src/gui/itemviews/qstandarditemmodel_p.h b/src/gui/itemviews/qstandarditemmodel_p.h
index e21ac9c..5984a59 100644
--- a/src/gui/itemviews/qstandarditemmodel_p.h
+++ b/src/gui/itemviews/qstandarditemmodel_p.h
@@ -75,6 +75,7 @@ public:
parent(0),
rows(0),
columns(0),
+ q_ptr(0),
lastIndexOf(2)
{ }
virtual ~QStandardItemPrivate();
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index ee7cea3..025f83c 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -2074,6 +2074,8 @@ QList<QTreeWidgetItem*> QTreeWidgetItem::takeChildren()
void QTreeWidgetItemPrivate::sortChildren(int column, Qt::SortOrder order, bool climb)
{
QTreeModel *model = (q->view ? qobject_cast<QTreeModel*>(q->view->model()) : 0);
+ if (!model)
+ return;
model->sortItems(&q->children, column, order);
if (climb) {
QList<QTreeWidgetItem*>::iterator it = q->children.begin();
diff --git a/src/gui/itemviews/qtreewidgetitemiterator_p.h b/src/gui/itemviews/qtreewidgetitemiterator_p.h
index 3ffe823..ee0808c 100644
--- a/src/gui/itemviews/qtreewidgetitemiterator_p.h
+++ b/src/gui/itemviews/qtreewidgetitemiterator_p.h
@@ -73,7 +73,8 @@ public:
}
QTreeWidgetItemIteratorPrivate(const QTreeWidgetItemIteratorPrivate& other)
- : m_currentIndex(other.m_currentIndex), m_model(other.m_model), m_parentIndex(other.m_parentIndex)
+ : m_currentIndex(other.m_currentIndex), m_model(other.m_model),
+ m_parentIndex(other.m_parentIndex), q_ptr(other.q_ptr)
{
}
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index cc41f73..c00f953 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -2747,7 +2747,7 @@ void QWidget::showNormal()
bool QWidget::isEnabledTo(QWidget* ancestor) const
{
const QWidget * w = this;
- while (w && !w->testAttribute(Qt::WA_ForceDisabled)
+ while (!w->testAttribute(Qt::WA_ForceDisabled)
&& !w->isWindow()
&& w->parentWidget()
&& w->parentWidget() != ancestor)
@@ -7239,8 +7239,7 @@ bool QWidget::isVisibleTo(QWidget* ancestor) const
if (!ancestor)
return isVisible();
const QWidget * w = this;
- while (w
- && !w->isHidden()
+ while (!w->isHidden()
&& !w->isWindow()
&& w->parentWidget()
&& w->parentWidget() != ancestor)
diff --git a/src/gui/kernel/qx11info_x11.cpp b/src/gui/kernel/qx11info_x11.cpp
index 786d48d..136f7f8 100644
--- a/src/gui/kernel/qx11info_x11.cpp
+++ b/src/gui/kernel/qx11info_x11.cpp
@@ -179,6 +179,7 @@ QX11InfoData* QX11Info::getX11Data(bool def) const
QX11InfoData* res = 0;
if (def) {
res = new QX11InfoData;
+ res->ref = 0;
res->screen = appScreen();
res->depth = appDepth();
res->cells = appCells();
@@ -189,8 +190,8 @@ QX11InfoData* QX11Info::getX11Data(bool def) const
} else if (x11data) {
res = new QX11InfoData;
*res = *x11data;
+ res->ref = 0;
}
- res->ref = 0;
return res;
}
diff --git a/src/gui/styles/qstyleoption.cpp b/src/gui/styles/qstyleoption.cpp
index 38abd95..98996e2 100644
--- a/src/gui/styles/qstyleoption.cpp
+++ b/src/gui/styles/qstyleoption.cpp
@@ -954,7 +954,7 @@ QStyleOptionViewItemV2 &QStyleOptionViewItemV2::operator=(const QStyleOptionView
Constructs a QStyleOptionViewItemV3 object.
*/
QStyleOptionViewItemV3::QStyleOptionViewItemV3()
- : QStyleOptionViewItemV2(Version)
+ : QStyleOptionViewItemV2(Version), widget(0)
{
}
@@ -962,7 +962,7 @@ QStyleOptionViewItemV3::QStyleOptionViewItemV3()
Constructs a copy of \a other.
*/
QStyleOptionViewItemV3::QStyleOptionViewItemV3(const QStyleOptionViewItem &other)
- : QStyleOptionViewItemV2(Version)
+ : QStyleOptionViewItemV2(Version), widget(0)
{
(void)QStyleOptionViewItemV3::operator=(other);
}
@@ -991,7 +991,7 @@ QStyleOptionViewItemV3 &QStyleOptionViewItemV3::operator = (const QStyleOptionVi
\internal
*/
QStyleOptionViewItemV3::QStyleOptionViewItemV3(int version)
- : QStyleOptionViewItemV2(version)
+ : QStyleOptionViewItemV2(version), widget(0)
{
}
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index 2d21bc2..732164c 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -368,18 +368,18 @@ struct Q_GUI_EXPORT Value
};
struct ColorData {
- ColorData() : type(Invalid) {}
- ColorData(const QColor &col) : color(col) , type(Color) {}
- ColorData(QPalette::ColorRole r) : role(r) , type(Role) {}
+ ColorData() : role(QPalette::NoRole), type(Invalid) {}
+ ColorData(const QColor &col) : role(QPalette::NoRole), color(col), type(Color) {}
+ ColorData(QPalette::ColorRole r) : role(r), type(Role) {}
QColor color;
QPalette::ColorRole role;
enum { Invalid, Color, Role} type;
};
struct BrushData {
- BrushData() : type(Invalid) {}
- BrushData(const QBrush &br) : brush(br) , type(Brush) {}
- BrushData(QPalette::ColorRole r) : role(r) , type(Role) {}
+ BrushData() : role(QPalette::NoRole), type(Invalid) {}
+ BrushData(const QBrush &br) : brush(br), role(QPalette::NoRole), type(Brush) {}
+ BrushData(QPalette::ColorRole r) : role(r), type(Role) {}
QBrush brush;
QPalette::ColorRole role;
enum { Invalid, Brush, Role, DependsOnThePalette } type;
@@ -726,7 +726,7 @@ enum TokenType {
struct Q_GUI_EXPORT Symbol
{
- inline Symbol() : start(0), len(-1) {}
+ inline Symbol() : token(NONE), start(0), len(-1) {}
TokenType token;
QString text;
int start, len;
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index edef816..9fd13cd 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -771,7 +771,7 @@ QList<QZipReader::FileInfo> QZipReader::fileInfoList() const
{
d->scanFiles();
QList<QZipReader::FileInfo> files;
- for (int i = 0; d && i < d->fileHeaders.size(); ++i) {
+ for (int i = 0; i < d->fileHeaders.size(); ++i) {
QZipReader::FileInfo fi;
d->fillFileInfo(i, fi);
files.append(fi);
diff --git a/src/gui/widgets/qcalendarwidget.cpp b/src/gui/widgets/qcalendarwidget.cpp
index 31da850..8d5d0c7 100644
--- a/src/gui/widgets/qcalendarwidget.cpp
+++ b/src/gui/widgets/qcalendarwidget.cpp
@@ -332,10 +332,9 @@ QString QCalendarMonthValidator::text(const QDate &date, int repeat) const
return str + QString::number(date.month());
} else if (repeat == 3) {
return m_locale.standaloneMonthName(date.month(), QLocale::ShortFormat);
- } else if (repeat >= 4) {
+ } else /*if (repeat >= 4)*/ {
return m_locale.standaloneMonthName(date.month(), QLocale::LongFormat);
}
- return QString();
}
//////////////////////////////////