Switch browser dock buttons to toolbar

This commit is contained in:
Nyall Dawson 2015-05-30 21:21:50 +10:00
parent 2ab8a0bed9
commit 5a93f4c501
2 changed files with 87 additions and 140 deletions

View File

@ -447,11 +447,6 @@ QgsBrowserDockWidget::QgsBrowserDockWidget( QString name, QWidget * parent ) :
mBrowserView = new QgsDockBrowserTreeView( this ); mBrowserView = new QgsDockBrowserTreeView( this );
mLayoutBrowser->addWidget( mBrowserView ); mLayoutBrowser->addWidget( mBrowserView );
mBtnRefresh->setIcon( QgsApplication::getThemeIcon( "mActionDraw.svg" ) );
mBtnAddLayers->setIcon( QgsApplication::getThemeIcon( "mActionAdd.svg" ) );
mBtnCollapse->setIcon( QgsApplication::getThemeIcon( "mActionCollapseTree.svg" ) );
mBtnPropertiesWidget->setIcon( QgsApplication::getThemeIcon( "mActionPropertiesWidget.svg" ) );
mWidgetFilter->hide(); mWidgetFilter->hide();
mLeFilter->setPlaceholderText( tr( "Type here to filter current item..." ) ); mLeFilter->setPlaceholderText( tr( "Type here to filter current item..." ) );
// icons from http://www.fatcow.com/free-icons License: CC Attribution 3.0 // icons from http://www.fatcow.com/free-icons License: CC Attribution 3.0
@ -483,11 +478,11 @@ QgsBrowserDockWidget::QgsBrowserDockWidget( QString name, QWidget * parent ) :
action->setCheckable( true ); action->setCheckable( true );
menu->addAction( action ); menu->addAction( action );
connect( mBtnRefresh, SIGNAL( clicked() ), this, SLOT( refresh() ) ); connect( mActionRefresh, SIGNAL( triggered( bool ) ), this, SLOT( refresh() ) );
connect( mBtnAddLayers, SIGNAL( clicked() ), this, SLOT( addSelectedLayers() ) ); connect( mActionAddLayers, SIGNAL( triggered( bool ) ), this, SLOT( addSelectedLayers() ) );
connect( mBtnCollapse, SIGNAL( clicked() ), mBrowserView, SLOT( collapseAll() ) ); connect( mActionCollapse, SIGNAL( triggered( bool ) ), mBrowserView, SLOT( collapseAll() ) );
connect( mBtnFilterShow, SIGNAL( toggled( bool ) ), this, SLOT( showFilterWidget( bool ) ) ); connect( mActionShowFilter, SIGNAL( triggered( bool ) ), this, SLOT( showFilterWidget( bool ) ) );
connect( mBtnPropertiesWidget, SIGNAL( toggled( bool ) ), this, SLOT( enablePropertiesWidget( bool ) ) ); connect( mActionPropertiesWidget, SIGNAL( triggered( bool ) ), this, SLOT( enablePropertiesWidget( bool ) ) );
connect( mLeFilter, SIGNAL( returnPressed() ), this, SLOT( setFilter() ) ); connect( mLeFilter, SIGNAL( returnPressed() ), this, SLOT( setFilter() ) );
connect( mLeFilter, SIGNAL( cleared() ), this, SLOT( setFilter() ) ); connect( mLeFilter, SIGNAL( cleared() ), this, SLOT( setFilter() ) );
connect( mLeFilter, SIGNAL( textChanged( const QString & ) ), this, SLOT( setFilter() ) ); connect( mLeFilter, SIGNAL( textChanged( const QString & ) ), this, SLOT( setFilter() ) );
@ -530,7 +525,7 @@ void QgsBrowserDockWidget::showEvent( QShowEvent * e )
// objectName used by settingsSection() is not yet set in constructor // objectName used by settingsSection() is not yet set in constructor
QSettings settings; QSettings settings;
mPropertiesWidgetEnabled = settings.value( settingsSection() + "/propertiesWidgetEnabled", false ).toBool(); mPropertiesWidgetEnabled = settings.value( settingsSection() + "/propertiesWidgetEnabled", false ).toBool();
mBtnPropertiesWidget->setChecked( mPropertiesWidgetEnabled ); mActionPropertiesWidget->setChecked( mPropertiesWidgetEnabled );
mPropertiesWidget->setVisible( false ); // false until item is selected mPropertiesWidget->setVisible( false ); // false until item is selected
mPropertiesWidgetHeight = settings.value( settingsSection() + "/propertiesWidgetHeight" ).toFloat(); mPropertiesWidgetHeight = settings.value( settingsSection() + "/propertiesWidgetHeight" ).toFloat();

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>216</width> <width>216</width>
<height>121</height> <height>138</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -15,6 +15,9 @@
</property> </property>
<widget class="QWidget" name="mContents"> <widget class="QWidget" name="mContents">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -28,136 +31,22 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<layout class="QHBoxLayout" name="mLayoutHeader"> <widget class="QToolBar" name="mBrowserToolbar">
<property name="spacing"> <property name="iconSize">
<number>6</number> <size>
<width>16</width>
<height>16</height>
</size>
</property> </property>
<property name="leftMargin"> <property name="floatable">
<number>5</number> <bool>false</bool>
</property> </property>
<property name="rightMargin"> <addaction name="mActionRefresh"/>
<number>5</number> <addaction name="mActionAddLayers"/>
</property> <addaction name="mActionShowFilter"/>
<item> <addaction name="mActionCollapse"/>
<widget class="QToolButton" name="mBtnRefresh"> <addaction name="mActionPropertiesWidget"/>
<property name="toolTip"> </widget>
<string>Refresh</string>
</property>
<property name="text">
<string>Refresh</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionDraw.svg</normaloff>:/images/themes/default/mActionDraw.svg</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mBtnAddLayers">
<property name="toolTip">
<string>Add Selected Layers</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionAdd.svg</normaloff>:/images/themes/default/mActionAdd.svg</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mBtnFilterShow">
<property name="toolTip">
<string>Filter Files</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionFilter2.svg</normaloff>:/images/themes/default/mActionFilter2.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mBtnCollapse">
<property name="toolTip">
<string>Collapse All</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionCollapseTree.png</normaloff>:/images/themes/default/mActionCollapseTree.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mBtnPropertiesWidget">
<property name="toolTip">
<string>Enable / disable properties widget</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionPropertiesWidget.png</normaloff>:/images/themes/default/mActionPropertiesWidget.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
<item> <item>
<widget class="QWidget" name="mWidgetFilter" native="true"> <widget class="QWidget" name="mWidgetFilter" native="true">
@ -301,6 +190,69 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<action name="mActionRefresh">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionDraw.svg</normaloff>:/images/themes/default/mActionDraw.svg</iconset>
</property>
<property name="text">
<string>Refresh</string>
</property>
</action>
<action name="mActionAddLayers">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionAdd.svg</normaloff>:/images/themes/default/mActionAdd.svg</iconset>
</property>
<property name="text">
<string>Add Layers</string>
</property>
<property name="toolTip">
<string>Add Selected Layers</string>
</property>
</action>
<action name="mActionShowFilter">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionFilter2.svg</normaloff>:/images/themes/default/mActionFilter2.svg</iconset>
</property>
<property name="text">
<string>Filter browser</string>
</property>
<property name="toolTip">
<string>Filter Browser</string>
</property>
</action>
<action name="mActionCollapse">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionCollapseTree.svg</normaloff>:/images/themes/default/mActionCollapseTree.svg</iconset>
</property>
<property name="text">
<string>Collapse All</string>
</property>
<property name="toolTip">
<string>Collapse All</string>
</property>
</action>
<action name="mActionPropertiesWidget">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionPropertiesWidget.svg</normaloff>:/images/themes/default/mActionPropertiesWidget.svg</iconset>
</property>
<property name="text">
<string>Show Properties</string>
</property>
<property name="toolTip">
<string>Enable/disable properties widget</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>