Remove flattreeview example

The relevant bits are a two-line snippet.

Pick-to: 6.6 6.5
Change-Id: Id1731e5bc6585b1d1fd684817b39d19ad0a8a9cc
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Volker Hilsheimer 2023-06-09 10:47:13 +02:00
parent 05c3342b43
commit ce13dc8c2f
6 changed files with 5 additions and 82 deletions

View File

@ -10,7 +10,6 @@ qt_internal_add_example(customsortfiltermodel)
qt_internal_add_example(dirview)
qt_internal_add_example(editabletreemodel)
qt_internal_add_example(fetchmore)
qt_internal_add_example(flattreeview)
qt_internal_add_example(frozencolumn)
qt_internal_add_example(interview)
qt_internal_add_example(pixelator)

View File

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

View File

@ -1,7 +0,0 @@
QT += widgets
SOURCES = main.cpp
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/flattreeview
INSTALLS += target

View File

@ -1,37 +0,0 @@
// Copyright (C) 2017 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
/*
main.cpp
A simple example that shows a multi-column list using QTreeView.
The data is not a tree, so the first column was made movable.
*/
#include <QApplication>
#include <QHeaderView>
#include <QStandardItemModel>
#include <QTreeView>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QStandardItemModel model(4, 2);
QTreeView treeView;
treeView.setModel(&model);
treeView.setRootIsDecorated(false);
treeView.header()->setFirstSectionMovable(true);
treeView.header()->setStretchLastSection(true);
for (int row = 0; row < 4; ++row) {
for (int column = 0; column < 2; ++column) {
QModelIndex index = model.index(row, column, QModelIndex());
model.setData(index, QVariant((row + 1) * (column + 1)));
}
}
treeView.setWindowTitle(QObject::tr("Flat Tree View"));
treeView.show();
return app.exec();
}

View File

@ -8,7 +8,6 @@ SUBDIRS = addressbook \
dirview \
editabletreemodel \
fetchmore \
flattreeview \
frozencolumn \
interview \
pixelator \

View File

@ -1137,6 +1137,11 @@ bool QHeaderView::sectionsMovable() const
In such a scenario, it is recommended to call QTreeView::setRootIsDecorated(false)
as well.
\code
treeView->setRootIsDecorated(false);
treeView->header()->setFirstSectionMovable(true);
\endcode
Setting it to true has no effect unless setSectionsMovable(true) is called
as well.