mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-29 20:30:54 +00:00
Added some more checks, signal and slots related to widget adding.
--HG-- branch : gsoc2012-gui-editor
This commit is contained in:
parent
c91e7492bb
commit
45f5d6cc0d
6 changed files with 46 additions and 1 deletions
|
@ -49,6 +49,16 @@ namespace GUIEditor
|
|||
|
||||
void AddWidgetWidget::onAddClicked()
|
||||
{
|
||||
if( groupEdit->text().isEmpty() )
|
||||
{
|
||||
QMessageBox::warning( NULL,
|
||||
tr( "WARNING" ),
|
||||
tr( "You need to be adding the new widget into a group!" ),
|
||||
QMessageBox::Ok );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if( nameEdit->text().isEmpty() )
|
||||
{
|
||||
QMessageBox::warning( NULL,
|
||||
|
@ -60,5 +70,8 @@ namespace GUIEditor
|
|||
}
|
||||
|
||||
close();
|
||||
|
||||
Q_EMIT adding( groupEdit->text(), widgetCB->currentText(), nameEdit->text() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@ namespace GUIEditor
|
|||
|
||||
private Q_SLOTS:
|
||||
void onAddClicked();
|
||||
|
||||
Q_SIGNALS:
|
||||
void adding( const QString &parentGroup, const QString &widgetType, const QString &name );
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
|
|
|
@ -54,5 +54,24 @@ namespace GUIEditor
|
|||
CWidgetManager::getInstance()->setCurrentEditorSelection( "" );
|
||||
}
|
||||
}
|
||||
|
||||
void CEditorMessageProcessor::onAdd( const QString &parentGroup, const QString &widgetType, const QString &name )
|
||||
{
|
||||
// Check if this group exists
|
||||
CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( std::string( parentGroup.toAscii() ) );
|
||||
if( e == NULL )
|
||||
return;
|
||||
CInterfaceGroup *g = dynamic_cast< CInterfaceGroup* >( e );
|
||||
if( g == NULL )
|
||||
return;
|
||||
|
||||
// Check if an element already exists with that name
|
||||
if( g->getElement( std::string( name.toAscii() ) ) != NULL )
|
||||
return;
|
||||
|
||||
// Create and add the new widget
|
||||
//CViewBase *v = NULL;
|
||||
//g->addView( v );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace GUIEditor
|
|||
|
||||
public Q_SLOTS:
|
||||
void onDelete();
|
||||
void onAdd( const QString &parentGroup, const QString &widgetType, const QString &name );
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -99,6 +99,12 @@ namespace GUIEditor
|
|||
|
||||
connect( viewPort, SIGNAL( guiLoadComplete() ), this, SLOT( onGUILoaded() ) );
|
||||
connect( widgetProps, SIGNAL( treeChanged() ), this, SLOT( onTreeChanged() ) );
|
||||
connect(
|
||||
addWidgetWidget,
|
||||
SIGNAL( adding( const QString&, const QString&, const QString& ) ),
|
||||
messageProcessor,
|
||||
SLOT( onAdd( const QString&, const QString&, const QString& ) )
|
||||
);
|
||||
}
|
||||
|
||||
GUIEditorWindow::~GUIEditorWindow()
|
||||
|
|
Loading…
Reference in a new issue