Make group selection optional.

--HG--
branch : dfighter-tools
This commit is contained in:
dfighter1985 2014-10-08 18:45:17 +02:00
parent 08b6675b3d
commit d7d62e690c
5 changed files with 21 additions and 1 deletions

View file

@ -517,6 +517,8 @@ namespace NLGUI
CInterfaceElement* addWidgetToGroup( std::string &group, std::string &widgetClass, std::string &widgetName ); CInterfaceElement* addWidgetToGroup( std::string &group, std::string &widgetClass, std::string &widgetName );
void setGroupSelection( bool b ){ groupSelection = b; }
private: private:
CWidgetManager(); CWidgetManager();
~CWidgetManager(); ~CWidgetManager();
@ -610,6 +612,7 @@ namespace NLGUI
std::string currentEditorSelection; std::string currentEditorSelection;
bool groupSelection;
}; };
} }

View file

@ -2408,7 +2408,7 @@ namespace NLGUI
// This may happen when alt-tab has been used => the sheet is dragged but the left button is up // This may happen when alt-tab has been used => the sheet is dragged but the left button is up
if (!CCtrlDraggable::getDraggedSheet()) if (!CCtrlDraggable::getDraggedSheet())
{ {
if( CInterfaceElement::getEditorMode() ) if( CInterfaceElement::getEditorMode() && groupSelection )
{ {
for( sint32 i = _GroupsUnderPointer.size() - 1; i >= 0; i-- ) for( sint32 i = _GroupsUnderPointer.size() - 1; i >= 0; i-- )
{ {
@ -3516,6 +3516,7 @@ namespace NLGUI
setScreenWH( 0, 0 ); setScreenWH( 0, 0 );
currentEditorSelection = ""; currentEditorSelection = "";
groupSelection = false;
} }
CWidgetManager::~CWidgetManager() CWidgetManager::~CWidgetManager()

View file

@ -130,5 +130,10 @@ namespace GUIEditor
e->setActive( false ); e->setActive( false );
e->setActive( true ); e->setActive( true );
} }
void CEditorMessageProcessor::onSetGroupSelection( bool b )
{
CWidgetManager::getInstance()->setGroupSelection( b );
}
} }

View file

@ -38,6 +38,7 @@ namespace GUIEditor
public Q_SLOTS: public Q_SLOTS:
void onDelete(); void onDelete();
void onAdd( const QString &parentGroup, const QString &widgetType, const QString &name ); void onAdd( const QString &parentGroup, const QString &widgetType, const QString &name );
void onSetGroupSelection( bool b );
private: private:
CWidgetInfoTree *tree; CWidgetInfoTree *tree;

View file

@ -399,6 +399,16 @@ namespace GUIEditor
connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onAddWidgetClicked() ) ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onAddWidgetClicked() ) );
m->addAction( a ); m->addAction( a );
// ----------------------------------------------------------------------------------
m->addSeparator();
a = new QAction( "Select groups", this );
a->setCheckable( true );
a->setChecked( false );
connect( a, SIGNAL( triggered( bool ) ), messageProcessor, SLOT( onSetGroupSelection( bool ) ) );
m->addAction( a );
menu = m; menu = m;
} }
} }