diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
commit | ea318d1431c89e647598c510c4245c6571aa5f46 (patch) | |
tree | 996d29b80c30d453dda86d1a23162d441628f169 /doc/html/customlayout.html | |
parent | aaf89d4b48f69c9293feb187db26362e550b5561 (diff) | |
download | tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.tar.gz tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.zip |
Update to latest tqt3 automated conversion
Diffstat (limited to 'doc/html/customlayout.html')
-rw-r--r-- | doc/html/customlayout.html | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/doc/html/customlayout.html b/doc/html/customlayout.html index 188b7f2b8..5b9c77732 100644 --- a/doc/html/customlayout.html +++ b/doc/html/customlayout.html @@ -35,50 +35,50 @@ body { background: #ffffff; color: black; } <p> Here we present an example in detail. The class CardLayout is inspired by the Java layout manager of the same name. It lays out the items (widgets or nested layouts) on top of each other, each item offset by -<a href="qlayout.html#spacing">TQLayout::spacing</a>(). +<a href="ntqlayout.html#spacing">TQLayout::spacing</a>(). <p> To write your own layout class, you must define the following: <ul> <li> A data structure to store the items handled by the layout. Each item is a <a href="qlayoutitem.html">TQLayoutItem</a>. We will use a -<a href="qptrlist.html">TQPtrList</a> in this example. -<li> <a href="qlayout.html#addItem">addItem()</a>, how to add items to +<a href="ntqptrlist.html">TQPtrList</a> in this example. +<li> <a href="ntqlayout.html#addItem">addItem()</a>, how to add items to the layout. -<li> <a href="qlayout.html#setGeometry">setGeometry()</a>, how to perform +<li> <a href="ntqlayout.html#setGeometry">setGeometry()</a>, how to perform the layout. <li> <a href="qlayoutitem.html#sizeHint">sizeHint()</a>, the preferred size of the layout. -<li> <a href="qlayout.html#iterator">iterator()</a>, how to iterate over +<li> <a href="ntqlayout.html#iterator">iterator()</a>, how to iterate over the layout. </ul> -<p> In most cases, you will also implement <a href="qlayout.html#minimumSize">minimumSize</a>(). +<p> In most cases, you will also implement <a href="ntqlayout.html#minimumSize">minimumSize</a>(). <p> <h2> card.h </h2> <a name="1"></a><p> <pre> #ifndef CARD_H #define CARD_H -#include <<a href="qlayout-h.html">qlayout.h</a>> -#include <<a href="qptrlist-h.html">qptrlist.h</a>> +#include <<a href="qlayout-h.html">ntqlayout.h</a>> +#include <<a href="qptrlist-h.html">ntqptrlist.h</a>> -class CardLayout : public <a href="qlayout.html">TQLayout</a> +class CardLayout : public <a href="ntqlayout.html">TQLayout</a> { public: - CardLayout( <a href="qwidget.html">TQWidget</a> *parent, int dist ) - : <a href="qlayout.html">TQLayout</a>( parent, 0, dist ) {} - CardLayout( <a href="qlayout.html">TQLayout</a>* parent, int dist) - : <a href="qlayout.html">TQLayout</a>( parent, dist ) { } + CardLayout( <a href="ntqwidget.html">TQWidget</a> *parent, int dist ) + : <a href="ntqlayout.html">TQLayout</a>( parent, 0, dist ) {} + CardLayout( <a href="ntqlayout.html">TQLayout</a>* parent, int dist) + : <a href="ntqlayout.html">TQLayout</a>( parent, dist ) { } CardLayout( int dist ) - : <a href="qlayout.html">TQLayout</a>( dist ) {} + : <a href="ntqlayout.html">TQLayout</a>( dist ) {} ~CardLayout(); void addItem(TQLayoutItem *item); - <a href="qsize.html">TQSize</a> sizeHint() const; - <a href="qsize.html">TQSize</a> minimumSize() const; + <a href="ntqsize.html">TQSize</a> sizeHint() const; + <a href="ntqsize.html">TQSize</a> minimumSize() const; <a href="qlayoutiterator.html">TQLayoutIterator</a> iterator(); - void setGeometry(const <a href="qrect.html">TQRect</a> &rect); + void setGeometry(const <a href="ntqrect.html">TQRect</a> &rect); private: - <a href="qptrlist.html">TQPtrList</a><TQLayoutItem> list; + <a href="ntqptrlist.html">TQPtrList</a><TQLayoutItem> list; }; #endif @@ -105,21 +105,21 @@ constructor. In our example we do not need a destructor. class CardLayoutIterator : public <a href="qglayoutiterator.html">TQGLayoutIterator</a> { public: - CardLayoutIterator( <a href="qptrlist.html">TQPtrList</a><TQLayoutItem> *l ) + CardLayoutIterator( <a href="ntqptrlist.html">TQPtrList</a><TQLayoutItem> *l ) : idx( 0 ), list( l ) {} <a href="qlayoutitem.html">TQLayoutItem</a> *current() - { return idx < int(list-><a href="qptrlist.html#count">count</a>()) ? list-><a href="qptrlist.html#at">at</a>(idx) : 0; } + { return idx < int(list-><a href="ntqptrlist.html#count">count</a>()) ? list-><a href="ntqptrlist.html#at">at</a>(idx) : 0; } <a href="qlayoutitem.html">TQLayoutItem</a> *next() { idx++; return current(); } <a href="qlayoutitem.html">TQLayoutItem</a> *takeCurrent() - { return list-><a href="qptrlist.html#take">take</a>( idx ); } + { return list-><a href="ntqptrlist.html#take">take</a>( idx ); } private: int idx; - <a href="qptrlist.html">TQPtrList</a><TQLayoutItem> *list; + <a href="ntqptrlist.html">TQPtrList</a><TQLayoutItem> *list; }; </pre> @@ -133,9 +133,9 @@ TQLayoutIterator CardLayout::iterator() </pre> <p> addItem() implements the default placement strategy for layout items. -It must be implemented. It is used by <a href="qlayout.html#add">TQLayout::add</a>(), by the <a href="qlayout.html">TQLayout</a> +It must be implemented. It is used by <a href="ntqlayout.html#add">TQLayout::add</a>(), by the <a href="ntqlayout.html">TQLayout</a> constructor that takes a layout as parent, and it is used to implement -the <a href="qlayout.html#autoAdd">auto-add</a> feature. If your layout +the <a href="ntqlayout.html#autoAdd">auto-add</a> feature. If your layout has advanced placement options that require parameters, you must provide extra access functions such as <a href="qgridlayout.html#addMultiCell">TQGridLayout::addMultiCell</a>(). <p> <pre> @@ -146,8 +146,8 @@ void CardLayout::addItem( <a href="qlayoutitem.html">TQLayoutItem</a> *item ) </pre> <p> The layout takes over responsibility of the items added. Since -<a href="qlayoutitem.html">TQLayoutItem</a> does not inherit <a href="qobject.html">TQObject</a>, we must delete the items -manually. The function <a href="qlayout.html#deleteAllItems">TQLayout::deleteAllItems</a>() uses the iterator we +<a href="qlayoutitem.html">TQLayoutItem</a> does not inherit <a href="ntqobject.html">TQObject</a>, we must delete the items +manually. The function <a href="ntqlayout.html#deleteAllItems">TQLayout::deleteAllItems</a>() uses the iterator we defined above to delete all the items in the layout. <p> <pre> CardLayout::~CardLayout() @@ -160,9 +160,9 @@ CardLayout::~CardLayout() supplied as an argument does not include margin(). If relevant, use spacing() as the distance between items. <p> <pre> -void CardLayout::setGeometry( const <a href="qrect.html">TQRect</a> &rect ) +void CardLayout::setGeometry( const <a href="ntqrect.html">TQRect</a> &rect ) { - TQLayout::<a href="qlayout.html#setGeometry">setGeometry</a>( rect ); + TQLayout::<a href="ntqlayout.html#setGeometry">setGeometry</a>( rect ); <a href="qptrlistiterator.html">TQPtrListIterator</a><TQLayoutItem> it( list ); if (it.<a href="qptrlistiterator.html#count">count</a>() == 0) @@ -172,12 +172,12 @@ void CardLayout::setGeometry( const <a href="qrect.html">TQRect</a> &rect ) int i = 0; - int w = rect.<a href="qrect.html#width">width</a>() - ( list.count() - 1 ) * spacing(); - int h = rect.<a href="qrect.html#height">height</a>() - ( list.count() - 1 ) * spacing(); + int w = rect.<a href="ntqrect.html#width">width</a>() - ( list.count() - 1 ) * spacing(); + int h = rect.<a href="ntqrect.html#height">height</a>() - ( list.count() - 1 ) * spacing(); while ( (item = it.<a href="qptrlistiterator.html#current">current</a>()) != 0 ) { ++it; - <a href="qrect.html">TQRect</a> geom( rect.<a href="qrect.html#x">x</a>() + i * spacing(), rect.<a href="qrect.html#y">y</a>() + i * spacing(), + <a href="ntqrect.html">TQRect</a> geom( rect.<a href="ntqrect.html#x">x</a>() + i * spacing(), rect.<a href="ntqrect.html#y">y</a>() + i * spacing(), w, h ); item-><a href="qlayoutitem.html#setGeometry">setGeometry</a>( geom ); ++i; @@ -191,7 +191,7 @@ spacing(), but not margin(). <p> <pre> TQSize CardLayout::sizeHint() const { - <a href="qsize.html">TQSize</a> s( 0, 0 ); + <a href="ntqsize.html">TQSize</a> s( 0, 0 ); int n = list.count(); if ( n > 0 ) s = TQSize( 100, 70 ); // start with a nice default size @@ -199,20 +199,20 @@ TQSize CardLayout::sizeHint() const <a href="qlayoutitem.html">TQLayoutItem</a> *item; while ( (item = it.<a href="qptrlistiterator.html#current">current</a>()) != 0 ) { ++it; - s = s.<a href="qsize.html#expandedTo">expandedTo</a>( item-><a href="qlayoutitem.html#minimumSize">minimumSize</a>() ); + s = s.<a href="ntqsize.html#expandedTo">expandedTo</a>( item-><a href="qlayoutitem.html#minimumSize">minimumSize</a>() ); } return s + n * TQSize( spacing(), spacing() ); } TQSize CardLayout::minimumSize() const { - <a href="qsize.html">TQSize</a> s( 0, 0 ); + <a href="ntqsize.html">TQSize</a> s( 0, 0 ); int n = list.count(); <a href="qptrlistiterator.html">TQPtrListIterator</a><TQLayoutItem> it( list ); <a href="qlayoutitem.html">TQLayoutItem</a> *item; while ( (item = it.<a href="qptrlistiterator.html#current">current</a>()) != 0 ) { ++it; - s = s.<a href="qsize.html#expandedTo">expandedTo</a>( item-><a href="qlayoutitem.html#minimumSize">minimumSize</a>() ); + s = s.<a href="ntqsize.html#expandedTo">expandedTo</a>( item-><a href="qlayoutitem.html#minimumSize">minimumSize</a>() ); } return s + n * TQSize( spacing(), spacing() ); } |