QGIS API Documentation 3.99.0-Master (d270888f95f)
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 <QString>
24#include <QTreeView>
25#include <QVBoxLayout>
26
27#include "moc_qgssettingstreewidget.cpp"
28
29using namespace Qt::StringLiterals;
30
32 : QWidget( parent )
34{
35 setObjectName( u"mSettingsTreeWidget"_s );
36
37 QVBoxLayout *mainLayout = new QVBoxLayout( this );
38 mainLayout->setContentsMargins( 0, 0, 0, 0 );
39
41
42 mTreeView = new QTreeView( this );
43 mTreeView->setModel( mTreeModel );
44 mTreeView->setItemDelegate( new QgsSettingsTreeItemDelegate( qobject_cast<QgsSettingsTreeModel *>( mTreeModel->sourceModel() ), parent ) );
45 mTreeView->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
46 mTreeView->setMinimumWidth( 400 );
47 mTreeView->resizeColumnToContents( 0 );
48
49 mainLayout->addWidget( mTreeView );
50}
51
53{
54 mTreeModel->applyChanges();
55}
56
57
58bool QgsSettingsTreeWidget::searchText( const QString &text )
59{
60 mTreeModel->setFilterText( text );
61 return mTreeModel->rowCount() > 0;
62}
63
64bool QgsSettingsTreeWidget::highlightText( const QString &text )
65{
66 Q_UNUSED( text );
67 return true;
68}
69
71{
72 mTreeModel->setFilterText( QString() );
73}
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.