15 #include <QDialogButtonBox> 16 #include <QPushButton> 41 Qt::UniqueConnection );
42 mStackedWidget->insertWidget( 0, panel );
43 mStackedWidget->setCurrentIndex( 0 );
48 return qobject_cast<
QgsPanelWidget *>( mStackedWidget->widget( 0 ) );
56 QWidget *widget = mStackedWidget->widget( 0 );
57 mStackedWidget->removeWidget( widget );
63 for (
int i = mStackedWidget->count() - 1; i >= 0; i-- )
65 if (
QgsPanelWidget *panelWidget = qobject_cast<QgsPanelWidget *>( mStackedWidget->widget( i ) ) )
67 mStackedWidget->removeWidget( panelWidget );
68 if ( panelWidget->autoDelete() )
70 panelWidget->deleteLater();
73 else if ( QWidget *widget = mStackedWidget->widget( i ) )
75 mStackedWidget->removeWidget( widget );
76 widget->deleteLater();
82 this->updateBreadcrumb();
87 return qobject_cast<
QgsPanelWidget *>( mStackedWidget->currentWidget() );
93 if ( mStackedWidget->currentIndex() <= 0 )
103 setUpdatesEnabled(
false );
104 mStackedWidget->setUpdatesEnabled(
false );
106 for (
int i = mStackedWidget->count() - 1; i > 0; --i )
108 if (
QgsPanelWidget *panelWidget = qobject_cast<QgsPanelWidget *>( mStackedWidget->widget( i ) ) )
110 panelWidget->acceptPanel();
113 setUpdatesEnabled(
true );
114 mStackedWidget->setUpdatesEnabled(
true );
124 int index = mStackedWidget->addWidget( panel );
125 mStackedWidget->setCurrentIndex( index );
129 this->updateBreadcrumb();
135 mStackedWidget->setCurrentIndex( mStackedWidget->currentIndex() - 1 );
136 mStackedWidget->removeWidget( panel );
139 panel->deleteLater();
142 if ( mStackedWidget->currentIndex() == 0 )
147 this->updateBreadcrumb();
152 if ( e->button() == Qt::BackButton )
160 if ( e->key() == Qt::Key_Escape )
166 void QgsPanelWidgetStack::updateBreadcrumb()
169 const auto constMTitles = mTitles;
170 for ( QString title : constMTitles )
172 breadcrumb += QStringLiteral(
" %1 >" ).arg( title );
175 breadcrumb.chop( 1 );
176 mTitleText->setText( breadcrumb );