Qt 4.8
Functions | Variables
qstyle.cpp File Reference
#include "qstyle.h"
#include "qapplication.h"
#include "qpainter.h"
#include "qwidget.h"
#include "qbitmap.h"
#include "qpixmapcache.h"
#include "qstyleoption.h"
#include "private/qstyle_p.h"
#include "qdebug.h"
#include <qx11info_x11.h>
#include <limits.h>
#include <QDebug>

Go to the source code of this file.

Functions

QDebug operator<< (QDebug debug, QStyle::State state)
 
static int unpackControlTypes (QSizePolicy::ControlTypes controls, QSizePolicy::ControlType *array)
 

Variables

static const int MaxBits = 8 * sizeof(QSizePolicy::ControlType)
 

Function Documentation

◆ operator<<()

QDebug operator<< ( QDebug  debug,
QStyle::State  state 
)

Definition at line 2495 of file qstyle.cpp.

2496 {
2497 #if !defined(QT_NO_DEBUG)
2498  debug << "QStyle::State(";
2499 
2500  QStringList states;
2501  if (state & QStyle::State_Active) states << QLatin1String("Active");
2502  if (state & QStyle::State_AutoRaise) states << QLatin1String("AutoRaise");
2503  if (state & QStyle::State_Bottom) states << QLatin1String("Bottom");
2504  if (state & QStyle::State_Children) states << QLatin1String("Children");
2505  if (state & QStyle::State_DownArrow) states << QLatin1String("DownArrow");
2506  if (state & QStyle::State_Editing) states << QLatin1String("Editing");
2507  if (state & QStyle::State_Enabled) states << QLatin1String("Enabled");
2508  if (state & QStyle::State_FocusAtBorder) states << QLatin1String("FocusAtBorder");
2509  if (state & QStyle::State_HasFocus) states << QLatin1String("HasFocus");
2510  if (state & QStyle::State_Horizontal) states << QLatin1String("Horizontal");
2511  if (state & QStyle::State_Item) states << QLatin1String("Item");
2512  if (state & QStyle::State_KeyboardFocusChange) states << QLatin1String("KeyboardFocusChange");
2513  if (state & QStyle::State_MouseOver) states << QLatin1String("MouseOver");
2514  if (state & QStyle::State_NoChange) states << QLatin1String("NoChange");
2515  if (state & QStyle::State_Off) states << QLatin1String("Off");
2516  if (state & QStyle::State_On) states << QLatin1String("On");
2517  if (state & QStyle::State_Open) states << QLatin1String("Open");
2518  if (state & QStyle::State_Raised) states << QLatin1String("Raised");
2519  if (state & QStyle::State_ReadOnly) states << QLatin1String("ReadOnly");
2520  if (state & QStyle::State_Selected) states << QLatin1String("Selected");
2521  if (state & QStyle::State_Sibling) states << QLatin1String("Sibling");
2522  if (state & QStyle::State_Sunken) states << QLatin1String("Sunken");
2523  if (state & QStyle::State_Top) states << QLatin1String("Top");
2524  if (state & QStyle::State_UpArrow) states << QLatin1String("UpArrow");
2525 
2526  qSort(states);
2527  debug << states.join(QLatin1String(" | "));
2528  debug << ')';
2529 #else
2530  Q_UNUSED(state);
2531 #endif
2532  return debug;
2533 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
void qSort(RandomAccessIterator start, RandomAccessIterator end)
Definition: qalgorithms.h:177
QString join(const QString &sep) const
Joins all the string list&#39;s strings into a single string with each element separated by the given sep...
Definition: qstringlist.h:162
#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

◆ unpackControlTypes()

static int unpackControlTypes ( QSizePolicy::ControlTypes  controls,
QSizePolicy::ControlType array 
)
static

Definition at line 64 of file qstyle.cpp.

Referenced by QStyle::combinedLayoutSpacing().

65 {
66  if (!controls)
67  return 0;
68 
69  // optimization: exactly one bit is set
70  if ((controls & (controls - 1)) == 0) {
71  array[0] = QSizePolicy::ControlType(uint(controls));
72  return 1;
73  }
74 
75  int count = 0;
76  for (int i = 0; i < MaxBits; ++i) {
77  if (uint bit = (controls & (0x1 << i)))
78  array[count++] = QSizePolicy::ControlType(bit);
79  }
80  return count;
81 }
static const int MaxBits
Definition: qstyle.cpp:62
unsigned int uint
Definition: qglobal.h:996

Variable Documentation

◆ MaxBits

const int MaxBits = 8 * sizeof(QSizePolicy::ControlType)
static

Definition at line 62 of file qstyle.cpp.

Referenced by QStyle::combinedLayoutSpacing(), and unpackControlTypes().