Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/widgets/qeffects.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    127127QAlphaWidget::~QAlphaWidget()
    128128{
    129 #ifdef Q_WS_WIN
     129#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
    130130    // Restore user-defined opacity value
    131     if (widget && QSysInfo::WindowsVersion >= QSysInfo::WV_2000 && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)
     131    if (widget)
    132132        widget->setWindowOpacity(windowOpacity);
    133133#endif
     
    161161
    162162    showWidget = true;
    163 #if defined(Q_OS_WIN)
    164     if (QSysInfo::WindowsVersion >= QSysInfo::WV_2000 && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) {
    165         qApp->installEventFilter(this);
    166         widget->setWindowOpacity(0.0);
    167         widget->show();
     163#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
     164    qApp->installEventFilter(this);
     165    widget->setWindowOpacity(0.0);
     166    widget->show();
     167    connect(&anim, SIGNAL(timeout()), this, SLOT(render()));
     168    anim.start(1);
     169#else
     170    //This is roughly equivalent to calling setVisible(true) without actually showing the widget
     171    widget->setAttribute(Qt::WA_WState_ExplicitShowHide, true);
     172    widget->setAttribute(Qt::WA_WState_Hidden, false);
     173
     174    qApp->installEventFilter(this);
     175
     176    move(widget->geometry().x(),widget->geometry().y());
     177    resize(widget->size().width(), widget->size().height());
     178
     179    frontImage = QPixmap::grabWidget(widget).toImage();
     180    backImage = QPixmap::grabWindow(QApplication::desktop()->winId(),
     181                                widget->geometry().x(), widget->geometry().y(),
     182                                widget->geometry().width(), widget->geometry().height()).toImage();
     183
     184    if (!backImage.isNull() && checkTime.elapsed() < duration / 2) {
     185        mixedImage = backImage.copy();
     186        pm = QPixmap::fromImage(mixedImage);
     187        show();
     188        setEnabled(false);
     189
    168190        connect(&anim, SIGNAL(timeout()), this, SLOT(render()));
    169191        anim.start(1);
    170     } else
     192    } else {
     193       duration = 0;
     194       render();
     195    }
    171196#endif
    172     {
    173         //This is roughly equivalent to calling setVisible(true) without actually showing the widget
    174         widget->setAttribute(Qt::WA_WState_ExplicitShowHide, true);
    175         widget->setAttribute(Qt::WA_WState_Hidden, false);
    176 
    177         qApp->installEventFilter(this);
    178 
    179         move(widget->geometry().x(),widget->geometry().y());
    180         resize(widget->size().width(), widget->size().height());
    181 
    182         frontImage = QPixmap::grabWidget(widget).toImage();
    183         backImage = QPixmap::grabWindow(QApplication::desktop()->winId(),
    184                                     widget->geometry().x(), widget->geometry().y(),
    185                                     widget->geometry().width(), widget->geometry().height()).toImage();
    186 
    187         if (!backImage.isNull() && checkTime.elapsed() < duration / 2) {
    188             mixedImage = backImage.copy();
    189             pm = QPixmap::fromImage(mixedImage);
    190             show();
    191             setEnabled(false);
    192 
    193             connect(&anim, SIGNAL(timeout()), this, SLOT(render()));
    194             anim.start(1);
    195         } else {
    196            duration = 0;
    197            render();
    198         }
    199     }
    200197}
    201198
     
    271268        alpha = 1;
    272269
    273 #if defined(Q_OS_WIN)
    274     if (QSysInfo::WindowsVersion >= QSysInfo::WV_2000 && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) {
    275         if (alpha >= windowOpacity || !showWidget) {
    276             anim.stop();
    277             qApp->removeEventFilter(this);
    278             widget->setWindowOpacity(windowOpacity);
    279             q_blend = 0;
    280             deleteLater();
    281         } else {
    282             widget->setWindowOpacity(alpha);
    283         }
    284     } else
    285 #endif
     270#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
     271    if (alpha >= windowOpacity || !showWidget) {
     272        anim.stop();
     273        qApp->removeEventFilter(this);
     274        widget->setWindowOpacity(windowOpacity);
     275        q_blend = 0;
     276        deleteLater();
     277    } else {
     278        widget->setWindowOpacity(alpha);
     279    }
     280#else
    286281    if (alpha >= 1 || !showWidget) {
    287282        anim.stop();
     
    293288                setEnabled(true);
    294289                setFocus();
    295 #endif
     290#endif // Q_WS_WIN
    296291                widget->hide();
    297292            } else {
     
    310305        repaint();
    311306    }
     307#endif // defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
    312308}
    313309
     
    589585        return;
    590586
    591     qApp->sendPostedEvents(w, QEvent::Move);
    592     qApp->sendPostedEvents(w, QEvent::Resize);
     587    QApplication::sendPostedEvents(w, QEvent::Move);
     588    QApplication::sendPostedEvents(w, QEvent::Resize);
    593589    Qt::WindowFlags flags = Qt::ToolTip;
    594590
     
    611607        return;
    612608
    613     qApp->sendPostedEvents(w, QEvent::Move);
    614     qApp->sendPostedEvents(w, QEvent::Resize);
     609    QApplication::sendPostedEvents(w, QEvent::Move);
     610    QApplication::sendPostedEvents(w, QEvent::Resize);
    615611
    616612    Qt::WindowFlags flags = Qt::ToolTip;
Note: See TracChangeset for help on using the changeset viewer.