Qt 4.8
Classes | Public Types | Public Functions | Static Public Functions | Public Variables | Static Public Variables | Protected Functions | Private Slots | List of all members
QMacStylePrivate Class Reference

#include <qmacstyle_mac_p.h>

Inheritance diagram for QMacStylePrivate:
QObject

Classes

struct  ButtonState
 

Public Types

enum  Animates { AquaPushButton, AquaProgressBar, AquaListViewItemOpen }
 

Public Functions

bool addWidget (QWidget *)
 
bool animatable (Animates, const QWidget *) const
 
int animateSpeed (Animates) const
 
QAquaWidgetSize aquaSizeConstrain (const QStyleOption *option, const QWidget *widg, QStyle::ContentsType ct=QStyle::CT_CustomBase, QSize szHint=QSize(-1, -1), QSize *insz=0) const
 
bool contentFitsInPushButton (const QStyleOptionButton *btn, HIThemeButtonDrawInfo *bdi, ThemeButtonKind buttonKindToCheck) const
 
bool doAnimate (Animates)
 
void drawColorlessButton (const HIRect &macRect, HIThemeButtonDrawInfo *bdi, QPainter *p, const QStyleOption *opt) const
 
QPixmap generateBackgroundPattern () const
 
void getSliderInfo (QStyle::ComplexControl cc, const QStyleOptionSlider *slider, HIThemeTrackDrawInfo *tdi, const QWidget *needToRemoveMe)
 
void initComboboxBdi (const QStyleOptionComboBox *combo, HIThemeButtonDrawInfo *bdi, const QWidget *widget, const ThemeDrawState &tds)
 
void initHIThemePushButton (const QStyleOptionButton *btn, const QWidget *widget, const ThemeDrawState tds, HIThemeButtonDrawInfo *bdi) const
 
HIRect pushButtonContentBounds (const QStyleOptionButton *btn, const HIThemeButtonDrawInfo *bdi) const
 
QSize pushButtonSizeFromContents (const QStyleOptionButton *btn) const
 
 QMacStylePrivate (QMacStyle *style)
 
void removeWidget (QWidget *)
 
void startAnimate (Animates, QWidget *)
 
void stopAnimate (Animates, QWidget *)
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 

Static Public Functions

static QRect comboboxEditBounds (const QRect &outerBounds, const HIThemeButtonDrawInfo &bdi)
 
static HIRect comboboxInnerBounds (const HIRect &outerBounds, int buttonKind)
 
static void drawCombobox (const HIRect &outerBounds, const HIThemeButtonDrawInfo &bdi, QPainter *p)
 
static void drawTableHeader (const HIRect &outerBounds, bool drawTopBorder, bool drawLeftBorder, const HIThemeButtonDrawInfo &bdi, QPainter *p)
 
static ThemeDrawState getDrawState (QStyle::State flags)
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 

Public Variables

struct QMacStylePrivate::ButtonState buttonState
 
QPointer< QPushButtondefaultButton
 
CFAbsoluteTime defaultButtonStart
 
QPointer< QFocusFramefocusWidget
 
bool mouseDown
 
QList< QPointer< QWidget > > progressBars
 
UInt8 progressFrame
 
QMacStyleq
 
int timerID
 

Static Public Variables

static const int BevelButtonH = 22
 
static const int BevelButtonW = 50
 
static const int MiniButtonH = 26
 
static const int PushButtonBottomOffset = 12
 
static const int PushButtonContentPadding = 6
 
static const int PushButtonLeftOffset = 6
 
static const int PushButtonRightOffset = 12
 
static const int PushButtonTopOffset = 4
 
static const int SmallButtonH = 30
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 

Protected Functions

bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 

Private Slots

void startAnimationTimer ()
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 155 of file qmacstyle_mac_p.h.

Enumerations

◆ Animates

Constructors and Destructors

◆ QMacStylePrivate()

QMacStylePrivate::QMacStylePrivate ( QMacStyle style)

Definition at line 1427 of file qmacstyle_mac.mm.

1428  : timerID(-1), progressFrame(0), q(style), mouseDown(false)
1429 {
1430  defaultButtonStart = CFAbsoluteTimeGetCurrent();
1431  memset(&buttonState, 0, sizeof(ButtonState));
1432 
1433  if (ptrHIShapeGetBounds == 0) {
1434  QLibrary library(QLatin1String("/System/Library/Frameworks/Carbon.framework/Carbon"));
1435  library.setLoadHints(QLibrary::ExportExternalSymbolsHint);
1436  ptrHIShapeGetBounds = reinterpret_cast<PtrHIShapeGetBounds>(library.resolve("HIShapeGetBounds"));
1437  }
1438 
1439 }
HIRect *(* PtrHIShapeGetBounds)(HIShapeRef, HIRect *)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
struct QMacStylePrivate::ButtonState buttonState
static PtrHIShapeGetBounds ptrHIShapeGetBounds
CFAbsoluteTime defaultButtonStart
The QLibrary class loads shared libraries at runtime.
Definition: qlibrary.h:62

Functions

◆ addWidget()

bool QMacStylePrivate::addWidget ( QWidget w)

Definition at line 1489 of file qmacstyle_mac.mm.

Referenced by QMacStyle::polish().

1490 {
1491  //already knew of it
1492  if (static_cast<QPushButton*>(w) == defaultButton
1493  || progressBars.contains(static_cast<QProgressBar*>(w)))
1494  return false;
1495 
1496  if (QPushButton *btn = qobject_cast<QPushButton *>(w)) {
1497  btn->installEventFilter(this);
1498  if (btn->isDefault() || (btn->autoDefault() && btn->hasFocus()))
1500  return true;
1501  } else {
1502  bool isProgressBar = (qobject_cast<QProgressBar *>(w)
1503 #ifdef QT3_SUPPORT
1504  || w->inherits("Q3ProgressBar")
1505 #endif
1506  );
1507  if (isProgressBar) {
1508  w->installEventFilter(this);
1510  return true;
1511  }
1512  }
1513  if (w->isWindow()) {
1514  w->installEventFilter(this);
1515  return true;
1516  }
1517  return false;
1518 }
void startAnimate(Animates, QWidget *)
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QPushButton widget provides a command button.
Definition: qpushbutton.h:57
The QProgressBar widget provides a horizontal or vertical progress bar.
Definition: qprogressbar.h:58
T * qobject_cast(QObject *object)
Definition: qobject.h:375
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
Definition: qlist.h:880
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
Definition: qobject.h:275
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
Definition: qobject.cpp:2070
QPointer< QPushButton > defaultButton
QList< QPointer< QWidget > > progressBars

◆ animatable()

bool QMacStylePrivate::animatable ( QMacStylePrivate::Animates  as,
const QWidget w 
) const

Definition at line 1441 of file qmacstyle_mac.mm.

Referenced by QMacStyle::drawControl().

1442 {
1443  if (!w)
1444  return false;
1445 
1446  if (as == AquaPushButton) {
1447  QPushButton *pb = const_cast<QPushButton *>(static_cast<const QPushButton *>(w));
1448  if (w->window()->isActiveWindow() && pb && !mouseDown) {
1449  if (static_cast<const QPushButton *>(w) != defaultButton) {
1450  // Changed on its own, update the value.
1451  const_cast<QMacStylePrivate *>(this)->stopAnimate(as, defaultButton);
1452  const_cast<QMacStylePrivate *>(this)->startAnimate(as, pb);
1453  }
1454  return true;
1455  }
1456  } else if (as == AquaProgressBar) {
1457  if (progressBars.contains((const_cast<QWidget *>(w))))
1458  return true;
1459  }
1460  return false;
1461 }
void startAnimate(Animates, QWidget *)
bool isActiveWindow
whether this widget&#39;s window is the active window
Definition: qwidget.h:186
The QPushButton widget provides a command button.
Definition: qpushbutton.h:57
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
Definition: qlist.h:880
void stopAnimate(Animates, QWidget *)
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
QPointer< QPushButton > defaultButton
QList< QPointer< QWidget > > progressBars

◆ animateSpeed()

int QMacStylePrivate::animateSpeed ( Animates  ) const
inline

Definition at line 189 of file qmacstyle_mac_p.h.

Referenced by startAnimationTimer().

189 { return 33; }

◆ aquaSizeConstrain()

QAquaWidgetSize QMacStylePrivate::aquaSizeConstrain ( const QStyleOption option,
const QWidget widg,
QStyle::ContentsType  ct = QStyle::CT_CustomBase,
QSize  szHint = QSize(-1, -1),
QSize insz = 0 
) const

Definition at line 866 of file qmacstyle_mac.mm.

Referenced by QMacStyle::drawComplexControl(), QMacStyle::drawControl(), QMacStyle::drawPrimitive(), getSliderInfo(), initComboboxBdi(), initHIThemePushButton(), QMacStyle::pixelMetric(), QMacStyle::sizeFromContents(), and QMacStyle::subControlRect().

868 {
869 #if defined(QMAC_QAQUASTYLE_SIZE_CONSTRAIN) || defined(DEBUG_SIZE_CONSTRAINT)
870  if (option) {
871  if (option->state & QStyle::State_Small)
872  return QAquaSizeSmall;
873  if (option->state & QStyle::State_Mini)
874  return QAquaSizeMini;
875  }
876 
877  if (!widg) {
878  if (insz)
879  *insz = QSize();
880  if (!qgetenv("QWIDGET_ALL_SMALL").isNull())
881  return QAquaSizeSmall;
882  if (!qgetenv("QWIDGET_ALL_MINI").isNull())
883  return QAquaSizeMini;
884  return QAquaSizeUnknown;
885  }
886  QSize large = qt_aqua_get_known_size(ct, widg, szHint, QAquaSizeLarge),
887  small = qt_aqua_get_known_size(ct, widg, szHint, QAquaSizeSmall),
888  mini = qt_aqua_get_known_size(ct, widg, szHint, QAquaSizeMini);
889  bool guess_size = false;
892  if (wsp == QMacStyle::SizeDefault)
893  guess_size = true;
894  else if (wsp == QMacStyle::SizeMini)
895  ret = QAquaSizeMini;
896  else if (wsp == QMacStyle::SizeSmall)
897  ret = QAquaSizeSmall;
898  else if (wsp == QMacStyle::SizeLarge)
899  ret = QAquaSizeLarge;
900  if (guess_size)
901  ret = qt_aqua_guess_size(widg, large, small, mini);
902 
903  QSize *sz = 0;
904  if (ret == QAquaSizeSmall)
905  sz = &small;
906  else if (ret == QAquaSizeLarge)
907  sz = &large;
908  else if (ret == QAquaSizeMini)
909  sz = &mini;
910  if (insz)
911  *insz = sz ? *sz : QSize(-1, -1);
912 #ifdef DEBUG_SIZE_CONSTRAINT
913  if (sz) {
914  const char *size_desc = "Unknown";
915  if (sz == &small)
916  size_desc = "Small";
917  else if (sz == &large)
918  size_desc = "Large";
919  else if (sz == &mini)
920  size_desc = "Mini";
921  qDebug("%s - %s: %s taken (%d, %d) [%d, %d]",
922  widg ? widg->objectName().toLatin1().constData() : "*Unknown*",
923  widg ? widg->metaObject()->className() : "*Unknown*", size_desc, widg->width(), widg->height(),
924  sz->width(), sz->height());
925  }
926 #endif
927  return ret;
928 #else
929  if (insz)
930  *insz = QSize();
931  Q_UNUSED(widg);
932  Q_UNUSED(ct);
933  Q_UNUSED(szHint);
934  return QAquaSizeUnknown;
935 #endif
936 }
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
int width
the width of the widget excluding any window frame
Definition: qwidget.h:166
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg, QSize szHint, QAquaWidgetSize sz)
static QAquaWidgetSize qt_aqua_guess_size(const QWidget *widg, QSize large, QSize small, QSize mini)
Q_CORE_EXPORT void qDebug(const char *,...)
int width() const
Returns the width.
Definition: qsize.h:126
int height
the height of the widget excluding any window frame
Definition: qwidget.h:167
QAquaWidgetSize
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
static WidgetSizePolicy widgetSizePolicy(const QWidget *w)
const char * className() const
Returns the class name.
Definition: qobjectdefs.h:491
QString objectName() const
int height() const
Returns the height.
Definition: qsize.h:129
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
static bool isNull(const QVariant::Private *d)
Definition: qvariant.cpp:300

◆ comboboxEditBounds()

QRect QMacStylePrivate::comboboxEditBounds ( const QRect outerBounds,
const HIThemeButtonDrawInfo &  bdi 
)
static

Inside a combobox Qt places a line edit widget. The size of this widget should depend on the kind of combobox we choose to draw. This function calculates and returns this size.

Definition at line 1193 of file qmacstyle_mac.mm.

Referenced by animateSpeed(), and QMacStyle::subControlRect().

1194 {
1195  QRect ret = outerBounds;
1196  switch (bdi.kind){
1197  case kThemeComboBox:
1198  ret.adjust(5, 5, -22, -5);
1199  break;
1200  case kThemeComboBoxSmall:
1201  ret.adjust(4, 6, -20, 0);
1202  ret.setHeight(14);
1203  break;
1204  case kThemeComboBoxMini:
1205  ret.adjust(4, 5, -18, -1);
1206  ret.setHeight(12);
1207  break;
1208  case kThemePopupButton:
1209  ret.adjust(10, 2, -23, -4);
1210  break;
1211  case kThemePopupButtonSmall:
1212  ret.adjust(9, 3, -20, -3);
1213  break;
1214  case kThemePopupButtonMini:
1215  ret.adjust(8, 3, -19, 0);
1216  ret.setHeight(13);
1217  break;
1218  }
1219  return ret;
1220 }
void setHeight(int h)
Sets the height of the rectangle to the given height.
Definition: qrect.h:445
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
Definition: qrect.h:434
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58

◆ comboboxInnerBounds()

HIRect QMacStylePrivate::comboboxInnerBounds ( const HIRect &  outerBounds,
int  buttonKind 
)
static

Carbon draws comboboxes (and other views) outside the rect given as argument. Use this function to obtain the corresponding inner rect for drawing the same combobox so that it stays inside the given outerBounds.

Definition at line 1140 of file qmacstyle_mac.mm.

Referenced by animateSpeed(), drawCombobox(), QMacStyle::sizeFromContents(), and QMacStyle::subControlRect().

1141 {
1142  HIRect innerBounds = outerBounds;
1143  // Carbon draw parts of the view outside the rect.
1144  // So make the rect a bit smaller to compensate
1145  // (I wish HIThemeGetButtonBackgroundBounds worked)
1146  switch (buttonKind){
1147  case kThemePopupButton:
1148  innerBounds.origin.x += 2;
1149  innerBounds.origin.y += 2;
1150  innerBounds.size.width -= 5;
1151  innerBounds.size.height -= 6;
1152  break;
1153  case kThemePopupButtonSmall:
1154  innerBounds.origin.x += 3;
1155  innerBounds.origin.y += 3;
1156  innerBounds.size.width -= 6;
1157  innerBounds.size.height -= 7;
1158  break;
1159  case kThemePopupButtonMini:
1160  innerBounds.origin.x += 2;
1161  innerBounds.origin.y += 2;
1162  innerBounds.size.width -= 5;
1163  innerBounds.size.height -= 6;
1164  break;
1165  case kThemeComboBox:
1166  innerBounds.origin.x += 3;
1167  innerBounds.origin.y += 2;
1168  innerBounds.size.width -= 6;
1169  innerBounds.size.height -= 8;
1170  break;
1171  case kThemeComboBoxSmall:
1172  innerBounds.origin.x += 3;
1173  innerBounds.origin.y += 3;
1174  innerBounds.size.width -= 7;
1175  innerBounds.size.height -= 8;
1176  break;
1177  case kThemeComboBoxMini:
1178  innerBounds.origin.x += 3;
1179  innerBounds.origin.y += 3;
1180  innerBounds.size.width -= 4;
1181  innerBounds.size.height -= 8;
1182  break;
1183  default:
1184  break;
1185  }
1186  return innerBounds;
1187 }

◆ contentFitsInPushButton()

bool QMacStylePrivate::contentFitsInPushButton ( const QStyleOptionButton btn,
HIThemeButtonDrawInfo *  bdi,
ThemeButtonKind  buttonKindToCheck 
) const

Checks if the actual contents of btn fits inside the free content bounds of 'buttonKindToCheck'. Meant as a helper function for 'initHIThemePushButton' for determining which button kind to use for drawing.

Definition at line 983 of file qmacstyle_mac.mm.

Referenced by animateSpeed(), and initHIThemePushButton().

986 {
987  ThemeButtonKind tmp = bdi->kind;
988  bdi->kind = buttonKindToCheck;
989  QSize contentSize = pushButtonSizeFromContents(btn);
990  QRect freeContentRect = qt_qrectForHIRect(pushButtonContentBounds(btn, bdi));
991  bdi->kind = tmp;
992  return freeContentRect.contains(QRect(freeContentRect.x(), freeContentRect.y(),
993  contentSize.width(), contentSize.height()));
994 }
static const QRect qt_qrectForHIRect(const HIRect &hirect)
int width() const
Returns the width.
Definition: qsize.h:126
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
Definition: qrect.cpp:1101
QSize pushButtonSizeFromContents(const QStyleOptionButton *btn) const
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
int height() const
Returns the height.
Definition: qsize.h:129
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
HIRect pushButtonContentBounds(const QStyleOptionButton *btn, const HIThemeButtonDrawInfo *bdi) const

◆ doAnimate()

bool QMacStylePrivate::doAnimate ( QMacStylePrivate::Animates  as)

Definition at line 1665 of file qmacstyle_mac.mm.

Referenced by timerEvent().

1666 {
1667  if (as == AquaPushButton) {
1668  } else if (as == AquaProgressBar) {
1669  // something for later...
1670  } else if (as == AquaListViewItemOpen) {
1671  // To be revived later...
1672  }
1673  return true;
1674 }

◆ drawColorlessButton()

void QMacStylePrivate::drawColorlessButton ( const HIRect &  macRect,
HIThemeButtonDrawInfo *  bdi,
QPainter p,
const QStyleOption opt 
) const

Definition at line 1676 of file qmacstyle_mac.mm.

Referenced by animateSpeed(), QMacStyle::drawComplexControl(), and QMacStyle::drawPrimitive().

1678 {
1679  int xoff = 0,
1680  yoff = 0,
1681  extraWidth = 0,
1682  extraHeight = 0,
1683  finalyoff = 0;
1684 
1685  const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(opt);
1686  int width = int(macRect.size.width) + extraWidth;
1687  int height = int(macRect.size.height) + extraHeight;
1688 
1689  if (width <= 0 || height <= 0)
1690  return; // nothing to draw
1691 
1692  QString key = QLatin1String("$qt_mac_style_ctb_") + QString::number(bdi->kind) + QLatin1Char('_')
1693  + QString::number(bdi->value) + QLatin1Char('_') + QString::number(width)
1694  + QLatin1Char('_') + QString::number(height);
1695  QPixmap pm;
1696  if (!QPixmapCache::find(key, pm)) {
1697  QPixmap activePixmap(width, height);
1698  activePixmap.fill(Qt::transparent);
1699  {
1700  if (combo){
1701  // Carbon combos don't scale. Therefore we draw it
1702  // ourselves, if a scaled version is needed.
1703  QPainter tmpPainter(&activePixmap);
1704  QMacStylePrivate::drawCombobox(macRect, *bdi, &tmpPainter);
1705  }
1706  else {
1707  QMacCGContext cg(&activePixmap);
1708  HIRect newRect = CGRectMake(xoff, yoff, macRect.size.width, macRect.size.height);
1709  HIThemeDrawButton(&newRect, bdi, cg, kHIThemeOrientationNormal, 0);
1710  }
1711  }
1712 
1713  if (!combo && bdi->value == kThemeButtonOff) {
1714  pm = activePixmap;
1715  } else if (combo) {
1716  QImage image = activePixmap.toImage();
1717 
1718  for (int y = 0; y < height; ++y) {
1719  QRgb *scanLine = reinterpret_cast<QRgb *>(image.scanLine(y));
1720 
1721  for (int x = 0; x < width; ++x) {
1722  QRgb &pixel = scanLine[x];
1723 
1724  int darkest = qRed(pixel);
1725  int mid = qGreen(pixel);
1726  int lightest = qBlue(pixel);
1727 
1728  if (darkest > mid)
1729  qSwap(darkest, mid);
1730  if (mid > lightest)
1731  qSwap(mid, lightest);
1732  if (darkest > mid)
1733  qSwap(darkest, mid);
1734 
1735  int gray = (mid + 2 * lightest) / 3;
1736  pixel = qRgba(gray, gray, gray, qAlpha(pixel));
1737  }
1738  }
1739  pm = QPixmap::fromImage(image);
1740  } else {
1741  QImage activeImage = activePixmap.toImage();
1742  QImage colorlessImage;
1743  {
1744  QPixmap colorlessPixmap(width, height);
1745  colorlessPixmap.fill(Qt::transparent);
1746 
1747  QMacCGContext cg(&colorlessPixmap);
1748  HIRect newRect = CGRectMake(xoff, yoff, macRect.size.width, macRect.size.height);
1749  int oldValue = bdi->value;
1750  bdi->value = kThemeButtonOff;
1751  HIThemeDrawButton(&newRect, bdi, cg, kHIThemeOrientationNormal, 0);
1752  bdi->value = oldValue;
1753  colorlessImage = colorlessPixmap.toImage();
1754  }
1755 
1756  for (int y = 0; y < height; ++y) {
1757  QRgb *colorlessScanLine = reinterpret_cast<QRgb *>(colorlessImage.scanLine(y));
1758  const QRgb *activeScanLine = reinterpret_cast<const QRgb *>(activeImage.scanLine(y));
1759 
1760  for (int x = 0; x < width; ++x) {
1761  QRgb &colorlessPixel = colorlessScanLine[x];
1762  QRgb activePixel = activeScanLine[x];
1763 
1764  if (activePixel != colorlessPixel) {
1765  int max = qMax(qMax(qRed(activePixel), qGreen(activePixel)),
1766  qBlue(activePixel));
1767  QRgb newPixel = qRgba(max, max, max, qAlpha(activePixel));
1768  if (qGray(newPixel) < qGray(colorlessPixel)
1769  || qAlpha(newPixel) > qAlpha(colorlessPixel))
1770  colorlessPixel = newPixel;
1771  }
1772  }
1773  }
1774  pm = QPixmap::fromImage(colorlessImage);
1775  }
1776  QPixmapCache::insert(key, pm);
1777  }
1778  p->drawPixmap(int(macRect.origin.x), int(macRect.origin.y) + finalyoff, width, height, pm);
1779 }
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.cpp:6448
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
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.
Definition: qpixmap.cpp:2197
unsigned int QRgb
Definition: qrgb.h:53
Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb)
Definition: qrgb.h:66
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
static QPixmap * find(const QString &key)
Q_GUI_EXPORT_INLINE int qRed(QRgb rgb)
Definition: qrgb.h:57
Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)
Definition: qrgb.h:72
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
static void drawCombobox(const HIRect &outerBounds, const HIThemeButtonDrawInfo &bdi, QPainter *p)
Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb)
Definition: qrgb.h:63
void qSwap(T &value1, T &value2)
Definition: qglobal.h:2181
Q_GUI_EXPORT_INLINE int qGray(int r, int g, int b)
Definition: qrgb.h:75
T qstyleoption_cast(const QStyleOption *opt)
Definition: qstyleoption.h:885
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
int key
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
Definition: qstyleoption.h:796
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb)
Definition: qrgb.h:60
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
Definition: qpainter.cpp:5619
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
Definition: qimage.cpp:1886

◆ drawCombobox()

void QMacStylePrivate::drawCombobox ( const HIRect &  outerBounds,
const HIThemeButtonDrawInfo &  bdi,
QPainter p 
)
static

Carbon comboboxes don't scale (sight). If the size of the combo suggest a scaled version, create it manually by drawing a small Carbon combo onto a pixmap (use pixmap cache), chop it up, and copy it back onto the widget. Othervise, draw the combobox supplied by Carbon directly.

Definition at line 1227 of file qmacstyle_mac.mm.

Referenced by animateSpeed(), drawColorlessButton(), and QMacStyle::drawComplexControl().

1228 {
1229  if (!(bdi.kind == kThemeComboBox && outerBounds.size.height > 28)){
1230  // We have an unscaled combobox, or popup-button; use Carbon directly.
1231  HIRect innerBounds = QMacStylePrivate::comboboxInnerBounds(outerBounds, bdi.kind);
1232  HIThemeDrawButton(&innerBounds, &bdi, QMacCGContext(p), kHIThemeOrientationNormal, 0);
1233  } else {
1234  QPixmap buffer;
1235  QString key = QString(QLatin1String("$qt_cbox%1-%2")).arg(int(bdi.state)).arg(int(bdi.adornment));
1236  if (!QPixmapCache::find(key, buffer)) {
1237  HIRect innerBoundsSmallCombo = {{3, 3}, {29, 25}};
1238  buffer = QPixmap(35, 28);
1239  buffer.fill(Qt::transparent);
1240  QPainter buffPainter(&buffer);
1241  HIThemeDrawButton(&innerBoundsSmallCombo, &bdi, QMacCGContext(&buffPainter), kHIThemeOrientationNormal, 0);
1242  buffPainter.end();
1243  QPixmapCache::insert(key, buffer);
1244  }
1245 
1246  const int bwidth = 20;
1247  const int fwidth = 10;
1248  const int fheight = 10;
1249  int w = qRound(outerBounds.size.width);
1250  int h = qRound(outerBounds.size.height);
1251  int bstart = w - bwidth;
1252  int blower = fheight + 1;
1253  int flower = h - fheight;
1254  int sheight = flower - fheight;
1255  int center = qRound(outerBounds.size.height + outerBounds.origin.y) / 2;
1256 
1257  // Draw upper and lower gap
1258  p->drawPixmap(fwidth, 0, bstart - fwidth, fheight, buffer, fwidth, 0, 1, fheight);
1259  p->drawPixmap(fwidth, flower, bstart - fwidth, fheight, buffer, fwidth, buffer.height() - fheight, 1, fheight);
1260  // Draw left and right gap. Right gap is drawn top and bottom separatly
1261  p->drawPixmap(0, fheight, fwidth, sheight, buffer, 0, fheight, fwidth, 1);
1262  p->drawPixmap(bstart, fheight, bwidth, center - fheight, buffer, buffer.width() - bwidth, fheight - 1, bwidth, 1);
1263  p->drawPixmap(bstart, center, bwidth, sheight / 2, buffer, buffer.width() - bwidth, fheight + 6, bwidth, 1);
1264  // Draw arrow
1265  p->drawPixmap(bstart, center - 4, bwidth - 3, 6, buffer, buffer.width() - bwidth, fheight, bwidth - 3, 6);
1266  // Draw corners
1267  p->drawPixmap(0, 0, fwidth, fheight, buffer, 0, 0, fwidth, fheight);
1268  p->drawPixmap(bstart, 0, bwidth, fheight, buffer, buffer.width() - bwidth, 0, bwidth, fheight);
1269  p->drawPixmap(0, flower, fwidth, fheight, buffer, 0, buffer.height() - fheight, fwidth, fheight);
1270  p->drawPixmap(bstart, h - blower, bwidth, blower, buffer, buffer.width() - bwidth, buffer.height() - blower, bwidth, blower);
1271  }
1272 }
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
int width() const
Returns the width of the pixmap.
Definition: qpixmap.cpp:630
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QPixmap * find(const QString &key)
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
Definition: qpixmap.cpp:1080
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
int key
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
Definition: qpainter.cpp:5619
int height() const
Returns the height of the pixmap.
Definition: qpixmap.cpp:645
static HIRect comboboxInnerBounds(const HIRect &outerBounds, int buttonKind)
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ drawTableHeader()

void QMacStylePrivate::drawTableHeader ( const HIRect &  outerBounds,
bool  drawTopBorder,
bool  drawLeftBorder,
const HIThemeButtonDrawInfo &  bdi,
QPainter p 
)
static

Carbon tableheaders don't scale (sight). So create it manually by drawing a small Carbon header onto a pixmap (use pixmap cache), chop it up, and copy it back onto the widget.

Definition at line 1278 of file qmacstyle_mac.mm.

Referenced by animateSpeed(), and QMacStyle::drawControl().

1280 {
1281  static SInt32 headerHeight = 0;
1282  static OSStatus err = GetThemeMetric(kThemeMetricListHeaderHeight, &headerHeight);
1283  Q_UNUSED(err);
1284 
1285  QPixmap buffer;
1286  QString key = QString(QLatin1String("$qt_tableh%1-%2-%3")).arg(int(bdi.state)).arg(int(bdi.adornment)).arg(int(bdi.value));
1287  if (!QPixmapCache::find(key, buffer)) {
1288  HIRect headerNormalRect = {{0., 0.}, {16., CGFloat(headerHeight)}};
1289  buffer = QPixmap(headerNormalRect.size.width, headerNormalRect.size.height);
1290  buffer.fill(Qt::transparent);
1291  QPainter buffPainter(&buffer);
1292  HIThemeDrawButton(&headerNormalRect, &bdi, QMacCGContext(&buffPainter), kHIThemeOrientationNormal, 0);
1293  buffPainter.end();
1294  QPixmapCache::insert(key, buffer);
1295  }
1296  const int buttonw = qRound(outerBounds.size.width);
1297  const int buttonh = qRound(outerBounds.size.height);
1298  const int framew = 1;
1299  const int frameh_n = 4;
1300  const int frameh_s = 3;
1301  const int transh = buffer.height() - frameh_n - frameh_s;
1302  int center = buttonh - frameh_s - int(transh / 2.0f) + 1; // Align bottom;
1303 
1304  int skipTopBorder = 0;
1305  if (!drawTopBorder)
1306  skipTopBorder = 1;
1307 
1308  p->translate(outerBounds.origin.x, outerBounds.origin.y);
1309 
1310  p->drawPixmap(QRect(QRect(0, -skipTopBorder, buttonw - framew , frameh_n)), buffer, QRect(framew, 0, 1, frameh_n));
1311  p->drawPixmap(QRect(0, buttonh - frameh_s, buttonw - framew, frameh_s), buffer, QRect(framew, buffer.height() - frameh_s, 1, frameh_s));
1312  // Draw upper and lower center blocks
1313  p->drawPixmap(QRect(0, frameh_n - skipTopBorder, buttonw - framew, center - frameh_n + skipTopBorder), buffer, QRect(framew, frameh_n, 1, 1));
1314  p->drawPixmap(QRect(0, center, buttonw - framew, buttonh - center - frameh_s), buffer, QRect(framew, buffer.height() - frameh_s, 1, 1));
1315  // Draw right center block borders
1316  p->drawPixmap(QRect(buttonw - framew, frameh_n - skipTopBorder, framew, center - frameh_n), buffer, QRect(buffer.width() - framew, frameh_n, framew, 1));
1317  p->drawPixmap(QRect(buttonw - framew, center, framew, buttonh - center - 1), buffer, QRect(buffer.width() - framew, buffer.height() - frameh_s, framew, 1));
1318  // Draw right corners
1319  p->drawPixmap(QRect(buttonw - framew, -skipTopBorder, framew, frameh_n), buffer, QRect(buffer.width() - framew, 0, framew, frameh_n));
1320  p->drawPixmap(QRect(buttonw - framew, buttonh - frameh_s, framew, frameh_s), buffer, QRect(buffer.width() - framew, buffer.height() - frameh_s, framew, frameh_s));
1321  // Draw center transition block
1322  p->drawPixmap(QRect(0, center - qRound(transh / 2.0f), buttonw - framew, buffer.height() - frameh_n - frameh_s), buffer, QRect(framew, frameh_n + 1, 1, transh));
1323  // Draw right center transition block border
1324  p->drawPixmap(QRect(buttonw - framew, center - qRound(transh / 2.0f), framew, buffer.height() - frameh_n - frameh_s), buffer, QRect(buffer.width() - framew, frameh_n + 1, framew, transh));
1325  if (drawLeftBorder){
1326  // Draw left center block borders
1327  p->drawPixmap(QRect(0, frameh_n - skipTopBorder, framew, center - frameh_n + skipTopBorder), buffer, QRect(0, frameh_n, framew, 1));
1328  p->drawPixmap(QRect(0, center, framew, buttonh - center - 1), buffer, QRect(0, buffer.height() - frameh_s, framew, 1));
1329  // Draw left corners
1330  p->drawPixmap(QRect(0, -skipTopBorder, framew, frameh_n), buffer, QRect(0, 0, framew, frameh_n));
1331  p->drawPixmap(QRect(0, buttonh - frameh_s, framew, frameh_s), buffer, QRect(0, buffer.height() - frameh_s, framew, frameh_s));
1332  // Draw left center transition block border
1333  p->drawPixmap(QRect(0, center - qRound(transh / 2.0f), framew, buffer.height() - frameh_n - frameh_s), buffer, QRect(0, frameh_n + 1, framew, transh));
1334  }
1335 
1336  p->translate(-outerBounds.origin.x, -outerBounds.origin.y);
1337 }
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
int width() const
Returns the width of the pixmap.
Definition: qpixmap.cpp:630
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QPixmap * find(const QString &key)
signed long OSStatus
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
Definition: qpixmap.cpp:1080
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
int key
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
Definition: qpainter.cpp:5619
int height() const
Returns the height of the pixmap.
Definition: qpixmap.cpp:645
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203
float CGFloat
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
Definition: qpainter.cpp:3311

◆ eventFilter()

bool QMacStylePrivate::eventFilter ( QObject ,
QEvent  
)
protectedvirtual

Filters events if this object has been installed as an event filter for the watched object.

In your reimplementation of this function, if you want to filter the event out, i.e. stop it being handled further, return true; otherwise return false.

Example:

class MainWindow : public QMainWindow
{
public:
MainWindow();
protected:
bool eventFilter(QObject *obj, QEvent *ev);
private:
QTextEdit *textEdit;
};
MainWindow::MainWindow()
{
textEdit = new QTextEdit;
setCentralWidget(textEdit);
textEdit->installEventFilter(this);
}
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
if (obj == textEdit) {
if (event->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
qDebug() << "Ate key press" << keyEvent->key();
return true;
} else {
return false;
}
} else {
// pass the event on to the parent class
return QMainWindow::eventFilter(obj, event);
}
}

Notice in the example above that unhandled events are passed to the base class's eventFilter() function, since the base class might have reimplemented eventFilter() for its own internal purposes.

Warning
If you delete the receiver object in this function, be sure to return true. Otherwise, Qt will forward the event to the deleted object and the program might crash.
See also
installEventFilter()

Reimplemented from QObject.

Definition at line 1603 of file qmacstyle_mac.mm.

Referenced by animateSpeed().

1604 {
1605  //animate
1606  if (QProgressBar *pb = qobject_cast<QProgressBar *>(o)) {
1607  switch (e->type()) {
1608  default:
1609  break;
1610  case QEvent::Show:
1611  if (!progressBars.contains(pb))
1613  break;
1614  case QEvent::Destroy:
1615  case QEvent::Hide:
1616  progressBars.removeAll(pb);
1617  }
1618  } else if (QPushButton *btn = qobject_cast<QPushButton *>(o)) {
1619  switch (e->type()) {
1620  default:
1621  break;
1622  case QEvent::FocusIn:
1623  if (btn->autoDefault())
1625  break;
1626  case QEvent::Destroy:
1627  case QEvent::Hide:
1628  if (btn == defaultButton)
1630  break;
1632  // It is very confusing to keep the button pulsing, so just stop the animation.
1633  if (static_cast<QMouseEvent *>(e)->button() == Qt::LeftButton)
1634  mouseDown = true;
1636  break;
1638  if (static_cast<QMouseEvent *>(e)->button() == Qt::LeftButton)
1639  mouseDown = false;
1640  // fall through
1641  case QEvent::FocusOut:
1642  case QEvent::Show:
1643  case QEvent::WindowActivate: {
1644  QList<QPushButton *> list = btn->window()->findChildren<QPushButton *>();
1645  for (int i = 0; i < list.size(); ++i) {
1646  QPushButton *pBtn = list.at(i);
1647  if ((e->type() == QEvent::FocusOut
1648  && (pBtn->isDefault() || (pBtn->autoDefault() && pBtn->hasFocus()))
1649  && pBtn != btn)
1650  || ((e->type() == QEvent::Show || e->type() == QEvent::MouseButtonRelease
1651  || e->type() == QEvent::WindowActivate)
1652  && pBtn->isDefault())) {
1653  if (pBtn->window()->isActiveWindow()) {
1655  }
1656  break;
1657  }
1658  }
1659  break; }
1660  }
1661  }
1662  return false;
1663 }
void startAnimate(Animates, QWidget *)
bool isActiveWindow
whether this widget&#39;s window is the active window
Definition: qwidget.h:186
bool autoDefault
whether the push button is an auto default button
Definition: qpushbutton.h:61
The QPushButton widget provides a command button.
Definition: qpushbutton.h:57
The QProgressBar widget provides a horizontal or vertical progress bar.
Definition: qprogressbar.h:58
bool hasFocus() const
Definition: qwidget.cpp:6583
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
Definition: qlist.h:880
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
void stopAnimate(Animates, QWidget *)
bool isDefault() const
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
QPointer< QPushButton > defaultButton
QList< QPointer< QWidget > > progressBars
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Definition: qlist.h:770

◆ generateBackgroundPattern()

QPixmap QMacStylePrivate::generateBackgroundPattern ( ) const
Warning
This function is not part of the public interface. Generates the standard widget background pattern.

Definition at line 1797 of file qmacstyle_mac.mm.

Referenced by animateSpeed(), and QMacStyle::polish().

1798 {
1799  QPixmap px(4, 4);
1800  QMacCGContext cg(&px);
1801  HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationNormal);
1802  const CGRect cgRect = CGRectMake(0, 0, px.width(), px.height());
1803  CGContextFillRect(cg, cgRect);
1804  return px;
1805 }
struct CGRect CGRect
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71

◆ getDrawState()

ThemeDrawState QMacStylePrivate::getDrawState ( QStyle::State  flags)
static

Definition at line 1534 of file qmacstyle_mac.mm.

Referenced by QMacStyle::drawComplexControl(), QMacStyle::drawControl(), QMacStyle::drawPrimitive(), QMacStyle::subControlRect(), and QMacStyle::subElementRect().

1535 {
1536  ThemeDrawState tds = kThemeStateActive;
1537  if (flags & QStyle::State_Sunken) {
1538  tds = kThemeStatePressed;
1539  } else if (flags & QStyle::State_Active) {
1540  if (!(flags & QStyle::State_Enabled))
1541  tds = kThemeStateUnavailable;
1542  } else {
1543  if (flags & QStyle::State_Enabled)
1544  tds = kThemeStateInactive;
1545  else
1546  tds = kThemeStateUnavailableInactive;
1547  }
1548  return tds;
1549 }

◆ getSliderInfo()

void QMacStylePrivate::getSliderInfo ( QStyle::ComplexControl  cc,
const QStyleOptionSlider slider,
HIThemeTrackDrawInfo *  tdi,
const QWidget needToRemoveMe 
)

Definition at line 1356 of file qmacstyle_mac.mm.

Referenced by QMacStyle::drawComplexControl(), QMacStyle::hitTestComplexControl(), and QMacStyle::subControlRect().

1358 {
1359  memset(tdi, 0, sizeof(HIThemeTrackDrawInfo)); // We don't get it all for some reason or another...
1360  tdi->version = qt_mac_hitheme_version;
1361  tdi->reserved = 0;
1362  tdi->filler1 = 0;
1363  bool isScrollbar = (cc == QStyle::CC_ScrollBar);
1364  switch (aquaSizeConstrain(0, needToRemoveMe)) {
1365  case QAquaSizeUnknown:
1366  case QAquaSizeLarge:
1367  if (isScrollbar)
1368  tdi->kind = kThemeMediumScrollBar;
1369  else
1370  tdi->kind = kThemeMediumSlider;
1371  break;
1372  case QAquaSizeMini:
1373  if (isScrollbar)
1374  tdi->kind = kThemeSmallScrollBar; // should be kThemeMiniScrollBar, but not implemented
1375  else
1376  tdi->kind = kThemeMiniSlider;
1377  break;
1378  case QAquaSizeSmall:
1379  if (isScrollbar)
1380  tdi->kind = kThemeSmallScrollBar;
1381  else
1382  tdi->kind = kThemeSmallSlider;
1383  break;
1384  }
1385  tdi->bounds = qt_hirectForQRect(slider->rect);
1386  tdi->min = slider->minimum;
1387  tdi->max = slider->maximum;
1388  tdi->value = slider->sliderPosition;
1389  tdi->attributes = kThemeTrackShowThumb;
1390  if (slider->upsideDown)
1391  tdi->attributes |= kThemeTrackRightToLeft;
1392  if (slider->orientation == Qt::Horizontal) {
1393  tdi->attributes |= kThemeTrackHorizontal;
1394  if (isScrollbar && slider->direction == Qt::RightToLeft) {
1395  if (!slider->upsideDown)
1396  tdi->attributes |= kThemeTrackRightToLeft;
1397  else
1398  tdi->attributes &= ~kThemeTrackRightToLeft;
1399  }
1400  }
1401 
1402  // Tiger broke reverse scroll bars so put them back and "fake it"
1403  if (isScrollbar && (tdi->attributes & kThemeTrackRightToLeft)) {
1404  tdi->attributes &= ~kThemeTrackRightToLeft;
1405  tdi->value = tdi->max - slider->sliderPosition;
1406  }
1407 
1408  tdi->enableState = (slider->state & QStyle::State_Enabled) ? kThemeTrackActive
1409  : kThemeTrackDisabled;
1410  if (!(slider->state & QStyle::State_Active))
1411  tdi->enableState = kThemeTrackInactive;
1412  if (!isScrollbar) {
1413  if (slider->state & QStyle::QStyle::State_HasFocus)
1414  tdi->attributes |= kThemeTrackHasFocus;
1416  tdi->trackInfo.slider.thumbDir = kThemeThumbPlain;
1417  else if (slider->tickPosition == QSlider::TicksAbove)
1418  tdi->trackInfo.slider.thumbDir = kThemeThumbUpward;
1419  else
1420  tdi->trackInfo.slider.thumbDir = kThemeThumbDownward;
1421  } else {
1422  tdi->trackInfo.scrollbar.viewsize = slider->pageStep;
1423  }
1424 }
const int qt_mac_hitheme_version
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
QAquaWidgetSize aquaSizeConstrain(const QStyleOption *option, const QWidget *widg, QStyle::ContentsType ct=QStyle::CT_CustomBase, QSize szHint=QSize(-1, -1), QSize *insz=0) const
QSlider::TickPosition tickPosition
the position of the slider&#39;s tick marks, if any
Definition: qstyleoption.h:710
bool upsideDown
the slider control orientation
Definition: qstyleoption.h:712
int sliderPosition
the position of the slider handle
Definition: qstyleoption.h:713
static HIRect qt_hirectForQRect(const QRect &convertRect, const QRect &rect=QRect())
int maximum
the maximum value for the slider
Definition: qstyleoption.h:709
int minimum
the minimum value for the slider
Definition: qstyleoption.h:708
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
Definition: qstyleoption.h:89
if(void) toggleToolbarShown
Qt::Orientation orientation
the slider&#39;s orientation (horizontal or vertical)
Definition: qstyleoption.h:707
int pageStep
the size of the page step of the slider
Definition: qstyleoption.h:716
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

◆ initComboboxBdi()

void QMacStylePrivate::initComboboxBdi ( const QStyleOptionComboBox combo,
HIThemeButtonDrawInfo *  bdi,
const QWidget widget,
const ThemeDrawState &  tds 
)

Creates a HIThemeButtonDrawInfo structure that specifies the correct button kind and other details to use for drawing the given combobox. Which button kind depends on the size of the combo, wether or not it is editable, explicit user style settings, etc.

Definition at line 1078 of file qmacstyle_mac.mm.

Referenced by animateSpeed(), QMacStyle::drawComplexControl(), and QMacStyle::subControlRect().

1080 {
1081  bdi->version = qt_mac_hitheme_version;
1082  bdi->adornment = kThemeAdornmentArrowLeftArrow;
1083  bdi->value = kThemeButtonOff;
1084  if (combo->state & QStyle::State_HasFocus)
1085  bdi->adornment = kThemeAdornmentFocus;
1086  bool drawColorless = combo->palette.currentColorGroup() == QPalette::Active && tds == kThemeStateInactive;
1088  bdi->state = kThemeStatePressed;
1089  else if (drawColorless)
1090  bdi->state = kThemeStateActive;
1091  else
1092  bdi->state = tds;
1093 
1094  QAquaWidgetSize aSize = aquaSizeConstrain(combo, widget);
1095  switch (aSize) {
1096  case QAquaSizeMini:
1097  bdi->kind = combo->editable ? ThemeButtonKind(kThemeComboBoxMini)
1098  : ThemeButtonKind(kThemePopupButtonMini);
1099  break;
1100  case QAquaSizeSmall:
1101  bdi->kind = combo->editable ? ThemeButtonKind(kThemeComboBoxSmall)
1102  : ThemeButtonKind(kThemePopupButtonSmall);
1103  break;
1104  case QAquaSizeUnknown:
1105  case QAquaSizeLarge:
1106  // Unless the user explicitly specified large buttons, determine the
1107  // kind by looking at the combox size.
1108  // ... specifying small and mini-buttons it not a current feature of
1109  // Qt (e.g. QWidget::getAttribute(WA_ButtonSize)). But when it is, add
1110  // an extra check here before using the mini and small buttons.
1111  int h = combo->rect.size().height();
1112  if (combo->editable){
1113  if (h < 21)
1114  bdi->kind = kThemeComboBoxMini;
1115  else if (h < 26)
1116  bdi->kind = kThemeComboBoxSmall;
1117  else
1118  bdi->kind = kThemeComboBox;
1119  } else {
1120  // Even if we specify that we want the kThemePopupButton, Carbon
1121  // will use the kThemePopupButtonSmall if the size matches. So we
1122  // do the same size check explicit to have the size of the inner
1123  // text field be correct. Therefore, do this even if the user specifies
1124  // the use of LargeButtons explicit.
1125  if (h < 21)
1126  bdi->kind = kThemePopupButtonMini;
1127  else if (h < 26)
1128  bdi->kind = kThemePopupButtonSmall;
1129  else
1130  bdi->kind = kThemePopupButton;
1131  }
1132  break;
1133  }
1134 }
const int qt_mac_hitheme_version
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
QAquaWidgetSize aquaSizeConstrain(const QStyleOption *option, const QWidget *widg, QStyle::ContentsType ct=QStyle::CT_CustomBase, QSize szHint=QSize(-1, -1), QSize *insz=0) const
QStyle::SubControls activeSubControls
This variable holds a bitwise OR of the sub-controls that are active for the complex control...
Definition: qstyleoption.h:694
bool editable
whether or not the combobox is editable or not
Definition: qstyleoption.h:802
ColorGroup currentColorGroup() const
Returns the palette&#39;s current color group.
Definition: qpalette.h:104
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
QAquaWidgetSize
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
int height() const
Returns the height.
Definition: qsize.h:129
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

◆ initHIThemePushButton()

void QMacStylePrivate::initHIThemePushButton ( const QStyleOptionButton btn,
const QWidget widget,
const ThemeDrawState  tds,
HIThemeButtonDrawInfo *  bdi 
) const

Creates a HIThemeButtonDrawInfo structure that specifies the correct button kind and other details to use for drawing the given push button. Which button kind depends on the size of the button, the size of the contents, explicit user style settings, etc.

Definition at line 1002 of file qmacstyle_mac.mm.

Referenced by animateSpeed(), QMacStyle::drawControl(), qt_mac_buttonIsRenderedFlat(), and QMacStyle::subElementRect().

1006 {
1007  bool drawColorless = btn->palette.currentColorGroup() == QPalette::Active;
1008  ThemeDrawState tdsModified = tds;
1009  if (btn->state & QStyle::State_On)
1010  tdsModified = kThemeStatePressed;
1011  bdi->version = qt_mac_hitheme_version;
1012  bdi->state = tdsModified;
1013  bdi->value = kThemeButtonOff;
1014 
1015  if (drawColorless && tdsModified == kThemeStateInactive)
1016  bdi->state = kThemeStateActive;
1017  if (btn->state & QStyle::State_HasFocus)
1018  bdi->adornment = kThemeAdornmentFocus;
1019  else
1020  bdi->adornment = kThemeAdornmentNone;
1021 
1022 
1023  if (btn->features & (QStyleOptionButton::Flat)) {
1024  bdi->kind = kThemeBevelButton;
1025  } else {
1026  switch (aquaSizeConstrain(btn, widget)) {
1027  case QAquaSizeSmall:
1028  bdi->kind = kThemePushButtonSmall;
1029  break;
1030  case QAquaSizeMini:
1031  bdi->kind = kThemePushButtonMini;
1032  break;
1033  case QAquaSizeLarge:
1034  // ... We should honor if the user is explicit about using the
1035  // large button. But right now Qt will specify the large button
1036  // as default rather than QAquaSizeUnknown.
1037  // So we treat it like QAquaSizeUnknown
1038  // to get the dynamic choosing of button kind.
1039  case QAquaSizeUnknown:
1040  // Choose the button kind that closest match the button rect, but at the
1041  // same time displays the button contents without clipping.
1042  bdi->kind = kThemeBevelButton;
1044  if (widget && widget->testAttribute(Qt::WA_MacVariableSize)) {
1045  if (btn->rect.height() <= QMacStylePrivate::MiniButtonH){
1046  if (contentFitsInPushButton(btn, bdi, kThemePushButtonMini))
1047  bdi->kind = kThemePushButtonMini;
1048  } else if (btn->rect.height() <= QMacStylePrivate::SmallButtonH){
1049  if (contentFitsInPushButton(btn, bdi, kThemePushButtonSmall))
1050  bdi->kind = kThemePushButtonSmall;
1051  } else if (contentFitsInPushButton(btn, bdi, kThemePushButton)) {
1052  bdi->kind = kThemePushButton;
1053  }
1054  } else {
1055  bdi->kind = kThemePushButton;
1056  }
1057  }
1058  }
1059  }
1060 }
const int qt_mac_hitheme_version
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
QAquaWidgetSize aquaSizeConstrain(const QStyleOption *option, const QWidget *widg, QStyle::ContentsType ct=QStyle::CT_CustomBase, QSize szHint=QSize(-1, -1), QSize *insz=0) const
static const int MiniButtonH
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
ColorGroup currentColorGroup() const
Returns the palette&#39;s current color group.
Definition: qpalette.h:104
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
static const int BevelButtonW
ButtonFeatures features
a bitwise OR of the features that describe this button
Definition: qstyleoption.h:289
static const int SmallButtonH
bool contentFitsInPushButton(const QStyleOptionButton *btn, HIThemeButtonDrawInfo *bdi, ThemeButtonKind buttonKindToCheck) const
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
static const int BevelButtonH
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

◆ pushButtonContentBounds()

HIRect QMacStylePrivate::pushButtonContentBounds ( const QStyleOptionButton btn,
const HIThemeButtonDrawInfo *  bdi 
) const

Returns the free space awailable for contents inside the button (and not the size of the contents itself)

Definition at line 942 of file qmacstyle_mac.mm.

Referenced by animateSpeed(), contentFitsInPushButton(), and QMacStyle::subElementRect().

944 {
945  HIRect outerBounds = qt_hirectForQRect(btn->rect);
946  // Adjust the bounds to correct for
947  // carbon not calculating the content bounds fully correct
948  if (bdi->kind == kThemePushButton || bdi->kind == kThemePushButtonSmall){
949  outerBounds.origin.y += QMacStylePrivate::PushButtonTopOffset;
950  outerBounds.size.height -= QMacStylePrivate::PushButtonBottomOffset;
951  } else if (bdi->kind == kThemePushButtonMini) {
952  outerBounds.origin.y += QMacStylePrivate::PushButtonTopOffset;
953  }
954 
955  HIRect contentBounds;
956  HIThemeGetButtonContentBounds(&outerBounds, bdi, &contentBounds);
957  return contentBounds;
958 }
static const int PushButtonBottomOffset
static HIRect qt_hirectForQRect(const QRect &convertRect, const QRect &rect=QRect())
static const int PushButtonTopOffset
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

◆ pushButtonSizeFromContents()

QSize QMacStylePrivate::pushButtonSizeFromContents ( const QStyleOptionButton btn) const

Calculates the size of the button contents. This includes both the text and the icon.

Definition at line 964 of file qmacstyle_mac.mm.

Referenced by animateSpeed(), and contentFitsInPushButton().

965 {
966  QSize csz(0, 0);
967  QSize iconSize = btn->icon.isNull() ? QSize(0, 0)
968  : (btn->iconSize + QSize(QMacStylePrivate::PushButtonContentPadding, 0));
969  QRect textRect = btn->text.isEmpty() ? QRect(0, 0, 1, 1)
970  : btn->fontMetrics.boundingRect(QRect(), Qt::AlignCenter, btn->text);
971  csz.setWidth(iconSize.width() + textRect.width()
973  ? q->proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, 0) : 0));
974  csz.setHeight(qMax(iconSize.height(), textRect.height()));
975  return csz;
976 }
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
QString text
the text of the button
Definition: qstyleoption.h:290
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
static const QRectF boundingRect(const QPointF *points, int pointCount)
int width() const
Returns the width.
Definition: qsize.h:126
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QIcon icon
the icon of the button
Definition: qstyleoption.h:291
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
Definition: qicon.cpp:769
ButtonFeatures features
a bitwise OR of the features that describe this button
Definition: qstyleoption.h:289
int height() const
Returns the height.
Definition: qsize.h:129
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
Definition: qnamespace.h:54
static const int PushButtonContentPadding
const QStyle * proxy() const
Definition: qstyle.cpp:2546
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
void setWidth(qreal w)
Sets the width of the rectangle to the given width.
Definition: qrect.h:784
#define text
Definition: qobjectdefs.h:80

◆ removeWidget()

void QMacStylePrivate::removeWidget ( QWidget w)

Definition at line 1520 of file qmacstyle_mac.mm.

Referenced by QMacStyle::unpolish().

1521 {
1522  QPushButton *btn = qobject_cast<QPushButton *>(w);
1523  if (btn && btn == defaultButton) {
1525  } else if (qobject_cast<QProgressBar *>(w)
1526 #ifdef QT3_SUPPORT
1527  || w->inherits("Q3ProgressBar")
1528 #endif
1529  ) {
1531  }
1532 }
The QPushButton widget provides a command button.
Definition: qpushbutton.h:57
T * qobject_cast(QObject *object)
Definition: qobject.h:375
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
Definition: qobject.h:275
void stopAnimate(Animates, QWidget *)
QPointer< QPushButton > defaultButton

◆ startAnimate()

void QMacStylePrivate::startAnimate ( QMacStylePrivate::Animates  as,
QWidget w 
)

Definition at line 1474 of file qmacstyle_mac.mm.

Referenced by addWidget(), animatable(), and eventFilter().

1475 {
1476  if (as == AquaPushButton)
1477  defaultButton = static_cast<QPushButton *>(w);
1478  else if (as == AquaProgressBar)
1479  progressBars.append(w);
1481 }
The QPushButton widget provides a command button.
Definition: qpushbutton.h:57
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QPointer< QPushButton > defaultButton
QList< QPointer< QWidget > > progressBars

◆ startAnimationTimer

void QMacStylePrivate::startAnimationTimer ( )
privateslot

Definition at line 1483 of file qmacstyle_mac.mm.

Referenced by animateSpeed(), and startAnimate().

1484 {
1485  if ((defaultButton || !progressBars.isEmpty()) && timerID <= -1)
1487 }
int startTimer(int interval)
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer...
Definition: qobject.cpp:1623
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
int animateSpeed(Animates) const
QPointer< QPushButton > defaultButton
QList< QPointer< QWidget > > progressBars

◆ stopAnimate()

void QMacStylePrivate::stopAnimate ( QMacStylePrivate::Animates  as,
QWidget w 
)

Definition at line 1463 of file qmacstyle_mac.mm.

Referenced by animatable(), eventFilter(), and removeWidget().

1464 {
1465  if (as == AquaPushButton && defaultButton) {
1466  QPushButton *tmp = defaultButton;
1467  defaultButton = 0;
1468  tmp->update();
1469  } else if (as == AquaProgressBar) {
1471  }
1472 }
The QPushButton widget provides a command button.
Definition: qpushbutton.h:57
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
QPointer< QPushButton > defaultButton
QList< QPointer< QWidget > > progressBars
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Definition: qlist.h:770

◆ timerEvent()

void QMacStylePrivate::timerEvent ( QTimerEvent event)
protectedvirtual

This event handler can be reimplemented in a subclass to receive timer events for the object.

QTimer provides a higher-level interface to the timer functionality, and also more general information about timers. The timer event is passed in the event parameter.

See also
startTimer(), killTimer(), event()

Reimplemented from QObject.

Definition at line 1551 of file qmacstyle_mac.mm.

Referenced by animateSpeed().

1552 {
1553  int animated = 0;
1557  && doAnimate(AquaPushButton)) {
1558  ++animated;
1559  defaultButton->update();
1560  }
1561  if (!progressBars.isEmpty()) {
1562  int i = 0;
1563  while (i < progressBars.size()) {
1564  QWidget *maybeProgress = progressBars.at(i);
1565  if (!maybeProgress) {
1567  } else {
1568  if (QProgressBar *pb = qobject_cast<QProgressBar *>(maybeProgress)) {
1569  if (pb->maximum() == 0 || (pb->value() > 0 && pb->value() < pb->maximum())) {
1571  pb->update();
1572  }
1573  }
1574 #ifdef QT3_SUPPORT
1575  else {
1576  // Watch me now...
1577  QVariant progress = maybeProgress->property("progress");
1578  QVariant totalSteps = maybeProgress->property("totalSteps");
1579  if (progress.isValid() && totalSteps.isValid()) {
1580  int intProgress = progress.toInt();
1581  int intTotalSteps = totalSteps.toInt();
1582  if (intTotalSteps == 0 || intProgress > 0 && intProgress < intTotalSteps) {
1584  maybeProgress->update();
1585  }
1586  }
1587  }
1588 #endif
1589  ++i;
1590  }
1591  }
1592  if (i > 0) {
1593  ++progressFrame;
1594  animated += i;
1595  }
1596  }
1597  if (animated <= 0) {
1598  killTimer(timerID);
1599  timerID = -1;
1600  }
1601 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
bool isActiveWindow
whether this widget&#39;s window is the active window
Definition: qwidget.h:186
bool autoDefault
whether the push button is an auto default button
Definition: qpushbutton.h:61
bool isVisibleTo(QWidget *) const
Returns true if this widget would become visible if ancestor is shown; otherwise returns false...
Definition: qwidget.cpp:8371
bool doAnimate(Animates)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
The QProgressBar widget provides a horizontal or vertical progress bar.
Definition: qprogressbar.h:58
bool hasFocus() const
Definition: qwidget.cpp:6583
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
Definition: qvariant.cpp:2625
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
bool isEnabled() const
Definition: qwidget.h:948
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
bool isDefault() const
QVariant property(const char *name) const
Returns the value of the object&#39;s name property.
Definition: qobject.cpp:3807
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
QPointer< QPushButton > defaultButton
QList< QPointer< QWidget > > progressBars
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
Definition: qvariant.h:485
void killTimer(int id)
Kills the timer with timer identifier, id.
Definition: qobject.cpp:1650
void removeAt(int i)
Removes the item at index position i.
Definition: qlist.h:480

Properties

◆ BevelButtonH

const int QMacStylePrivate::BevelButtonH = 22
static

Definition at line 170 of file qmacstyle_mac_p.h.

Referenced by initHIThemePushButton().

◆ BevelButtonW

const int QMacStylePrivate::BevelButtonW = 50
static

Definition at line 169 of file qmacstyle_mac_p.h.

Referenced by initHIThemePushButton().

◆ buttonState

struct QMacStylePrivate::ButtonState QMacStylePrivate::buttonState

Referenced by QMacStylePrivate().

◆ defaultButton

QPointer<QPushButton> QMacStylePrivate::defaultButton

◆ defaultButtonStart

CFAbsoluteTime QMacStylePrivate::defaultButtonStart

Definition at line 234 of file qmacstyle_mac_p.h.

Referenced by QMacStyle::drawControl(), and QMacStylePrivate().

◆ focusWidget

QPointer<QFocusFrame> QMacStylePrivate::focusWidget

Definition at line 233 of file qmacstyle_mac_p.h.

Referenced by QMacStyle::event().

◆ MiniButtonH

const int QMacStylePrivate::MiniButtonH = 26
static

Definition at line 167 of file qmacstyle_mac_p.h.

Referenced by initHIThemePushButton().

◆ mouseDown

bool QMacStylePrivate::mouseDown

Definition at line 236 of file qmacstyle_mac_p.h.

Referenced by animatable(), and eventFilter().

◆ progressBars

QList<QPointer<QWidget> > QMacStylePrivate::progressBars

◆ progressFrame

UInt8 QMacStylePrivate::progressFrame

Definition at line 232 of file qmacstyle_mac_p.h.

Referenced by QMacStyle::drawControl(), and timerEvent().

◆ PushButtonBottomOffset

const int QMacStylePrivate::PushButtonBottomOffset = 12
static

◆ PushButtonContentPadding

const int QMacStylePrivate::PushButtonContentPadding = 6
static

◆ PushButtonLeftOffset

const int QMacStylePrivate::PushButtonLeftOffset = 6
static

◆ PushButtonRightOffset

const int QMacStylePrivate::PushButtonRightOffset = 12
static

◆ PushButtonTopOffset

const int QMacStylePrivate::PushButtonTopOffset = 4
static

◆ q

QMacStyle* QMacStylePrivate::q

Definition at line 235 of file qmacstyle_mac_p.h.

Referenced by aquaSizeConstrain(), and pushButtonSizeFromContents().

◆ SmallButtonH

const int QMacStylePrivate::SmallButtonH = 30
static

Definition at line 168 of file qmacstyle_mac_p.h.

Referenced by initHIThemePushButton().

◆ timerID

int QMacStylePrivate::timerID

Definition at line 225 of file qmacstyle_mac_p.h.

Referenced by QMacStyle::drawControl(), startAnimationTimer(), and timerEvent().


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