Changeset 372 for trunk/tools/designer/src/lib/shared
- Timestamp:
- Dec 2, 2009, 4:30:02 AM (16 years ago)
- Location:
- trunk/tools/designer/src/lib/shared
- Files:
-
- 10 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/designer/src/lib/shared/actionrepository.cpp
r2 r372 291 291 static bool handleImageDragEnterMoveEvent(QDropEvent *event) 292 292 { 293 #ifndef QT_NO_DRAGANDDROP 293 294 QtResourceView::ResourceType type; 294 295 const bool rc = QtResourceView::decodeMimeData(event->mimeData(), &type) && type == QtResourceView::ResourceImage; … … 298 299 event->ignore(); 299 300 return rc; 301 #else 302 return 0; 303 #endif 300 304 } 301 305 302 306 static void handleImageDropEvent(const QAbstractItemView *iv, QDropEvent *event, ActionModel *am) 303 307 { 308 #ifndef QT_NO_DRAGANDDROP 304 309 const QModelIndex index = iv->indexAt(event->pos()); 305 310 if (!index.isValid()) { … … 307 312 return; 308 313 } 314 #endif 309 315 310 316 if (!handleImageDragEnterMoveEvent(event)) 311 317 return; 312 318 319 #ifndef QT_NO_DRAGANDDROP 313 320 am->dropMimeData(event->mimeData(), event->proposedAction(), index.row(), 0, iv->rootIndex()); 321 #endif 314 322 } 315 323 … … 322 330 return; 323 331 332 #ifndef QT_NO_DRAGANDDROP 324 333 QDrag *drag = new QDrag(dragParent); 325 334 QMimeData *data = model->mimeData(indexes); … … 329 338 330 339 drag->start(supportedActions); 340 #endif 331 341 } 332 342 … … 336 346 m_model(model) 337 347 { 348 #ifndef QT_NO_DRAGANDDROP 338 349 setDragEnabled(true); 339 350 setAcceptDrops(true); 340 351 setDropIndicatorShown(true); 341 352 setDragDropMode(DragDrop); 353 #endif 342 354 setModel(model); 343 355 setRootIsDecorated(false); … … 368 380 void ActionTreeView::dragEnterEvent(QDragEnterEvent *event) 369 381 { 382 #ifndef QT_NO_DRAGANDDROP 370 383 handleImageDragEnterMoveEvent(event); 384 #endif 371 385 } 372 386 373 387 void ActionTreeView::dragMoveEvent(QDragMoveEvent *event) 374 388 { 389 #ifndef QT_NO_DRAGANDDROP 375 390 handleImageDragEnterMoveEvent(event); 391 #endif 376 392 } 377 393 378 394 void ActionTreeView::dropEvent(QDropEvent *event) 379 395 { 396 #ifndef QT_NO_DRAGANDDROP 380 397 handleImageDropEvent(this, event, m_model); 398 #endif 381 399 } 382 400 … … 414 432 m_model(model) 415 433 { 434 #ifndef QT_NO_DRAGANDDROP 416 435 setDragEnabled(true); 417 436 setAcceptDrops(true); 418 437 setDropIndicatorShown(true); 419 438 setDragDropMode(DragDrop); 439 #endif 420 440 setModel(model); 421 441 setTextElideMode(Qt::ElideMiddle); … … 449 469 void ActionListView::dragEnterEvent(QDragEnterEvent *event) 450 470 { 471 #ifndef QT_NO_DRAGANDDROP 451 472 handleImageDragEnterMoveEvent(event); 473 #endif 452 474 } 453 475 454 476 void ActionListView::dragMoveEvent(QDragMoveEvent *event) 455 477 { 478 #ifndef QT_NO_DRAGANDDROP 456 479 handleImageDragEnterMoveEvent(event); 480 #endif 457 481 } 458 482 459 483 void ActionListView::dropEvent(QDropEvent *event) 460 484 { 485 #ifndef QT_NO_DRAGANDDROP 461 486 handleImageDropEvent(this, event, m_model); 487 #endif 462 488 } 463 489 … … 647 673 void ActionRepositoryMimeData::accept(QDragMoveEvent *event) const 648 674 { 675 #ifndef QT_NO_DRAGANDDROP 649 676 if (event->proposedAction() == m_dropAction) { 650 677 event->acceptProposedAction(); … … 653 680 event->accept(); 654 681 } 682 #endif 655 683 } 656 684 -
trunk/tools/designer/src/lib/shared/formwindowbase_p.h
r2 r372 170 170 CRLFLineTerminator, 171 171 NativeLineTerminator = 172 #if defined (Q_OS_WIN) 172 #if defined (Q_OS_WIN) || defined(Q_OS_OS2) 173 173 CRLFLineTerminator 174 174 #else -
trunk/tools/designer/src/lib/shared/orderdialog.cpp
r2 r372 46 46 #include "orderdialog_p.h" 47 47 #include "iconloader_p.h" 48 #include "ui_orderdialog.h" 48 #ifndef QT_NO_DRAGANDDROP 49 # include "ui_orderdialog.h" 50 #else 51 # include "ui_orderdialog_nodnd.h" 52 #endif 49 53 50 54 #include <QtDesigner/QExtensionManager> -
trunk/tools/designer/src/lib/shared/orderdialog_nodnd.ui
r362 r372 82 82 <height>0</height> 83 83 </size> 84 </property>85 <property name="dragDropMode" >86 <enum>QAbstractItemView::InternalMove</enum>87 84 </property> 88 85 <property name="selectionMode" > -
trunk/tools/designer/src/lib/shared/qdesigner_dnditem.cpp
r2 r372 154 154 drag->setPixmap(QPixmap::fromImage(image)); 155 155 #else 156 #ifndef QT_NO_DRAGANDDROP 156 157 drag->setPixmap(widgetPixmap); 158 #endif 157 159 #endif 158 160 } … … 189 191 QPixmap pixmap = QPixmap::fromImage(image); 190 192 pixmap.setMask(mask); 193 #ifndef QT_NO_DRAGANDDROP 191 194 drag->setPixmap(pixmap); 195 #endif 192 196 } 193 197 break; … … 197 201 m_globalStartPos = m_items.first()->decoration()->pos() + m_items.first()->hotSpot(); 198 202 m_hotSpot = m_globalStartPos - decorationTopLeft; 203 #ifndef QT_NO_DRAGANDDROP 199 204 drag->setHotSpot(m_hotSpot); 200 205 201 206 drag->setMimeData(this); 207 #endif 202 208 } 203 209 … … 219 225 return Qt::IgnoreAction; 220 226 227 #ifndef QT_NO_DRAGANDDROP 221 228 QDrag *drag = new QDrag(dragSource); 222 229 QDesignerMimeData *mimeData = new QDesignerMimeData(items, drag); … … 237 244 238 245 return executedAction; 246 #else 247 return Qt::IgnoreAction; 248 #endif 239 249 } 240 250 … … 270 280 void QDesignerMimeData::acceptEventWithAction(Qt::DropAction desiredAction, QDropEvent *e) 271 281 { 282 #ifndef QT_NO_DRAGANDDROP 272 283 if (e->proposedAction() == desiredAction) { 273 284 e->acceptProposedAction(); … … 276 287 e->accept(); 277 288 } 289 #endif 278 290 } 279 291 -
trunk/tools/designer/src/lib/shared/qdesigner_menu.cpp
r2 r372 165 165 } 166 166 167 #ifndef QT_NO_DRAGANDDROP 167 168 QDrag *drag = new QDrag(this); 168 169 drag->setPixmap(ActionRepositoryMimeData::actionDragPixmap(action)); 169 170 drag->setMimeData(new ActionRepositoryMimeData(action, dropAction)); 171 #endif 170 172 171 173 const int old_index = m_currentIndex; 172 174 m_currentIndex = -1; 173 175 176 #ifndef QT_NO_DRAGANDDROP 174 177 if (drag->start(dropAction) == Qt::IgnoreAction) { 178 #else 179 { 180 #endif 175 181 if (dropAction == Qt::MoveAction) { 176 182 QAction *previous = safeActionAt(index); … … 712 718 void QDesignerMenu::dragEnterEvent(QDragEnterEvent *event) 713 719 { 720 #ifndef QT_NO_DRAGANDDROP 714 721 const ActionRepositoryMimeData *d = qobject_cast<const ActionRepositoryMimeData*>(event->mimeData()); 715 722 if (!d || d->actionList().empty()) { … … 734 741 break; 735 742 } 743 #endif 736 744 } 737 745 738 746 void QDesignerMenu::dragMoveEvent(QDragMoveEvent *event) 739 747 { 748 #ifndef QT_NO_DRAGANDDROP 740 749 if (actionGeometry(m_addSeparator).contains(event->pos())) { 741 750 event->ignore(); … … 773 782 break; 774 783 } 784 #endif 775 785 } 776 786 … … 784 794 void QDesignerMenu::dropEvent(QDropEvent *event) 785 795 { 796 #ifndef QT_NO_DRAGANDDROP 786 797 m_showSubMenuTimer->stop(); 787 798 hideSubMenu(); … … 820 831 event->ignore(); 821 832 } 833 #endif 822 834 adjustIndicator(QPoint(-1, -1)); 823 835 } -
trunk/tools/designer/src/lib/shared/qdesigner_menubar.cpp
r2 r372 328 328 hideMenu(index); 329 329 330 #ifndef QT_NO_DRAGANDDROP 330 331 QDrag *drag = new QDrag(this); 331 332 drag->setPixmap(ActionRepositoryMimeData::actionDragPixmap(action)); 332 333 drag->setMimeData(new ActionRepositoryMimeData(action, Qt::MoveAction)); 334 #endif 333 335 334 336 const int old_index = m_currentIndex; 335 337 m_currentIndex = -1; 336 338 339 #ifndef QT_NO_DRAGANDDROP 337 340 if (drag->start(Qt::MoveAction) == Qt::IgnoreAction) { 341 #else 342 { 343 #endif 338 344 InsertActionIntoCommand *cmd = new InsertActionIntoCommand(fw); 339 345 cmd->init(this, action, safeActionAt(index)); … … 629 635 void QDesignerMenuBar::dragEnterEvent(QDragEnterEvent *event) 630 636 { 637 #ifndef QT_NO_DRAGANDDROP 631 638 const ActionRepositoryMimeData *d = qobject_cast<const ActionRepositoryMimeData*>(event->mimeData()); 632 639 if (!d || d->actionList().empty()) { … … 650 657 break; 651 658 } 659 #endif 652 660 } 653 661 654 662 void QDesignerMenuBar::dragMoveEvent(QDragMoveEvent *event) 655 663 { 664 #ifndef QT_NO_DRAGANDDROP 656 665 const ActionRepositoryMimeData *d = qobject_cast<const ActionRepositoryMimeData*>(event->mimeData()); 657 666 if (!d || d->actionList().empty()) { … … 674 683 break; 675 684 } 685 #endif 676 686 } 677 687 … … 687 697 m_dragging = false; 688 698 699 #ifndef QT_NO_DRAGANDDROP 689 700 if (const ActionRepositoryMimeData *d = qobject_cast<const ActionRepositoryMimeData*>(event->mimeData())) { 690 701 … … 707 718 } 708 719 event->ignore(); 720 #endif 709 721 } 710 722 -
trunk/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp
r2 r372 215 215 216 216 m_mousePressed = false; 217 #ifndef QT_NO_DRAGANDDROP 217 218 QDrag *drg = new QDrag(m_tabWidget); 218 219 drg->setMimeData(new qdesigner_internal::MyMimeData(m_tabWidget)); 220 #endif 219 221 220 222 m_dragIndex = index; … … 225 227 QLabel *label = new QLabel(m_dragLabel); 226 228 label->adjustSize(); 229 #ifndef QT_NO_DRAGANDDROP 227 230 drg->setPixmap(QPixmap::grabWidget(label)); 231 #endif 228 232 label->deleteLater(); 229 233 } else { 234 #ifndef QT_NO_DRAGANDDROP 230 235 drg->setPixmap(m_dragIcon.pixmap(22, 22)); 236 #endif 231 237 } 232 238 233 239 m_tabWidget->removeTab(m_dragIndex); 234 240 241 #ifndef QT_NO_DRAGANDDROP 235 242 const Qt::DropActions dropAction = drg->start(Qt::MoveAction); 243 #else 244 const Qt::DropActions dropAction = Qt::IgnoreAction; 245 #endif 236 246 237 247 if (dropAction == Qt::IgnoreAction) { … … 253 263 case QEvent::DragEnter: 254 264 case QEvent::DragMove: { 265 #ifndef QT_NO_DRAGANDDROP 255 266 QDragMoveEvent *de = static_cast<QDragMoveEvent*>(e); 256 267 if (!qdesigner_internal::MyMimeData::fromMyTab(de->mimeData(), m_tabWidget)) … … 282 293 m_dropIndicator->setGeometry(pos.x(), pos.y() , 3, rect.height()); 283 294 m_dropIndicator->show(); 295 #else 296 return false; 297 #endif 298 284 299 } break; 285 300 286 301 case QEvent::Drop: { 302 #ifndef QT_NO_DRAGANDDROP 287 303 QDropEvent *de = static_cast<QDropEvent*>(e); 288 304 if (!qdesigner_internal::MyMimeData::fromMyTab(de->mimeData(), m_tabWidget)) … … 298 314 cmd->init(m_tabWidget, m_dragPage, m_dragIcon, m_dragLabel, m_dragIndex, newIndex); 299 315 fw->commandHistory()->push(cmd); 316 #else 317 return false; 318 #endif 300 319 } break; 301 320 -
trunk/tools/designer/src/lib/shared/qdesigner_toolbar.cpp
r2 r372 122 122 case QEvent::ContextMenu: 123 123 return handleContextMenuEvent(static_cast<QContextMenuEvent*>(event)); 124 #ifndef QT_NO_DRAGANDDROP 124 125 case QEvent::DragEnter: 125 126 case QEvent::DragMove: … … 129 130 case QEvent::Drop: 130 131 return handleDropEvent(static_cast<QDropEvent *>(event)); 132 #endif 131 133 case QEvent::MouseButtonPress: 132 134 return handleMousePressEvent(static_cast<QMouseEvent*>(event)); … … 327 329 } 328 330 331 #ifndef QT_NO_DRAGANDDROP 329 332 bool ToolBarEventFilter::handleDragEnterMoveEvent(QDragMoveEvent *event) 330 333 { … … 400 403 return true; 401 404 } 405 #endif 402 406 403 407 void ToolBarEventFilter::startDrag(const QPoint &pos, Qt::KeyboardModifiers modifiers) … … 420 424 } 421 425 426 #ifndef QT_NO_DRAGANDDROP 422 427 QDrag *drag = new QDrag(m_toolBar); 423 428 drag->setPixmap(ActionRepositoryMimeData::actionDragPixmap( action)); … … 425 430 426 431 if (drag->start(dropAction) == Qt::IgnoreAction) { 432 #else 433 { 434 #endif 427 435 hideDragIndicator(); 428 436 if (dropAction == Qt::MoveAction) { -
trunk/tools/designer/src/lib/shared/qtresourceview.cpp
r2 r372 94 94 QListWidget(parent) 95 95 { 96 #ifndef QT_NO_DRAGANDDROP 96 97 setDragEnabled(true); 98 #endif 97 99 } 98 100 … … 106 108 return; 107 109 110 #ifndef QT_NO_DRAGANDDROP 108 111 const QString filePath = item->data(Qt::UserRole).toString(); 109 112 const QIcon icon = item->icon(); … … 122 125 drag->setMimeData(mimeData); 123 126 drag->exec(Qt::CopyAction); 127 #endif 124 128 } 125 129 … … 605 609 void QtResourceView::setDragEnabled(bool dragEnabled) 606 610 { 611 #ifndef QT_NO_DRAGANDDROP 607 612 d_ptr->m_listWidget->setDragEnabled(dragEnabled); 613 #endif 608 614 } 609 615 610 616 bool QtResourceView::dragEnabled() const 611 617 { 618 #ifndef QT_NO_DRAGANDDROP 612 619 return d_ptr->m_listWidget->dragEnabled(); 620 #endif 613 621 } 614 622 -
trunk/tools/designer/src/lib/shared/shared.pri
r2 r372 188 188 189 189 RESOURCES += $$PWD/shared.qrc 190 191 contains(DEFINES, QT_NO_DRAGANDDROP) { 192 FORMS -= $$PWD/orderdialog.ui 193 FORMS += $$PWD/orderdialog_nodnd.ui 194 }
Note:
See TracChangeset
for help on using the changeset viewer.