Qt 4.8
Public Functions | Public Variables | Static Public Variables | List of all members
QColorDialogPrivate Class Reference

#include <qcolordialog_p.h>

Inheritance diagram for QColorDialogPrivate:
QDialogPrivate QWidgetPrivate QObjectPrivate QObjectData

Public Functions

void _q_addCustom ()
 
void _q_macRunNativeAppModalPanel ()
 
void _q_newColorTypedIn (QRgb rgb)
 
void _q_newCustom (int, int)
 
void _q_newHsv (int h, int s, int v)
 
void _q_newStandard (int, int)
 
void closeCocoaColorPanel ()
 
QColorDialogcolorDialog ()
 
int currentAlpha () const
 
QRgb currentColor () const
 
QColor currentQColor () const
 
void done (int result)
 
void init (const QColor &initial)
 
bool isAlphaVisible () const
 
void mac_nativeDialogModalHelp ()
 
void openCocoaColorPanel (const QColor &initial, QWidget *parent, const QString &title, QColorDialog::ColorDialogOptions options)
 
void releaseCocoaColorPanelDelegate ()
 
void retranslateStrings ()
 
bool selectColor (const QColor &color)
 
void setCocoaPanelColor (const QColor &color)
 
void setCurrentAlpha (int a)
 
void setCurrentColor (QRgb rgb)
 
void setCurrentQColor (const QColor &color)
 
void showAlpha (bool b)
 
- Public Functions inherited from QDialogPrivate
void hideDefault ()
 Hides the default button indicator. More...
 
 QDialogPrivate ()
 
void resetModalitySetByOpen ()
 
void setDefault (QPushButton *)
 This function is called by the push button pushButton when it becomes the default button. More...
 
void setMainDefault (QPushButton *)
 This function sets the default default push button to pushButton. More...
 
- Public Functions inherited from QWidgetPrivate
void _q_showIfNotHidden ()
 
virtual void aboutToDestroy ()
 
void activateChildLayoutsRecursively ()
 
QSize adjustedSize () const
 
void adjustQuitOnCloseAttribute ()
 
QInputContextassignedInputContext () const
 
QPainterbeginSharedPainter ()
 
QWidgetchildAt_helper (const QPoint &, bool) const
 
QWidgetchildAtRecursiveHelper (const QPoint &p, bool, bool includeFrame=false) const
 
QRect clipRect () const
 
QRegion clipRegion () const
 
void clipToEffectiveMask (QRegion &region) const
 
bool close_helper (CloseMode mode)
 
void create_sys (WId window, bool initializeWindow, bool destroyOldWindow)
 
QWindowSurfacecreateDefaultWindowSurface ()
 
QWindowSurfacecreateDefaultWindowSurface_sys ()
 
void createExtra ()
 Creates the widget extra data. More...
 
void createRecursively ()
 
void createSysExtra ()
 
void createTLExtra ()
 
void createTLSysExtra ()
 
void createWinId (WId id=0)
 
void deactivateWidgetCleanup ()
 
void deleteExtra ()
 Deletes the widget extra data. More...
 
void deleteSysExtra ()
 
void deleteTLSysExtra ()
 
void drawWidget (QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter=0, QWidgetBackingStore *backingStore=0)
 
QWidgeteffectiveFocusWidget ()
 
QRect effectiveRectFor (const QRect &rect) const
 
bool endSharedPainter ()
 
void enforceNativeChildren ()
 
QWExtraextraData () const
 
QRect frameStrut () const
 
void getLayoutItemMargins (int *left, int *top, int *right, int *bottom) const
 
const QRegiongetOpaqueChildren () const
 
void handleSoftwareInputPanel (Qt::MouseButton button, bool clickCausedFocus)
 
virtual bool hasHeightForWidth () const
 
void hide_helper ()
 
void hide_sys ()
 Platform-specific part of QWidget::hide(). More...
 
void hideChildren (bool spontaneous)
 
void inheritStyle ()
 
void init (QWidget *desktopWidget, Qt::WindowFlags f)
 
QInputContextinputContext () const
 
