mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-30 04:40:53 +00:00
Added some more checks, signal and slots related to widget adding.
This commit is contained in:
parent
dad844cc99
commit
00fa4cb321
6 changed files with 46 additions and 1 deletions
|
@ -49,6 +49,16 @@ namespace GUIEditor
|
||||||
|
|
||||||
void AddWidgetWidget::onAddClicked()
|
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() )
|
if( nameEdit->text().isEmpty() )
|
||||||
{
|
{
|
||||||
QMessageBox::warning( NULL,
|
QMessageBox::warning( NULL,
|
||||||
|
@ -60,5 +70,8 @@ namespace GUIEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
close();
|
close();
|
||||||
|
|
||||||
|
Q_EMIT adding( groupEdit->text(), widgetCB->currentText(), nameEdit->text() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,9 @@ namespace GUIEditor
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onAddClicked();
|
void onAddClicked();
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void adding( const QString &parentGroup, const QString &widgetType, const QString &name );
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,9 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
|
|
|
@ -54,5 +54,24 @@ namespace GUIEditor
|
||||||
CWidgetManager::getInstance()->setCurrentEditorSelection( "" );
|
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:
|
public Q_SLOTS:
|
||||||
void onDelete();
|
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( viewPort, SIGNAL( guiLoadComplete() ), this, SLOT( onGUILoaded() ) );
|
||||||
connect( widgetProps, SIGNAL( treeChanged() ), this, SLOT( onTreeChanged() ) );
|
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()
|
GUIEditorWindow::~GUIEditorWindow()
|
||||||
|
|
Loading…
Reference in a new issue