From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/customlayout.html | 70 +++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'doc/html/customlayout.html') diff --git a/doc/html/customlayout.html b/doc/html/customlayout.html index 188b7f2b..5b9c7773 100644 --- a/doc/html/customlayout.html +++ b/doc/html/customlayout.html @@ -35,50 +35,50 @@ body { background: #ffffff; color: black; }

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 -TQLayout::spacing(). +TQLayout::spacing().

To write your own layout class, you must define the following:

-

In most cases, you will also implement minimumSize(). +

In most cases, you will also implement minimumSize().

card.h

 #ifndef CARD_H
 #define CARD_H
 
-#include <qlayout.h>
-#include <qptrlist.h>
+#include <ntqlayout.h>
+#include <ntqptrlist.h>
 
-class CardLayout : public TQLayout
+class CardLayout : public TQLayout
 {
 public:
-    CardLayout( TQWidget *parent, int dist )
-        : TQLayout( parent, 0, dist ) {}
-    CardLayout( TQLayout* parent, int dist)
-        : TQLayout( parent, dist ) { }
+    CardLayout( TQWidget *parent, int dist )
+        : TQLayout( parent, 0, dist ) {}
+    CardLayout( TQLayout* parent, int dist)
+        : TQLayout( parent, dist ) { }
     CardLayout( int dist )
-        : TQLayout( dist ) {}
+        : TQLayout( dist ) {}
     ~CardLayout();
 
     void addItem(TQLayoutItem *item);
-    TQSize sizeHint() const;
-    TQSize minimumSize() const;
+    TQSize sizeHint() const;
+    TQSize minimumSize() const;
     TQLayoutIterator iterator();
-    void setGeometry(const TQRect &rect);
+    void setGeometry(const TQRect &rect);
 
 private:
-    TQPtrList<TQLayoutItem> list;
+    TQPtrList<TQLayoutItem> list;
 };
 
 #endif
@@ -105,21 +105,21 @@ constructor. In our example we do not need a destructor.
 class CardLayoutIterator : public TQGLayoutIterator
 {
 public:
-    CardLayoutIterator( TQPtrList<TQLayoutItem> *l )
+    CardLayoutIterator( TQPtrList<TQLayoutItem> *l )
         : idx( 0 ), list( l ) {}
 
     TQLayoutItem *current()
-    { return idx < int(list->count()) ? list->at(idx) : 0;  }
+    { return idx < int(list->count()) ? list->at(idx) : 0;  }
 
     TQLayoutItem *next()
     { idx++; return current(); }
 
     TQLayoutItem *takeCurrent()
-    { return list->take( idx ); }
+    { return list->take( idx ); }
 
 private:
     int idx;
-    TQPtrList<TQLayoutItem> *list;
+    TQPtrList<TQLayoutItem> *list;
 };
 
@@ -133,9 +133,9 @@ TQLayoutIterator CardLayout::iterator()

addItem() implements the default placement strategy for layout items. -It must be implemented. It is used by TQLayout::add(), by the TQLayout +It must be implemented. It is used by TQLayout::add(), by the TQLayout constructor that takes a layout as parent, and it is used to implement -the auto-add feature. If your layout +the auto-add feature. If your layout has advanced placement options that require parameters, you must provide extra access functions such as TQGridLayout::addMultiCell().

@@ -146,8 +146,8 @@ void CardLayout::addItem( TQLayoutItem *item )
 

The layout takes over responsibility of the items added. Since -TQLayoutItem does not inherit TQObject, we must delete the items -manually. The function TQLayout::deleteAllItems() uses the iterator we +TQLayoutItem does not inherit TQObject, we must delete the items +manually. The function TQLayout::deleteAllItems() uses the iterator we defined above to delete all the items in the layout.

 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.
 

-void CardLayout::setGeometry( const TQRect &rect )
+void CardLayout::setGeometry( const TQRect &rect )
 {
-    TQLayout::setGeometry( rect );
+    TQLayout::setGeometry( rect );
 
     TQPtrListIterator<TQLayoutItem> it( list );
     if (it.count() == 0)
@@ -172,12 +172,12 @@ void CardLayout::setGeometry( const TQRect &rect )
 
     int i = 0;
 
-    int w = rect.width() - ( list.count() - 1 ) * spacing();
-    int h = rect.height() - ( list.count() - 1 ) * spacing();
+    int w = rect.width() - ( list.count() - 1 ) * spacing();
+    int h = rect.height() - ( list.count() - 1 ) * spacing();
 
     while ( (item = it.current()) != 0 ) {
         ++it;
-        TQRect geom( rect.x() + i * spacing(), rect.y() + i * spacing(),
+        TQRect geom( rect.x() + i * spacing(), rect.y() + i * spacing(),
                     w, h );
         item->setGeometry( geom );
         ++i;
@@ -191,7 +191,7 @@ spacing(), but not margin().
 

 TQSize CardLayout::sizeHint() const
 {
-    TQSize s( 0, 0 );
+    TQSize 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
     TQLayoutItem *item;
     while ( (item = it.current()) != 0 ) {
         ++it;
-        s = s.expandedTo( item->minimumSize() );
+        s = s.expandedTo( item->minimumSize() );
     }
     return s + n * TQSize( spacing(), spacing() );
 }
 
 TQSize CardLayout::minimumSize() const
 {
-    TQSize s( 0, 0 );
+    TQSize s( 0, 0 );
     int n = list.count();
     TQPtrListIterator<TQLayoutItem> it( list );
     TQLayoutItem *item;
     while ( (item = it.current()) != 0 ) {
         ++it;
-        s = s.expandedTo( item->minimumSize() );
+        s = s.expandedTo( item->minimumSize() );
     }
     return s + n * TQSize( spacing(), spacing() );
 }
-- 
cgit v1.2.1