void invalidateBuffer (const QRegion &)
 Invalidates the rgn (in widget's coordinates) of the backing store, i.e. More...
 
void invalidateBuffer (const QRect &)
 This function is equivalent to calling invalidateBuffer(QRegion(rect), ...), but is more efficient as it eliminates QRegion operations/allocations and can use the rect more precisely for additional cut-offs. More...
 
void invalidateBuffer_resizeHelper (const QPoint &oldPos, const QSize &oldSize)
 Invalidates the buffer when the widget is resized. More...
 
void invalidateGraphicsEffectsRecursively ()
 
bool isAboutToShow () const
 
bool isBackgroundInherited () const
 
bool isOverlapped (const QRect &) const
 
void lower_sys ()
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QWidgetBackingStoremaybeBackingStore () const
 
QTLWExtramaybeTopData () const
 
void moveRect (const QRect &, int dx, int dy)
 
bool nativeChildrenForced () const
 
QFont naturalWidgetFont (uint inheritedMask) const
 
QPalette naturalWidgetPalette (uint inheritedMask) const
 Returns the palette that the widget w inherits from its ancestors and QApplication::palette. More...
 
void paintBackground (QPainter *, const QRegion &, int flags=DrawAsRoot) const
 
bool paintOnScreen () const
 
void paintSiblingsRecursive (QPaintDevice *pdev, const QObjectList &children, int index, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter, QWidgetBackingStore *backingStore)
 
bool pointInsideRectAndMask (const QPoint &) const
 
QRegion prepareToRender (const QRegion &region, QWidget::RenderFlags renderFlags)
 
void propagatePaletteChange ()
 Propagate this widget's palette to all children, except style sheet widgets, and windows that don't enable window propagation (palettes don't normally propagate to windows). More...
 
 QWidgetPrivate (int version=QObjectPrivateVersion)
 
void raise_sys ()
 
QPaintDeviceredirected (QPoint *offset) const
 
void registerDropSite (bool)
 
void render (QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags, bool readyToRender)
 
void render_helper (QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags)
 
void repaint_sys (const QRegion &rgn)
 
void reparentFocusWidgets (QWidget *oldtlw)
 
void resolveFont ()
 Determine which font is implicitly imposed on this widget by its ancestors and QApplication::font, resolve this against its own font (attributes from the implicit font are copied over). More...
 
void resolveLayoutDirection ()
 
void resolveLocale ()
 
void resolvePalette ()
 Determine which palette is inherited from this widget's ancestors and QApplication::palette, resolve this against this widget's palette (attributes from the inherited palette are copied over this widget's palette). More...
 
void restoreRedirected ()
 
void scroll_sys (int dx, int dy)
 
void scroll_sys (int dx, int dy, const QRect &r)
 
void scrollChildren (int dx, int dy)
 
void scrollRect (const QRect &, int dx, int dy)
 
void sendPendingMoveAndResizeEvents (bool recursive=false, bool disableUpdates=false)
 
void sendStartupMessage (const char *message) const
 Platform-specific part of QWidget::show(). More...
 
void setConstraints_sys ()
 
void setCursor_sys (const QCursor &cursor)
 
void setDirtyOpaqueRegion ()
 
void setEnabled_helper (bool)
 
void setFocus_sys ()
 
void setFont_helper (const QFont &font)
 
void setGeometry_sys (int, int, int, int, bool)
 
void setLayoutDirection_helper (Qt::LayoutDirection)
 
void setLayoutItemMargins (int left, int top, int right, int bottom)
 
void setLayoutItemMargins (QStyle::SubElement element, const QStyleOption *opt=0)
 
void setLocale_helper (const QLocale &l, bool forceUpdate=false)
 
void setMask_sys (const QRegion &)
 
bool setMaximumSize_helper (int &maxw, int &maxh)
 
bool setMinimumSize_helper (int &minw, int &minh)
 
void setModal_sys ()
 
void setNetWmWindowTypes ()
 
void setOpaque (bool opaque)
 
void setPalette_helper (const QPalette &)
 
void setParent_sys (QWidget *parent, Qt::WindowFlags)
 
void setRedirected (QPaintDevice *replacement, const QPoint &offset)
 
void setSharedPainter (QPainter *painter)
 
void setStyle_helper (QStyle *newStyle, bool propagate, bool metalHack=false)
 
void setUpdatesEnabled_helper (bool)
 
void setWindowFilePath_helper (const QString &filePath)
 
void setWindowIcon_helper ()
 
void setWindowIcon_sys (bool forceReset=false)
 
void setWindowIconText_helper (const QString &cap)
 
void setWindowIconText_sys (const QString &cap)
 
void setWindowOpacity_sys (qreal opacity)
 
void setWindowRole ()
 
void setWindowTitle_helper (const QString &cap)
 
void setWindowTitle_sys (const QString &cap)
 
void setWinId (WId)
 
QPaintersharedPainter () const
 
void show_helper ()
 
void show_recursive ()
 Makes the widget visible in the isVisible() meaning of the word. More...
 
void show_sys ()
 Platform-specific part of QWidget::show(). More...
 
void showChildren (bool spontaneous)
 
void stackUnder_sys (QWidget *)
 
void subtractOpaqueChildren (QRegion &rgn, const QRect &clipRect) const
 
void subtractOpaqueSiblings (QRegion &source, bool *hasDirtySiblingsAbove=0, bool alsoNonOpaque=false) const
 
void syncBackingStore ()
 
void syncBackingStore (const QRegion &region)
 
QTLWExtratopData () const
 
void unsetCursor_sys ()
 
void updateFont (const QFont &)
 Assign font to this widget, and propagate it to all children, except style sheet widgets (handled differently) and windows that don't enable window propagation. More...
 
void updateFrameStrut ()
 Computes the frame rectangle when needed. More...
 
void updateGeometry_helper (bool forceUpdate)
 
void updateIsOpaque ()
 
void updateIsTranslucent ()
 
void updateSystemBackground ()
 
void updateX11AcceptFocus ()
 
void x11UpdateIsOpaque ()
 
 ~QWidgetPrivate ()
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Public Variables

QPushButtonaddCusBt
 
QDialogButtonBoxbuttons
 
QPushButtoncancel
 
QColorPickercp
 
QColorShowercs
 
QWellArraycustom
 
void * delegate
 
QLabellblBasicColors
 
QLabellblCustomColors
 
QVBoxLayoutleftLay
 
QColorLuminancePickerlp
 
QByteArray memberToDisconnectOnClose
 
bool nativeDialogInUse
 
int nextCust
 
QPushButtonok
 
QColorDialog::ColorDialogOptions opts
 
QPointer< QObjectreceiverToDisconnectOnClose
 
QColor selectedQColor
 
bool smallDisplay
 
QWellArraystandard
 
- Public Variables inherited from QDialogPrivate
bool doShowExtension
 
QPointer< QEventLoopeventLoop
 
QWidgetextension
 
QPoint lastRMBPress
 
QPointer< QPushButtonmainDef
 
QSize max
 
QSize min
 
Qt::Orientation orientation
 
int rescode
 
int resetModalityTo
 
QSizeGripresizer
 
QSize size
 
bool sizeGripEnabled
 
bool wasModalitySet
 
- Public Variables inherited from QWidgetPrivate
QString accessibleDescription
 
QString accessibleName
 
QList< QAction * > actions
 
QPalette::ColorRole bg_role: 8
 
signed char bottomLayoutItemMargin
 
short bottommargin
 
QWidgetData data
 
QRegion dirty
 
uint dirtyOpaqueChildren: 1
 
QWExtraextra
 
QPaintEngineextraPaintEngine
 
QPalette::ColorRole fg_role: 8
 
QWidgetfocus_child
 
QWidgetfocus_next
 
QWidgetfocus_prev
 
QMap< Qt::GestureType, Qt::GestureFlags > gestureContext
 
QGraphicsEffectgraphicsEffect
 
Qt::HANDLE hd
 
uint high_attributes [4]
 
QPointer< QInputContextic
 
Qt::InputMethodHints imHints
 
uint inDirtyList: 1
 
uint inheritedFontResolveMask
 
uint inheritedPaletteResolveMask
 
uint inheritsInputMethodHints: 1
 
uint inSetParent: 1
 
uint isGLWidget: 1
 
uint isMoved: 1
 
uint isOpaque: 1
 
uint isScrolled: 1
 
QLayoutlayout
 
signed char leftLayoutItemMargin
 
short leftmargin
 
QLocale locale
 
QRegionneedsFlush
 
QRegion opaqueChildren
 
Qt::HANDLE picture
 
const QMetaObjectpolished
 
QPaintDeviceredirectDev
 
QPoint redirectOffset
 
signed char rightLayoutItemMargin
 
short rightmargin
 
QSizePolicy size_policy
 
QString statusTip
 
QString toolTip
 
signed char topLayoutItemMargin
 
short topmargin
 
uint usesDoubleBufferedGLContext: 1
 
QString whatsThis
 
QWidgetItemV2widgetItem
 
QX11Info xinfo
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Static Public Variables

static bool sharedColorPanelAvailable = true
 
- Static Public Variables inherited from QWidgetPrivate
static QWidgetSetallWidgets = 0
 
static int instanceCounter = 0
 
static QWidgetkeyboardGrabber = 0
 
static QWidgetMappermapper = 0
 
static int maxInstances = 0
 
static QWidgetmouseGrabber = 0
 

Additional Inherited Members

- Public Types inherited from QWidgetPrivate
enum  CloseMode { CloseNoEvent, CloseWithEvent, CloseWithSpontaneousEvent }
 
enum  Direction { DirectionNorth = 0x01, DirectionEast = 0x10, DirectionSouth = 0x02, DirectionWest = 0x20 }
 
enum  DrawWidgetFlags {
  DrawAsRoot = 0x01, DrawPaintOnScreen = 0x02, DrawRecursive = 0x04, DrawInvisible = 0x08,
  DontSubtractOpaqueChildren = 0x10, DontSetCompositionMode = 0x20, DontDrawOpaqueChildren = 0x40, DontDrawNativeChildren = 0x80
}
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
- Static Public Functions inherited from QWidgetPrivate
static void adjustFlags (Qt::WindowFlags &flags, QWidget *w=0)
 
static QGraphicsProxyWidgetnearestGraphicsProxyWidget (const QWidget *origin)
 Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this widget and its ancestors. More...
 
static int pointToRect (const QPoint &p, const QRect &r)
 
static QRect screenGeometry (const QWidget *widget)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 

Detailed Description

Definition at line 73 of file qcolordialog_p.h.

Functions

◆ _q_addCustom()

void QColorDialogPrivate::_q_addCustom ( )

Definition at line 1660 of file qcolordialog.cpp.

1661 {
1663  if (custom)
1664  custom->update();
1665  nextCust = (nextCust+1) % 16;
1666 }
QWellArray * custom
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
QColorShower * cs
static QRgb cusrgb[2 *8]
QRgb currentColor() const

◆ _q_macRunNativeAppModalPanel()

void QColorDialogPrivate::_q_macRunNativeAppModalPanel ( )

Definition at line 482 of file qcolordialog_mac.mm.

483 {
484  [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) exec];
485 }
#define QT_MANGLE_NAMESPACE(name)
Definition: qglobal.h:106

◆ _q_newColorTypedIn()

void QColorDialogPrivate::_q_newColorTypedIn ( QRgb  rgb)

Definition at line 1459 of file qcolordialog.cpp.

1460 {
1461  int h, s, v;
1462  rgb2hsv(rgb, h, s, v);
1463  cp->setCol(h, s);
1464  lp->setCol(h, s, v);
1465 }
void setCol(int h, int s, int v)
void setCol(int h, int s)
static void rgb2hsv(QRgb rgb, int &h, int &s, int &v)
#define rgb(r, g, b)
Definition: qcolor_p.cpp:130
QColorPicker * cp
QColorLuminancePicker * lp

◆ _q_newCustom()

void QColorDialogPrivate::_q_newCustom ( int  r,
int  c 
)

Definition at line 1467 of file qcolordialog.cpp.

1468 {
1469  int i = r+2*c;
1470  setCurrentColor(cusrgb[i]);
1471  nextCust = i;
1472  if (standard)
1473  standard->setSelected(-1,-1);
1474 }
unsigned char c[8]
Definition: qnumeric_p.h:62
void setCurrentColor(QRgb rgb)
virtual void setSelected(int row, int col)
QWellArray * standard
static QRgb cusrgb[2 *8]

◆ _q_newHsv()

void QColorDialogPrivate::_q_newHsv ( int  h,
int  s,
int  v 
)

Definition at line 1399 of file qcolordialog.cpp.

1400 {
1401  cs->setHsv(h, s, v);
1402  cp->setCol(h, s);
1403  lp->setCol(h, s, v);
1404 }
void setCol(int h, int s, int v)
QColorShower * cs
void setCol(int h, int s)
void setHsv(int h, int s, int v)
QColorPicker * cp
QColorLuminancePicker * lp

◆ _q_newStandard()

void QColorDialogPrivate::_q_newStandard ( int  r,
int  c 
)

Definition at line 1476 of file qcolordialog.cpp.

1477 {
1478  setCurrentColor(stdrgb[r+c*6]);
1479  if (custom)
1480  custom->setSelected(-1,-1);
1481 }
unsigned char c[8]
Definition: qnumeric_p.h:62
QWellArray * custom
void setCurrentColor(QRgb rgb)
virtual void setSelected(int row, int col)
static QRgb stdrgb[6 *8]

◆ closeCocoaColorPanel()

void QColorDialogPrivate::closeCocoaColorPanel ( )

Definition at line 457 of file qcolordialog_mac.mm.

458 {
459  [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) onCancelClicked];
460 }
#define QT_MANGLE_NAMESPACE(name)
Definition: qglobal.h:106

◆ colorDialog()

QColorDialog* QColorDialogPrivate::colorDialog ( )
inline

Definition at line 127 of file qcolordialog_p.h.

127 { return q_func(); }

◆ currentAlpha()

int QColorDialogPrivate::currentAlpha ( ) const
inline

Definition at line 1285 of file qcolordialog.cpp.

1285 { return cs->currentAlpha(); }
QColorShower * cs
int currentAlpha() const

◆ currentColor()

QRgb QColorDialogPrivate::currentColor ( ) const
inline

Definition at line 1284 of file qcolordialog.cpp.

1284 { return cs->currentColor(); }
QColorShower * cs
QRgb currentColor() const

◆ currentQColor()

QColor QColorDialogPrivate::currentQColor ( ) const

Definition at line 1290 of file qcolordialog.cpp.

1291 {
1292  return cs->currentQColor();
1293 }
QColor currentQColor() const
QColorShower * cs

◆ done()

void QColorDialogPrivate::done ( int  result)
inline

Definition at line 126 of file qcolordialog_p.h.

126 { q_func()->done(result); }

◆ init()

void QColorDialogPrivate::init ( const QColor initial)

Definition at line 1483 of file qcolordialog.cpp.

1484 {
1485  Q_Q(QColorDialog);
1486 
1487  q->setSizeGripEnabled(false);
1488  q->setWindowTitle(QColorDialog::tr("Select Color"));
1489 
1490  nativeDialogInUse = false;
1491 
1492  nextCust = 0;
1493  QVBoxLayout *mainLay = new QVBoxLayout(q);
1494  // there's nothing in this dialog that benefits from sizing up
1496 
1497  QHBoxLayout *topLay = new QHBoxLayout();
1498  mainLay->addLayout(topLay);
1499 
1500  leftLay = 0;
1501 
1502 #if defined(Q_WS_WINCE) || defined(QT_SMALL_COLORDIALOG)
1503  smallDisplay = true;
1504  const int lumSpace = 20;
1505 #else
1506  // small displays (e.g. PDAs) cannot fit the full color dialog,
1507  // so just use the color picker.
1509  const int lumSpace = topLay->spacing() / 2;
1510 #endif
1511 
1512  if (!smallDisplay) {
1513  leftLay = new QVBoxLayout;
1514  topLay->addLayout(leftLay);
1515  }
1516 
1517  initRGB();
1518 
1519 #ifndef QT_NO_SETTINGS
1520  if (!customSet) {
1521  QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
1522  for (int i = 0; i < 2*8; ++i) {
1523  QVariant v = settings.value(QLatin1String("Qt/customColors/") + QString::number(i));
1524  if (v.isValid()) {
1525  QRgb rgb = v.toUInt();
1526  cusrgb[i] = rgb;
1527  }
1528  }
1529  }
1530 #endif
1531 
1532 #if defined(QT_SMALL_COLORDIALOG)
1533 # if defined(Q_WS_S60)
1534  const bool nonTouchUI = !S60->hasTouchscreen;
1535 # elif defined(Q_WS_MAEMO_5)
1536  const bool nonTouchUI = false;
1537 # endif
1538 #endif
1539 
1540  if (!smallDisplay) {
1541  standard = new QColorWell(q, 6, 8, stdrgb);
1542  lblBasicColors = new QLabel(q);
1543 #ifndef QT_NO_SHORTCUT
1545 #endif
1546  q->connect(standard, SIGNAL(selected(int,int)), SLOT(_q_newStandard(int,int)));
1549 
1550 #if !defined(Q_WS_WINCE)
1551  leftLay->addStretch();
1552 #endif
1553 
1554  custom = new QColorWell(q, 2, 8, cusrgb);
1555  custom->setAcceptDrops(true);
1556 
1557  q->connect(custom, SIGNAL(selected(int,int)), SLOT(_q_newCustom(int,int)));
1558  lblCustomColors = new QLabel(q);
1559 #ifndef QT_NO_SHORTCUT
1561 #endif
1564 
1565  addCusBt = new QPushButton(q);
1566  QObject::connect(addCusBt, SIGNAL(clicked()), q, SLOT(_q_addCustom()));
1568  } else {
1569  // better color picker size for small displays
1570 #if defined(QT_SMALL_COLORDIALOG)
1572  pWidth = pHeight = qMin(screenSize.width(), screenSize.height());
1573  pHeight -= 20;
1574  if(screenSize.height() > screenSize.width())
1575  pWidth -= 20;
1576 #else
1577  pWidth = 150;
1578  pHeight = 100;
1579 #endif
1580  custom = 0;
1581  standard = 0;
1582  }
1583 
1584  QVBoxLayout *rightLay = new QVBoxLayout;
1585  topLay->addLayout(rightLay);
1586 
1587  QHBoxLayout *pickLay = new QHBoxLayout;
1588  rightLay->addLayout(pickLay);
1589 
1590  QVBoxLayout *cLay = new QVBoxLayout;
1591  pickLay->addLayout(cLay);
1592  cp = new QColorPicker(q);
1593 
1595 
1596 #if defined(QT_SMALL_COLORDIALOG)
1597  if (!nonTouchUI) {
1598  pickLay->addWidget(cp);
1599  cLay->addSpacing(lumSpace);
1600  } else {
1601  cp->hide();
1602  }
1603 #else
1604  cLay->addSpacing(lumSpace);
1605  cLay->addWidget(cp);
1606 #endif
1607  cLay->addSpacing(lumSpace);
1608 
1609  lp = new QColorLuminancePicker(q);
1610 #if defined(QT_SMALL_COLORDIALOG)
1612  const int minDimension = qMin(screenSize.height(), screenSize.width());
1613  //set picker to be finger-usable
1614  int pickerWidth = !nonTouchUI ? minDimension/9 : minDimension/12;
1615  lp->setFixedWidth(pickerWidth);
1616  if (!nonTouchUI)
1617  pickLay->addWidget(lp);
1618  else
1619  lp->hide();
1620 #else
1621  lp->setFixedWidth(20);
1622  pickLay->addWidget(lp);
1623 #endif
1624 
1625  QObject::connect(cp, SIGNAL(newCol(int,int)), lp, SLOT(setCol(int,int)));
1626  QObject::connect(lp, SIGNAL(newHsv(int,int,int)), q, SLOT(_q_newHsv(int,int,int)));
1627 
1628  rightLay->addStretch();
1629 
1630  cs = new QColorShower(q);
1632  QObject::connect(cs, SIGNAL(currentColorChanged(QColor)),
1633  q, SIGNAL(currentColorChanged(QColor)));
1634 #if defined(QT_SMALL_COLORDIALOG)
1635  if (!nonTouchUI)
1636  pWidth -= cp->size().width();
1637  topLay->addWidget(cs);
1638 #else
1639  rightLay->addWidget(cs);
1640 #endif
1641 
1642  buttons = new QDialogButtonBox(q);
1643  mainLay->addWidget(buttons);
1644 
1646  QObject::connect(ok, SIGNAL(clicked()), q, SLOT(accept()));
1647  ok->setDefault(true);
1649  QObject::connect(cancel, SIGNAL(clicked()), q, SLOT(reject()));
1650 
1652 
1653 #ifdef Q_WS_MAC
1654  delegate = 0;
1655 #endif
1656 
1657  q->setCurrentColor(initial);
1658 }
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 QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
static int pHeight
QDialogButtonBox * buttons
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
static int pWidth
unsigned int QRgb
Definition: qrgb.h:53
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
QSize size() const
QWellArray * custom
void _q_newHsv(int h, int s, int v)
The QSettings class provides persistent platform-independent application settings.
Definition: qsettings.h:73
void _q_newStandard(int, int)
void addLayout(QLayout *layout, int stretch=0)
Adds layout to the end of the box, with serial stretch factor stretch.
#define SLOT(a)
Definition: qobjectdefs.h:226
void setDefault(bool)
The QPushButton widget provides a command button.
Definition: qpushbutton.h:57
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QWellArray * standard
QPushButton * addCusBt
void _q_newCustom(int, int)
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=0)
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment...
int height() const
void setFixedWidth(int w)
Sets both the minimum and maximum width of the widget to w without changing the heights.
Definition: qwidget.cpp:4368
#define Q_Q(Class)
Definition: qglobal.h:2483
void addStretch(int stretch=0)
Adds a stretchable space (a QSpacerItem) with zero minimum size and stretch factor stretch to the end...
#define SIGNAL(a)
Definition: qobjectdefs.h:227
QColorShower * cs
int width() const
Returns the width.
Definition: qsize.h:126
static bool customSet
The QColorDialog class provides a dialog widget for specifying colors.
Definition: qcolordialog.h:57
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 rece...
Definition: qobject.cpp:2580
int width() const
static QRgb cusrgb[2 *8]
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
static QRgb stdrgb[6 *8]
static void initRGB()
void _q_newColorTypedIn(QRgb rgb)
void addButton(QAbstractButton *button, ButtonRole role)
Adds the given button to the button box with the specified role.
void hide()
Hides the widget.
Definition: qwidget.h:501
#define rgb(r, g, b)
Definition: qcolor_p.cpp:130
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
QVBoxLayout * leftLay
void setAcceptDrops(bool on)
Definition: qwidget.cpp:3534
void setBuddy(QWidget *)
Sets this label&#39;s buddy to buddy.
Definition: qlabel.cpp:1297
void addSpacing(int size)
Adds a non-stretchable space (a QSpacerItem) with size size to the end of this box layout...
The QDialogButtonBox class is a widget that presents buttons in a layout that is appropriate to the c...
void setFrameStyle(int)
Sets the frame style to style.
Definition: qframe.cpp:329
uint toUInt(bool *ok=0) const
Returns the variant as an unsigned int if the variant has type() UInt , Bool , ByteArray ...
Definition: qvariant.cpp:2644
int height() const
Returns the height.
Definition: qsize.h:129
The QLabel widget provides a text or image display.
Definition: qlabel.h:55
The QHBoxLayout class lines up widgets horizontally.
Definition: qboxlayout.h:129
int spacing() const
Reimplements QLayout::spacing().
Definition: qboxlayout.cpp:649
void setSizeConstraint(SizeConstraint)
Definition: qlayout.cpp:1435
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QColorPicker * cp
const QRect availableGeometry(int screen=-1) const
The QVBoxLayout class lines up widgets vertically.
Definition: qboxlayout.h:149
T value() const
Returns the stored value converted to the template type T.
Definition: qvariant.h:332
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
Definition: qvariant.h:485
QColorLuminancePicker * lp
QPushButton * cancel
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.
Definition: qcursor_mac.mm:310

