Class: QgsQueryBuilder¶
- class qgis.gui.QgsQueryBuilder¶
Bases:
QgsSubsetStringEditorInterface
Query Builder for layers.
The query builder allows interactive creation of a SQL for limiting the features displayed in a vector layer. The fields in the table are displayed and sample values (or all values) can be viewed to aid in constructing the query. A test function returns the number of features that will be returned.
QgsQueryBuilder(layer:
QgsVectorLayer
, parent: QWidget = None, fl: Union[Qt.WindowFlags, Qt.WindowType] = QgsGuiUtils.ModalDialogFlags) This constructor is used when the query builder is called from the vector layer properties dialog- Parameters:
layer – existing vector layer
parent – Parent widget
fl –
dialog flags
Methods
Returns the code editor widget for the SQL.
Load query from the XML file
Load query from the XML file
Save query to the XML file
Save query to the XML file
- param uri:
Set the sql statement to display in the dialog.
- param subsetString:
- param event:
Returns the sql statement entered in the dialog.
- rtype:
str
The default implementation tests that the constructed sql statement to see if the vector layer data provider likes it.
- accept(self)¶
- actionEvent(self, QActionEvent)¶
- changeEvent(self, QEvent)¶
- childEvent(self, QChildEvent)¶
- clear(self)¶
- closeEvent(self, QCloseEvent)¶
- codeEditorWidget(self) QgsCodeEditor ¶
Returns the code editor widget for the SQL.
New in version 3.18.
- Return type:
- connectNotify(self, QMetaMethod)¶
- contextMenuEvent(self, QContextMenuEvent)¶
- create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)¶
- customEvent(self, QEvent)¶
- destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)¶
- disconnectNotify(self, QMetaMethod)¶
- dragEnterEvent(self, QDragEnterEvent)¶
- dragLeaveEvent(self, QDragLeaveEvent)¶
- dragMoveEvent(self, QDragMoveEvent)¶
- dropEvent(self, QDropEvent)¶
- enterEvent(self, QEvent)¶
- event(self, QEvent) bool ¶
- eventFilter(self, QObject, QEvent) bool ¶
- focusInEvent(self, QFocusEvent)¶
- focusNextChild(self) bool ¶
- focusNextPrevChild(self, bool) bool ¶
- focusOutEvent(self, QFocusEvent)¶
- focusPreviousChild(self) bool ¶
- hideEvent(self, QHideEvent)¶
- initPainter(self, QPainter)¶
- inputMethodEvent(self, QInputMethodEvent)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- keyPressEvent(self, QKeyEvent)¶
- keyReleaseEvent(self, QKeyEvent)¶
- leaveEvent(self, QEvent)¶
- loadQuery(self)¶
Load query from the XML file
New in version 3.16.
- loadQueryFromFile(subset: str) bool ¶
Load query from the XML file
New in version 3.26.
- Parameters:
subset (str) –
- Return type:
bool
- metric(self, QPaintDevice.PaintDeviceMetric) int ¶
- mouseDoubleClickEvent(self, QMouseEvent)¶
- mouseMoveEvent(self, QMouseEvent)¶
- mousePressEvent(self, QMouseEvent)¶
- mouseReleaseEvent(self, QMouseEvent)¶
- moveEvent(self, QMoveEvent)¶
- nativeEvent(self, Union[QByteArray, bytes, bytearray], PyQt5.sip.voidptr) Tuple[bool, int] ¶
- paintEvent(self, QPaintEvent)¶
- receivers(self, PYQT_SIGNAL) int ¶
- reject(self)¶
- resizeEvent(self, QResizeEvent)¶
- saveQuery(self)¶
Save query to the XML file
New in version 3.16.
- saveQueryToFile(subset: str) bool ¶
Save query to the XML file
New in version 3.26.
- Parameters:
subset (str) –
- Return type:
bool
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setDatasourceDescription(self, uri: str)¶
- Parameters:
uri (str) –
- setSql(self, sqlStatement: str)¶
Set the sql statement to display in the dialog.
- Parameters:
sqlStatement (str) –
- setSubsetString(self, subsetString: str)¶
- Parameters:
subsetString (str) –
- showEvent(self, event: QShowEvent)¶
- Parameters:
event (QShowEvent) –
- sql(self) str ¶
Returns the sql statement entered in the dialog.
- Return type:
str
- subsetString(self) str ¶
- Return type:
str
- tabletEvent(self, QTabletEvent)¶
- test(self)¶
The default implementation tests that the constructed sql statement to see if the vector layer data provider likes it. The number of rows that would be returned is displayed in a message box. The test uses a “select count(*) from …” query to test the SQL statement.
- timerEvent(self, QTimerEvent)¶
- updateMicroFocus(self)¶
- wheelEvent(self, QWheelEvent)¶