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:
parent
05c3342b43
commit
ce13dc8c2f
@ -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)
|
||||
|
@ -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}"
|
||||
)
|
@ -1,7 +0,0 @@
|
||||
QT += widgets
|
||||
|
||||
SOURCES = main.cpp
|
||||
|
||||
# install
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/flattreeview
|
||||
INSTALLS += target
|
@ -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();
|
||||
}
|
@ -8,7 +8,6 @@ SUBDIRS = addressbook \
|
||||
dirview \
|
||||
editabletreemodel \
|
||||
fetchmore \
|
||||
flattreeview \
|
||||
frozencolumn \
|
||||
interview \
|
||||
pixelator \
|
||||
|
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user