Skip to content

Commit

Permalink
Avoid overflowing url drawn over widgets in browser info widget
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 8, 2015
1 parent aeda955 commit 35834e8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/app/qgsbrowserdockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,22 @@ void QgsBrowserLayerProperties::setItem( QgsDataItem* item )
}
}

void QgsBrowserLayerProperties::setCondensedMode( bool condensedMode )
{
if ( condensedMode )
{
mUriLabel->setLineWrapMode( QTextEdit::NoWrap );
mUriLabel->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
mUriLabel->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
}
else
{
mUriLabel->setLineWrapMode( QTextEdit::WidgetWidth );
mUriLabel->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
mUriLabel->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded );
}
}

QgsBrowserDirectoryProperties::QgsBrowserDirectoryProperties( QWidget* parent ) :
QgsBrowserPropertiesWidget( parent )
, mDirectoryWidget( 0 )
Expand Down Expand Up @@ -863,7 +879,11 @@ void QgsBrowserDockWidget::setPropertiesWidget()
QModelIndex index = mProxyModel->mapToSource( indexes.value( 0 ) );
QgsDataItem* item = mModel->dataItem( index );
QgsBrowserPropertiesWidget* propertiesWidget = QgsBrowserPropertiesWidget::createWidget( item, mPropertiesWidget );
mPropertiesLayout->addWidget( propertiesWidget );
if ( propertiesWidget )
{
propertiesWidget->setCondensedMode( true );
mPropertiesLayout->addWidget( propertiesWidget );
}
}
}
mPropertiesWidget->setVisible( mPropertiesLayout->count() > 0 );
Expand Down
9 changes: 9 additions & 0 deletions src/app/qgsbrowserdockwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ class QgsBrowserPropertiesWidget : public QWidget
QgsBrowserPropertiesWidget( QWidget* parent = 0 );
static QgsBrowserPropertiesWidget* createWidget( QgsDataItem* item, QWidget* parent = 0 );
virtual void setItem( QgsDataItem* item ) = 0;

/** Sets whether the properties widget should display in condensed mode, ie, for display in a dock
* widget rather than it's own seperate dialog.
* @param condensedMode set to true to enable condensed mode
* @note added in QGIS 2.10
*/
virtual void setCondensedMode( bool condensedMode ) { Q_UNUSED( condensedMode ); }
};

class QgsBrowserLayerProperties : public QgsBrowserPropertiesWidget, private Ui::QgsBrowserLayerPropertiesBase
Expand All @@ -57,6 +64,8 @@ class QgsBrowserLayerProperties : public QgsBrowserPropertiesWidget, private Ui:
QgsBrowserLayerProperties( QWidget* parent = 0 );
void setItem( QgsDataItem* item ) override;

virtual void setCondensedMode( bool condensedMode ) override;

private:
QgsBrowserPropertiesWrapLabel *mUriLabel;
};
Expand Down

0 comments on commit 35834e8

Please sign in to comment.