QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgssettingstreewidget.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgssettingstreewidget.h
3 --------------------------------------
4 Date : April 2023
5 Copyright : (C) 2023 by Denis Rouzaud
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
17
18#include "qgssettingstree.h"
20
21#include <QAction>
22#include <QHBoxLayout>
23#include <QTreeView>
24#include <QVBoxLayout>
25
26#include "moc_qgssettingstreewidget.cpp"
27
29 : QWidget( parent )
31{
32 setObjectName( QStringLiteral( "mSettingsTreeWidget" ) );
33
34 QVBoxLayout *mainLayout = new QVBoxLayout( this );
35 mainLayout->setContentsMargins( 0, 0, 0, 0 );
36
38
39 mTreeView = new QTreeView( this );
40 mTreeView->setModel( mTreeModel );
41 mTreeView->setItemDelegate( new QgsSettingsTreeItemDelegate( qobject_cast<QgsSettingsTreeModel *>( mTreeModel->sourceModel() ), parent ) );
42 mTreeView->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
43 mTreeView->setMinimumWidth( 400 );
44 mTreeView->resizeColumnToContents( 0 );
45
46 mainLayout->addWidget( mTreeView );
47}
48
50{
51 mTreeModel->applyChanges();
52}
53
54
55bool QgsSettingsTreeWidget::searchText( const QString &text )
56{
57 mTreeModel->setFilterText( text );
58 return mTreeModel->rowCount() > 0;
59}
60
61bool QgsSettingsTreeWidget::highlightText( const QString &text )
62{
63 Q_UNUSED( text );
64 return true;
65}
66
68{
69 mTreeModel->setFilterText( QString() );
70}
QgsOptionsDialogHighlightWidget(QWidget *widget=nullptr)
Constructor.
A proxy model which allows filtering the settings tree.
void applyChanges() const
Apply changes to settings value.
bool searchText(const QString &text) override
Search for the text in the widget and return true if it was found.
void reset() override
reset the style of the widgets to its original state
QgsSettingsTreeWidget(QWidget *parent=nullptr)
Constructor.
bool highlightText(const QString &text) override
Highlight the text in the widget.
static QgsSettingsTreeNode * treeRoot()
Returns the tree root node for the settings tree.