mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-22 00:14:55 -05:00
Merge pull request #2405 from elpaso/symbol-export-select-by-group
Interactive selection by group of exported symbols
This commit is contained in:
commit
feab3ad8ec
@ -188,6 +188,7 @@
|
||||
%Include symbology-ng/qgssinglesymbolrendererv2widget.sip
|
||||
%Include symbology-ng/qgssmartgroupeditordialog.sip
|
||||
%Include symbology-ng/qgsstylev2managerdialog.sip
|
||||
%Include symbology-ng/qgsstylev2groupselectiondialog.sip
|
||||
%Include symbology-ng/qgssymbollayerv2widget.sip
|
||||
%Include symbology-ng/qgssymbollevelsv2dialog.sip
|
||||
%Include symbology-ng/qgssymbolslistwidget.sip
|
||||
|
||||
@ -15,10 +15,51 @@ class QgsStyleV2ExportImportDialog : QDialog
|
||||
QgsStyleV2ExportImportDialog( QgsStyleV2* style, QWidget *parent /TransferThis/ = NULL, Mode mode = Export );
|
||||
~QgsStyleV2ExportImportDialog();
|
||||
|
||||
/**
|
||||
* @brief selectSymbols select symbols by name
|
||||
* @param symbolNames list of symbol names
|
||||
*/
|
||||
void selectSymbols(const QStringList symbolNames);
|
||||
/**
|
||||
* @brief deselectSymbols deselect symbols by name
|
||||
* @param symbolNames list of symbol names
|
||||
*/
|
||||
void deselectSymbols(const QStringList symbolNames);
|
||||
|
||||
public slots:
|
||||
void doExportImport();
|
||||
/**
|
||||
* @brief selectByGroup open select by group dialog
|
||||
*/
|
||||
void selectByGroup();
|
||||
/**
|
||||
* @brief selectAll selects all symbols
|
||||
*/
|
||||
void selectAll();
|
||||
/**
|
||||
* @brief clearSelection deselects all symbols
|
||||
*/
|
||||
void clearSelection();
|
||||
/**
|
||||
* Select the symbols belonging to the given group
|
||||
* @param groupName the name of the group to be selected
|
||||
*/
|
||||
void selectGroup( const QString groupName );
|
||||
/**
|
||||
* Unselect the symbols belonging to the given group
|
||||
* @param groupName the name of the group to be deselected
|
||||
*/
|
||||
void deselectGroup(const QString groupName);
|
||||
/**
|
||||
* @brief selectSmartgroup selects all symbols from a smart group
|
||||
* @param groupName
|
||||
*/
|
||||
void selectSmartgroup(const QString groupName);
|
||||
/**
|
||||
* @brief deselectSmartgroup deselects all symbols from a smart group
|
||||
* @param groupName
|
||||
*/
|
||||
void deselectSmartgroup(const QString groupName);
|
||||
|
||||
void importTypeChanged( int );
|
||||
void browse();
|
||||
|
||||
47
python/gui/symbology-ng/qgsstylev2groupselectiondialog.sip
Normal file
47
python/gui/symbology-ng/qgsstylev2groupselectiondialog.sip
Normal file
@ -0,0 +1,47 @@
|
||||
/***************************************************************************
|
||||
qgsstylev2groupselectiondialog.h
|
||||
---------------------
|
||||
begin : Oct 2015
|
||||
copyright : (C) 2015 by Alessandro Pasotti
|
||||
email : elpaso at itopen dot it
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
class QgsStyleV2GroupSelectionDialog : public QDialog, private Ui::SymbolsV2GroupSelectionDialogBase
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsstylev2groupselectiondialog.h>
|
||||
%End
|
||||
|
||||
public:
|
||||
QgsStyleV2GroupSelectionDialog(QgsStyleV2* style, QWidget *parent = 0);
|
||||
~QgsStyleV2GroupSelectionDialog();
|
||||
//! Set bold font for item
|
||||
void setBold(QStandardItem *item);
|
||||
|
||||
signals:
|
||||
//! group with groupName has been selected
|
||||
void groupSelected( const QString groupName );
|
||||
//! group with groupName has been deselected
|
||||
void groupDeselected( const QString groupName );
|
||||
//! smartgroup with groupName has been selected
|
||||
void smartgroupSelected( const QString groupName);
|
||||
//! smart group with groupName has been deselected
|
||||
void smartgroupDeselected( const QString groupName );
|
||||
//! all deselected
|
||||
void allDeselected( );
|
||||
//! all selected
|
||||
void allSelected( );
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ SET(QGIS_GUI_SRCS
|
||||
symbology-ng/qgsinvertedpolygonrendererwidget.cpp
|
||||
symbology-ng/qgsrendererv2propertiesdialog.cpp
|
||||
symbology-ng/qgsstylev2managerdialog.cpp
|
||||
symbology-ng/qgsstylev2groupselectiondialog.cpp
|
||||
symbology-ng/qgssymbollevelsv2dialog.cpp
|
||||
symbology-ng/qgssymbolv2selectordialog.cpp
|
||||
symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp
|
||||
@ -419,6 +420,7 @@ SET(QGIS_GUI_MOC_HDRS
|
||||
symbology-ng/qgssinglesymbolrendererv2widget.h
|
||||
symbology-ng/qgssmartgroupeditordialog.h
|
||||
symbology-ng/qgsstylev2exportimportdialog.h
|
||||
symbology-ng/qgsstylev2groupselectiondialog.h
|
||||
symbology-ng/qgsstylev2managerdialog.h
|
||||
symbology-ng/qgssvgselectorwidget.h
|
||||
symbology-ng/qgssymbollayerv2widget.h
|
||||
|
||||
@ -13,7 +13,9 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsstylev2exportimportdialog.h"
|
||||
#include "ui_qgsstylev2exportimportdialogbase.h"
|
||||
|
||||
#include "qgsstylev2.h"
|
||||
#include "qgssymbolv2.h"
|
||||
@ -28,6 +30,7 @@
|
||||
#include <QPushButton>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
|
||||
QgsStyleV2ExportImportDialog::QgsStyleV2ExportImportDialog( QgsStyleV2* style, QWidget *parent, Mode mode )
|
||||
: QDialog( parent )
|
||||
, mDialogMode( mode )
|
||||
@ -46,12 +49,14 @@ QgsStyleV2ExportImportDialog::QgsStyleV2ExportImportDialog( QgsStyleV2* style, Q
|
||||
connect( pb, SIGNAL( clicked() ), this, SLOT( clearSelection() ) );
|
||||
|
||||
QStandardItemModel* model = new QStandardItemModel( listItems );
|
||||
|
||||
listItems->setModel( model );
|
||||
|
||||
mTempStyle = new QgsStyleV2();
|
||||
// TODO validate
|
||||
mFileName = "";
|
||||
mProgressDlg = NULL;
|
||||
mGroupSelectionDlg = NULL;
|
||||
mTempFile = NULL;
|
||||
mNetManager = new QNetworkAccessManager( this );
|
||||
mNetReply = NULL;
|
||||
@ -87,6 +92,10 @@ QgsStyleV2ExportImportDialog::QgsStyleV2ExportImportDialog( QgsStyleV2* style, Q
|
||||
importTypeCombo->setHidden( true );
|
||||
locationLabel->setHidden( true );
|
||||
locationLineEdit->setHidden( true );
|
||||
|
||||
pb = new QPushButton( tr( "Select by group" ) );
|
||||
buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
|
||||
connect( pb, SIGNAL( clicked() ), this, SLOT( selectByGroup() ) );
|
||||
groupLabel->setHidden( true );
|
||||
groupCombo->setHidden( true );
|
||||
|
||||
@ -95,6 +104,7 @@ QgsStyleV2ExportImportDialog::QgsStyleV2ExportImportDialog( QgsStyleV2* style, Q
|
||||
{
|
||||
QApplication::postEvent( this, new QCloseEvent() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// use Ok button for starting import and export operations
|
||||
@ -370,6 +380,7 @@ QgsStyleV2ExportImportDialog::~QgsStyleV2ExportImportDialog()
|
||||
{
|
||||
delete mTempFile;
|
||||
delete mTempStyle;
|
||||
delete mGroupSelectionDlg;
|
||||
}
|
||||
|
||||
void QgsStyleV2ExportImportDialog::selectAll()
|
||||
@ -382,6 +393,80 @@ void QgsStyleV2ExportImportDialog::clearSelection()
|
||||
listItems->clearSelection();
|
||||
}
|
||||
|
||||
|
||||
void QgsStyleV2ExportImportDialog::selectSymbols( const QStringList symbolNames )
|
||||
{
|
||||
foreach ( QString symbolName, symbolNames )
|
||||
{
|
||||
QModelIndexList indexes = listItems->model()->match( listItems->model()->index( 0, 0 ), Qt::DisplayRole, symbolName , 1, Qt::MatchFixedString | Qt::MatchCaseSensitive );
|
||||
foreach ( QModelIndex index, indexes )
|
||||
{
|
||||
listItems->selectionModel()->select( index, QItemSelectionModel::Select );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QgsStyleV2ExportImportDialog::deselectSymbols( const QStringList symbolNames )
|
||||
{
|
||||
foreach ( QString symbolName, symbolNames )
|
||||
{
|
||||
QModelIndexList indexes = listItems->model()->match( listItems->model()->index( 0, 0 ), Qt::DisplayRole, symbolName , 1, Qt::MatchFixedString | Qt::MatchCaseSensitive );
|
||||
foreach ( QModelIndex index, indexes )
|
||||
{
|
||||
QItemSelection deselection( index, index );
|
||||
listItems->selectionModel()->select( deselection, QItemSelectionModel::Deselect );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QgsStyleV2ExportImportDialog::selectGroup( const QString groupName )
|
||||
{
|
||||
QStringList symbolNames = mQgisStyle->symbolsOfGroup( QgsStyleV2::StyleEntity::SymbolEntity, mQgisStyle->groupId( groupName ) );
|
||||
selectSymbols( symbolNames );
|
||||
}
|
||||
|
||||
|
||||
void QgsStyleV2ExportImportDialog::deselectGroup( const QString groupName )
|
||||
{
|
||||
QStringList symbolNames = mQgisStyle->symbolsOfGroup( QgsStyleV2::StyleEntity::SymbolEntity, mQgisStyle->groupId( groupName ) );
|
||||
deselectSymbols( symbolNames );
|
||||
}
|
||||
|
||||
|
||||
void QgsStyleV2ExportImportDialog::selectSmartgroup( const QString groupName )
|
||||
{
|
||||
QStringList symbolNames = mQgisStyle->symbolsOfSmartgroup( QgsStyleV2::StyleEntity::SymbolEntity, mQgisStyle->smartgroupId( groupName ) );
|
||||
selectSymbols( symbolNames );
|
||||
}
|
||||
|
||||
|
||||
void QgsStyleV2ExportImportDialog::deselectSmartgroup( const QString groupName )
|
||||
{
|
||||
QStringList symbolNames = mQgisStyle->symbolsOfSmartgroup( QgsStyleV2::StyleEntity::SymbolEntity, mQgisStyle->smartgroupId( groupName ) );
|
||||
deselectSymbols( symbolNames );
|
||||
}
|
||||
|
||||
|
||||
void QgsStyleV2ExportImportDialog::selectByGroup( )
|
||||
{
|
||||
if ( ! mGroupSelectionDlg )
|
||||
{
|
||||
mGroupSelectionDlg = new QgsStyleV2GroupSelectionDialog( mQgisStyle, this );
|
||||
mGroupSelectionDlg->setWindowTitle( tr( "Select symbols by group" ) );
|
||||
connect( mGroupSelectionDlg, SIGNAL( groupSelected( const QString ) ), this, SLOT( selectGroup( const QString ) ) );
|
||||
connect( mGroupSelectionDlg, SIGNAL( groupDeselected( const QString ) ), this, SLOT( deselectGroup( const QString ) ) );
|
||||
connect( mGroupSelectionDlg, SIGNAL( allSelected( ) ), this, SLOT( selectAll( ) ) );
|
||||
connect( mGroupSelectionDlg, SIGNAL( allDeselected( ) ), this, SLOT( clearSelection( ) ) );
|
||||
connect( mGroupSelectionDlg, SIGNAL( smartgroupSelected( const QString ) ), this, SLOT( selectSmartgroup( const QString ) ) );
|
||||
connect( mGroupSelectionDlg, SIGNAL( smartgroupDeselected( const QString ) ), this, SLOT( deselectSmartgroup( const QString ) ) );
|
||||
}
|
||||
mGroupSelectionDlg->show();
|
||||
mGroupSelectionDlg->raise();
|
||||
mGroupSelectionDlg->activateWindow();
|
||||
}
|
||||
|
||||
|
||||
void QgsStyleV2ExportImportDialog::importTypeChanged( int index )
|
||||
{
|
||||
QString type = importTypeCombo->itemData( index ).toString();
|
||||
|
||||
@ -23,6 +23,9 @@
|
||||
#include <QTemporaryFile>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QStandardItem>
|
||||
|
||||
#include "qgsstylev2groupselectiondialog.h"
|
||||
|
||||
#include "ui_qgsstylev2exportimportdialogbase.h"
|
||||
|
||||
@ -43,11 +46,51 @@ class GUI_EXPORT QgsStyleV2ExportImportDialog : public QDialog, private Ui::QgsS
|
||||
// mode argument must be 0 for saving and 1 for loading
|
||||
QgsStyleV2ExportImportDialog( QgsStyleV2* style, QWidget *parent = NULL, Mode mode = Export );
|
||||
~QgsStyleV2ExportImportDialog();
|
||||
/**
|
||||
* @brief selectSymbols select symbols by name
|
||||
* @param symbolNames list of symbol names
|
||||
*/
|
||||
void selectSymbols( const QStringList symbolNames );
|
||||
/**
|
||||
* @brief deselectSymbols deselect symbols by name
|
||||
* @param symbolNames list of symbol names
|
||||
*/
|
||||
void deselectSymbols( const QStringList symbolNames );
|
||||
|
||||
public slots:
|
||||
void doExportImport();
|
||||
/**
|
||||
* @brief selectByGroup open select by group dialog
|
||||
*/
|
||||
void selectByGroup();
|
||||
/**
|
||||
* @brief selectAll selects all symbols
|
||||
*/
|
||||
void selectAll();
|
||||
/**
|
||||
* @brief clearSelection deselects all symbols
|
||||
*/
|
||||
void clearSelection();
|
||||
/**
|
||||
* Select the symbols belonging to the given group
|
||||
* @param groupName the name of the group to be selected
|
||||
*/
|
||||
void selectGroup( const QString groupName );
|
||||
/**
|
||||
* Unselect the symbols belonging to the given group
|
||||
* @param groupName the name of the group to be deselected
|
||||
*/
|
||||
void deselectGroup( const QString groupName );
|
||||
/**
|
||||
* @brief selectSmartgroup selects all symbols from a smart group
|
||||
* @param groupName
|
||||
*/
|
||||
void selectSmartgroup( const QString groupName );
|
||||
/**
|
||||
* @brief deselectSmartgroup deselects all symbols from a smart group
|
||||
* @param groupName
|
||||
*/
|
||||
void deselectSmartgroup( const QString groupName );
|
||||
|
||||
void importTypeChanged( int );
|
||||
void browse();
|
||||
@ -64,6 +107,7 @@ class GUI_EXPORT QgsStyleV2ExportImportDialog : public QDialog, private Ui::QgsS
|
||||
void moveStyles( QModelIndexList* selection, QgsStyleV2* src, QgsStyleV2* dst );
|
||||
|
||||
QProgressDialog *mProgressDlg;
|
||||
QgsStyleV2GroupSelectionDialog *mGroupSelectionDlg;
|
||||
QTemporaryFile *mTempFile;
|
||||
QNetworkAccessManager *mNetManager;
|
||||
QNetworkReply *mNetReply;
|
||||
|
||||
165
src/gui/symbology-ng/qgsstylev2groupselectiondialog.cpp
Normal file
165
src/gui/symbology-ng/qgsstylev2groupselectiondialog.cpp
Normal file
@ -0,0 +1,165 @@
|
||||
/***************************************************************************
|
||||
qgsstylev2groupselectiondialog.h
|
||||
---------------------
|
||||
begin : Oct 2015
|
||||
copyright : (C) 2015 by Alessandro Pasotti
|
||||
email : elpaso at itopen dot it
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "qgsstylev2groupselectiondialog.h"
|
||||
#include "qgsstylev2.h"
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <QStandardItem>
|
||||
|
||||
|
||||
QgsStyleV2GroupSelectionDialog::QgsStyleV2GroupSelectionDialog( QgsStyleV2 *style, QWidget *parent ) :
|
||||
QDialog( parent )
|
||||
, mStyle( style )
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
QStandardItemModel* model = new QStandardItemModel( groupTree );
|
||||
groupTree->setModel( model );
|
||||
|
||||
QStandardItem *allSymbols = new QStandardItem( tr( "All Symbols" ) );
|
||||
allSymbols->setData( "all", Qt::UserRole + 2 );
|
||||
allSymbols->setEditable( false );
|
||||
setBold( allSymbols );
|
||||
model->appendRow( allSymbols );
|
||||
|
||||
QStandardItem *group = new QStandardItem( "" ); //require empty name to get first order groups
|
||||
group->setData( "groupsheader", Qt::UserRole + 2 );
|
||||
group->setEditable( false );
|
||||
group->setFlags( group->flags() & ~Qt::ItemIsSelectable );
|
||||
buildGroupTree( group );
|
||||
group->setText( tr( "Groups" ) );//set title later
|
||||
QStandardItem *ungrouped = new QStandardItem( tr( "Ungrouped" ) );
|
||||
ungrouped->setData( 0 );
|
||||
ungrouped->setData( "group", Qt::UserRole + 2 );
|
||||
setBold( ungrouped );
|
||||
setBold( group );
|
||||
group->appendRow( ungrouped );
|
||||
model->appendRow( group );
|
||||
|
||||
QStandardItem *tag = new QStandardItem( tr( "Smart Groups" ) );
|
||||
tag->setData( "smartgroupsheader" , Qt::UserRole + 2 );
|
||||
tag->setEditable( false );
|
||||
tag->setFlags( group->flags() & ~Qt::ItemIsSelectable );
|
||||
setBold( tag );
|
||||
QgsSymbolGroupMap sgMap = mStyle->smartgroupsListMap();
|
||||
QgsSymbolGroupMap::const_iterator i = sgMap.constBegin();
|
||||
while ( i != sgMap.constEnd() )
|
||||
{
|
||||
QStandardItem *item = new QStandardItem( i.value() );
|
||||
item->setEditable( false );
|
||||
item->setData( i.key() );
|
||||
item->setData( "smartgroup" , Qt::UserRole + 2 );
|
||||
tag->appendRow( item );
|
||||
++i;
|
||||
}
|
||||
model->appendRow( tag );
|
||||
|
||||
// expand things in the group tree
|
||||
int rows = model->rowCount( model->indexFromItem( model->invisibleRootItem() ) );
|
||||
for ( int i = 0; i < rows; i++ )
|
||||
{
|
||||
groupTree->setExpanded( model->indexFromItem( model->item( i ) ), true );
|
||||
}
|
||||
connect( groupTree->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SLOT( groupTreeSelectionChanged( const QItemSelection&, const QItemSelection& ) ) );
|
||||
}
|
||||
|
||||
|
||||
QgsStyleV2GroupSelectionDialog::~QgsStyleV2GroupSelectionDialog()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void QgsStyleV2GroupSelectionDialog::setBold( QStandardItem* item )
|
||||
{
|
||||
QFont font = item->font();
|
||||
font.setBold( true );
|
||||
item->setFont( font );
|
||||
}
|
||||
|
||||
|
||||
void QgsStyleV2GroupSelectionDialog::groupTreeSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected )
|
||||
{
|
||||
QModelIndex index;
|
||||
QModelIndexList selectedItems = selected.indexes();
|
||||
QModelIndexList deselectedItems = deselected.indexes();
|
||||
|
||||
foreach ( index, deselectedItems )
|
||||
{
|
||||
if ( index.data( Qt::UserRole + 2 ).toString() == "groupsheader" )
|
||||
{
|
||||
// Ignore: it's the group header
|
||||
}
|
||||
else if ( index.data( Qt::UserRole + 2 ).toString() == "all" )
|
||||
{
|
||||
emit allDeselected( );
|
||||
}
|
||||
else if ( index.data( Qt::UserRole + 2 ).toString() == "smartgroupsheader" )
|
||||
{
|
||||
// Ignore: it's the smartgroups header
|
||||
}
|
||||
else if ( index.data( Qt::UserRole + 2 ).toString() == "smartgroup" )
|
||||
{
|
||||
emit smartgroupDeselected( index.data( ).toString() );
|
||||
}
|
||||
else if ( index.data( Qt::UserRole + 2 ).toString() == "group" )
|
||||
{ // It's a group
|
||||
emit groupDeselected( index.data( ).toString() );
|
||||
}
|
||||
}
|
||||
foreach ( index, selectedItems )
|
||||
{
|
||||
if ( index.data( Qt::UserRole + 2 ).toString( ) == "groupsheader" )
|
||||
{
|
||||
// Ignore: it's the group header
|
||||
}
|
||||
else if ( index.data( Qt::UserRole + 2 ).toString() == "all" )
|
||||
{
|
||||
emit allSelected( );
|
||||
}
|
||||
else if ( index.data( Qt::UserRole + 2 ).toString() == "smartgroupsheader" )
|
||||
{
|
||||
// Ignore: it's the smartgroups header
|
||||
}
|
||||
else if ( index.data( Qt::UserRole + 2 ).toString() == "smartgroup" )
|
||||
{
|
||||
emit smartgroupSelected( index.data( ).toString() );
|
||||
}
|
||||
else if ( index.data( Qt::UserRole + 2 ).toString() == "group" )
|
||||
{ // It's a group
|
||||
emit groupSelected( index.data( ).toString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QgsStyleV2GroupSelectionDialog::buildGroupTree( QStandardItem* &parent )
|
||||
{
|
||||
QgsSymbolGroupMap groups = mStyle->childGroupNames( parent->text() );
|
||||
QgsSymbolGroupMap::const_iterator i = groups.constBegin();
|
||||
while ( i != groups.constEnd() )
|
||||
{
|
||||
QStandardItem *item = new QStandardItem( i.value() );
|
||||
item->setData( i.key() );
|
||||
item->setData( "group" , Qt::UserRole + 2 );
|
||||
item->setEditable( false );
|
||||
parent->appendRow( item );
|
||||
buildGroupTree( item );
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
64
src/gui/symbology-ng/qgsstylev2groupselectiondialog.h
Normal file
64
src/gui/symbology-ng/qgsstylev2groupselectiondialog.h
Normal file
@ -0,0 +1,64 @@
|
||||
/***************************************************************************
|
||||
qgsstylev2groupselectiondialog.h
|
||||
---------------------
|
||||
begin : Oct 2015
|
||||
copyright : (C) 2015 by Alessandro Pasotti
|
||||
email : elpaso at itopen dot it
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QGSSTYLEV2GROUPSELECTIONDIALOG_H
|
||||
#define QGSSTYLEV2GROUPSELECTIONDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QStandardItem>
|
||||
#include "ui_qgsstylev2groupselectiondialogbase.h"
|
||||
|
||||
|
||||
class QgsStyleV2;
|
||||
|
||||
class GUI_EXPORT QgsStyleV2GroupSelectionDialog : public QDialog, private Ui::SymbolsV2GroupSelectionDialogBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QgsStyleV2GroupSelectionDialog( QgsStyleV2* style, QWidget *parent = 0 );
|
||||
~QgsStyleV2GroupSelectionDialog();
|
||||
//! Set bold font for item
|
||||
void setBold( QStandardItem *item );
|
||||
|
||||
signals:
|
||||
//! group with groupName has been selected
|
||||
void groupSelected( const QString groupName );
|
||||
//! group with groupName has been deselected
|
||||
void groupDeselected( const QString groupName );
|
||||
//! smartgroup with groupName has been selected
|
||||
void smartgroupSelected( const QString groupName );
|
||||
//! smart group with groupName has been deselected
|
||||
void smartgroupDeselected( const QString groupName );
|
||||
//! all deselected
|
||||
void allDeselected( );
|
||||
//! all selected
|
||||
void allSelected( );
|
||||
|
||||
private slots:
|
||||
void groupTreeSelectionChanged( const QItemSelection&selected, const QItemSelection& deselected );
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief build group tree
|
||||
* @param parent
|
||||
*/
|
||||
void buildGroupTree( QStandardItem *&parent );
|
||||
QgsStyleV2* mStyle;
|
||||
|
||||
};
|
||||
|
||||
#endif // QGSSTYLEV2GROUPSELECTIONDIALOG_H
|
||||
88
src/ui/qgsstylev2groupselectiondialogbase.ui
Normal file
88
src/ui/qgsstylev2groupselectiondialogbase.ui
Normal file
@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SymbolsV2GroupSelectionDialogBase</class>
|
||||
<widget class="QDialog" name="SymbolsV2GroupSelectionDialogBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>287</width>
|
||||
<height>348</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Group Selection Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTreeView" name="groupTree">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="headerHidden">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<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="QPushButton" name="okButton">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>okButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>SymbolsV2GroupSelectionDialogBase</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>391</x>
|
||||
<y>322</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>226</x>
|
||||
<y>173</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>SymbolsV2GroupSelectionDialogBase</sender>
|
||||
<signal>destroyed()</signal>
|
||||
<receiver>SymbolsV2GroupSelectionDialogBase</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>226</x>
|
||||
<y>173</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>226</x>
|
||||
<y>173</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
Loading…
x
Reference in New Issue
Block a user