15 setAttribute( Qt::WA_DeleteOnClose );
19 QVBoxLayout*
main =
new QVBoxLayout(
this );
20 main->setSpacing ( 2 );
21 main->setContentsMargins ( 2, 2, 2, 2 );
23 QHBoxLayout* edits =
new QHBoxLayout;
25 QLabel* lb_wl =
us_label( tr(
"Wavelength:" ) );
26 edits->addWidget( lb_wl );
29 connect(
le_wl, SIGNAL( editingFinished() ), SLOT(
edited() ) );
30 edits->addWidget(
le_wl );
33 edits->addWidget( lb_value );
36 connect(
le_value, SIGNAL( editingFinished() ), SLOT(
edited() ) );
39 main->addLayout( edits );
45 connect(
lw_table, SIGNAL( itemSelectionChanged(
void ) ),
48 connect(
lw_table, SIGNAL( itemDoubleClicked ( QListWidgetItem* ) ),
51 QBoxLayout* buttons =
new QHBoxLayout;
54 connect( pb_cancel, SIGNAL( clicked() ), SLOT( reject() ) );
55 buttons->addWidget( pb_cancel );
58 connect( pb_accept, SIGNAL( clicked() ), SLOT(
done() ) );
59 buttons->addWidget( pb_accept );
61 main->addLayout( buttons );
79 if (
le_wl->text().isEmpty() ||
le_value->text().isEmpty() )
return;
81 double wl =
le_wl ->text().toDouble();
82 double value =
le_value->text().toDouble();
84 if ( wl < 190.0 || wl > 750.0 )
86 QMessageBox::warning(
this,
88 tr(
"The wavelength must be in the range of 190-750." ) );
96 QMessageBox::warning(
this,
98 tr(
"The value entered cannot be negative." ) );
104 local.insert( wl, value );
114 QList< double > keys =
local.keys();
117 for (
int i = 0; i < keys.size(); i++ )
119 QString wavelength = QString::number( keys[ i ],
'f', 1 );
120 QString value = QString::number(
local[ keys[ i ] ],
'f', 4 );
122 lw_table->addItem( wavelength +
" / " + value );
128 QStringList v =
lw_table->currentItem()->text().split(
" / " );
129 le_wl ->setText( v[ 0 ] );
135 int response = QMessageBox::question(
this,
136 tr(
"Delete Entry?" ),
137 tr(
"Delete the current entry?" ),
138 QMessageBox::Yes, QMessageBox::Cancel );
140 if ( response == QMessageBox::Yes )
142 QStringList v = item->text().split(
" / " );
143 local.remove( v[ 0 ].toDouble() );