Implemented add and remove buttons.

--HG--
branch : dfighter-tools
This commit is contained in:
dfighter1985 2014-09-02 19:26:02 +02:00
parent ed1c600c4d
commit c51b519845
3 changed files with 24 additions and 2 deletions

View file

@ -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);

View file

@ -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

View file

@ -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 )