본문으로 건너뛰기
로딩중...
검색중...
일치하는것 없음
LayerTreeDialog.h
1#pragma once
2
3#include "gdkqt/QtGdkExport.h"
4
5#include <QDialog>
6#include <QHash>
7#include <QString>
8#include <QStringList>
9
10class QPushButton;
11class QShowEvent;
12class QTreeWidget;
13class QTreeWidgetItem;
14
15namespace GDK {
16class glsGroupLayer;
17class glsMapLayer;
18class glsMapView;
19}
20
21namespace GdkQt {
22
28using LayerTreeWarningRunner = void (*)(QWidget* parent, const QString& title, const QString& text);
41QT_GDK_API void setLayerTreeReadFailureForTest(const QString& error);
42
55class QT_GDK_API LayerTreeDialog final : public QDialog
56{
57 Q_OBJECT
58public:
66 explicit LayerTreeDialog(GDK::glsMapView* view, QWidget* parent = nullptr);
68 ~LayerTreeDialog() override;
69
70signals:
78
79protected:
84 void showEvent(QShowEvent* event) override;
85
86private:
87 void populate();
88 bool addLayerItem(QTreeWidgetItem* parent, GDK::glsMapLayer* layer, int index, QString* error);
89 bool readTreeKey(QStringList* key, QStringList* rootIds, QString* error) const;
90 void updateCommands();
91 void addGroupLayer();
92 void applyTree();
93 void collectHandles(QTreeWidgetItem* item);
94 void writeChangedGroupName(GDK::glsMapLayer* layer, QTreeWidgetItem* item) const;
95 void handleItemChanged(QTreeWidgetItem* item, int column);
96 bool rebuildGroup(GDK::glsGroupLayer* group, QTreeWidgetItem* item, QString* errorMessage);
97 bool hasInvalidChildPlacement(QTreeWidgetItem* item, QString* message) const;
98 bool itemIdExists(const QString& id) const;
99 QString itemLayerId(QTreeWidgetItem* item) const;
100 bool itemIsGroup(QTreeWidgetItem* item) const;
101 QString uniqueGroupId() const;
102 QString uniqueGroupName(QTreeWidgetItem* parent) const;
103 QTreeWidgetItem* selectedParentForNewGroup() const;
104
105 GDK::glsMapView* m_view = nullptr;
106 QTreeWidget* m_tree = nullptr;
107 QPushButton* m_addGroupButton = nullptr;
108 QPushButton* m_applyButton = nullptr;
109 // The map's whole tree ("depth/id" per layer, depth first, map order) as this dialog last read or wrote it
110 // (S10 T5 L8 stale guard).
111 QStringList m_treeKey;
112 // The open-failure error, shown once after the dialog is first shown.
113 QString m_openError;
114 bool m_openErrorPending = false;
115 // False once the tree could not be read or changed behind the dialog: Add Group and Apply stay off.
116 bool m_treeUsable = true;
117 QHash<QString, GDK::glsMapLayer*> m_handles;
118 QHash<QString, GDK::glsMapLayer*> m_newLayers;
119 bool m_updatingItems = false;
120};
121
122} // namespace GdkQt
void treeApplied()
적용 버튼으로 레이어 트리를 지도에 반영한 뒤 UI 스레드에서 발생합니다.
void showEvent(QShowEvent *event) override
기본 표시 처리를 한 뒤, 열 때 트리를 읽지 못했으면 그 오류를 한 번만 경고합니다.
LayerTreeDialog(GDK::glsMapView *view, QWidget *parent=nullptr)
대화상자를 만들고 지도 뷰의 레이어 트리를 읽어 행을 채웁니다.
~LayerTreeDialog() override
대화상자를 없애고, 그룹 추가로 만들었지만 아직 적용하지 않은 그룹 레이어 핸들을 해제합니다.
void(*)(QWidget *parent, const QString &title, const QString &text) LayerTreeWarningRunner
LayerTreeDialog의 경고 메시지 상자를 대신하는 테스트용 함수 형식입니다(S10 T5 L8).
정의 LayerTreeDialog.h:28
void setLayerTreeWarningRunnerForTest(LayerTreeWarningRunner runner)
LayerTreeDialog의 경고 메시지 상자를 대신할 함수를 설치하는 테스트 이음새입니다(S10 T5 L8).
void setLayerTreeReadFailureForTest(const QString &error)
LayerTreeDialog의 레이어 트리 읽기를 강제로 실패시키는 테스트 이음새입니다(S10 T5 L8).
glsGdkQt의 공개 형식과 함수가 있는 네임스페이스입니다.
정의 AppSettings.h:15