Brief description of class still missing. More...
#include <PropertyEditor.h>
Public Member Functions | |
| void | addCategory (QIcon icon, QString caption, ExpandTabWidget *w) |
| void | addTab (QString category, QString title, PropertyWidget *w) |
| PropertyEditor (QWidget *parent=0) | |
| PropertyProxy * | proxy () const |
| void | removeCategory (QString category) |
| void | restoreStates () |
| void | saveStates () |
| void | setProxy (PropertyProxy *proxy) |
| void | takeWidgets () |
| ExpandTabWidget * | widget (QString category) |
| ~PropertyEditor () | |
Static Public Member Functions | |
| static PropertyEditor * | instance () |
Protected Member Functions | |
| virtual bool | eventFilter (QObject *watched, QEvent *event) |
| virtual void | moveEvent (QMoveEvent *) |
| virtual void | resizeEvent (QResizeEvent *) |
Brief description of class still missing.
Full description of class still missing
| QGpGuiTools::PropertyEditor::PropertyEditor | ( | QWidget * | parent = 0 | ) |
Description of constructor still missing
References QGpCoreTools::CoreApplicationPrivate::addGlobalObject(), QGpGuiTools::Settings::getRect(), QGpGuiTools::PropertyCategorySettings::set(), QGpGuiTools::PropertyCategorySettings::setClickTime(), and QGpCoreTools::tr().
: QWidget(parent, Qt::Tool)
{
ASSERT(!_instance);
resize(400, 600);
_instance=this;
Application::addGlobalObject(this);
_proxy=0;
setWhatsThis(tr("<p>When you select more than one object at a time, "
"there may be some properties marked in red, meaning that properties differ between "
"widgets. <b>Touching red properties will uniformize them across all objects.</b></p>"));
QVBoxLayout * vboxLayout=new QVBoxLayout(this);
_tab=new QTabWidget(this);
_tab->setTabPosition(QTabWidget::West);
connect(_tab, SIGNAL(currentChanged(int)), this, SLOT(currentCategoryChanged(int)));
vboxLayout->addWidget(_tab);
// Restore category settings to registry
QSettings reg;
reg.beginGroup("PropertyEditor");
QStringList categoryKeys=reg.childGroups();
for(QStringList::iterator it=categoryKeys.begin(); it!=categoryKeys.end();it++) {
reg.beginGroup(*it);
QStringList tabKeys=reg.value( "keys" ).toStringList();
QList<QVariant> tabStates=reg.value( "states" ).toList();
QStringList tabScrollPositions=reg.value( "scrollPositions" ).toStringList();
time_t t=reg.value( "clickTime" ).toInt();
if(tabKeys.count()>0 &&
tabKeys.count()==tabStates.count() &&
tabKeys.count()==tabScrollPositions.count()) {
PropertyCategorySettings * s=new PropertyCategorySettings;
s->set(tabKeys, tabStates, tabScrollPositions);
s->setClickTime(t);
_categorySettings.insert( *it, s);
}
reg.endGroup();
}
Settings::getRect(this, "PropertyEditor" );
}
Description of destructor still missing
{
QMap<QString, PropertyCategorySettings *>::iterator it;
// Save category settings to registry
QSettings reg;
reg.beginGroup("PropertyEditor");
for(it=_categorySettings.begin(); it!=_categorySettings.end();it++) {
reg.beginGroup(it.key());
reg.setValue( "keys", it.value()->keys());
reg.setValue( "states", it.value()->states());
reg.setValue( "scrollPositions", it.value()->scrollPositions());
reg.setValue( "clickTime", (int)it.value()->clickTime());
reg.endGroup();
}
// Delete settings
for(it=_categorySettings.begin(); it!=_categorySettings.end();it++) {
delete it.value();
}
_instance=0;
}
| void QGpGuiTools::PropertyEditor::addCategory | ( | QIcon | icon, |
| QString | caption, | ||
| ExpandTabWidget * | w | ||
| ) |
Referenced by QGpGuiTools::PropertyProxy::addCategory(), and QGpGuiTools::PropertyProxy::setEditor().
{
PropertyArea * pa=new PropertyArea(this);
w->installEventFilter(this);
pa->setWidget(w);
_tab->blockSignals(true); // currentCategoryChanged called only after user click
_tab->addTab(pa, caption);
_tab->blockSignals(false);
_categories.insert(caption, pa);
_propertyAreas.insert(w, pa);
// Current category restore
QMap<QString, PropertyCategorySettings *>::iterator it;
time_t currentCategoryTime=0;
if(_tab->count()>0) {
QString categoryName=_tab->tabText(_tab->currentIndex());
it=_categorySettings.find(categoryName);
if(it!=_categorySettings.end()) {
currentCategoryTime=it.value()->clickTime();
}
}
it=_categorySettings.find(caption);
if(it!=_categorySettings.end()) {
if(currentCategoryTime<it.value()->clickTime()) {
_tab->blockSignals(true); // currentCategoryChanged called only after user click
_tab->setCurrentIndex(_tab->count()-1);
_tab->blockSignals(false);
}
}
}
| void QGpGuiTools::PropertyEditor::addTab | ( | QString | category, |
| QString | title, | ||
| PropertyWidget * | w | ||
| ) |
Referenced by QGpGuiTools::PropertyProxy::addTab().
{
QMap<QString, QWidget *>::iterator it=_categories.find(category);
if(it!=_categories.end()) {
PropertyArea * pa=static_cast<PropertyArea *>(it.value());
static_cast<ExpandTabWidget *>(pa->widget())->addWidget(title, w);
}
}
| bool QGpGuiTools::PropertyEditor::eventFilter | ( | QObject * | watched, |
| QEvent * | event | ||
| ) | [protected, virtual] |
References QGpGuiTools::PropertyArea::resizeContent().
{
ExpandTabWidget * w=qobject_cast<ExpandTabWidget *>(watched);
if(w) {
if(event->type()==QEvent::LayoutRequest) {
PropertyArea * pa=_propertyAreas[w];
pa->resizeContent();
}
}
return false;
}
| static PropertyEditor* QGpGuiTools::PropertyEditor::instance | ( | ) | [inline, static] |
Referenced by QGpGuiTools::PropertyProxy::addCategory(), QGpGuiTools::PropertyProxy::addTab(), QGpGuiTools::PropertyProxy::raiseEditor(), QGpGuiTools::PropertyProxy::removeTab(), QGpGuiTools::PropertyProxy::restoreStates(), QGpGuiTools::PropertyProxy::saveStates(), QGpGuiTools::PropertyProxy::setEditor(), and QGpGuiTools::PropertyProxy::~PropertyProxy().
{return _instance;}
| void QGpGuiTools::PropertyEditor::moveEvent | ( | QMoveEvent * | ) | [protected, virtual] |
References QGpGuiTools::Settings::setRect().
{
Settings::setRect(this, "propertyEditor" );
}
| PropertyProxy* QGpGuiTools::PropertyEditor::proxy | ( | ) | const [inline] |
Referenced by setProxy().
{return _proxy;}
| void QGpGuiTools::PropertyEditor::removeCategory | ( | QString | category | ) |
Referenced by QGpGuiTools::PropertyProxy::removeTab().
{
QMap<QString, QWidget *>::iterator it=_categories.find(category);
if(it!=_categories.end()) {
int i=_tab->indexOf(it.value());
_tab->blockSignals(true); // currentCategoryChanged called only after user click
_tab->removeTab(i);
_tab->blockSignals(false);
PropertyArea * pa=static_cast<PropertyArea *>(it.value());
_propertyAreas.remove(static_cast<ExpandTabWidget *>(pa->widget()));
delete pa;
_categories.erase(it);
if(_tab->count()==0) hide();
}
}
| void QGpGuiTools::PropertyEditor::resizeEvent | ( | QResizeEvent * | ) | [protected, virtual] |
References QGpGuiTools::Settings::setSize().
{
Settings::setSize(this, "propertyEditor" );
}
Referenced by QGpGuiTools::PropertyProxy::restoreStates().
{
int n=_tab->count();
for(int i=0; i<n;i++) {
restoreState(i);
}
}
Referenced by QGpGuiTools::PropertyProxy::saveStates(), and QGpGuiTools::PropertyProxy::~PropertyProxy().
{
int n=_tab->count();
for(int i=0; i<n;i++) {
saveState(i);
}
}
| void QGpGuiTools::PropertyEditor::setProxy | ( | PropertyProxy * | proxy | ) |
References proxy(), QGpGuiTools::PropertyProxy::setEditor(), takeWidgets(), QGpGuiTools::PropertyProxy::title(), and QGpCoreTools::tr().
Referenced by QGpGuiTools::PropertyProxy::raiseEditor().
Remove all categories, delete ExpandTabWidget but do not delete individual widgets
Referenced by setProxy(), and QGpGuiTools::PropertyProxy::~PropertyProxy().
{
_tab->blockSignals(true); // currentCategoryChanged called only after user click
int n=_tab->count();
for(int i=0; i<n;i++) {
PropertyArea * pa=static_cast<PropertyArea *>(_tab->widget(0));
static_cast<ExpandTabWidget *>(pa->widget())->takeWidgets();
_tab->removeTab(0);
delete pa;
}
_categories.clear();
_propertyAreas.clear();
_tab->blockSignals(false);
}
| ExpandTabWidget * QGpGuiTools::PropertyEditor::widget | ( | QString | category | ) |
Referenced by QGpGuiTools::PropertyProxy::removeTab().
{
QMap<QString, QWidget *>::iterator it=_categories.find(category);
if(it!=_categories.end()) {
PropertyArea * pa=static_cast<PropertyArea *>(it.value());
return static_cast<ExpandTabWidget *>(pa->widget());
} else {
return 0;
}
}