mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-19 05:36:13 +00:00
Implemented add and remove buttons.
This commit is contained in:
parent
556c949058
commit
5dfe7e8923
3 changed files with 24 additions and 2 deletions
|
@ -162,6 +162,10 @@ public:
|
|||
NLMISC::CSmartPtr<CFormDfn> Parent;
|
||||
};
|
||||
|
||||
void addEntry( const std::string &name );
|
||||
|
||||
void removeEntry( uint idx );
|
||||
|
||||
// ** IO functions
|
||||
void write (xmlDocPtr root, const char *filename);
|
||||
|
||||
|
|
|
@ -41,6 +41,21 @@ void warning (bool exception, const char *format, ... );
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormDfn::addEntry( const std::string &name )
|
||||
{
|
||||
CEntry entry;
|
||||
entry.setName( name.c_str() );
|
||||
Entries.push_back( entry );
|
||||
}
|
||||
|
||||
void CFormDfn::removeEntry( uint idx )
|
||||
{
|
||||
std::vector< CEntry >::iterator itr = Entries.begin() + idx;
|
||||
Entries.erase( itr );
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormDfn::write (xmlDocPtr doc, const char *filename)
|
||||
{
|
||||
// Save filename
|
||||
|
|
|
@ -33,8 +33,8 @@ GeorgesDockWidget( parent )
|
|||
{
|
||||
m_ui.setupUi( this );
|
||||
|
||||
m_ui.addButton->setEnabled( false );
|
||||
m_ui.removeButton->setEnabled( false );
|
||||
//m_ui.addButton->setEnabled( false );
|
||||
//m_ui.removeButton->setEnabled( false );
|
||||
|
||||
m_pvt = new GeorgesDFNDialogPvt();
|
||||
m_pvt->ctrl->setBrowser( m_ui.browser );
|
||||
|
@ -119,6 +119,7 @@ void GeorgesDFNDialog::onAddClicked()
|
|||
}
|
||||
|
||||
m_ui.list->addItem( name );
|
||||
m_pvt->dfn->addEntry( name.toUtf8().constData() );
|
||||
}
|
||||
|
||||
void GeorgesDFNDialog::onRemoveClicked()
|
||||
|
@ -129,6 +130,8 @@ void GeorgesDFNDialog::onRemoveClicked()
|
|||
|
||||
QListWidgetItem *item = m_ui.list->takeItem( row );
|
||||
delete item;
|
||||
|
||||
m_pvt->dfn->removeEntry( row );
|
||||
}
|
||||
|
||||
void GeorgesDFNDialog::onCurrentRowChanged( int row )
|
||||
|
|
Loading…
Reference in a new issue