Implemented add and remove buttons.

--HG--
branch : dfighter-tools
hg/feature/qt5
dfighter1985 10 years ago
parent ed1c600c4d
commit c51b519845

@ -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…
Cancel
Save