Move the settingseditor example into tests/manual

The example uses QTreeWidget when it should use a QTreeView with a
dedicated item model, primarily shows how to use item views (and very
little about QSettings), and is generally not useful to show how an
application could or should use QSettings to store settings.

Turn it into a manual test instead; it's useful for that as it supports
ini and plist files, and settings in different scopes.

Pick-to: 6.7
Fixes: QTBUG-119978
Change-Id: I7ce039f6391c41c679d126d90a251eee60327c39
Reviewed-by: Ed Cooke <ed.cooke@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
Volker Hilsheimer 2023-12-11 16:17:09 +01:00
parent 38fa1d55ee
commit bddf27cd5a
21 changed files with 17 additions and 64 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@ -1,15 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\example tools/settingseditor
\title Settings Editor Example
\examplecategory {User Interface Components}
\ingroup examples-widgets-tools
\brief The Settings Editor example shows how Qt's standard settings support is used in an
application by providing an editor that enables the user to view the settings for
installed applications, and modify those that can be edited.
\image settingseditor-example.png
*/

View File

@ -4,7 +4,6 @@
qt_internal_add_example(completer)
qt_internal_add_example(customcompleter)
qt_internal_add_example(regularexpression)
qt_internal_add_example(settingseditor)
qt_internal_add_example(styleplugin)
qt_internal_add_example(treemodelcompleter)
qt_internal_add_example(undoframework)

View File

@ -1,40 +0,0 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(settingseditor LANGUAGES CXX)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/settingseditor")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_standard_project_setup()
qt_add_executable(settingseditor
locationdialog.cpp locationdialog.h
main.cpp
mainwindow.cpp mainwindow.h
settingstree.cpp settingstree.h
variantdelegate.cpp variantdelegate.h
)
set_target_properties(settingseditor PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_link_libraries(settingseditor PRIVATE
Qt6::Core
Qt6::Gui
Qt6::Widgets
)
install(TARGETS settingseditor
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)

View File

@ -4,7 +4,6 @@ SUBDIRS = \
customcompleter \
echoplugin \
regularexpression \
settingseditor \
styleplugin \
treemodelcompleter \
undoframework

View File

@ -2121,10 +2121,6 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
as QString. The numeric value can be recovered using \l QString::toInt(), \l
QString::toDouble() and related functions.
The \l{tools/settingseditor}{Settings Editor} example lets you
experiment with different settings location and with fallbacks
turned on or off.
\section1 Restoring the State of a GUI Application
QSettings is often used to store the state of a GUI
@ -2365,7 +2361,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
\endlist
\sa QVariant, QSessionManager, {Settings Editor Example}
\sa QVariant, QSessionManager
*/
/*! \enum QSettings::Status

View File

@ -282,7 +282,7 @@ QSizeF QItemDelegatePrivate::doTextLayout(int lineWidth) const
the style for drawing.
\sa {Delegate Classes}, QStyledItemDelegate, QAbstractItemDelegate,
{Spin Box Delegate Example}, {Settings Editor Example}
{Spin Box Delegate Example}
*/
/*!

View File

@ -2453,7 +2453,7 @@ void QTreeWidgetPrivate::dataChanged(const QModelIndex &topLeft,
whether sorting is enabled.
\sa QTreeWidgetItem, QTreeWidgetItemIterator, QTreeView,
{Model/View Programming}, {Settings Editor Example}
{Model/View Programming}
*/
/*!

View File

@ -0,0 +1,14 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_internal_add_manual_test(settingseditor
SOURCES
locationdialog.cpp locationdialog.h
main.cpp
mainwindow.cpp mainwindow.h
settingstree.cpp settingstree.h
variantdelegate.cpp variantdelegate.h
LIBRARIES
Qt::Widgets
)