 |
ATLAS Offline Software
|
Go to the documentation of this file.
26 #include <Inventor/nodes/SoMaterial.h>
31 #include <QDataStream>
37 #include <QDoubleSpinBox>
41 #include <QRadioButton>
60 if (
w&&!
w->signalsBlocked()) {
61 w->blockSignals(
true);
77 +QString(
w->metaObject()->className())
78 +
", name="+
w->objectName());
108 if (!
m_d->
buffer->open(QIODevice::ReadOnly)) {
124 message(
"WARNING: warnUnrestored(..) was never called!");
126 message(
"Destructor WARNING: Buffer not at end!");
160 if (!
m||ba.isEmpty())
169 messageDebug(
"VP1Deserialise::restore(VP1MaterialButton)");
173 QList<SoMaterial*> mats =
mb ?
mb->handledMaterials() : QList<SoMaterial*>();
174 bool tempmat = mats.isEmpty() || !mats.at(0);
175 m = tempmat ?
new SoMaterial : mats.at(0);
180 mb->copyValuesFromMaterial(
m);
195 messageDebug(
"VP1Deserialise::restore(QColor) - name: " +
c.name());
206 messageDebug(
"VP1Deserialise::restore(VP1ColorSelectButton) - name: " + cb->objectName());
210 if (
c.isValid()&&cb&&cb->
color()!=
c) {
221 messageDebug(
"VP1Deserialise::restore(PhiSectionWidget) - name: " +
phi->objectName());
225 if (
phi&&ba != QByteArray()) {
227 phi->setState(std::move(ba));
247 messageDebug(
"VP1Deserialise::restore(QCheckBox) - name: " + cb->objectName());
259 if (cb->isChecked()!=
b) {
273 messageDebug(
"VP1Deserialise::restore(QGroupBox) - name: " + gb->objectName());
275 if (!gb->isCheckable())
276 message(
"WARNING: Asked to handled GroupBox which is not checkable: "+gb->objectName());
279 if (gb->isChecked()!=
b) {
290 messageDebug(
"VP1Deserialise::restore(QComboBox) - name: " + cb->objectName());
296 int i = cb->findText(
t);
297 if (i<0||i>cb->count()-1)
299 if (cb->currentIndex()!=
i) {
301 cb->setCurrentIndex(
i);
310 messageDebug(
"VP1Deserialise::restore(QLineEdit) - name: " + le->objectName());
325 messageDebug(
"VP1Deserialise::restore(QDoubleSpinBox) - name: " +
sb->objectName());
330 if (
sb->value()!=dbl) {
341 messageDebug(
"VP1Deserialise::restore(QSpinBox) - name: " +
sb->objectName());
346 if (
sb->value()!=
i) {
357 messageDebug(
"VP1Deserialise::restore(QSlider) - name: " +
s->objectName());
373 messageDebug(
"VP1Deserialise::restore(QToolBox) - name: " +
tb->objectName());
377 if (
i>=0&&i<tb->
count()&&
i!=
tb->currentIndex()) {
379 tb->setCurrentIndex(
i);
388 messageDebug(
"VP1Deserialise::restore(QToolBox) - name: " +
tb->objectName());
393 for (
int i = 0;
i <
tb->count(); ++
i) {
394 if (
tb->itemText(
i)==
s) {
399 if (itarget>0&&itarget<tb->
count()&&itarget!=
tb->currentIndex()) {
401 tb->setCurrentIndex(itarget);
462 QList<QRadioButton *>
l;
463 l << rb0 << rb1 << rb2 << rb3 << rb4 << rb5 << rb6 << rb7 << rb8 << rb9;
464 for (qint32
i = 0;
i <
l.count(); ++
i) {
467 messageDebug(
"VP1Deserialise::restore(QRadioButton) - name: " +
l.at(
i)->objectName());
473 if (ichecked<0||ichecked>=
l.count()||!
l.at(ichecked))
475 for (qint32
i = 0;
i <
l.count(); ++
i) {
476 QRadioButton *
rb =
l.at(
i);
477 if (
rb&&
rb->isChecked()!=(
i==ichecked)) {
479 rb->setChecked(
i==ichecked);
489 messageDebug(
"VP1Deserialise::restore(VP1CollectionWidget) - name: " + cw->objectName());
490 messageDebug(
"VP1Deserialise::restore(VP1CollectionWidget)- start...");
496 buffer.open(QIODevice::ReadOnly);
497 QDataStream state(&
buffer);
509 messageDebug(
"VP1Deserialise::restore(VP1CollectionWidget)- end.");
517 messageDebug(
"VP1Deserialise::restore(VP1CollectionSettingsButtonBase) - name: " +
w->objectName());
518 messageDebug(
"VP1Deserialise::restore(VP1CollectionSettingsButtonBase)- start...");
524 if (
w&&ba!=QByteArray()) {
526 w->restoreFromState(ba);
530 messageDebug(
"VP1Deserialise::restore(VP1CollectionSettingsButtonBase)- end.");
553 messageDebug(
"VP1Deserialise::restore(VP1EtaPhiCutWidget) - name: " +
w->objectName());
559 if (
w&&ba!=QByteArray()) {
561 w->restoreFromState(ba);
573 messageDebug(
"VP1Deserialise::restore(VP1DrawOptionsWidget) - name: " +
w->objectName());
579 if (
w&&ba!=QByteArray()) {
639 QPair<int,QList<int> > state;
650 messageDebug(
"VP1Deserialise::ignoreWidget(QWidget) - name: " +
w->objectName());
671 if (
w->inherits(
"QGroupBox"))
672 return static_cast<QGroupBox*
>(
w)->isCheckable();
674 return w->inherits(
"QCheckBox")
675 ||
w->inherits(
"QRadioButton")
676 ||
w->inherits(
"QComboBox")
677 ||
w->inherits(
"QAbstractSpinBox")
678 ||
w->inherits(
"QSlider")
679 ||
w->inherits(
"QToolBox")
680 ||
w->inherits(
"PhiSectionWidget")
681 ||
w->inherits(
"VP1EtaPhiCutWidget")
682 ||
w->inherits(
"VP1DrawOptionsWidget")
683 ||
w->inherits(
"QLineEdit")
684 ||
w->inherits(
"VP1ColorSelectButton")
685 ||
w->inherits(
"VP1MaterialButton");
708 if (
object->isWidgetType()&&!
object->objectName().startsWith(
"qt_")) {
709 QWidget * wid =
static_cast<QWidget*
>(
object);
711 QString
s(
"WARNING Unrestored widget of type: "+QString(wid->metaObject()->className())+
" and object name = "+wid->objectName());
721 for (QObject* o :
object->children())
QMap< QByteArray, QByteArray > VP1CollStates
virtual ~VP1Deserialise()
VP1Deserialise(const QByteArray &, IVP1System *sys=0)
QSet< QWidget * > ignoredWidgets
Scalar phi() const
phi method
void messageVerbose(const QString &) const
void disableUnrestoredChecks()
void restoreByTitle(QToolBox *)
VP1Deserialise * theclass
static void decrementNumberOfInstantiations()
static QString str(const QString &s)
void messageDebug(const QString &) const
static bool deserialiseSoMaterial(QByteArray &, SoMaterial *&)
void handle(const QWidget *w)
QSet< const QWidget * > handledWidgets
static unsigned numberOfInstantiations
static unsigned numberOfInstantiations()
QWidget * widgetNeedingUnblock
void widgetHandled(QWidget *)
void warnUnrestored(QObject *)
const double mb
1mb to cm2
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
void ignoreObsoletePhiSectionWidgetState()
void message(const QString &) const
bool expectsPersistification(QWidget *w)
void ignoreWidget(QWidget *)
QByteArray restoreByteArray()