jfjoch_viewer: Start image number from 1 in the toolbar and image list

This commit is contained in:
2026-04-21 11:43:12 +02:00
parent c2de9c2b67
commit 36e726a8d2
2 changed files with 7 additions and 7 deletions
+5 -5
View File
@@ -98,8 +98,8 @@ JFJochViewerToolbarImage::JFJochViewerToolbarImage(QWidget *parent) : QToolBar(p
void JFJochViewerToolbarImage::updateButtons() {
if (image_count_in_dataset > 0) {
current_image_edit->setDisabled(false);
current_image_edit->setText(QString::number(curr_image));
current_image_edit_validator->setRange(0, image_count_in_dataset - 1);
current_image_edit->setText(QString::number(curr_image + 1));
current_image_edit_validator->setRange(1, image_count_in_dataset);
left_button->setDisabled(curr_image < jump_value);
right_button->setDisabled(curr_image >= image_count_in_dataset - jump_value);
@@ -123,7 +123,7 @@ void JFJochViewerToolbarImage::updateButtons() {
if (image_count_in_dataset == 0)
total_number_label->setText("/ - ");
else
total_number_label->setText("/" + QString::number(image_count_in_dataset - 1));
total_number_label->setText("/" + QString::number(image_count_in_dataset));
}
void JFJochViewerToolbarImage::setImageNumber(int64_t total_images, int64_t current_image) {
@@ -173,8 +173,8 @@ void JFJochViewerToolbarImage::editFinalized() {
bool ok;
int editedValue = current_image_edit->text().toInt(&ok);
if (ok && editedValue >= 0 && editedValue <= image_count_in_dataset - 1) {
emit loadImage(editedValue, sum);
if (ok && editedValue >= 1 && editedValue <= image_count_in_dataset) {
emit loadImage(editedValue - 1, sum);
}
}
@@ -123,7 +123,7 @@ void JFJochViewerImageListWindow::datasetLoaded(std::shared_ptr<const JFJochRead
if (dataset->max_value.size() > i)
max_value = dataset->max_value[i];
addDataRow(i,
addDataRow(i + 1,
bkg_estimate,
indexing_result,
spot_count,
@@ -156,5 +156,5 @@ void JFJochViewerImageListWindow::onTableRowDoubleClicked(const QModelIndex &ind
QModelIndex sourceIndex = proxyModel->mapToSource(index);
int imageNumber = tableModel->item(sourceIndex.row(), 0)->data(Qt::DisplayRole).toInt();
emit imageSelected(imageNumber, 1);
emit imageSelected(imageNumber - 1, 1);
}