48 #include <QVBoxLayout> 50 #include "SideArea.hh" 51 #include "SideElement.hh" 59 layout_ =
new QVBoxLayout;
60 layout_->setSpacing (0);
62 QVBoxLayout *l =
new QVBoxLayout;
63 l->addLayout (layout_);
65 l->setContentsMargins(2, 2, 2, 2);
73 QIcon *_icon, QWidget *_headerAreaWidget)
76 layout_->addWidget (e);
78 plugins_.push_back(_plugin);
79 itemNames_.push_back(_name);
87 if(_position < 0 || _position >= items_.size())
91 QVector<SideElement*>::iterator it = items_.begin();
92 for(; it != items_.end(); ++it) {
93 if( (*it)->name() == _name )
97 if(it != items_.end()) {
98 layout_->removeWidget(*it);
99 layout_->insertWidget(_position, (*it));
108 if(_position < 0 || _position >= items_.size())
112 QVector<SideElement*>::iterator it = items_.begin();
114 for(; it != items_.end(); ++it, ++i) {
115 if( ((*it)->name() == _name)
116 && (plugins_[i] == _plugin) )
120 bool active = (*it)->active();
122 if(it != items_.end()) {
123 layout_->removeWidget(*it);
124 layout_->insertWidget(_position, (*it));
133 return items_.size();
142 layout_->removeWidget (e);
153 void SideArea::expandAll()
161 void SideArea::expand(QWidget *sideElementWidget,
bool expand)
165 if (e->
widget() == sideElementWidget)
174 _settings.beginGroup (
"SideArea");
179 _settings.endGroup ();
186 _settings.beginGroup (
"SideArea");
191 _settings.endGroup ();
198 sideElementState_[_viewMode + e->
name()] = e->
active();
214 for (
int i=0; i < items_.count(); i++)
215 if ( items_[i]->name() == _name ){
216 items_[i]->setActive(_active);
QWidget const * widget()
returns the pointer to the plugin tool widget
void setElementActive(QString _name, bool _active)
set the active state of given element
SideArea(QWidget *_parent=0)
bool active()
returns if the SideElement is active
void setActive(bool _active)
Set the element as active.
void restoreState(QSettings &_settings)
restores the state
void saveState(QSettings &_settings)
returns the current state
void moveItemToPosition(const QString &_name, int _position)
Move a toolbox widget to a given position.
void addItem(QObject const *const _plugin, QWidget *_w, QString _name, QIcon *_icon=0, QWidget *_headerAreaWidget=0)
int getNumberOfWidgets() const
Get number of widgets.
void restoreViewModeState(const QString &_viewMode)
restores the active state of _viewMode
void clear()
clears the whole tool widget area
const QList< const QObject * > & plugins()
Get plugins in side area.
void saveViewModeState(const QString &_viewMode)
saves the active state of _viewMode
void saveState(QSettings &_settings)
saves the current state
const QString & name()
return the name
const QStringList & names()
Get item names.
void restoreState(QSettings &_settings)
restores the state