============================================================================
| 707 | |
| 708 | //============================================================================ |
| 709 | void CDockAreaWidget::setCurrentIndex(int index) |
| 710 | { |
| 711 | auto TabBar = d->tabBar(); |
| 712 | if (index < 0 || index > (TabBar->count() - 1)) |
| 713 | { |
| 714 | qWarning() << Q_FUNC_INFO << "Invalid index" << index; |
| 715 | return; |
| 716 | } |
| 717 | |
| 718 | auto cw = d->ContentsLayout->currentWidget(); |
| 719 | auto nw = d->ContentsLayout->widget(index); |
| 720 | if (cw == nw && !nw->isHidden()) |
| 721 | { |
| 722 | return; |
| 723 | } |
| 724 | |
| 725 | Q_EMIT currentChanging(index); |
| 726 | TabBar->setCurrentIndex(index); |
| 727 | d->ContentsLayout->setCurrentIndex(index); |
| 728 | d->ContentsLayout->currentWidget()->show(); |
| 729 | Q_EMIT currentChanged(index); |
| 730 | } |
| 731 | |
| 732 | |
| 733 | //============================================================================ |
no test coverage detected