Qt 4.8
Public Functions | Static Public Functions | Properties | List of all members
QMacWindowFader Class Reference

#include <qt_mac_p.h>

Public Functions

float fadeDuration () const
 
void performFade ()
 
 QMacWindowFader ()
 
void registerWindowToFade (QWidget *window)
 
void setFadeDuration (float durationInSecs)
 

Static Public Functions

static QMacWindowFadercurrentFader ()
 

Properties

float m_duration
 
QWidgetList m_windowsToFade
 

Detailed Description

Definition at line 127 of file qt_mac_p.h.

Constructors and Destructors

◆ QMacWindowFader()

QMacWindowFader::QMacWindowFader ( )

Definition at line 104 of file qt_cocoa_helpers_mac.mm.

105  : m_duration(0.250)
106 {
107 }
float m_duration
Definition: qt_mac_p.h:130

Functions

◆ currentFader()

QMacWindowFader * QMacWindowFader::currentFader ( )
static

Definition at line 109 of file qt_cocoa_helpers_mac.mm.

Referenced by QMenuPrivate::hideMenu(), QMenuPrivate::hideUpToMenuBar(), and macWindowFade().

110 {
111  return macwindowFader();
112 }

◆ fadeDuration()

float QMacWindowFader::fadeDuration ( ) const
inline

Definition at line 137 of file qt_mac_p.h.

137 { return m_duration; }
float m_duration
Definition: qt_mac_p.h:130

◆ performFade()

void QMacWindowFader::performFade ( )

Definition at line 119 of file qt_cocoa_helpers_mac.mm.

Referenced by QMenuPrivate::hideUpToMenuBar(), and macWindowFade().

120 {
121  const QWidgetList myWidgetsToFade = m_windowsToFade;
122  const int widgetCount = myWidgetsToFade.count();
123 #if QT_MAC_USE_COCOA
125  [NSAnimationContext beginGrouping];
126  [[NSAnimationContext currentContext] setDuration:NSTimeInterval(m_duration)];
127 #endif
128 
129  for (int i = 0; i < widgetCount; ++i) {
132 #if QT_MAC_USE_COCOA
133  [[window animator] setAlphaValue:0.0];
134  QTimer::singleShot(qRound(m_duration * 1000), widget, SLOT(hide()));
135 #else
136  TransitionWindowOptions options = {0, m_duration, 0, 0};
137  TransitionWindowWithOptions(window, kWindowFadeTransitionEffect, kWindowHideTransitionAction,
138  0, 1, &options);
139 #endif
140  }
141 #if QT_MAC_USE_COCOA
142  [NSAnimationContext endGrouping];
143 #endif
144  m_duration = 0.250;
146 }
float m_duration
Definition: qt_mac_p.h:130
QPointer< QWidget > widget
#define SLOT(a)
Definition: qobjectdefs.h:226
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
OSWindowRef qt_mac_window_for(const QWidget *)
Definition: qwidget_mac.mm:484
NSWindow * window
WindowRef OSWindowRef
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void clear()
Removes all items from the list.
Definition: qlist.h:764
QWidgetList m_windowsToFade
Definition: qt_mac_p.h:129
bool singleShot
This static function calls a slot after a given time interval.
Definition: qtimer.h:59
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ registerWindowToFade()

void QMacWindowFader::registerWindowToFade ( QWidget window)

Definition at line 114 of file qt_cocoa_helpers_mac.mm.

Referenced by QMenuPrivate::hideMenu(), and macWindowFade().

115 {
116  m_windowsToFade.append(window);
117 }
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QWidgetList m_windowsToFade
Definition: qt_mac_p.h:129

◆ setFadeDuration()

void QMacWindowFader::setFadeDuration ( float  durationInSecs)
inline

Definition at line 136 of file qt_mac_p.h.

Referenced by QMenuPrivate::hideMenu(), and macWindowFade().

136 { m_duration = durationInSecs; }
float m_duration
Definition: qt_mac_p.h:130

Properties

◆ m_duration

float QMacWindowFader::m_duration
private

Definition at line 130 of file qt_mac_p.h.

Referenced by performFade().

◆ m_windowsToFade

QWidgetList QMacWindowFader::m_windowsToFade
private

Definition at line 129 of file qt_mac_p.h.

Referenced by performFade(), and registerWindowToFade().


The documentation for this class was generated from the following files: