Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_gui_widgets_qrubberband.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
6{
7 origin = event->pos();
8 if (!rubberBand)
9 rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
10 rubberBand->setGeometry(QRect(origin, QSize()));
11 rubberBand->show();
12}
13
15{
16 rubberBand->setGeometry(QRect(origin, event->pos()).normalized());
17}
18
20{
21 rubberBand->hide();
22 // determine selection, for example using QRect::intersects()
23 // and QRect::contains().
24}
\inmodule QtGui
Definition qevent.h:196
\inmodule QtCore\reentrant
Definition qrect.h:30
QRect normalized() const noexcept
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height.
Definition qrect.cpp:277
The QRubberBand class provides a rectangle or line that can indicate a selection or a boundary.
Definition qrubberband.h:18
\inmodule QtCore
Definition qsize.h:25
virtual void mouseMoveEvent(QMouseEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events ...
Definition qwidget.cpp:9461
virtual void mousePressEvent(QMouseEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
Definition qwidget.cpp:9483
virtual void mouseReleaseEvent(QMouseEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive mouse release even...
Definition qwidget.cpp:9508
struct _cl_event * event