Skip to content
Permalink
Browse files

[browser] Remove redundant name/uri/provider labels from top

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 Oct 31, 2018
1 parent ab46018 commit 7f332fb7a635ebaea64dfc787926c61b98338b54
Showing with 13 additions and 121 deletions.
  1. +3 −20 src/gui/qgsbrowserdockwidget_p.cpp
  2. +0 −3 src/gui/qgsbrowserdockwidget_p.h
  3. +10 −98 src/ui/qgsbrowserlayerpropertiesbase.ui
@@ -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 );
}
@@ -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 );
@@ -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 );
@@ -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 )
@@ -126,9 +126,6 @@ class QgsBrowserLayerProperties : public QgsBrowserPropertiesWidget, private Ui:
private slots:

void urlClicked( const QUrl &url );

private:
QgsBrowserPropertiesWrapLabel *mUriLabel = nullptr;
};

/**
@@ -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>

0 comments on commit 7f332fb

Please sign in to comment.
You can’t perform that action at this time.