18#include "ui_vp1customtourframewidget.h"
21#include <QDragEnterEvent>
27#include <QtWidgetsVersion>
35 Ui::VP1CustomTourFrameWidgetForm
ui;
47 ui.label_snapshot->setText(
"");
49 int maxheight =
static_cast<int>(0.5+QFontMetricsF(
ui.pushButton_remove->font()).height()*1.05+2);
50 ui.pushButton_remove->setMaximumHeight(maxheight);
51 ui.pushButton_show->setMaximumHeight(maxheight);
52 ui.checkBox_frameEnabled->setMaximumHeight(maxheight);
63 ui.label_camtypeicon->setText(
"");
70 ?
":/icons/icons/perspective.png"
71 :
":/icons/icons/ortho.png") );
80 : QFrame(parent),
m_d(new
Imp(this))
82 m_d->camPerspective = camPerspective;
90 : QFrame(parent),
m_d(new
Imp(this))
93 m_d->camState = s.restoreByteArray();
94 m_d->camPerspective = s.restoreBool();
95 s.restore(
m_d->ui.doubleSpinBox_zoomToFrameTime);
96 s.restore(
m_d->ui.doubleSpinBox_stayOnFrameTime);
98 s.restore(
m_d->ui.doubleSpinBox_clipVolumePercentOfATLAS);
100 s.restore(
m_d->ui.comboBox_approachMethod);
101 s.restore(
m_d->ui.checkBox_frameEnabled);
102 QPixmap pm = s.restore<QPixmap>();
104 m_d->ui.label_snapshot->setPixmap(pm);
105 s.warnUnrestored(
this);
113 s.save(
m_d->camState);
114 s.save(
m_d->camPerspective);
115 s.save(
m_d->ui.doubleSpinBox_zoomToFrameTime);
116 s.save(
m_d->ui.doubleSpinBox_stayOnFrameTime);
117 s.save(
m_d->ui.doubleSpinBox_clipVolumePercentOfATLAS);
118 s.save(
m_d->ui.comboBox_approachMethod);
119 s.save(
m_d->ui.checkBox_frameEnabled);
120#if QTWIDGETS_VERSION >= 0x050F00
121 s.save(
m_d->ui.label_snapshot->pixmap(Qt::ReturnByValue));
123 s.save(
m_d->ui.label_snapshot->pixmap() ? *(
m_d->ui.label_snapshot->pixmap()) : QPixmap());
138 if (sender()==
m_d->ui.pushButton_moveEarlier)
140 else if (sender()==
m_d->ui.pushButton_moveLater)
142 else if (sender()==
m_d->ui.pushButton_remove)
144 else if (sender()==
m_d->ui.pushButton_show)
152 return m_d->ui.checkBox_frameEnabled->isChecked();
158 return m_d->ui.comboBox_approachMethod->currentIndex()==0;
163 return m_d->ui.comboBox_approachMethod->currentIndex()==2;
169 return m_d->ui.doubleSpinBox_zoomToFrameTime->value();
175 return m_d->ui.doubleSpinBox_stayOnFrameTime->value();
181 return m_d->ui.doubleSpinBox_clipVolumePercentOfATLAS->value();
187 return m_d->camPerspective;
193 return m_d->camState;
199 m_d->ui.pushButton_moveEarlier->setVisible(b);
205 m_d->ui.pushButton_moveLater->setVisible(b);
211 if (event->button() == Qt::LeftButton)
212 m_d->dragStartPosition =
event->pos();
213 QFrame::mousePressEvent(event);
219 if (!(event->buttons() & Qt::LeftButton))
221 if ((event->pos() -
m_d->dragStartPosition).manhattanLength()
222 < QApplication::startDragDistance())
224 QDrag *drag =
new QDrag(
this);
225 QMimeData *mimeData =
new QMimeData;
226 mimeData->setData(
"vp1/customtourframe", QByteArray() );
227 drag->setMimeData(mimeData);
228#if QTWIDGETS_VERSION >= 0x050F00
229 QPixmap pm =
m_d->ui.label_snapshot->pixmap(Qt::ReturnByValue);
231 QPixmap pm =
m_d->ui.label_snapshot->pixmap() ? *(
m_d->ui.label_snapshot->pixmap()) : QPixmap();
234 drag->setPixmap(pm );
235 drag->exec(Qt::CopyAction | Qt::MoveAction);
241 if (event->source()&&event->source()!=
this && event->mimeData()->hasFormat(
"vp1/customtourframe"))
242 event->acceptProposedAction();
248 QByteArray
data =
event->mimeData()->data(
"vp1/customtourframe");
249 event->acceptProposedAction();
259 m_d->ui.label_snapshot->setPixmap(pm);
char data[hepevt_bytes_allocation_ATLAS]