added a scroll area to the mixer board so that a large number of clients can be supported, thanks to doloopuntil for his example code
This commit is contained in:
parent
e99e5b2720
commit
bef3506a38
2 changed files with 19 additions and 7 deletions
|
@ -464,19 +464,20 @@ double CChannelFader::CalcFaderGain ( const int value )
|
|||
* CAudioMixerBoard *
|
||||
\******************************************************************************/
|
||||
CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) :
|
||||
QGroupBox ( parent ),
|
||||
QScrollArea ( parent ),
|
||||
vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ),
|
||||
vecStoredFaderLevels ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_FADER_MAX ),
|
||||
vecStoredFaderIsSolo ( MAX_NUM_STORED_FADER_SETTINGS, false ),
|
||||
iNewClientFaderLevel ( 100 ),
|
||||
bNoFaderVisible ( true )
|
||||
{
|
||||
// add group box and hboxlayout
|
||||
pGroupBox = new QGroupBox(); // will be added to the scroll area which is then the parent
|
||||
pMainLayout = new QHBoxLayout ( pGroupBox );
|
||||
|
||||
// set title text (default: no server given)
|
||||
SetServerName ( "" );
|
||||
|
||||
// add hboxlayout
|
||||
pMainLayout = new QHBoxLayout ( this );
|
||||
|
||||
// create all mixer controls and make them invisible
|
||||
vecpChanFader.Init ( MAX_NUM_CHANNELS );
|
||||
|
||||
|
@ -489,6 +490,15 @@ CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) :
|
|||
// insert horizontal spacer
|
||||
pMainLayout->addItem ( new QSpacerItem ( 0, 0, QSizePolicy::Expanding ) );
|
||||
|
||||
// add the group box to the scroll area
|
||||
setMinimumWidth ( 200 ); // at least two faders shall be visible
|
||||
setWidget ( pGroupBox );
|
||||
setWidgetResizable ( true ); // make sure it fills the entire scroll area
|
||||
setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
|
||||
setHorizontalScrollBarPolicy ( Qt::ScrollBarAsNeeded );
|
||||
setStyleSheet ( "background: transparent;" );
|
||||
setFrameShape ( QFrame::NoFrame );
|
||||
|
||||
|
||||
// Connections -------------------------------------------------------------
|
||||
// CODE TAG: MAX_NUM_CHANNELS_TAG
|
||||
|
@ -601,11 +611,11 @@ void CAudioMixerBoard::SetServerName ( const QString& strNewServerName )
|
|||
// set title text of the group box
|
||||
if ( strNewServerName.isEmpty() )
|
||||
{
|
||||
setTitle ( "Server" );
|
||||
pGroupBox->setTitle ( "Server" );
|
||||
}
|
||||
else
|
||||
{
|
||||
setTitle ( strNewServerName );
|
||||
pGroupBox->setTitle ( strNewServerName );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <QFrame>
|
||||
#include <QScrollArea>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
|
@ -89,7 +90,7 @@ signals:
|
|||
};
|
||||
|
||||
|
||||
class CAudioMixerBoard : public QGroupBox
|
||||
class CAudioMixerBoard : public QScrollArea
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -121,6 +122,7 @@ protected:
|
|||
const double dValue );
|
||||
|
||||
CVector<CChannelFader*> vecpChanFader;
|
||||
QGroupBox* pGroupBox;
|
||||
QHBoxLayout* pMainLayout;
|
||||
bool bNoFaderVisible;
|
||||
|
||||
|
|
Loading…
Reference in a new issue