summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qfiledialog.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Don't accept QFileDialog when disabled item is activatedKeith Kyzivat2024-03-211-2/+3
| | | | | | | | | | | | | On macOS, entries that do not match the filter are shown in the directory listing. Do not accept the dialog when these entries are double-clicked (activated). Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-120768 Change-Id: If8ff6c56f1d21861b4e30051c212c9497042ed0f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Doc: Mention AA_DontUseNativeDialogs in QFileDialogKai Köhne2024-02-191-4/+7
| | | | | | | Pick-to: 6.5 6.6 6.7 Task-number: QTBUG-119551 Change-Id: I54f7e8f4b855b15d22b2180095cbf454b31412c3 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QFileDialog: Use pmf-style connectsChristian Ehrlicher2024-01-101-113/+136
| | | | | | | | Port all string-based signal/slots connections to pmf-style connects. Pick-to: 6.7 Change-Id: I6121e727c2730f9e5947f9f3b7550903bb17aee0 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Add parent arg to QFileDialog::getOpenFileContent and saveFileContentChris Von Bargen2023-12-281-14/+19
| | | | | | | | | | | | | | | | | | | | | | | | | This change updates getOpenFileContent to provide a parent when the non-WASM fallback to a QFileDialog is created, which avoids issues where this call is made inside another application. Specifically, if a QDialog is created lacking a parent to the main window, it will prevent interaction with that dialog. This patch addresses that problem with window modality. This change also updates saveFileContent to provide a parent for the fallback mechanism, so that both static APIs that interact with WASM/non-WASM dialogs have comparable behavior. The new parent argument is updated in the documentation. Documentation is clarified in terms of usage outside Qt for WebAssembly. [ChangeLog][QtWidgets][QFileDialog] Adds an overload to the static methods getOpenFileContent and saveFileContent with a new parent argument which always no-ops in the WASM environment. Fixes: QTBUG-118396 Pick-to: 6.7 6.6 6.5 Change-Id: Ic59aee386631172d4a29b42fe11e5af318474a1d Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Doc: Improve documentation for QFileDialog::OptionKai Köhne2023-12-281-23/+27
| | | | | | | | | | | | | | | | | | Do not add new paragraphs in the \value description, which breaks the generated HTML table. Instead, use \br more often to break overly long lines. Replace 'option is only valid' or 'supported' by 'effective' and 'used'; if an enum doesn't apply to a dialog or platform it will just be ignored, but it's OK to set it. Fix link to DontUseCustomDirectoryIcons enum. Pick-to: 6.5 6.6 6.7 Task-number: QTBUG-119551 Change-Id: Iac86a85c7b3b402997fa14f4c4e2fa7111c62e9e Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Doc: Fix linking to QFileDialog::NativeFileDialogKai Köhne2023-12-191-2/+2
| | | | | | | | Pick-to: 6.5 6.6 6.7 Task-number: QTBUG-119551 Change-Id: I1c698673873e5534b6d7867f8bc752115c254241 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Inkamari Harjula <inkamari.harjula@qt.io>
* Doc: Review and improve QFileDialog documentationInkamari Harjula2023-12-141-120/+123
| | | | | | | | Grammar improvements made. A screenshot added. Task-number: QTBUG-119551 Change-Id: Ia14c654e92eede5a32bba18cd4d05a74d289f64b Reviewed-by: Mats Honkamaa <mats.honkamaa@qt.io>
* Doc: Add AcceptMode info to DontConfirmOverwriteSafiyyah Moosa2023-12-131-1/+2
| | | | | | | | | | | | When QFileDialog::DontConfirmOverwrite is in the false state (default state), it requires QFileDialog::AcceptMode to be set to QFileDialog::AcceptSave. This information was not stated in the documents and this fix adds this information to the docs. Fixes: QTBUG-49720 Pick-to: 6.5 6.6 6.7 Change-Id: I1017252980810e712f2710751c8852dd12eaeef7 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Unify QDialog WA_WState_ExplicitShowHide handlingTor Arne Vestbø2023-10-231-5/+0
| | | | | | | | | | | | | | | | Instead of checking it inside QDialogPrivate::setVisible and its overrides, we can check it in QDialog::setVisible, up front. The logic in QDialogPrivate::setVisible related to modality that was executed prior to the WA_WState_ExplicitShowHide is now skipped in the case the WA_WState_ExplicitShowHide condition hits, but this makes sense as the modality logic has a second part at the end of the function, restoring the modality, and this part was never executed as the code was prior to this change. Change-Id: I9580e91dbc5a981c83538d765b86138afee44f14 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* dialogs: use const methods moreAnton Kudryavtsev2023-09-081-1/+1
| | | | | | | | to avoid implicit detach Change-Id: I2d46696a29f2a454452239e0400af2e2de534cbb Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Dialogs: clean up native dialogs when object gets destroyedVolker Hilsheimer2023-09-061-18/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | QWidget::setVisible is virtual, and called via hide() by both the QDialog and the QWidget destructor. A dialog that becomes invisible when getting destroyed will at most execute the QDialog override. Subclassing QDialog and overriding setVisible() to update the state of the native platform dialog will not work, unless we explicitly call hide() in the respective subclass's destructor. Since e0bb9e81ab1a9d71f2893844ea82, QDialogPrivate::setVisible is also virtual, and gets called by QDialog::setVisible. So the clean solution is to move the implementation of the native dialog status update into an override of QDialogPrivate::setVisible. Add test that verifies that the transient parent of the dialog becomes inactive when the (native) dialog shows (and skip if that fails), and then becomes active again when the (native) dialog is closed through the destructor of the Q*Dialog class. The test of QFileDialog has to be skipped on Android for the same reason as the widgetlessNativeDialog. Fixes: QTBUG-116277 Pick-to: 6.6 6.5 Change-Id: Ie3f93980d8653b8d933bf70aac3ef90de606f0ef Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QtWidgets: code tidies: use the 4-arg connect overloadGiuseppe D'Angelo2023-06-281-2/+2
| | | | | | | | The 3-arg connect is error-prone and makes the lifetime of the connection unclear. Change-Id: I4e518dd4a9733cc0a42b02639cce9c6136ad5afc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix missing references to 'Qt Widgets - Application Example'Tor Arne Vestbø2023-06-271-2/+1
| | | | | | | | Amends eda71105ff9a516059c6dd6643ff446a82edac81 Pick-to: 6.5 6.6 Change-Id: I44fa9acef37667d635d5770ce5d50fc52d92aa88 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QFileDialog: refactor a static helperAhmad Samir2023-06-051-12/+20
| | | | | | | | | | | - Fix narrowing conversion warnings - Don't use an out of bounds index with QStringView::mid(), which happened when view.size() was used as an index - Use sliced() Change-Id: Ia9bf62887ffb6ddd2458c9e46d33e8cfe0ee2b66 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFileDialog: use ::sysconf() to get initial passwd struct buffer sizeAhmad Samir2023-06-051-4/+6
| | | | | | | | Use QVLA since buf is no techincally a var-length-array. Change-Id: I334cf2d1f9ef162495ed223a8e48e1b8e674afc0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QFileDialog: split a static helperAhmad Samir2023-06-051-20/+25
| | | | | | | | | Split the getpwnam* related code to a separate helper; this makes the code more readable. Change-Id: Ia7c6b6f7801d88b6b3a8809e973ede6c58e89923 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Misc.: fix narrowing conversion warnings with explicit cast to intAhmad Samir2023-06-051-7/+8
| | | | | | | | | | | | | And using qsizetype in some places. ::pathconf() returns long. Found by using -Wshorten-64-to-32 clang compiler flag, or adding that flag to the flags clangd uses. Change-Id: I9f9abd3d4d6fe73f525eec869ceabc799317f3d6 Pick-to: 6.6 6.5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Misc.: fix narrowing conversion warningsAhmad Samir2023-06-051-20/+18
| | | | | | | | | | | | | | | | Using: - range-for and iterator-based loops - QList constructor that takes a pair of iterators Found by using -Wshorten-64-to-32 clang compiler flag, or adding that flag to the flags clangd uses, e.g. adding this to clangd's config file (see https://clangd.llvm.org/config): CompileFlags: Add: [-Wshorten-64-to-32] Pick-to: 6.6 6.5 Change-Id: I13ae65e09ab59a59f9e5c189ea27e4e16527df2d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* FileDialog: Use well-known DeleteOnClose instead of custom lambdaMikolaj Boc2023-04-181-12/+2
| | | | | | | | | The custom dialog-deleting lambda in QFileDialog::saveFileContent is redundant Change-Id: I03c2fa29ab0502b981460e34674a40a704a22e2d Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtWidgets: Disambiguate static functions/variables and definesFriedemann Kleint2023-01-141-0/+2
| | | | | | | | | | | | | They cause clashes in CMake Unity (Jumbo) builds. Properly prefixing the childWidgets() function also prevents it from cluttering static builds. Task-number: QTBUG-109394 Pick-to: 6.5 Change-Id: Idd2b1ec748f33cfae8f3213847c43b3fb0550377 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* wasm: align QWasmLocalFileAccess API with 6.4Morten Sørvig2022-12-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | This API is undocumented, but by keeping unchanged makes it easier to use from external projects. openFile(): Copy the accept/filter list parsing function from 6.4. It makes sense to implement this behind the API, so that user code doesn't have to reimplement it. saveFile(): Slightly more complicated; the new variant which takes a QByteArray is better since the implementation can then keep a reference to the data for as long as it needs, without copying the data. Add the const char * variant to keep existing code going for now. Adjust the calling code in widgets. Pick-to: 6.5 Change-Id: I1899ebffdb90e40429dcb10313ccc5334f20c34f Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* QFileDialog: Decouple nativeDialogInUse from QPlatformDialogHelperTor Arne Vestbø2022-11-111-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QDialogPrivate::nativeDialogInUse member is used to track whether a native dialog will be used down the line when the dialog is shown, or if a native dialog is actively showing or has been shown once. The former case applies to QFileDialog and QColorDialog, which both set nativeDialogInUse based on the result of creating a platform dialog helper in Q(File|Color)DialogPrivate::init(), and then use that information to avoid creating a widget hierarchy if not needed. The latter case applies when the native dialog is attempted to be shown(), where failure to show the native dialog results in the nativeDialogInUse member being set to false. The QFontDialog and QMessageBox subclasses do not rely on the former mechanism, and will only have nativeDialogInUse set to true if the native dialog has been actively shown at least once. The QPlatformDialogHelper on the other hand, tracked by the member QDialogPrivate::m_platformHelper, does not map 1:1 to the state of nativeDialogInUse, as in the case of QPlatformFileDialogHelper there is also functionality in the helper to give hints to the widget-based non-native dialog on how to behave. As a result, we can have a valid m_platformHelper, but with nativeDialogInUse being false. To decouple this and simplify the code we let QFileDialog::setOption() reset the nativeDialogInUse based on QDialog::DontUseNativeDialog, just like QColorDialog does, and let QFileDialogPrivate::createWidgets() proceed without having to delete the platform helper, which would otherwise be necessary to reset nativeDialogInUse. The only side effect of this is that a widget-based non-native dialog will still have a QPlatformFileDialogHelper alive, but since this dialog is not going to be shown this should not be an issue in practice. Task-number: QTBUG-108153 Change-Id: I96af6cfa715717c0907fe840aa86d4e5b280d54c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-031-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QFileDialog: use QUrl::toString(QUrl::PreferLocalFile)Ahmad Samir2022-10-281-12/+5
| | | | | | | It'll handle both cases. Change-Id: I6e2e037f19eff74a1e99b2a92dc2c9daf11fcd94 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QFileDialog: split some code out of accept() to smaller functionsAhmad Samir2022-10-281-18/+31
| | | | | | | Easier to reason about. Change-Id: I4f0351f405517cee522fc2159eb4014963a8946c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QFileDialog: use QString::remove() instead of mid()Ahmad Samir2022-10-281-3/+3
| | | | | | | Minor, less allocations. Change-Id: I73c188b0030248c6d038fab3dfb949442083d33d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-111-2/+2
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtWidgets: Use C string literals as keysMate Barany2022-09-261-21/+21
| | | | | | | | | | | | | Addressing a comment from the review of QTBUG-98434. QSettings has been already ported to use QAnyStringView keys so use C literals to call beginGroup, setValue and value. Since the constructor of QSettings does not have an overload for latin1 strings, change the calls to use u""_s instead of _L1. Task-number: QTBUG-103100 Change-Id: I9407ac8cf9d4c6f045a774b2abe7541086401b07 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QtWidgets: Use strcmp instead of equality operatorMate Barany2022-09-261-3/+1
| | | | | | | | | | Addressing some findings from the review of QTBUG-98434, use strcmp instead of the equality operator. This saves one strlen() per QL1SV constructor and takes L1 out of the picture. Task-number: QTBUG-103100 Change-Id: Iffe8ce4c4dd9a3ee590d4bb8a14b950241b835e2 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Doc: Fix typo in QFileDialog documentationKai Köhne2022-09-261-1/+1
| | | | | | | | Fix typo introduced in 9cd3ff2bdea Pick-to: 6.2 6.4 Change-Id: I248779c06fff81aaea1ef8f0a3a412cfb7cfc0bc Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QtWidgets: Fix mismatches between string types and literalsMate Barany2022-09-231-2/+2
| | | | | | | | | To address some findings from the review of QTBUG-98434, fix type mismatches between strings and string literals in QtWidgets. Task-number: QTBUG-103100 Change-Id: Ie4543d49ddfba382183c5d43df067694f5da53c7 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Use popup() instead of exec() for file dialog's context menuMikolaj Boc2022-08-191-7/+10
| | | | | | | | | | There are seemingly no differences in how the menu operates and this fixes WASM without asyncify hanging on menu open attempts. Fixes: QTBUG-104963 Change-Id: If4364f08acb75947e03ecced85d77af9af0498ba Pick-to: 6.4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix ignored name filter in QFileDialog::getOpenFileContent()Sze Howe Koh2022-08-161-1/+1
| | | | | | | Fixes: QTBUG-104948 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I83a565bfe604472fcdeb8757464e0e350da5d766 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Use the local file APIs to save/load files on WASMMikolaj Boc2022-08-121-8/+2
| | | | | | | | | | | | QFileDialog::saveFileContent, QFileDialog::getOpenFileContent are now using local file APIs to access files on any browser that passes a feature check. The feature is thoroughly tested using sinon and a new mock library. Task-number: QTBUG-99611 Change-Id: I3dd27a9d21eb143c71ea7db0563f70ac7db3a3ac Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* QtWidgets: restore Qt 5 compatibility for save/restore stateGiuseppe D'Angelo2022-05-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Several classes in QWidget use QDataStream internally in order to save and restore state. These QDataStream usages were not versioned, meaning that if Qt changes the serialization for some datatype, then the data saved between different Qt versions becomes incompatible. Note that the save/restore API in question just produce opaque blobs as QByteArrays -- the user has no control over the QDataStream objects and thus versions. Fix by version the usages. In QHeaderView this has caused a regression because QBitArray *did* change version between Qt 5 and 6. In general, using QDataStream without explicit versioning is a mistake, so deploy the same fix elsewhere as well. Fixes: QTBUG-99487 Pick-to: 5.15 6.2 6.3 Change-Id: I82bb5c266f4e5dedc0887cbef855dccab1015e29 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: <doctor.whom@gmail.com>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtWidgets: replace remaining uses of QL1String with QL1StringViewSona Kurazyan2022-05-021-3/+3
| | | | | | | Task-number: QTBUG-98434 Change-Id: If20e217e6e4fecd18c7707bf94650f5ba856893f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QtWidgets: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-05-021-47/+47
| | | | | | Task-number: QTBUG-98434 Change-Id: I310ea8f19d73a79d985ebfb8bfbff7a02c424360 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtWidgets: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-261-26/+26
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: I133b80334b66e0a5ab9546dd8e1ff0631e79601e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Document that native file dialogs might not show a titleVolker Hilsheimer2022-03-231-5/+10
| | | | | | | | | | | | Native dialogs on macOS haven't shown a title bar since macOS 10.11. The caption string passed in might not be visible to the end user, which can be problematic for certain applications that use the title text to provide context to the user. Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-59805 Change-Id: I3a1cea8f11a62c0927a9ba00159a118e2b078956 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Fix deprecated use of QBA/Q*String::countMårten Nordheim2022-03-151-2/+2
| | | | | | | 'Use size() or length() instead' Change-Id: I284fce29727c4c1ec9ea38a4e8ea13a9e0af5390 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QFileDialog: Fix adding default suffix when file path contains dotAlexander Volkov2021-11-121-3/+8
| | | | | | | | | | Check that a file name, not the full path, contains a dot. Fixes: QTBUG-59401 Pick-to: 5.15 6.2 Change-Id: I193b2ae457a3ac6a460524dbf200786eb3461cef Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix correspondence between QFileDialog::Option and ↵Alexander Volkov2021-10-191-0/+7
| | | | | | | | | | QFileDialogOption::FileDialogOptions It was broken by fe4a5a27e09b8109381e52aa1b71135a916dff1a. Pick-to: 6.2 Change-Id: I77da7ec9cdedc80a72b7f11980950a8bebfdaf3b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Update some links to Microsoft's documentationLuca Di Sera2021-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The documentation links on `msdn.microsoft.com` and `msdn2.microsoft.com` now redirect to `docs.microsoft.com`. Some of the links in the documentation were to those domains. In particular: - An `\externalpage` link to the `Mitigating Cross-site Scripting With HTTP-only Cookies` article. - An `\externalpage` link to `Microsoft Actibe Accessibility Event Constants` - A link to the `RtlGetVersion` function in `qoperatingsystemversion.cpp` - A link to the `GetCommandLine` function in `qcoreapplication.cpp` - A link to the `KNOWNFOLDERID` constant in `qfiledialog.cpp` While the redirection works, our script to catch broken links on dev-snapshots builds of the documentation doesn't handle redirection correctly, reporting it as broken. Both to appease the broken-links script and to avoid an unneccesary redirection, the above links were modified to point to the equivalent address in the new domain. Task-number: QTBUG-96127 Pick-to: 6.2 Change-Id: I0e9a132f06af7fc43bca6c8ad2054feb6e3e27cd Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QFileDialogComboBox: member variable is not initializedYang Yuyin2021-08-311-8/+0
| | | | | | | | | | initialize d_ptr in the constructor Pick-to: 6.2 Change-Id: I5a8062dd0a81023e6c1a5858bb8603d279cdbcee Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QFileDialog: Use static const QRegularExpressionWaqar Ahmed2021-08-181-1/+1
| | | | | | | This avoids rebuilding the same pattern. Caught by clazy. Change-Id: Ibd0f2063617df1a9e975f58e34df556d1983afff Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QFileDialog::saveFileContent crashes on acceptDong Rui2021-06-031-2/+2
| | | | | | | | | | | When using QFileDialog::saveFileCOntent, there is a risk of crash. Using deleteLater in the dialogClosed lambda in QFileDialog::saveFileContent Pick-to: 5.15 Fixes: QTBUG-90442 Change-Id: I200ccda9d973af2fa9b6ce9d72a518b154ef2019 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Variable is Assigned a never used value in qt_make_filter_list()Huang Jie2021-03-041-11/+4
| | | | | | | | | Variable 'i' is assigned a value that is never used in qt_make_filter_list() Pick-to: 6.1 Change-Id: Id845ecb5231b97a899443bdcb9f49cccb7f20bea Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* macOS: Mark QFileDialog::DontConfirmOverwrite as unsupportedMorten Johan Sørvig2021-01-151-0/+3
| | | | | | | | | | | | | | | | | The native NSSavePanel does not have an option corresponding to DontConfirmOverwrite. Qt has a workaround where the save-file-name is temporarily given a prefix in order do bypass the overwrite check, however this has stopped working on recent versions of macOS. (Confirmed on macOS 11) Users who want to use DontConfirmOverwrite should use Qt’s file dialog instead. Fixes: QTBUG-39791 Pick-to: 5.15 6.0 Change-Id: Id3b9e6de72c2afc9526c96f1d9fdbce78db92aeb Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>