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( 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 m_itemList; int m_itemWidth;