2023-10-05 Fred Gleason <fredg@paravelsystems.com>

* Fixed a regression in rdairplay(1) and rdpanel(1) that caused
	extraneous buttons to appear when resizing the sound panel.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2023-10-05 10:55:28 -04:00
parent 18c3d85108
commit 7c46d99bc3
5 changed files with 17 additions and 12 deletions

View File

@@ -257,13 +257,15 @@ QString RDButtonPanel::json(int padding,bool final) const
void RDButtonPanel::setVisible(bool state)
{
printf("Calling RDButtonPanel::setVisible(%d) @ %p\n",state,this);
RDWidget::setVisible(state);
for(int i=0;i<PANEL_MAX_BUTTON_ROWS;i++) {
for(int j=0;j<PANEL_MAX_BUTTON_COLUMNS;j++) {
panel_button[i][j]->setVisible(state);
}
}
if(state) {
UpdateViewport();
}
}
@@ -271,9 +273,9 @@ void RDButtonPanel::buttonClickedData(int id)
{
int pnum=id/(PANEL_MAX_BUTTON_COLUMNS*PANEL_MAX_BUTTON_ROWS);
int pos=id%(PANEL_MAX_BUTTON_COLUMNS*PANEL_MAX_BUTTON_ROWS);
printf("emitting buttonClicked(%d,%d,%d)\n",
pnum,pos%PANEL_MAX_BUTTON_COLUMNS,pos/PANEL_MAX_BUTTON_COLUMNS);
emit buttonClicked(pnum,pos%PANEL_MAX_BUTTON_COLUMNS,pos/PANEL_MAX_BUTTON_COLUMNS);
emit buttonClicked(pnum,pos%PANEL_MAX_BUTTON_COLUMNS,
pos/PANEL_MAX_BUTTON_COLUMNS);
}
@@ -287,6 +289,12 @@ void RDButtonPanel::resizeEvent(QResizeEvent *e)
PANEL_BUTTON_SIZE_Y);
}
}
UpdateViewport();
}
void RDButtonPanel::UpdateViewport()
{
for(int i=0;i<PANEL_MAX_BUTTON_ROWS;i++) {
for(int j=0;j<PANEL_MAX_BUTTON_COLUMNS;j++) {
RDPanelButton *button=panel_button[i][j];