/usr/include/qgis/qgsmultiedittoolbutton.h is in libqgis-dev 2.18.17+dfsg-1.
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 | /***************************************************************************
qgsmultiedittoolbutton.h
------------------------
Date : March 2016
Copyright : (C) 2016 Nyall Dawson
Email : nyall dot dawson at gmail.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 QGSMULTIEDITTOOLBUTTON_H
#define QGSMULTIEDITTOOLBUTTON_H
#include "qgsfield.h"
#include <QToolButton>
/** \ingroup gui
* \class QgsMultiEditToolButton
* A tool button widget which is displayed next to editor widgets in attribute forms, and
* allows for controlling how the widget behaves and interacts with the form while in multi
* edit mode.
* \note Added in version 2.16
*/
class GUI_EXPORT QgsMultiEditToolButton : public QToolButton
{
Q_OBJECT
public:
//! Button states
enum State
{
Default, /*!< Default state, all features have same value for widget */
MixedValues, /*!< Mixed state, some features have different values for the widget */
Changed, /*!< Value for widget has changed but changes have not yet been committed */
};
/** Constructor for QgsMultiEditToolButton.
* @param parent parent object
*/
explicit QgsMultiEditToolButton( QWidget *parent = nullptr );
/** Returns the current displayed state of the button.
*/
State state() const { return mState; }
/** Sets the field associated with this button. This is used to customise the widget menu
* and tooltips to match the field properties.
* @param field associated field
*/
void setField( const QgsField& field ) { mField = field; }
public slots:
/** Sets whether the associated field contains mixed values.
* @param mixed whether field values are mixed
* @see isMixed()
* @see setIsChanged()
* @see resetChanges()
*/
void setIsMixed( bool mixed ) { mIsMixedValues = mixed; updateState(); }
/** Sets whether the associated field has changed.
* @param changed whether field has changed
* @see isChanged()
* @see setIsMixed()
* @see resetChanges()
*/
void setIsChanged( bool changed ) { mIsChanged = changed; updateState(); }
/** Resets the changed state for the field.
* @see setIsMixed()
* @see setIsChanged()
* @see changesCommitted()
*/
void resetChanges() { mIsChanged = false; updateState(); }
/** Called when field values have been changed and field now contains all the same values.
* @see resetChanges()
*/
void changesCommitted() { mIsMixedValues = false; mIsChanged = false; updateState(); }
signals:
//! Emitted when the "set field value for all features" option is selected.
void setFieldValueTriggered();
//! Emitted when the "reset to original values" option is selected.
void resetFieldValueTriggered();
private slots:
void aboutToShowMenu();
void setFieldTriggered();
void resetFieldTriggered();
private:
bool mIsMixedValues;
bool mIsChanged;
State mState;
QgsField mField;
QMenu* mMenu;
void updateState();
};
#endif // QGSMULTIEDITTOOLBUTTON_H
|