66 StackWidgetInfo::StackWidgetInfo(
bool _editable,QString _name,QWidget* _widget) :
75 for ( uint i = 0 ; i < stackWidgetList_.size(); ++i) {
76 if ( stackWidgetList_[i].
name == _name ) {
77 _widget = stackWidgetList_[i].widget;
88 slotGetStackWidget( _name, widget );
91 emit log(
LOGERR,tr(
"Name already existing"));
95 stackedWidget_->addWidget(_widget);
98 slotUpdateStackMenu();
104 QWidget* oldWidget = 0;
106 for ( uint i = 0 ; i < stackWidgetList_.size(); ++i) {
107 if ( stackWidgetList_[i].
name == _name ) {
108 oldWidget = stackWidgetList_[i].widget;
114 if ( oldWidget == 0 ) {
115 emit log(
LOGERR,tr(
"Did not find widget to update stackwidget"));
119 stackedWidget_->removeWidget( oldWidget );
120 stackWidgetList_.erase( stackWidgetList_.begin() + index );
122 stackedWidget_->addWidget(_widget);
123 stackWidgetList_.push_back(
StackWidgetInfo(
true, _name , _widget ) );
125 slotUpdateStackMenu();
131 QString objectName = _action->text();
134 for ( uint i = 0 ; i < stackWidgetList_.size(); ++i) {
135 if ( stackWidgetList_[i].
name == objectName ) {
136 widget = stackWidgetList_[i].widget;
142 emit log(
LOGERR,tr(
"Cannot set Widget"));
146 stackedWidget_->setCurrentWidget ( widget );
151 if ( stackWidgetList_.size() > 1 ) {
153 if ( stackMenu_ == 0 ) {
154 stackMenu_ =
new QMenu(tr(
"Views"));
155 menuBar()->addMenu(stackMenu_ );
159 if ( ! stackMenu_->isEmpty() )
163 QActionGroup* actionGroup =
new QActionGroup( stackMenu_ );
164 actionGroup->setExclusive(
true );
166 for ( uint i = 0 ; i < stackWidgetList_.size() ; ++i ) {
167 QAction* newAction =
new QAction(stackWidgetList_[i].
name, actionGroup);
168 newAction->setText(stackWidgetList_[i].name);
171 stackMenu_->addActions(actionGroup->actions());
174 connect( actionGroup, SIGNAL( triggered( QAction * ) ),
this, SLOT( slotViewMenuAction( QAction * ) ) );
179 if ( stackMenu_ != 0 ) {
182 menuBar()->removeAction( stackMenu_->menuAction() );
void slotGetStackWidget(QString _name, QWidget *&_widget)
QMenu containing the recently opened files.
void slotViewMenuAction(QAction *_action)
QMenu containing the recently opened files.
QWidget const * widget()
returns the pointer to the plugin tool widget
void slotUpdateStackMenu()
QMenu containing the recently opened files.
const QString & name()
return the name
void slotAddStackWidget(QString _name, QWidget *_widget)
QMenu containing the recently opened files.
void slotUpdateStackWidget(QString _name, QWidget *_widget)
QMenu containing the recently opened files.