[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/office/datakiosk/src
From:       Adam Treat <treat () kde ! org>
Date:       2005-09-30 22:08:40
Message-ID: 1128118120.076322.28295.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 465822 by treat:

* Fixes for minimum sizes to the view layouts.

 M  +1 -0      datatableedit.cpp  
 M  +2 -3      datatableeditorfactory.cpp  
 M  +13 -7     formlayout.cpp  
 M  +1 -1      formlayout.h  


--- trunk/extragear/office/datakiosk/src/datatableedit.cpp #465821:465822
@@ -636,6 +636,7 @@
     if ( m_viewMode )
     {
         setGeometry( viewRect() );
+        setMinimumSize( viewRect().size() );
         changeColorBox( viewColor() );
         m_label->setShown( viewLabelShown() );
 
--- trunk/extragear/office/datakiosk/src/datatableeditorfactory.cpp #465821:465822
@@ -428,7 +428,7 @@
 void DataEditorBase::setViewMode( bool view )
 {
     m_viewMode = view;
-
+    m_editor->setMinimumWidth( 0 );
     if ( m_viewMode )
     {
         switch ( viewLabelPosition() )
@@ -450,7 +450,7 @@
             m_editor->setMinimumWidth( m_viewWidth );
             break;
         case Hidden:
-            m_layout->setDirection( QBoxLayout::TopToBottom );
+            m_layout->setDirection( QBoxLayout::LeftToRight );
             m_label->hide();
             break;
         default:
@@ -468,7 +468,6 @@
 /*        m_label->setAlignment( Qt::AlignLeft );*/
         m_layout->setDirection( QBoxLayout::TopToBottom );
         m_label->setMinimumWidth( 0 );
-        m_editor->setMinimumWidth( 0 );
         m_label->show();
         QFont f( font() );
         f.setPointSize( font().pointSize() );
--- trunk/extragear/office/datakiosk/src/formlayout.cpp #465821:465822
@@ -74,7 +74,8 @@
 
 int FormLayout::heightForWidth( int width ) const
 {
-    int height = doLayout( QRect( 0, 0, width, 0 ), true );
+    bool viewMode;
+    int height = doLayout( QRect( 0, 0, width, 0 ), true, &viewMode );
     return height;
 }
 
@@ -82,7 +83,8 @@
 {
     QLayout::setGeometry( rect );
     slotCalculateItemSize();
-    doLayout( rect, false );
+    bool viewMode;
+    doLayout( rect, false, &viewMode );
 }
 
 QSize FormLayout::sizeHint() const
@@ -92,7 +94,10 @@
 
 QSize FormLayout::minimumSize() const
 {
-    return QSize( m_itemWidth, doLayout( QRect( 0, 0, m_width, 0 ), true ) );
+    bool viewMode = false;
+    int height = doLayout( QRect( 0, 0, m_width, 0 ), true, &viewMode );
+    int width = viewMode ? 0 : m_itemWidth;
+    return QSize( width, height );
 }
 
 void FormLayout::slotCalculateItemSize()
@@ -118,7 +123,7 @@
     m_width = mainWidget()->width();
 }
 
-int FormLayout::doLayout( const QRect &rect, bool testOnly ) const
+int FormLayout::doLayout( const QRect &rect, bool testOnly, bool *viewMode ) const
 {
     int x = rect.x();
     int y = rect.y();
@@ -128,14 +133,15 @@
     if ( it.count() == 0 )
         return 0;
 
+    *viewMode = false;
+
     QLayoutItem *item;
-    bool viewMode = false;
     while ( ( item = it.current() ) != 0 )
     {
         ++it;
 
         DataEditorBase *editor = ::qt_cast<DataEditorBase*>( item->widget() );
-        if ( viewMode = editor->viewMode() ?  true : viewMode )
+        if ( *viewMode = editor->viewMode() ?  true : *viewMode )
         {
             if ( !testOnly )
                 item ->setGeometry( editor->viewRect() );
@@ -159,7 +165,7 @@
         }
     }
 
-    if ( viewMode )
+    if ( *viewMode )
         return 0;
     else
         return y + lineHeight - rect.y();
--- trunk/extragear/office/datakiosk/src/formlayout.h #465821:465822
@@ -70,7 +70,7 @@
     virtual void setGeometry( const QRect &rect );
 
 private:
-    int doLayout( const QRect &rect, bool testOnly ) const;
+    int doLayout( const QRect &rect, bool testOnly, bool *viewMode ) const;
 
     QPtrList<QLayoutItem> m_itemList;
     int m_itemWidth;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic