Remove flattreeview example
The relevant bits are a two-line snippet. Change-Id: Id1731e5bc6585b1d1fd684817b39d19ad0a8a9cc Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit ce13dc8c2f73408ce2897f4bd044560955e38145) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
87b485b9bd
commit
ae0191d3b7
@ -10,7 +10,6 @@ qt_internal_add_example(customsortfiltermodel)
|
|||||||
qt_internal_add_example(dirview)
|
qt_internal_add_example(dirview)
|
||||||
qt_internal_add_example(editabletreemodel)
|
qt_internal_add_example(editabletreemodel)
|
||||||
qt_internal_add_example(fetchmore)
|
qt_internal_add_example(fetchmore)
|
||||||
qt_internal_add_example(flattreeview)
|
|
||||||
qt_internal_add_example(frozencolumn)
|
qt_internal_add_example(frozencolumn)
|
||||||
qt_internal_add_example(interview)
|
qt_internal_add_example(interview)
|
||||||
qt_internal_add_example(pixelator)
|
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 \
|
dirview \
|
||||||
editabletreemodel \
|
editabletreemodel \
|
||||||
fetchmore \
|
fetchmore \
|
||||||
flattreeview \
|
|
||||||
frozencolumn \
|
frozencolumn \
|
||||||
interview \
|
interview \
|
||||||
pixelator \
|
pixelator \
|
||||||
|
@ -1137,6 +1137,11 @@ bool QHeaderView::sectionsMovable() const
|
|||||||
In such a scenario, it is recommended to call QTreeView::setRootIsDecorated(false)
|
In such a scenario, it is recommended to call QTreeView::setRootIsDecorated(false)
|
||||||
as well.
|
as well.
|
||||||
|
|
||||||
|
\code
|
||||||
|
treeView->setRootIsDecorated(false);
|
||||||
|
treeView->header()->setFirstSectionMovable(true);
|
||||||
|
\endcode
|
||||||
|
|
||||||
Setting it to true has no effect unless setSectionsMovable(true) is called
|
Setting it to true has no effect unless setSectionsMovable(true) is called
|
||||||
as well.
|
as well.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user