/usr/include/qgis/qgsrelationreferencewidget.h is in libqgis-dev 2.8.6+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | /***************************************************************************
qgsrelationreferencewidget.h
--------------------------------------
Date : 20.4.2013
Copyright : (C) 2013 Matthias Kuhn
Email : matthias dot kuhn at gmx dot ch
***************************************************************************
* *
* 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 QGSRELATIONREFERENCEWIDGET_H
#define QGSRELATIONREFERENCEWIDGET_H
#include "qgsattributeeditorcontext.h"
#include "qgscollapsiblegroupbox.h"
#include "qgsfeature.h"
#include "qgshighlight.h"
#include "qgsmaptoolidentifyfeature.h"
#include <QComboBox>
#include <QToolButton>
#include <QLineEdit>
#include <QVBoxLayout>
class QgsAttributeForm;
class QgsVectorLayerTools;
class GUI_EXPORT QgsRelationReferenceWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY( bool openFormButtonVisible READ openFormButtonVisible WRITE setOpenFormButtonVisible )
public:
typedef QPair < QVariant, QgsFeatureId > ValueRelationItem;
typedef QVector < ValueRelationItem > ValueRelationCache;
enum CanvasExtent
{
Fixed,
Pan,
Scale
};
explicit QgsRelationReferenceWidget( QWidget* parent );
~QgsRelationReferenceWidget();
void setRelation( QgsRelation relation, bool allowNullValue );
void setRelationEditable( bool editable );
//! this sets the related feature using from the foreign key
void setForeignKey( const QVariant &value );
//! returns the related feature foreign key
QVariant foreignKey();
void setEditorContext( const QgsAttributeEditorContext& context, QgsMapCanvas* canvas, QgsMessageBar* messageBar );
//! determines if the form of the related feature will be shown
bool embedForm() {return mEmbedForm;}
void setEmbedForm( bool display );
//! determines if the foreign key is shown in a combox box or a read-only line edit
bool readOnlySelector() {return mReadOnlySelector;}
void setReadOnlySelector( bool readOnly );
//! determines if the widge offers the possibility to select the related feature on the map (using a dedicated map tool)
bool allowMapIdentification() {return mAllowMapIdentification;}
void setAllowMapIdentification( bool allowMapIdentification );
//! If the widget will order the combobox entries by value
bool orderByValue() { return mOrderByValue; }
//! Set if the widget will order the combobox entries by value
void setOrderByValue( bool orderByValue );
//! determines the open form button is visible in the widget
bool openFormButtonVisible() {return mOpenFormButtonVisible;}
void setOpenFormButtonVisible( bool openFormButtonVisible );
//! return the related feature (from the referenced layer)
//! if no feature is related, it returns an invalid feature
QgsFeature referencedFeature();
public slots:
//! open the form of the related feature in a new dialog
void openForm();
//! activate the map tool to select a new related feature on the map
void mapIdentification();
//! unset the currently related feature
void deleteForeignKey();
protected:
virtual void showEvent( QShowEvent* e ) override;
void init();
signals:
void foreignKeyChanged( QVariant );
private slots:
void highlightActionTriggered( QAction* action );
void deleteHighlight();
void comboReferenceChanged( int index );
void featureIdentified( const QgsFeature& feature );
void unsetMapTool();
void mapToolDeactivated();
private:
void highlightFeature( QgsFeature f = QgsFeature(), CanvasExtent canvasExtent = Fixed );
void updateAttributeEditorFrame( const QgsFeature feature );
// initialized
QgsAttributeEditorContext mEditorContext;
QgsMapCanvas* mCanvas;
QgsMessageBar* mMessageBar;
QVariant mForeignKey;
QgsFeatureId mFeatureId;
int mFkeyFieldIdx;
bool mAllowNull;
QgsHighlight* mHighlight;
QgsMapToolIdentifyFeature* mMapTool;
QgsMessageBarItem* mMessageBarItem;
QString mRelationName;
QgsAttributeForm* mReferencedAttributeForm;
QgsVectorLayer* mReferencedLayer;
QgsVectorLayer* mReferencingLayer;
QWidget* mWindowWidget;
bool mShown;
QgsRelation mRelation;
bool mIsEditable;
// Q_PROPERTY
bool mEmbedForm;
bool mReadOnlySelector;
bool mAllowMapIdentification;
bool mOrderByValue;
bool mOpenFormButtonVisible;
// UI
QVBoxLayout* mTopLayout;
QHash<QgsFeatureId, QVariant> mFidFkMap; // Mapping from feature id => foreign key
QToolButton* mMapIdentificationButton;
QToolButton* mRemoveFKButton;
QToolButton* mOpenFormButton;
QToolButton* mHighlightFeatureButton;
QAction* mHighlightFeatureAction;
QAction* mScaleHighlightFeatureAction;
QAction* mPanHighlightFeatureAction;
QComboBox* mComboBox;
QgsCollapsibleGroupBox* mAttributeEditorFrame;
QVBoxLayout* mAttributeEditorLayout;
QLineEdit* mLineEdit;
QLabel* mInvalidLabel;
};
#endif // QGSRELATIONREFERENCEWIDGET_H
|