#include <VP1TabBar.h>
Definition at line 41 of file VP1TabBar.h.
◆ VP1TabBar()
| VP1TabBar::VP1TabBar |
( |
QWidget * | parent = 0 | ) |
|
|
explicit |
Definition at line 66 of file VP1TabBar.cxx.
67 : QTabBar( parent ),
69{
70 setAcceptDrops( true );
71 setMouseTracking( true );
72
73
74
75
76 m_d->mActivateDragSwitchTabTimer =
new QTimer(
this );
77 m_d->mActivateDragSwitchTabTimer->setSingleShot(
true );
79
80
81}
virtual void activateDragSwitchTab()
◆ ~VP1TabBar()
| VP1TabBar::~VP1TabBar |
( |
| ) |
|
|
virtual |
◆ activateDragSwitchTab
| void VP1TabBar::activateDragSwitchTab |
( |
| ) |
|
|
protectedvirtualslot |
Definition at line 170 of file VP1TabBar.cxx.
171{
172 int tab =
selectTab( mapFromGlobal( QCursor::pos() ) );
173 if ( tab != -1 &&
m_d->mDragSwitchTab == tab )
174 setCurrentIndex(
m_d->mDragSwitchTab );
175
176 m_d->mDragSwitchTab = 0;
177}
int selectTab(const QPoint &position) const
◆ closeRequest
| void VP1TabBar::closeRequest |
( |
int | | ) |
|
|
signal |
◆ contextMenu
| void VP1TabBar::contextMenu |
( |
int | , |
|
|
const QPoint & | ) |
|
signal |
◆ dragEnterEvent()
| void VP1TabBar::dragEnterEvent |
( |
QDragEnterEvent * | event | ) |
|
|
protectedvirtual |
Definition at line 199 of file VP1TabBar.cxx.
200{
201 event->setAccepted( true );
202 QTabBar::dragEnterEvent( event );
203}
◆ dragMoveEvent()
| void VP1TabBar::dragMoveEvent |
( |
QDragMoveEvent * | event | ) |
|
|
protectedvirtual |
Definition at line 205 of file VP1TabBar.cxx.
206{
208 if ( tab != -1 ) {
210
211
213 if ( accept && tab != currentIndex() ) {
214 m_d->mDragSwitchTab = tab;
215 m_d->mActivateDragSwitchTabTimer->start( QApplication::doubleClickInterval() * 2 );
216 }
217
218 event->setAccepted( accept );
219 return;
220 }
221
222 event->setAccepted( false );
223 QTabBar::dragMoveEvent( event );
224}
void testCanDecode(const QDragMoveEvent *, bool &)
StatusCode accept(const xAOD::Muon *mu)
◆ dropEvent()
| void VP1TabBar::dropEvent |
( |
QDropEvent * | event | ) |
|
|
protectedvirtual |
Definition at line 226 of file VP1TabBar.cxx.
227{
229 if ( tab != -1 ) {
230 m_d->mActivateDragSwitchTabTimer->stop();
231 m_d->mDragSwitchTab = 0;
233 return;
234 }
235
236 QTabBar::dropEvent( event );
237}
void receivedDropEvent(int, QDropEvent *)
◆ initiateDrag
| void VP1TabBar::initiateDrag |
( |
int | | ) |
|
|
signal |
◆ isTabReorderingEnabled()
| bool VP1TabBar::isTabReorderingEnabled |
( |
| ) |
const |
◆ mouseDoubleClick
| void VP1TabBar::mouseDoubleClick |
( |
int | | ) |
|
|
signal |
◆ mouseDoubleClickEvent()
| void VP1TabBar::mouseDoubleClickEvent |
( |
QMouseEvent * | event | ) |
|
|
protectedvirtual |
Definition at line 88 of file VP1TabBar.cxx.
89{
90 if (
event->button() != Qt::LeftButton )
91 return;
92
94 if ( tab != -1 ) {
96 return;
97 }
98
99 QTabBar::mouseDoubleClickEvent( event );
100}
void mouseDoubleClick(int)
◆ mouseMiddleClick
| void VP1TabBar::mouseMiddleClick |
( |
int | | ) |
|
|
signal |
◆ mouseMoveEvent()
| void VP1TabBar::mouseMoveEvent |
( |
QMouseEvent * | event | ) |
|
|
protectedvirtual |
Definition at line 118 of file VP1TabBar.cxx.
119{
120 if (
event->buttons() == Qt::LeftButton ) {
122 if (
m_d->mDragSwitchTab && tab !=
m_d->mDragSwitchTab ) {
123 m_d->mActivateDragSwitchTabTimer->stop();
124 m_d->mDragSwitchTab = 0;
125 }
126
128 QPoint newPos = event->pos();
129 if ( newPos.x() >
m_d->mDragStart.x() +
delay || newPos.x() <
m_d->mDragStart.x() -
delay ||
130 newPos.y() >
m_d->mDragStart.y() +
delay || newPos.y() <
m_d->mDragStart.y() -
delay ) {
131 if ( tab != -1 ) {
133 return;
134 }
135 }
136 }
else if (
event->buttons() == Qt::MiddleButton ) {
137 if (
m_d->mReorderStartTab == -1 ) {
139 QPoint newPos = event->pos();
140
141 if ( newPos.x() >
m_d->mDragStart.x() +
delay || newPos.x() <
m_d->mDragStart.x() -
delay ||
142 newPos.y() >
m_d->mDragStart.y() +
delay || newPos.y() <
m_d->mDragStart.y() -
delay ) {
144 if ( tab != -1 &&
m_d->mTabReorderingEnabled ) {
145 m_d->mReorderStartTab = tab;
146 grabMouse( Qt::SizeAllCursor );
147 return;
148 }
149 }
150 } else {
152 if ( tab != -1 ) {
153 int reorderStopTab = tab;
154 if (
m_d->mReorderStartTab != reorderStopTab &&
m_d->mReorderPreviousTab != reorderStopTab ) {
155 emit
moveTab(
m_d->mReorderStartTab, reorderStopTab );
156
157 m_d->mReorderPreviousTab =
m_d->mReorderStartTab;
158 m_d->mReorderStartTab = reorderStopTab;
159
160 return;
161 }
162 }
163 }
164 }
165
166 QTabBar::mouseMoveEvent( event );
167}
double delay(std::size_t d)
◆ mousePressEvent()
| void VP1TabBar::mousePressEvent |
( |
QMouseEvent * | event | ) |
|
|
protectedvirtual |
Definition at line 102 of file VP1TabBar.cxx.
103{
104 if (
event->button() == Qt::LeftButton ) {
105
106 m_d->mDragStart =
event->pos();
107 }
else if(
event->button() == Qt::RightButton ) {
109 if ( tab != -1 ) {
111 return;
112 }
113 }
114
115 QTabBar::mousePressEvent( event );
116}
void contextMenu(int, const QPoint &)
◆ mouseReleaseEvent()
| void VP1TabBar::mouseReleaseEvent |
( |
QMouseEvent * | event | ) |
|
|
protectedvirtual |
Definition at line 179 of file VP1TabBar.cxx.
180{
181 if (
event->button() == Qt::MiddleButton ) {
182 if (
m_d->mReorderStartTab == -1 ) {
184 if ( tab != -1 ) {
186 return;
187 }
188 } else {
189 releaseMouse();
190 setCursor( Qt::ArrowCursor );
191 m_d->mReorderStartTab = -1;
192 m_d->mReorderPreviousTab = -1;
193 }
194 }
195
196 QTabBar::mouseReleaseEvent( event );
197}
void mouseMiddleClick(int)
◆ moveTab
| void VP1TabBar::moveTab |
( |
int | , |
|
|
int | ) |
|
signal |
◆ receivedDropEvent
| void VP1TabBar::receivedDropEvent |
( |
int | , |
|
|
QDropEvent * | ) |
|
signal |
◆ selectTab()
| int VP1TabBar::selectTab |
( |
const QPoint & | position | ) |
const |
Definition at line 273 of file VP1TabBar.cxx.
274{
275 for (
int i = 0;
i <
count(); ++
i )
278
279 return -1;
280}
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
◆ setTabCloseActivatePrevious()
| void VP1TabBar::setTabCloseActivatePrevious |
( |
bool | on | ) |
|
Definition at line 261 of file VP1TabBar.cxx.
262{
263 m_d->mTabCloseActivatePrevious = on;
264}
◆ setTabReorderingEnabled()
| void VP1TabBar::setTabReorderingEnabled |
( |
bool | enable | ) |
|
◆ tabCloseActivatePrevious()
| bool VP1TabBar::tabCloseActivatePrevious |
( |
| ) |
const |
Definition at line 256 of file VP1TabBar.cxx.
257{
258 return m_d->mTabCloseActivatePrevious;
259}
◆ tabLayoutChange()
| void VP1TabBar::tabLayoutChange |
( |
| ) |
|
|
protectedvirtual |
Definition at line 267 of file VP1TabBar.cxx.
268{
269 m_d->mActivateDragSwitchTabTimer->stop();
270 m_d->mDragSwitchTab = 0;
271}
◆ testCanDecode
| void VP1TabBar::testCanDecode |
( |
const QDragMoveEvent * | , |
|
|
bool & | ) |
|
signal |
◆ wheelDelta
| void VP1TabBar::wheelDelta |
( |
int | | ) |
|
|
signal |
◆ wheelEvent()
| void VP1TabBar::wheelEvent |
( |
QWheelEvent * | event | ) |
|
|
protectedvirtual |
◆ m_d
The documentation for this class was generated from the following files: