Address status bar text boxes by pointer instead of "command IDs".
[kdbg.git] / kdbg / testprogs / qt.cpp
blob2e04330b4e3d645af16f95419e6f6bc07b77d430
1 #include <qmap.h>
2 #include <qvaluelist.h>
3 #include <qvaluevector.h>
4 #include <qstring.h>
5 #include <qrect.h>
6 #include <iostream>
8 template<typename T>
9 void test_sharing(const T& input)
11 // a copy should increase the share counter
12 T copy = input;
14 // a const interator should not detach the copy
15 typename T::const_iterator cit = copy.constBegin();
16 std::cout << *cit << std::endl;
18 // a non-const iterator should detach the copy
19 typename T::iterator it = copy.begin();
20 std::cout << *it << std::endl;
23 int main()
25 QMap<QString,int> str2int;
26 str2int["foo"] = 42;
27 test_sharing(str2int);
29 QValueList<int> ints;
30 ints.push_back(42);
31 test_sharing(ints);
33 QValueVector<double> vals(6, 47.11);
34 vals.push_back(42);
35 test_sharing(vals);
37 QRect r(10,20, 130, 240);
38 QPoint p = r.topLeft();
39 QPoint q = r.bottomRight();
40 std::cout << r.width() << r.height() << p.x() << q.y() << std::endl;