◆ isAlphaVisible()

bool QColorDialogPrivate::isAlphaVisible ( ) const
inline

Definition at line 1288 of file qcolordialog.cpp.

1288 { return cs->isAlphaVisible(); }
QColorShower * cs
bool isAlphaVisible() const

◆ mac_nativeDialogModalHelp()

void QColorDialogPrivate::mac_nativeDialogModalHelp ( )
virtual

Reimplemented from QDialogPrivate.

Definition at line 467 of file qcolordialog_mac.mm.

468 {
469  // Do a queued meta-call to open the native modal dialog so it opens after the new
470  // event loop has started to execute (in QDialog::exec). Using a timer rather than
471  // a queued meta call is intentional to ensure that the call is only delivered when
472  // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not
473  // running (which is the case if e.g a top-most QEventLoop has been
474  // interrupted, and the second-most event loop has not yet been reactivated (regardless
475  // if [NSApp run] is still on the stack)), showing a native modal dialog will fail.
476  if (delegate){
477  Q_Q(QColorDialog);
479  }
480 }
#define SLOT(a)
Definition: qobjectdefs.h:226
#define Q_Q(Class)
Definition: qglobal.h:2483
The QColorDialog class provides a dialog widget for specifying colors.
Definition: qcolordialog.h:57
bool singleShot
This static function calls a slot after a given time interval.
Definition: qtimer.h:59

◆ openCocoaColorPanel()

void QColorDialogPrivate::openCocoaColorPanel ( const QColor initial,
QWidget parent,
const QString title,
QColorDialog::ColorDialogOptions  options 
)

Definition at line 381 of file qcolordialog_mac.mm.

383 {
384  Q_UNUSED(parent); // we would use the parent if only NSColorPanel could be a sheet
386 
387  if (!delegate) {
388  /*
389  The standard Cocoa color panel has no OK or Cancel button and
390  is created as a utility window, whereas we want something like
391  the Carbon color panel. We need to take the following steps:
392 
393  1. Intercept the color panel constructor to turn off the
394  NSUtilityWindowMask flag. This is done by temporarily
395  replacing initWithContentRect:styleMask:backing:defer:
396  in NSPanel by our own method.
397 
398  2. Modify the color panel so that its content view is part
399  of a new content view that contains it as well as two
400  buttons (OK and Cancel).
401 
402  3. Lay out the original content view and the buttons when
403  the color panel is shown and whenever it is resized.
404 
405  4. Clean up after ourselves.
406  */
407 
408  bool hackColorPanel = !(options & QColorDialog::NoButtons);
409 
410  if (hackColorPanel)
412  NSColorPanel *colorPanel = [NSColorPanel sharedColorPanel];
413  if (hackColorPanel)
415 
416  [colorPanel setHidesOnDeactivate:false];
417 
418  // set up the Cocoa color panel
419  [colorPanel setShowsAlpha:options & QColorDialog::ShowAlphaChannel];
420  [colorPanel setTitle:(NSString*)(CFStringRef)QCFString(title)];
421 
422  NSView *stolenContentView = 0;
423  NSButton *okButton = 0;
424  NSButton *cancelButton = 0;
425 
426  if (hackColorPanel) {
427  // steal the color panel's contents view
428  stolenContentView = [colorPanel contentView];
429  [stolenContentView retain];
430  [colorPanel setContentView:0];
431 
432  // create a new content view and add the stolen one as a subview
433  NSRect frameRect = { { 0.0, 0.0 }, { 0.0, 0.0 } };
434  NSView *ourContentView = [[NSView alloc] initWithFrame:frameRect];
435  [ourContentView addSubview:stolenContentView];
436 
437  // create OK and Cancel buttons and add these as subviews
438  okButton = macCreateButton("&OK", ourContentView);
439  cancelButton = macCreateButton("Cancel", ourContentView);
440 
441  [colorPanel setContentView:ourContentView];
442  [colorPanel setDefaultButtonCell:[okButton cell]];
443  }
444 
445  delegate = [[QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) alloc] initWithColorPanel:colorPanel
446  stolenContentView:stolenContentView
447  okButton:okButton
448  cancelButton:cancelButton
449  priv:this];
450  [colorPanel setDelegate:static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate)];
451  }
452  [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) setResultSet:NO];
453  setCocoaPanelColor(initial);
454  [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) showColorPanel];
455 }
const struct __CFString * CFStringRef
void macStartInterceptNSPanelCtor()
void macStopInterceptNSPanelCtor()
void setCocoaPanelColor(const QColor &color)
#define QT_MANGLE_NAMESPACE(name)
Definition: qglobal.h:106
static const QMetaObjectPrivate * priv(const uint *data)
#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
NSButton * macCreateButton(const char *text, NSView *superview)

◆ releaseCocoaColorPanelDelegate()

void QColorDialogPrivate::releaseCocoaColorPanelDelegate ( )

Definition at line 462 of file qcolordialog_mac.mm.

463 {
464  [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) release];
465 }
#define QT_MANGLE_NAMESPACE(name)
Definition: qglobal.h:106

◆ retranslateStrings()

void QColorDialogPrivate::retranslateStrings ( )

Definition at line 1668 of file qcolordialog.cpp.

1669 {
1670  if (!smallDisplay) {
1671  lblBasicColors->setText(QColorDialog::tr("&Basic colors"));
1672  lblCustomColors->setText(QColorDialog::tr("&Custom colors"));
1673  addCusBt->setText(QColorDialog::tr("&Add to Custom Colors"));
1674  }
1675 
1677 }
void setText(const QString &text)
void setText(const QString &)
Definition: qlabel.cpp:366
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QPushButton * addCusBt
void retranslateStrings()
QColorShower * cs

◆ selectColor()

bool QColorDialogPrivate::selectColor ( const QColor color)

Definition at line 1423 of file qcolordialog.cpp.

1424 {
1425  QRgb color = col.rgb();
1426  int i = 0, j = 0;
1427  // Check standard colors
1428  if (standard) {
1429  for (i = 0; i < 6; i++) {
1430  for (j = 0; j < 8; j++) {
1431  if (color == stdrgb[i + j*6]) {
1432  _q_newStandard(i, j);
1433  standard->setCurrent(i, j);
1434  standard->setSelected(i, j);
1435  standard->setFocus();
1436  return true;
1437  }
1438  }
1439  }
1440  }
1441  // Check custom colors
1442  if (custom) {
1443  for (i = 0; i < 2; i++) {
1444  for (j = 0; j < 8; j++) {
1445  if (color == cusrgb[i + j*2]) {
1446  _q_newCustom(i, j);
1447  custom->setCurrent(i, j);
1448  custom->setSelected(i, j);
1449  custom->setFocus();
1450  return true;
1451  }
1452  }
1453  }
1454  }
1455  return false;
1456 }
unsigned int QRgb
Definition: qrgb.h:53
QWellArray * custom
virtual void setSelected(int row, int col)
void _q_newStandard(int, int)
QWellArray * standard
void _q_newCustom(int, int)
static QRgb cusrgb[2 *8]
static QRgb stdrgb[6 *8]
void setFocus()
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its paren...
Definition: qwidget.h:432
virtual void setCurrent(int row, int col)
QRgb rgb() const
Returns the RGB value of the color.
Definition: qcolor.cpp:1051

◆ setCocoaPanelColor()

void QColorDialogPrivate::setCocoaPanelColor ( const QColor color)

Definition at line 487 of file qcolordialog_mac.mm.

488 {
491  NSColor *nsColor;
492  const QColor::Spec spec = color.spec();
493  if (spec == QColor::Cmyk) {
494  nsColor = [NSColor colorWithDeviceCyan:color.cyanF()
495  magenta:color.magentaF()
496  yellow:color.yellowF()
497  black:color.blackF()
498  alpha:color.alphaF()];
499  } else {
500  nsColor = [NSColor colorWithCalibratedRed:color.redF()
501  green:color.greenF()
502  blue:color.blueF()
503  alpha:color.alphaF()];
504  }
505  [[theDelegate colorPanel] setColor:nsColor];
506 }
qreal cyanF() const
Returns the cyan color component of this color.
Definition: qcolor.cpp:1585
qreal alphaF() const
Returns the alpha color component of this color.
Definition: qcolor.cpp:1106
qreal greenF() const
Returns the green color component of this color.
Definition: qcolor.cpp:1241
Spec
The type of color specified, either RGB, HSV, CMYK or HSL.
Definition: qcolor.h:70
qreal blackF() const
Returns the black color component of this color.
Definition: qcolor.cpp:1624
qreal yellowF() const
Returns the yellow color component of this color.
Definition: qcolor.cpp:1611
#define QT_MANGLE_NAMESPACE(name)
Definition: qglobal.h:106
qreal redF() const
Returns the red color component of this color.
Definition: qcolor.cpp:1213
qreal blueF() const
Returns the blue color component of this color.
Definition: qcolor.cpp:1269
qreal magentaF() const
Returns the magenta color component of this color.
Definition: qcolor.cpp:1598
Spec spec() const
Returns how the color was specified.
Definition: qcolor.h:88

◆ setCurrentAlpha()

void QColorDialogPrivate::setCurrentAlpha ( int  a)
inline

Definition at line 1286 of file qcolordialog.cpp.

1286 { cs->setCurrentAlpha(a); }
long ASN1_INTEGER_get ASN1_INTEGER * a
QColorShower * cs
void setCurrentAlpha(int a)

◆ setCurrentColor()

void QColorDialogPrivate::setCurrentColor ( QRgb  rgb)

Definition at line 1407 of file qcolordialog.cpp.

1408 {
1409  cs->setRgb(rgb);
1411 }
void setRgb(QRgb rgb)
QColorShower * cs
void _q_newColorTypedIn(QRgb rgb)
#define rgb(r, g, b)
Definition: qcolor_p.cpp:130

◆ setCurrentQColor()

void QColorDialogPrivate::setCurrentQColor ( const QColor color)

Definition at line 1414 of file qcolordialog.cpp.

1415 {
1416  Q_Q(QColorDialog);
1417  if (cs->curQColor != color) {
1418  cs->curQColor = color;
1419  emit q->currentColorChanged(color);
1420  }
1421 }
#define Q_Q(Class)
Definition: qglobal.h:2483
QColorShower * cs
The QColorDialog class provides a dialog widget for specifying colors.
Definition: qcolordialog.h:57
#define emit
Definition: qobjectdefs.h:76

◆ showAlpha()

void QColorDialogPrivate::showAlpha ( bool  b)
inline

Definition at line 1287 of file qcolordialog.cpp.

1287 { cs->showAlpha(b); }
QColorShower * cs
void showAlpha(bool b)

Properties

◆ addCusBt

QPushButton* QColorDialogPrivate::addCusBt

Definition at line 110 of file qcolordialog_p.h.

◆ buttons

QDialogButtonBox* QColorDialogPrivate::buttons

Definition at line 101 of file qcolordialog_p.h.

◆ cancel

QPushButton* QColorDialogPrivate::cancel

Definition at line 109 of file qcolordialog_p.h.

◆ cp

QColorPicker* QColorDialogPrivate::cp

Definition at line 103 of file qcolordialog_p.h.

◆ cs

QColorShower* QColorDialogPrivate::cs

Definition at line 105 of file qcolordialog_p.h.

◆ custom

QWellArray* QColorDialogPrivate::custom

Definition at line 98 of file qcolordialog_p.h.

◆ delegate

void* QColorDialogPrivate::delegate

Definition at line 129 of file qcolordialog_p.h.

◆ lblBasicColors

QLabel* QColorDialogPrivate::lblBasicColors

Definition at line 106 of file qcolordialog_p.h.

◆ lblCustomColors

QLabel* QColorDialogPrivate::lblCustomColors

Definition at line 107 of file qcolordialog_p.h.

◆ leftLay

QVBoxLayout* QColorDialogPrivate::leftLay

Definition at line 102 of file qcolordialog_p.h.

◆ lp

QColorLuminancePicker* QColorDialogPrivate::lp

Definition at line 104 of file qcolordialog_p.h.

◆ memberToDisconnectOnClose

QByteArray QColorDialogPrivate::memberToDisconnectOnClose

Definition at line 116 of file qcolordialog_p.h.

◆ nativeDialogInUse

bool QColorDialogPrivate::nativeDialogInUse

Definition at line 117 of file qcolordialog_p.h.

◆ nextCust

int QColorDialogPrivate::nextCust

Definition at line 112 of file qcolordialog_p.h.

◆ ok

QPushButton* QColorDialogPrivate::ok

Definition at line 108 of file qcolordialog_p.h.

◆ opts

QColorDialog::ColorDialogOptions QColorDialogPrivate::opts

Definition at line 114 of file qcolordialog_p.h.

◆ receiverToDisconnectOnClose

QPointer<QObject> QColorDialogPrivate::receiverToDisconnectOnClose

Definition at line 115 of file qcolordialog_p.h.

◆ selectedQColor

QColor QColorDialogPrivate::selectedQColor

Definition at line 111 of file qcolordialog_p.h.

◆ sharedColorPanelAvailable

bool QColorDialogPrivate::sharedColorPanelAvailable = true
static

◆ smallDisplay

bool QColorDialogPrivate::smallDisplay

Definition at line 113 of file qcolordialog_p.h.

◆ standard

QWellArray* QColorDialogPrivate::standard

Definition at line 99 of file qcolordialog_p.h.


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