Draw the partitions in the alongside view even when not resizing.

This commit is contained in:
Teo Mrnjavac 2016-01-12 14:04:44 +01:00
parent cad8845f12
commit cb63d7d302

View File

@ -245,7 +245,6 @@ PartitionSplitterWidget::paintEvent( QPaintEvent* event )
painter.fillRect( rect(), palette().window() ); painter.fillRect( rect(), palette().window() );
painter.setRenderHint( QPainter::Antialiasing ); painter.setRenderHint( QPainter::Antialiasing );
if ( m_itemToResize && m_itemToResizeNext )
drawPartitions( &painter, rect(), m_items ); drawPartitions( &painter, rect(), m_items );
} }
@ -253,7 +252,9 @@ PartitionSplitterWidget::paintEvent( QPaintEvent* event )
void void
PartitionSplitterWidget::mousePressEvent( QMouseEvent* event ) PartitionSplitterWidget::mousePressEvent( QMouseEvent* event )
{ {
if ( event->button() == Qt::LeftButton ) if ( m_itemToResize &&
m_itemToResizeNext &&
event->button() == Qt::LeftButton )
{ {
if ( qAbs( event->x() - m_resizeHandleX ) < HANDLE_SNAP ) if ( qAbs( event->x() - m_resizeHandleX ) < HANDLE_SNAP )
m_resizing = true; m_resizing = true;
@ -328,7 +329,7 @@ PartitionSplitterWidget::mouseMoveEvent( QMouseEvent* event )
} }
else else
{ {
if ( m_itemToResize ) if ( m_itemToResize && m_itemToResizeNext )
{ {
if ( qAbs( event->x() - m_resizeHandleX ) < HANDLE_SNAP ) if ( qAbs( event->x() - m_resizeHandleX ) < HANDLE_SNAP )
setCursor( Qt::SplitHCursor ); setCursor( Qt::SplitHCursor );
@ -474,11 +475,13 @@ PartitionSplitterWidget::drawPartitions( QPainter* painter,
drawPartitions( painter, subRect, item.children ); drawPartitions( painter, subRect, item.children );
} }
if ( item.itemPath == m_itemToResize->itemPath ) if ( m_itemToResize &&
item.itemPath == m_itemToResize->itemPath )
m_resizeHandleX = x + width; m_resizeHandleX = x + width;
x += width; x += width;
} }
if ( m_itemToResize && m_itemToResizeNext )
drawResizeHandle( painter, rect, m_resizeHandleX ); drawResizeHandle( painter, rect, m_resizeHandleX );
} }