Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 6945dbdb authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Dialog buttons added to ThemeSettingsDialog.

parent be0b7d70
......@@ -14,27 +14,30 @@
ThemeSettingsDialog::ThemeSettingsDialog( QWidget *parent ) : QDialog( parent )
{
// Setup the dialog grid layout.
// Create the widget containing the palette color matrix.
QGridLayout *l = new QGridLayout();
l->setSpacing( 0 );
setLayout( l );
QGridLayout *matrixLayout = new QGridLayout();
matrixLayout->setSpacing( 0 );
matrixLayout->setContentsMargins( 0, 0, 0, 0 );
QWidget *paletteMatrix = new QWidget();
paletteMatrix->setLayout( matrixLayout );
// Define horizontal labels corresponding to color group names.
// Define matrix horizontal labels corresponding to color group names.
int buttonWidth = 0;
for( int i=0; i<QPalette::NColorGroups; ++i )
{
QString groupName = PaletteDictionary::ColorGroupName( (QPalette::ColorGroup) i );
groupName[0] = groupName[0].toUpper();
l->addWidget( new QLabel(groupName), 0, i+1, Qt::AlignHCenter );
matrixLayout->addWidget( new QLabel(groupName), 0, i+1, Qt::AlignHCenter );
int w = QApplication::fontMetrics().width( groupName ) + 10;
if( w > buttonWidth )
buttonWidth = w;
}
// Define vertical labels corresponding to color role names.
// Define matrix vertical labels corresponding to color role names.
for( int i=0; i<QPalette::NColorRoles; ++i )
{
......@@ -42,10 +45,10 @@ ThemeSettingsDialog::ThemeSettingsDialog( QWidget *parent ) : QDialog( parent )
for( int j=0; j<roleName.length(); ++j )
if( j == 0 || roleName[j-1] == '-' )
roleName[j] = roleName[j].toUpper();
l->addWidget( new QLabel(roleName.remove('-')), i+1, 0 );
matrixLayout->addWidget( new QLabel(roleName.remove('-')), i+1, 0 );
}
// Create the matrix made of buttons corresponding to the palette colors.
// Create the button matrix based on the palette colors.
for( int i=0; i<QPalette::NColorGroups; ++i )
for( int j=0; j<QPalette::NColorRoles; ++j )
......@@ -58,8 +61,22 @@ ThemeSettingsDialog::ThemeSettingsDialog( QWidget *parent ) : QDialog( parent )
connect( b, SIGNAL(clicked(bool)), this, SLOT(onColorButtonTrigger()) );
l->addWidget( b, j+1, i+1 );
matrixLayout->addWidget( b, j+1, i+1 );
}
// Create dialog "OK" and "Cancel" buttons.
QDialogButtonBox *buttons = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this );
connect( buttons, SIGNAL(accepted()), this, SLOT(accept()) );
connect( buttons, SIGNAL(rejected()), this, SLOT(reject()) );
// Set the dialog layout.
QVBoxLayout *l = new QVBoxLayout();
setLayout( l );
l->addWidget( paletteMatrix );
l->addWidget( buttons );
}
......
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