QProxyModel/SortModel display items without children ?
-
Hey
Say I have a item model with this hierarchy:
>item >item2 >item3 >item4
Which model should I use to display it as
item item2 item3 item4
So no children, all linearly top to bottom.
As well as then display only ones matching specific string...
Would a QSortFilterProxyModel work for both of my needs or do I have to daisy chain 2 together? QProxyModel + SortFilter?Regards
Dariusz -
@Dariusz said in QProxyModel/SortModel display items without children ?:
How on earth do I get it
Open a developer command prompt with cmake and git and run:
(This is for Windows on MSVC, for MinGW replaceNMake
withMinGW
. for linux/mac just remove-G"NMake Makefiles"
)git clone https://invent.kde.org/frameworks/extra-cmake-modules.git cd extra-cmake-modules mkdir build cd build cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX="../../KDEAPI" ../ cmake --build . --target install cd ../../ git clone https://invent.kde.org/frameworks/kitemmodels.git cd kitemmodels mkdir build cd build cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_PREFIX_PATH="../../KDEAPI" -DCMAKE_INSTALL_PREFIX="../../KDEAPI" ../ cmake --build . --target install cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_PREFIX_PATH="../../KDEAPI" -DCMAKE_INSTALL_PREFIX="../../KDEAPI" ../ cmake --build . --target install cd ../../ rmdir extra-cmake-modules /s /q rmdir kitemmodels /s /q
Now just add the path to the newly created
KDEAPI
folder to theCMAKE_PREFIX_PATH
of your project in the project configuration -
Which model should I use to display it as
KDescendantsProxyModel
fromKItemModels
https://api.kde.org/frameworks/kitemmodels/html/classKDescendantsProxyModel.htmldo I have to daisy chain 2 together? QProxyModel + SortFilter?
Chain away!
-
@Dariusz said in QProxyModel/SortModel display items without children ?:
How on earth do I get it
Open a developer command prompt with cmake and git and run:
(This is for Windows on MSVC, for MinGW replaceNMake
withMinGW
. for linux/mac just remove-G"NMake Makefiles"
)git clone https://invent.kde.org/frameworks/extra-cmake-modules.git cd extra-cmake-modules mkdir build cd build cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX="../../KDEAPI" ../ cmake --build . --target install cd ../../ git clone https://invent.kde.org/frameworks/kitemmodels.git cd kitemmodels mkdir build cd build cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_PREFIX_PATH="../../KDEAPI" -DCMAKE_INSTALL_PREFIX="../../KDEAPI" ../ cmake --build . --target install cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_PREFIX_PATH="../../KDEAPI" -DCMAKE_INSTALL_PREFIX="../../KDEAPI" ../ cmake --build . --target install cd ../../ rmdir extra-cmake-modules /s /q rmdir kitemmodels /s /q
Now just add the path to the newly created
KDEAPI
folder to theCMAKE_PREFIX_PATH
of your project in the project configuration -
@VRonin Awesome thanks! I was able tho to just grab the 2 files and use them directly so yay!
This tree model is epic. It does 90% of what I wanted ! Now I just gotta figure out how to hide parent/groups, so I only see items, but that should be fine, super awesome, thanks!
Edit1. using sort filter model later to decide if I want to show parents/etc worked just fine, yay!