fixed the possibility to recursively open stylemgr and symbol selector

This commit is contained in:
Arunmozhi 2012-12-26 16:50:55 +05:30
parent c41cf2eac1
commit 3bb33b827e
5 changed files with 14 additions and 3 deletions

View File

@ -350,6 +350,10 @@ bool QgsStyleV2ManagerDialog::addSymbol()
}
// get symbol design
// NOTE : Set the parent widget as "this" to notify the Symbol selector
// that, it is being called by Style Manager, so recursive calling
// of style manger and symbol slector can be arrested
// Look Also: editSymbol()
QgsSymbolV2SelectorDialog dlg( symbol, mStyle, NULL, this );
if ( dlg.exec() == 0 )
{

View File

@ -62,6 +62,13 @@ QgsSymbolsListWidget::QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* sty
viewSymbols->setModel( model );
connect( viewSymbols->selectionModel(), SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), this, SLOT( setSymbolFromStyle( const QModelIndex & ) ) );
if ( parent )
{
if ( dynamic_cast<QgsStyleV2ManagerDialog*>( parent->parentWidget() ) )
{
btnStyle->setVisible( false );
}
}
// Set the Style Menu under btnStyle
QMenu *styleMenu = new QMenu( btnStyle );
QAction *styleMgrAction = new QAction( "Style Manager", styleMenu );

View File

@ -30,7 +30,7 @@ class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::SymbolsListW
Q_OBJECT
public:
QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* style, QMenu* menu, QWidget* parent = NULL );
QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* style, QMenu* menu, QWidget* parent );
public slots:
void setSymbolFromStyle( const QModelIndex & index );

View File

@ -332,7 +332,7 @@ void QgsSymbolV2SelectorDialog::layerChanged()
{
// then it must be a symbol
// Now populate symbols of that type using the symbols list widget:
QWidget *symbolsList = new QgsSymbolsListWidget( currentItem->symbol(), mStyle, mAdvancedMenu );
QWidget *symbolsList = new QgsSymbolsListWidget( currentItem->symbol(), mStyle, mAdvancedMenu, this );
setWidget( symbolsList );
connect( symbolsList, SIGNAL( changed() ), this, SLOT( symbolChanged() ) );
}

View File

@ -37,7 +37,7 @@ class GUI_EXPORT QgsSymbolV2SelectorDialog : public QDialog, private Ui::QgsSymb
Q_OBJECT
public:
QgsSymbolV2SelectorDialog( QgsSymbolV2* symbol, QgsStyleV2* style, const QgsVectorLayer* vl, QWidget* parent = NULL, bool embedded = false );
QgsSymbolV2SelectorDialog( QgsSymbolV2* symbol, QgsStyleV2* style, const QgsVectorLayer* vl, QWidget* parent = 0, bool embedded = false );
//! return menu for "advanced" button - create it if doesn't exist and show the advanced button
QMenu* advancedMenu();