Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create QgsHistoryWidget resuable widget for showing history entries
- Loading branch information
1 parent
a71671c
commit 34ce4d7
Showing
5 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/*************************************************************************** | ||
qgshistorywidget.cpp | ||
------------------ | ||
Date : April 2023 | ||
Copyright : (C) 2023 Nyall Dawson | ||
Email : nyall dot dawson at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgshistorywidget.h" | ||
#include "qgsgui.h" | ||
#include "qgshistoryentrymodel.h" | ||
|
||
QgsHistoryWidget::QgsHistoryWidget( const QString &providerId, Qgis::HistoryProviderBackends backends, QgsHistoryProviderRegistry *registry, QWidget *parent ) | ||
: QgsPanelWidget( parent ) | ||
{ | ||
setupUi( this ); | ||
|
||
mModel = new QgsHistoryEntryModel( providerId, backends, registry, this ); | ||
mTreeView->setModel( mModel ); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/*************************************************************************** | ||
qgshistorywidget.h | ||
------------------ | ||
Date : April 2023 | ||
Copyright : (C) 2023 Nyall Dawson | ||
Email : nyall dot dawson at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSHISTORYWIDGET_H | ||
#define QGSHISTORYWIDGET_H | ||
|
||
#include "qgis.h" | ||
#include "qgis_gui.h" | ||
#include "ui_qgshistorywidgetbase.h" | ||
#include "qgspanelwidget.h" | ||
|
||
class QgsHistoryProviderRegistry; | ||
class QgsHistoryEntryModel; | ||
|
||
/** | ||
* A widget showing entries from a QgsHistoryProviderRegistry. | ||
* \ingroup gui | ||
* \since QGIS 3.32 | ||
*/ | ||
class GUI_EXPORT QgsHistoryWidget : public QgsPanelWidget, private Ui::QgsHistoryWidgetBase | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
|
||
/** | ||
* Constructor for QgsHistoryWidget, with the specified \a parent widget. | ||
* | ||
* If \a providerId is specified then the widget will contain only items from the matching | ||
* history provider. | ||
* If \a backends is specified then the widget will be filtered to only matching backends. | ||
* | ||
* If no \a registry is specified then the singleton QgsHistoryProviderRegistry from QgsGui::historyProviderRegistry() | ||
* will be used. | ||
*/ | ||
QgsHistoryWidget( const QString &providerId = QString(), | ||
Qgis::HistoryProviderBackends backends = Qgis::HistoryProviderBackend::LocalProfile, | ||
QgsHistoryProviderRegistry *registry = nullptr, | ||
QWidget *parent = nullptr ); | ||
|
||
|
||
private: | ||
|
||
QgsHistoryEntryModel *mModel = nullptr; | ||
|
||
}; | ||
|
||
#endif // QGSHISTORYWIDGET_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>QgsHistoryWidgetBase</class> | ||
<widget class="QgsPanelWidget" name="QgsHistoryWidgetBase"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>800</width> | ||
<height>500</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>History</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<property name="spacing"> | ||
<number>6</number> | ||
</property> | ||
<property name="leftMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="topMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="rightMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="bottomMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="margin" stdset="0"> | ||
<number>9</number> | ||
</property> | ||
<item> | ||
<widget class="QSplitter" name="mSplitter"> | ||
<property name="orientation"> | ||
<enum>Qt::Vertical</enum> | ||
</property> | ||
<widget class="QTreeView" name="mTreeView"> | ||
<attribute name="headerVisible"> | ||
<bool>false</bool> | ||
</attribute> | ||
</widget> | ||
<widget class="QWidget" name="mEntryContainerWidget" native="true"/> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |