Skip to content
Permalink
Browse files
Avoid overflowing url drawn over widgets in browser info widget
  • Loading branch information
nyalldawson committed Jun 8, 2015
1 parent aeda955 commit 35834e849b1ddd9a84c1191ac96721617c6d2dd3
Showing with 30 additions and 1 deletion.
  1. +21 −1 src/app/qgsbrowserdockwidget.cpp
  2. +9 −0 src/app/qgsbrowserdockwidget.h
@@ -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 )
@@ -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 );
@@ -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
@@ -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;
};

0 comments on commit 35834e8

Please sign in to comment.