Commit 66a2be94 authored by Frédéric Brière's avatar Frédéric Brière
Browse files

radselect: Make it possible to rebuild the button grid

For the radical sort order to be changeable at runtime, the button grid
must be made rebuildable.
parent 96f6becd
......@@ -40,6 +40,15 @@ ButtonGrid::~ButtonGrid()
void ButtonGrid::buildRadicalButtons()
{
if( layout() )
{
// Instead of iterating over our children and deleting them one by one, we
// simply reparent the previous layout to a temporary widget; when it goes
// out of scope, everything will be automatically deleted.
// Thanks to https://stackoverflow.com/a/10439207 for the tip!
QWidget().setLayout( layout() );
}
//Setup the grid
QGridLayout *grid = new QGridLayout( this );
......@@ -85,6 +94,8 @@ void ButtonGrid::buildRadicalButtons()
}
delete radicalMap;
setLayout( grid );
updateButtons();
}
void ButtonGrid::clearSelections()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment