16#include "private/qwidget_p.h"
53 QPointer<QWidget> widget;
93 p.drawPixmap(0, 0, pm);
115 qApp->installEventFilter(
this);
125 qApp->installEventFilter(
this);
135 if (!backImage.
isNull() && checkTime.
elapsed() < duration / 2) {
136 mixedImage = backImage.
copy();
173#ifndef QT_NO_SHORTCUT
214 int tempel = checkTime.
elapsed();
215 if (elapsed >= tempel)
221 alpha = tempel / double(duration);
226 if (
alpha >= 1 || !showWidget) {
228 qApp->removeEventFilter(
this);
236 if (
alpha >= 1 || !showWidget) {
238 qApp->removeEventFilter(
this);
267 const int ia = 256 -
a;
269 const int sw = frontImage.
width();
270 const int sh = frontImage.
height();
272 switch(frontImage.
depth()) {
276 const uchar *back_data = backImage.
bits();
277 const uchar *front_data = frontImage.
bits();
279 for (
int sy = 0; sy < sh; sy++) {
283 for (
int sx = 0; sx < sw; sx++) {
325 QPointer<QWidget> widget;
363 totalWidth = widget->
width();
364 totalHeight = widget->
height();
370 currentHeight = totalHeight;
371 currentWidth = totalWidth;
387 int y = orientation &
DownScroll ?
qMin(0, currentHeight - totalHeight) : 0;
390 p.drawPixmap(
x,
y, pm);
426 dist += totalWidth - currentWidth;
428 dist += totalHeight - currentHeight;
435 resize(
qMin(currentWidth, totalWidth),
qMin(currentHeight, totalHeight));
453void QRollEffect::scroll()
455 if (!done && widget) {
456 int tempel = checkTime.
elapsed();
457 if (elapsed >= tempel)
462 if (currentWidth != totalWidth) {
463 currentWidth = totalWidth * (elapsed/duration)
464 + (2 * totalWidth * (elapsed%duration) + duration)
468 if (currentHeight != totalHeight) {
469 currentHeight = totalHeight * (elapsed/duration)
470 + (2 * totalHeight * (elapsed%duration) + duration)
474 done = (currentHeight >= totalHeight) &&
475 (currentWidth >= totalWidth);
483 w =
qMin(currentWidth, totalWidth);
485 h =
qMin(currentHeight, totalHeight);
489 y = widget->
geometry().
y() +
qMax(0, totalHeight - currentHeight);
499 if (done || !widget) {
574#include "qeffects.moc"
The QCloseEvent class contains parameters that describe a close event.
static void sendPostedEvents(QObject *receiver=nullptr, int event_type=0)
Immediately dispatches all events which have been previously queued with QCoreApplication::postEvent(...
qint64 elapsed() const noexcept
Returns the number of milliseconds since this QElapsedTimer was last started.
void start() noexcept
\typealias QElapsedTimer::Duration Synonym for std::chrono::nanoseconds.
Type type() const
Returns the event type.
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
QScreen * primaryScreen
the primary (or default) screen of the application.
qsizetype bytesPerLine() const
Returns the number of bytes per image scanline.
QImage copy(const QRect &rect=QRect()) const
Returns a sub-area of the image as a new image.
int width() const
Returns the width of the image.
uchar * bits()
Returns a pointer to the first pixel data.
bool isNull() const
Returns true if it is a null image, otherwise returns false.
int height() const
Returns the height of the image.
The QKeyEvent class describes a key event.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
virtual bool eventFilter(QObject *watched, QEvent *event)
Filters events if this object has been installed as an event filter for the watched object.
void deleteLater()
\threadsafe
The QPaintEvent class contains event parameters for paint events.
The QPainter class performs low-level painting on widgets and other paint devices.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
QImage toImage() const
Converts the pixmap to a QImage.
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
void paintEvent(QPaintEvent *) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
QRollEffect(QWidget *w, Qt::WindowFlags f, DirFlags orient)
void closeEvent(QCloseEvent *) override
This event handler is called with the given event when Qt receives a window close request for a top-l...
QPixmap grabWindow(WId window=0, int x=0, int y=0, int w=-1, int h=-1)
Creates and returns a pixmap constructed by grabbing the contents of the given window restricted by Q...
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
void stop()
Stops the timer.
void timeout(QPrivateSignal)
This signal is emitted when the timer times out.
Combined button and popup list for selecting options.
@ WA_WState_ExplicitShowHide
static QRollEffect * q_roll
static QAlphaWidget * q_blend
void qScrollEffect(QWidget *w, QEffects::DirFlags orient, int time)
void qFadeEffect(QWidget *w, int time)
int qRound(qfloat16 d) noexcept
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLfloat GLfloat GLfloat GLfloat h
GLfloat GLfloat GLfloat alpha
constexpr QRgb qRgb(int r, int g, int b)
constexpr int qRed(QRgb rgb)
constexpr int qGreen(QRgb rgb)
constexpr int qBlue(QRgb rgb)
std::uniform_real_distribution dist(1, 2.5)
[2]