|
32 | 32 | #include <QBoxLayout> |
33 | 33 | #include <QApplication> |
34 | 34 | #include <QElapsedTimer> |
| 35 | +#include <QMenu> |
35 | 36 |
|
36 | 37 | #include "AutoHideDockContainer.h" |
37 | 38 | #include "AutoHideSideBar.h" |
@@ -272,10 +273,65 @@ bool CAutoHideTab::event(QEvent* event) |
272 | 273 | return Super::event(event); |
273 | 274 | } |
274 | 275 |
|
| 276 | + |
275 | 277 | //============================================================================ |
276 | 278 | bool CAutoHideTab::iconOnly() const |
277 | 279 | { |
278 | 280 | return CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideSideBarsIconOnly) && !icon().isNull(); |
279 | 281 | } |
280 | 282 |
|
| 283 | + |
| 284 | +//============================================================================ |
| 285 | +void CAutoHideTab::contextMenuEvent(QContextMenuEvent* ev) |
| 286 | +{ |
| 287 | + ev->accept(); |
| 288 | + //d->saveDragStartMousePosition(ev->globalPos()); |
| 289 | + |
| 290 | + const bool isFloatable = d->DockWidget->features().testFlag(CDockWidget::DockWidgetFloatable); |
| 291 | + QAction* Action; |
| 292 | + QMenu Menu(this); |
| 293 | + |
| 294 | + |
| 295 | + Action = Menu.addAction(tr("Detach"), this, SLOT(setDockWidgetFloating())); |
| 296 | + Action->setEnabled(isFloatable); |
| 297 | + auto IsPinnable = d->DockWidget->features().testFlag(CDockWidget::DockWidgetPinnable); |
| 298 | + Action->setEnabled(IsPinnable); |
| 299 | + |
| 300 | + auto menu = Menu.addMenu(tr("Pin To...")); |
| 301 | + menu->setEnabled(IsPinnable); |
| 302 | + //d->createAutoHideToAction(tr("Top"), SideBarTop, menu); |
| 303 | + //d->createAutoHideToAction(tr("Left"), SideBarLeft, menu); |
| 304 | + //d->createAutoHideToAction(tr("Right"), SideBarRight, menu); |
| 305 | + //d->createAutoHideToAction(tr("Bottom"), SideBarBottom, menu); |
| 306 | + |
| 307 | + /*Menu.addSeparator(); |
| 308 | + Action = Menu.addAction(tr("Close"), this, SIGNAL(closeRequested())); |
| 309 | + Action->setEnabled(isClosable()); |
| 310 | + if (d->DockArea->openDockWidgetsCount() > 1) |
| 311 | + { |
| 312 | + Action = Menu.addAction(tr("Close Others"), this, SIGNAL(closeOtherTabsRequested())); |
| 313 | + }*/ |
| 314 | + Menu.exec(ev->globalPos()); |
| 315 | +} |
| 316 | + |
| 317 | + |
| 318 | +//============================================================================ |
| 319 | +void CAutoHideTab::mouseDoubleClickEvent(QMouseEvent *event) |
| 320 | +{ |
| 321 | + if (event->button() == Qt::LeftButton) |
| 322 | + { |
| 323 | + setDockWidgetFloating(); |
| 324 | + } |
| 325 | + |
| 326 | + Super::mouseDoubleClickEvent(event); |
| 327 | +} |
| 328 | + |
| 329 | + |
| 330 | +//============================================================================ |
| 331 | +void CAutoHideTab::setDockWidgetFloating() |
| 332 | +{ |
| 333 | + dockWidget()->setFloating(); |
| 334 | +} |
| 335 | + |
| 336 | + |
281 | 337 | } |
0 commit comments