QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
settings
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
6
Email : denis@opengis.ch
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
16
#include "
qgssettingstreewidget.h
"
17
18
#include "
qgssettingstree.h
"
19
#include "
qgssettingstreemodel.h
"
20
21
#include <QAction>
22
#include <QHBoxLayout>
23
#include <QString>
24
#include <QTreeView>
25
#include <QVBoxLayout>
26
27
#include "moc_qgssettingstreewidget.cpp"
28
29
using namespace
Qt::StringLiterals;
30
31
QgsSettingsTreeWidget::QgsSettingsTreeWidget
( QWidget *parent )
32
: QWidget( parent )
33
,
QgsOptionsDialogHighlightWidget
( this )
34
{
35
setObjectName( u
"mSettingsTreeWidget"
_s );
36
37
QVBoxLayout *mainLayout =
new
QVBoxLayout(
this
);
38
mainLayout->setContentsMargins( 0, 0, 0, 0 );
39
40
mTreeModel =
new
QgsSettingsTreeProxyModel
(
QgsSettingsTree::treeRoot
() );
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
52
void
QgsSettingsTreeWidget::applyChanges
()
const
53
{
54
mTreeModel->applyChanges();
55
}
56
57
58
bool
QgsSettingsTreeWidget::searchText
(
const
QString &text )
59
{
60
mTreeModel->setFilterText( text );
61
return
mTreeModel->rowCount() > 0;
62
}
63
64
bool
QgsSettingsTreeWidget::highlightText
(
const
QString &text )
65
{
66
Q_UNUSED( text );
67
return
true
;
68
}
69
70
void
QgsSettingsTreeWidget::reset
()
71
{
72
mTreeModel->setFilterText( QString() );
73
}
QgsOptionsDialogHighlightWidget::QgsOptionsDialogHighlightWidget
QgsOptionsDialogHighlightWidget(QWidget *widget=nullptr)
Constructor.
Definition
qgsoptionsdialoghighlightwidget.cpp:34
QgsSettingsTreeProxyModel
A proxy model which allows filtering the settings tree.
Definition
qgssettingstreemodel.h:223
QgsSettingsTreeWidget::applyChanges
void applyChanges() const
Apply changes to settings value.
Definition
qgssettingstreewidget.cpp:52
QgsSettingsTreeWidget::searchText
bool searchText(const QString &text) override
Search for the text in the widget and return true if it was found.
Definition
qgssettingstreewidget.cpp:58
QgsSettingsTreeWidget::reset
void reset() override
reset the style of the widgets to its original state
Definition
qgssettingstreewidget.cpp:70
QgsSettingsTreeWidget::QgsSettingsTreeWidget
QgsSettingsTreeWidget(QWidget *parent=nullptr)
Constructor.
Definition
qgssettingstreewidget.cpp:31
QgsSettingsTreeWidget::highlightText
bool highlightText(const QString &text) override
Highlight the text in the widget.
Definition
qgssettingstreewidget.cpp:64
QgsSettingsTree::treeRoot
static QgsSettingsTreeNode * treeRoot()
Returns the tree root node for the settings tree.
Definition
qgssettingstree.cpp:18
qgssettingstree.h
qgssettingstreemodel.h
qgssettingstreewidget.h
Generated on
for QGIS API Documentation by
1.17.0