60 StackWidgetInfo::StackWidgetInfo(
bool _editable,QString _name,QWidget* _widget) :
69 for ( uint i = 0 ; i < stackWidgetList_.size(); ++i) {
70 if ( stackWidgetList_[i].
name == _name ) {
71 _widget = stackWidgetList_[i].widget;
82 slotGetStackWidget( _name, widget );
85 emit log(
LOGERR,tr(
"Name already existing"));
89 stackedWidget_->addWidget(_widget);
92 slotUpdateStackMenu();
98 QWidget* oldWidget = 0;
100 for ( uint i = 0 ; i < stackWidgetList_.size(); ++i) {
101 if ( stackWidgetList_[i].
name == _name ) {
102 oldWidget = stackWidgetList_[i].widget;
108 if ( oldWidget == 0 ) {
109 emit log(
LOGERR,tr(
"Did not find widget to update stackwidget"));
113 stackedWidget_->removeWidget( oldWidget );
114 stackWidgetList_.erase( stackWidgetList_.begin() + index );
116 stackedWidget_->addWidget(_widget);
117 stackWidgetList_.push_back(
StackWidgetInfo(
true, _name , _widget ) );
119 slotUpdateStackMenu();
125 QString objectName = _action->text();
128 for ( uint i = 0 ; i < stackWidgetList_.size(); ++i) {
129 if ( stackWidgetList_[i].
name == objectName ) {
130 widget = stackWidgetList_[i].widget;
136 emit log(
LOGERR,tr(
"Cannot set Widget"));
140 stackedWidget_->setCurrentWidget ( widget );
145 if ( stackWidgetList_.size() > 1 ) {
147 if ( stackMenu_ == 0 ) {
148 stackMenu_ =
new QMenu(tr(
"Views"));
149 menuBar()->addMenu(stackMenu_ );
153 if ( ! stackMenu_->isEmpty() )
157 QActionGroup* actionGroup =
new QActionGroup( stackMenu_ );
158 actionGroup->setExclusive(
true );
160 for ( uint i = 0 ; i < stackWidgetList_.size() ; ++i ) {
161 QAction* newAction =
new QAction(stackWidgetList_[i].
name, actionGroup);
162 newAction->setText(stackWidgetList_[i].name);
165 stackMenu_->addActions(actionGroup->actions());
168 connect( actionGroup, SIGNAL( triggered( QAction * ) ),
this, SLOT( slotViewMenuAction( QAction * ) ) );
173 if ( stackMenu_ != 0 ) {
176 menuBar()->removeAction( stackMenu_->menuAction() );
QWidget const * widget()
returns the pointer to the plugin tool widget
const QString & name()
return the name