Skip to content
Permalink
Browse files

Browser: change Add Layers and Refresh buttons ; use designer file fo…

…r qgsbrowserdock
  • Loading branch information
etiennesky committed Nov 3, 2012
1 parent 33682f2 commit 3a6c904026cb188d4f23a2a5a83b5e146265fac2
@@ -20,6 +20,7 @@
<file>themes/default/join_miter.png</file>
<file>themes/default/join_round.png</file>
<file>themes/default/join_style.svg</file>
<file>themes/default/mActionAdd.png</file>
<file>themes/default/mActionAddAllToOverview.png</file>
<file>themes/default/mActionAddArrow.png</file>
<file>themes/default/mActionAddBasicShape.png</file>
@@ -126,6 +127,7 @@
<file>themes/default/mActionPropertyItem.png</file>
<file>themes/default/mActionQgisHomePage.png</file>
<file>themes/default/mActionRaiseItems.png</file>
<file>themes/default/mActionRefresh.png</file>
<file>themes/default/mActionRedo.png</file>
<file>themes/default/mActionRemoveAllFromOverview.png</file>
<file>themes/default/mActionRemoveLayer.png</file>
Binary file not shown.
Binary file not shown.
@@ -84,58 +84,22 @@ class QgsBrowserTreeView : public QTreeView
QgsBrowserDockWidget::QgsBrowserDockWidget( QWidget * parent ) :
QDockWidget( parent ), mModel( NULL )
{
setupUi( this );

setWindowTitle( tr( "Browser" ) );

mBrowserView = new QgsBrowserTreeView( this );
mLayoutBrowser->addWidget( mBrowserView );

QToolButton* refreshButton = new QToolButton( this );
refreshButton->setIcon( QgsApplication::getThemeIcon( "mActionDraw.png" ) );
// remove this to save space
refreshButton->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
refreshButton->setText( tr( "Refresh" ) );
refreshButton->setToolTip( tr( "Refresh" ) );
refreshButton->setAutoRaise( true );
connect( refreshButton, SIGNAL( clicked() ), this, SLOT( refresh() ) );

QToolButton* addLayersButton = new QToolButton( this );
addLayersButton->setIcon( QgsApplication::getThemeIcon( "mActionAddLayer.png" ) );
// remove this to save space
addLayersButton->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
addLayersButton->setText( tr( "Add Selection" ) );
addLayersButton->setToolTip( tr( "Add Selected Layers" ) );
addLayersButton->setAutoRaise( true );
connect( addLayersButton, SIGNAL( clicked() ), this, SLOT( addSelectedLayers() ) );

QToolButton* collapseButton = new QToolButton( this );
collapseButton->setIcon( QgsApplication::getThemeIcon( "mActionCollapseTree.png" ) );
collapseButton->setToolTip( tr( "Collapse All" ) );
collapseButton->setAutoRaise( true );
connect( collapseButton, SIGNAL( clicked() ), mBrowserView, SLOT( collapseAll() ) );

QVBoxLayout* layout = new QVBoxLayout();
QHBoxLayout* hlayout = new QHBoxLayout();
layout->setContentsMargins( 0, 0, 0, 0 );
layout->setSpacing( 0 );
hlayout->setContentsMargins( 0, 0, 0, 0 );
hlayout->setSpacing( 5 );
hlayout->setAlignment( Qt::AlignLeft );

hlayout->addSpacing( 5 );
hlayout->addWidget( refreshButton );
hlayout->addSpacing( 5 );
hlayout->addWidget( addLayersButton );
hlayout->addStretch( );
hlayout->addWidget( collapseButton );
layout->addLayout( hlayout );
layout->addWidget( mBrowserView );

QWidget* innerWidget = new QWidget( this );
innerWidget->setLayout( layout );
setWidget( innerWidget );
mBtnRefresh->setIcon( QgisApp::instance()->getThemeIcon( "mActionRefresh.png" ) );
mBtnAddLayers->setIcon( QgisApp::instance()->getThemeIcon( "mActionAdd.png" ) );
mBtnCollapse->setIcon( QgisApp::instance()->getThemeIcon( "mActionCollapseTree.png" ) );

connect( mBrowserView, SIGNAL( customContextMenuRequested( const QPoint & ) ), this, SLOT( showContextMenu( const QPoint & ) ) );
connect( mBrowserView, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( addLayerAtIndex( const QModelIndex& ) ) );

connect( mBtnRefresh, SIGNAL( clicked() ), this, SLOT( refresh() ) );
connect( mBtnAddLayers, SIGNAL( clicked() ), this, SLOT( addSelectedLayers() ) );
connect( mBtnCollapse, SIGNAL( clicked() ), mBrowserView, SLOT( collapseAll() ) );
}

void QgsBrowserDockWidget::showEvent( QShowEvent * e )
@@ -459,3 +423,4 @@ void QgsBrowserDockWidget::showProperties( )
}
}
}

@@ -16,13 +16,14 @@
#define QGSBROWSERDOCKWIDGET_H

#include <QDockWidget>
#include <ui_qgsbrowserdockwidgetbase.h>

class QgsBrowserModel;
class QModelIndex;
class QTreeView;
class QgsLayerItem;

class QgsBrowserDockWidget : public QDockWidget
class QgsBrowserDockWidget : public QDockWidget, private Ui::QgsBrowserDockWidgetBase
{
Q_OBJECT
public:
@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QgsBrowserDockWidgetBase</class>
<widget class="QDockWidget" name="QgsBrowserDockWidgetBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>274</width>
<height>76</height>
</rect>
</property>
<property name="windowTitle">
<string>Browser</string>
</property>
<widget class="QWidget" name="mContents">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>5</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<spacer name="mTopSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="mLayoutHeader">
<property name="spacing">
<number>5</number>
</property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="mBtnRefresh">
<property name="toolTip">
<string>Refresh</string>
</property>
<property name="text">
<string>Refresh</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionRefresh.png</normaloff>:/images/themes/default/mActionRefresh.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</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> Selection</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionAdd.png</normaloff>:/images/themes/default/mActionAdd.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</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>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="mLayoutBrowser"/>
</item>
</layout>
</widget>
</widget>
<resources>
<include location="../../images/images.qrc"/>
</resources>
<connections/>
</ui>

0 comments on commit 3a6c904

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