- Timestamp:
- Sep 15, 2009 1:01:57 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/QIDialog.h
r10916 r23031 35 35 QIDialog (QWidget *aParent = 0, Qt::WindowFlags aFlags = 0); 36 36 37 public slots: 38 int exec(); 39 37 40 protected: 38 41 -
trunk/src/VBox/Frontends/VirtualBox/src/QIDialog.cpp
r17150 r23031 42 42 if ((policy.horizontalPolicy() == QSizePolicy::Fixed && 43 43 policy.verticalPolicy() == QSizePolicy::Fixed) || 44 windowFlags() == Qt::Sheet)44 (windowFlags() & Qt::Sheet) == Qt::Sheet) 45 45 { 46 46 adjustSize(); … … 61 61 } 62 62 63 int QIDialog::exec() 64 { 65 #if QT_VERSION >= 0x040500 66 /* After 4.5 exec ignores the Qt::Sheet flag. See "New Ways of Using 67 * Dialogs" in http://doc.trolltech.com/qq/QtQuarterly30.pdf why. Because 68 * we are lazy, we recreate the old behavior. */ 69 if ((windowFlags() & Qt::Sheet) == Qt::Sheet) 70 { 71 QEventLoop eventLoop; 72 connect(this, SIGNAL(finished(int)), 73 &eventLoop, SLOT(quit())); 74 /* Use the new open call. */ 75 open(); 76 eventLoop.exec(); 77 78 return result(); 79 } 80 else 81 #endif /* QT_VERSION >= 0x040500 */ 82 return QDialog::exec(); 83 } -
trunk/src/VBox/Frontends/VirtualBox/src/QIFileDialog.cpp
r20078 r23031 344 344 } 345 345 return dlg.exec() ? dlg.selectedFiles() [0] : QString::null; 346 #elif defined (Q_WS_MAC) && (QT_VERSION >= 0x040600) 347 348 /* After 4.5 exec ignores the Qt::Sheet flag. See "New Ways of Using 349 * Dialogs" in http://doc.trolltech.com/qq/QtQuarterly30.pdf why. Because 350 * we are lazy, we recreate the old behavior. Unfortunately there is a bug 351 * in Qt 4.5.x which result in showing the native & the Qt dialog at the 352 * same time. */ 353 QFileDialog dlg (aParent, Qt::Sheet); 354 dlg.setWindowTitle (aCaption); 355 dlg.setDirectory (aDir); 356 dlg.setResolveSymlinks (aResolveSymlinks); 357 dlg.setFileMode (aDirOnly ? QFileDialog::DirectoryOnly : QFileDialog::Directory); 358 359 QEventLoop eventLoop; 360 QObject::connect(&dlg, SIGNAL(finished(int)), 361 &eventLoop, SLOT(quit())); 362 /* Use the new open call. */ 363 dlg.open(); 364 eventLoop.exec(); 365 366 return dlg.result() == QDialog::Accepted ? dlg.selectedFiles() [0] : QString::null; 346 367 347 368 #else … … 525 546 } 526 547 return dlg.exec() == QDialog::Accepted ? dlg.selectedFiles().value (0, "") : QString::null; 548 549 #elif defined (Q_WS_MAC) && (QT_VERSION >= 0x040600) 550 551 /* After 4.5 exec ignores the Qt::Sheet flag. See "New Ways of Using 552 * Dialogs" in http://doc.trolltech.com/qq/QtQuarterly30.pdf why. Because 553 * we are lazy, we recreate the old behavior. Unfortunately there is a bug 554 * in Qt 4.5.x which result in showing the native & the Qt dialog at the 555 * same time. */ 556 QFileDialog dlg (aParent); 557 dlg.setWindowTitle (aCaption); 558 dlg.setDirectory (aStartWith); 559 dlg.setFilter (aFilters); 560 dlg.setFileMode (QFileDialog::QFileDialog::AnyFile); 561 dlg.setAcceptMode (QFileDialog::AcceptSave); 562 if (aSelectedFilter) 563 dlg.selectFilter (*aSelectedFilter); 564 dlg.setResolveSymlinks (aResolveSymlinks); 565 dlg.setConfirmOverwrite (false); 566 567 QEventLoop eventLoop; 568 QObject::connect(&dlg, SIGNAL(finished(int)), 569 &eventLoop, SLOT(quit())); 570 /* Use the new open call. */ 571 dlg.open(); 572 eventLoop.exec(); 573 574 return dlg.result() == QDialog::Accepted ? dlg.selectedFiles().value (0, "") : QString::null; 527 575 528 576 #else … … 739 787 return dlg.exec() == QDialog::Accepted ? dlg.selectedFiles() : QStringList() << QString::null; 740 788 789 #elif defined (Q_WS_MAC) && (QT_VERSION >= 0x040600) 790 791 /* After 4.5 exec ignores the Qt::Sheet flag. See "New Ways of Using 792 * Dialogs" in http://doc.trolltech.com/qq/QtQuarterly30.pdf why. Because 793 * we are lazy, we recreate the old behavior. Unfortunately there is a bug 794 * in Qt 4.5.x which result in showing the native & the Qt dialog at the 795 * same time. */ 796 QFileDialog dlg (aParent, Qt::Sheet); 797 dlg.setWindowTitle (aCaption); 798 dlg.setDirectory (aStartWith); 799 dlg.setFilter (aFilters); 800 if (aSingleFile) 801 dlg.setFileMode (QFileDialog::ExistingFile); 802 else 803 dlg.setFileMode (QFileDialog::ExistingFiles); 804 if (aSelectedFilter) 805 dlg.selectFilter (*aSelectedFilter); 806 dlg.setResolveSymlinks (aResolveSymlinks); 807 808 QEventLoop eventLoop; 809 QObject::connect(&dlg, SIGNAL(finished(int)), 810 &eventLoop, SLOT(quit())); 811 /* Use the new open call. */ 812 dlg.open(); 813 eventLoop.exec(); 814 815 return dlg.result() == QDialog::Accepted ? dlg.selectedFiles() : QStringList() << QString::null; 816 741 817 #else 742 818
Note:
See TracChangeset
for help on using the changeset viewer.