Skip to content

Commit

Permalink
[browser] Remove redundant name/uri/provider labels from top
Browse files Browse the repository at this point in the history
of layer properties widget

All this information is already shown in the scrollable metadata
section below that, so we're wasting precious space in this
valuable widget with a lot of duplicate information
  • Loading branch information
nyalldawson committed Nov 1, 2018
1 parent ab46018 commit 7f332fb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 121 deletions.
23 changes: 3 additions & 20 deletions src/gui/qgsbrowserdockwidget_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ QgsBrowserPropertiesWrapLabel::QgsBrowserPropertiesWrapLabel( const QString &tex
setPalette( pal );
setLineWrapMode( QTextEdit::WidgetWidth );
setWordWrapMode( QTextOption::WrapAnywhere );
connect( qobject_cast<QAbstractTextDocumentLayout *>( document()->documentLayout() ), &QAbstractTextDocumentLayout::documentSizeChanged,
connect( document()->documentLayout(), &QAbstractTextDocumentLayout::documentSizeChanged,
this, &QgsBrowserPropertiesWrapLabel::adjustHeight );
setMaximumHeight( 20 );
}
Expand Down Expand Up @@ -116,9 +116,6 @@ QgsBrowserLayerProperties::QgsBrowserLayerProperties( QWidget *parent )
{
setupUi( this );

mUriLabel = new QgsBrowserPropertiesWrapLabel( QString(), this );
mHeaderGridLayout->addItem( new QWidgetItem( mUriLabel ), 1, 1 );

// we don't want links to open in the little widget, open them externally instead
mMetadataTextBrowser->setOpenLinks( false );
connect( mMetadataTextBrowser, &QTextBrowser::anchorClicked, this, &QgsBrowserLayerProperties::urlClicked );
Expand Down Expand Up @@ -218,9 +215,6 @@ void QgsBrowserLayerProperties::setItem( QgsDataItem *item )
return;
}

mNameLabel->setText( layerItem->name() );
mUriLabel->setText( layerItem->uri() );
mProviderLabel->setText( layerItem->providerKey() );
QString myStyle = QgsApplication::reportStyleSheet();
mMetadataTextBrowser->document()->setDefaultStyleSheet( myStyle );
mMetadataTextBrowser->setHtml( layerMetadata );
Expand All @@ -240,20 +234,9 @@ void QgsBrowserLayerProperties::setItem( QgsDataItem *item )
}
}

void QgsBrowserLayerProperties::setCondensedMode( bool condensedMode )
void QgsBrowserLayerProperties::setCondensedMode( bool )
{
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 );
}

}

void QgsBrowserLayerProperties::urlClicked( const QUrl &url )
Expand Down
3 changes: 0 additions & 3 deletions src/gui/qgsbrowserdockwidget_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ class QgsBrowserLayerProperties : public QgsBrowserPropertiesWidget, private Ui:
private slots:

void urlClicked( const QUrl &url );

private:
QgsBrowserPropertiesWrapLabel *mUriLabel = nullptr;
};

/**
Expand Down
108 changes: 10 additions & 98 deletions src/ui/qgsbrowserlayerpropertiesbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,106 +11,18 @@
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="mHeaderWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="mHeaderGridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="mNameTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="mNameLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>name</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mUriTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>URI</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mProviderTItleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Provider</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="mProviderLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>provider key</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="mLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="mMetadataLabel">
<property name="text">
<string>Metadata</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="mMetadataTextBrowser"/>
</item>
Expand Down

0 comments on commit 7f332fb

Please sign in to comment.