Class: QgsQueryResultWidget

class qgis.gui.QgsQueryResultWidget

Bases: PyQt5.QtWidgets.QWidget

The QgsQueryResultWidget class allows users to enter and run an SQL query on a DB connection (an instance of QgsAbstractDatabaseProviderConnection).

Query results are displayed in a table view. Query execution and result fetching can be interrupted by pressing the “Stop” push button.

Note

the ownership of the connection is transferred to the widget.

New in version 3.22.

QgsQueryResultWidget(parent: QWidget = None, connection: QgsAbstractDatabaseProviderConnection = None) Creates a QgsQueryResultWidget with the given connection, ownership is transferred to the widget.

Methods

actionEvent

changeEvent

childEvent

closeEvent

connectNotify

contextMenuEvent

create

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

event

executeQuery

Starts executing the query.

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

initPainter

inputMethodEvent

isSignalConnected

keyPressEvent

keyReleaseEvent

leaveEvent

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

receivers

resizeEvent

sender

senderSignalIndex

setConnection

Sets the connection to connection, ownership is transferred to the widget.

setQuery

Convenience method to set the SQL editor text to sql.

sharedPainter

showError

Hides the result table and shows the error title and message in the message bar or in the SQL error panel is isSqlError is set.

showEvent

tabletEvent

timerEvent

tokensReady

Triggered when the threaded API fetcher has new tokens to add.

updateMicroFocus

wheelEvent

Signals

createSqlVectorLayer

Emitted when a new vector SQL (query) layer must be created.

firstResultBatchFetched

Emitted when the first batch of results has been fetched.

actionEvent(self, QActionEvent)
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
createSqlVectorLayer

Emitted when a new vector SQL (query) layer must be created.

Parameters
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
executeQuery(self)

Starts executing the query.

firstResultBatchFetched

Emitted when the first batch of results has been fetched.

Note

If the query returns no results this signal is not emitted. [signal]

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)
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], sip.voidptr)Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL)int
resizeEvent(self, QResizeEvent)
sender(self)QObject
senderSignalIndex(self)int
setConnection(self, connection: QgsAbstractDatabaseProviderConnection)

Sets the connection to connection, ownership is transferred to the widget.

Parameters

connection (QgsAbstractDatabaseProviderConnection) –

setQuery(self, sql: str)

Convenience method to set the SQL editor text to sql.

Parameters

sql (str) –

sharedPainter(self)QPainter
showError(self, title: str, message: str, isSqlError: bool = False)

Hides the result table and shows the error title and message in the message bar or in the SQL error panel is isSqlError is set.

Parameters
  • title (str) –

  • message (str) –

  • isSqlError (bool = False) –

showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
tokensReady(self, tokens: Iterable[str])

Triggered when the threaded API fetcher has new tokens to add.

Parameters

tokens (Iterable[str]) –

updateMicroFocus(self)
wheelEvent(self, QWheelEvent)