summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-05-18 12:25:08 (GMT)
committeraxis <qt-info@nokia.com>2009-05-18 12:25:08 (GMT)
commit6e81bfbaf69864a06240835e0b30cdc47a2668b7 (patch)
treeaff37bf74549836696d420477e57f51969e97091 /doc/src/snippets
parent3e5abb158c1924e555dc4142c4be89adc517b8c1 (diff)
parent7008bfe80e0466ed2978b39e7e698bbd52fb690f (diff)
downloadQt-6e81bfbaf69864a06240835e0b30cdc47a2668b7.zip
Qt-6e81bfbaf69864a06240835e0b30cdc47a2668b7.tar.gz
Qt-6e81bfbaf69864a06240835e0b30cdc47a2668b7.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts: configure.exe src/corelib/kernel/qcoreapplication.cpp Configure.exe not rebuilt because the changes are irrelevant for the S60 port. We'll rebuild it before merging back.
Diffstat (limited to 'doc/src/snippets')
-rw-r--r--doc/src/snippets/code/doc_src_layout.qdoc45
-rw-r--r--doc/src/snippets/sqldatabase/sqldatabase.cpp2
2 files changed, 27 insertions, 20 deletions
diff --git a/doc/src/snippets/code/doc_src_layout.qdoc b/doc/src/snippets/code/doc_src_layout.qdoc
index 48e10e9..60f36b0 100644
--- a/doc/src/snippets/code/doc_src_layout.qdoc
+++ b/doc/src/snippets/code/doc_src_layout.qdoc
@@ -2,23 +2,21 @@
#ifndef CARD_H
#define CARD_H
-#include <QLayout>
+#include <QtGui>
#include <QList>
class CardLayout : public QLayout
{
public:
- CardLayout(QWidget *parent, int dist)
- : QLayout(parent, 0, dist) {}
- CardLayout(QLayout *parent, int dist)
- : QLayout(parent, dist) {}
- CardLayout(int dist)
- : QLayout(dist) {}
+ CardLayout(QWidget *parent, int dist): QLayout(parent, 0, dist) {}
+ CardLayout(QLayout *parent, int dist): QLayout(parent, dist) {}
+ CardLayout(int dist): QLayout(dist) {}
~CardLayout();
void addItem(QLayoutItem *item);
QSize sizeHint() const;
QSize minimumSize() const;
+ QLayoutItem *count() const;
QLayoutItem *itemAt(int) const;
QLayoutItem *takeAt(int);
void setGeometry(const QRect &rect);
@@ -31,11 +29,18 @@ private:
//! [1]
-#include "card.h"
+//#include "card.h"
//! [1]
-
//! [2]
+QLayoutItem *CardLayout::count() const
+{
+ // QList::size() returns the number of QLayoutItems in the list
+ return list.size();
+}
+//! [2]
+
+//! [3]
QLayoutItem *CardLayout::itemAt(int idx) const
{
// QList::value() performs index checking, and returns 0 if we are
@@ -48,26 +53,28 @@ QLayoutItem *CardLayout::takeAt(int idx)
// QList::take does not do index checking
return idx >= 0 && idx < list.size() ? list.takeAt(idx) : 0;
}
-//! [2]
+//! [3]
-//! [3]
+//! [4]
void CardLayout::addItem(QLayoutItem *item)
{
list.append(item);
}
-//! [3]
+//! [4]
-//! [4]
+//! [5]
CardLayout::~CardLayout()
{
- deleteAllItems();
+ QLayoutItem *item;
+ while ((item = takeAt(0)))
+ delete item;
}
-//! [4]
+//! [5]
-//! [5]
+//! [6]
void CardLayout::setGeometry(const QRect &r)
{
QLayout::setGeometry(r);
@@ -85,10 +92,10 @@ void CardLayout::setGeometry(const QRect &r)
++i;
}
}
-//! [5]
+//! [6]
-//! [6]
+//! [7]
QSize CardLayout::sizeHint() const
{
QSize s(0,0);
@@ -116,4 +123,4 @@ QSize CardLayout::minimumSize() const
}
return s + n*QSize(spacing(), spacing());
}
-//! [6]
+//! [7]
diff --git a/doc/src/snippets/sqldatabase/sqldatabase.cpp b/doc/src/snippets/sqldatabase/sqldatabase.cpp
index ae176ac..06afa0c 100644
--- a/doc/src/snippets/sqldatabase/sqldatabase.cpp
+++ b/doc/src/snippets/sqldatabase/sqldatabase.cpp
@@ -524,7 +524,7 @@ protected:
bool fetchLast() { return false; }
int size() { return 0; }
int numRowsAffected() { return 0; }
- QSqlRecord record() { return QSqlRecord(); }
+ QSqlRecord record() const { return QSqlRecord(); }
};
//! [47]