54 #include <QVBoxLayout>
56 #include "SideArea.hh"
57 #include "SideElement.hh"
65 layout_ =
new QVBoxLayout;
66 layout_->setSpacing (0);
68 QVBoxLayout *l =
new QVBoxLayout;
69 l->addLayout (layout_);
71 l->setContentsMargins(2, 2, 2, 2);
79 QIcon *_icon, QWidget *_headerAreaWidget)
82 layout_->addWidget (e);
85 itemNames_.push_back(_name);
93 if(_position < 0 || _position >= items_.size())
97 QVector<SideElement*>::iterator it = items_.begin();
98 for(; it != items_.end(); ++it) {
99 if( (*it)->name() == _name )
103 if(it != items_.end()) {
104 layout_->removeWidget(*it);
105 layout_->insertWidget(_position, (*it));
114 if(_position < 0 || _position >= items_.size())
118 QVector<SideElement*>::iterator it = items_.begin();
120 for(; it != items_.end(); ++it, ++i) {
121 if( ((*it)->name() == _name)
126 bool active = (*it)->active();
128 if(it != items_.end()) {
129 layout_->removeWidget(*it);
130 layout_->insertWidget(_position, (*it));
139 return items_.size();
148 layout_->removeWidget (e);
159 void SideArea::expandAll()
167 void SideArea::expand(QWidget *sideElementWidget,
bool expand)
171 if (e->
widget() == sideElementWidget)
180 _settings.beginGroup (
"SideArea");
185 _settings.endGroup ();
192 _settings.beginGroup (
"SideArea");
197 _settings.endGroup ();
204 sideElementState_[_viewMode + e->
name()] = e->
active();
220 for (
int i=0; i < items_.count(); i++)
221 if ( items_[i]->name() == _name ){
222 items_[i]->setActive(_active);
const QList< const QObject * > & plugins()
Get plugins in side area.
void restoreState(QSettings &_settings)
restores the state
void moveItemToPosition(const QString &_name, int _position)
Move a toolbox widget to a given position.
void setElementActive(QString _name, bool _active)
set the active state of given element
SideArea(QWidget *_parent=0)
const QString & name()
return the name
void setActive(bool _active)
Set the element as active.
void saveState(QSettings &_settings)
returns the current state
int getNumberOfWidgets() const
Get number of widgets.
void saveViewModeState(const QString &_viewMode)
saves the active state of _viewMode
QWidget const * widget()
returns the pointer to the plugin tool widget
std::vector< PluginInfo > plugins_
List of all loaded plugins_.
const QStringList & names()
Get item names.
void restoreViewModeState(const QString &_viewMode)
restores the active state of _viewMode
void clear()
clears the whole tool widget area
void addItem(QObject const *const _plugin, QWidget *_w, QString _name, QIcon *_icon=0, QWidget *_headerAreaWidget=0)
void saveState(QSettings &_settings)
saves the current state
void restoreState(QSettings &_settings)
restores the state
bool active()
returns if the SideElement is active