Qt 4.8
Public Functions | Public Variables | List of all members
QCommandLinkButtonPrivate Class Reference
Inheritance diagram for QCommandLinkButtonPrivate:
QPushButtonPrivate QAbstractButtonPrivate QWidgetPrivate QObjectPrivate QObjectData

Public Functions

int bottomMargin () const
 
QFont descriptionFont () const
 
int descriptionHeight (int width) const
 
int descriptionOffset () const
 
QRect descriptionRect () const
 
void init ()
 
int leftMargin () const
 
QColor mergedColors (const QColor &a, const QColor &b, int value) const
 
 QCommandLinkButtonPrivate ()
 
int rightMargin () const
 
int textOffset () const
 
QFont titleFont () const
 
QRect titleRect () const
 
qreal titleSize () const
 
int topMargin () const
 
bool usingVistaStyle () const
 
- Public Functions inherited from QPushButtonPrivate
void _q_popupPressed ()
 
QPoint adjustedMenuPosition ()
 
QDialogdialogParent () const
 
bool hitButton (const QPoint &pos)
 
void init ()
 
 QPushButtonPrivate ()
 
void resetLayoutItemMargins ()
 
- Public Functions inherited from QAbstractButtonPrivate
void click ()
 
void emitClicked ()
 
void emitPressed ()
 
void emitReleased ()
 
void fixFocusPolicy ()
 
void init ()
 
void moveFocus (int key)
 
void notifyChecked ()
 
 QAbstractButtonPrivate (QSizePolicy::ControlType type=QSizePolicy::DefaultType)
 
QList< QAbstractButton * > queryButtonList () const
 
QAbstractButtonqueryCheckedButton () const
 
void refresh ()
 
- 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

QColor currentColor
 
QString description
 
- Public Variables inherited from QPushButtonPrivate
uint autoDefault: 2
 
uint defaultButton: 1
 
uint flat: 1
 
uint lastAutoDefault: 1
 
QPointer< QMenumenu
 
uint menuOpen: 1
 
- Public Variables inherited from QAbstractButtonPrivate
QBasicTimer animateTimer
 
uint autoExclusive:1
 
uint autoRepeat:1
 
int autoRepeatDelay
 
int autoRepeatInterval
 
uint blockRefresh:1
 
uint checkable:1
 
uint checked:1
 
QSizePolicy::ControlType controlType
 
uint down:1
 
QButtonGroupgroup
 
QIcon icon
 
QSize iconSize
 
uint pressed: 1
 
QBasicTimer repeatTimer
 
QKeySequence shortcut
 
int shortcutId
 
QSize sizeHint
 
QString text
 
- 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
 

Additional Inherited Members

- Public Types inherited from QPushButtonPrivate
enum  AutoDefaultValue { Off = 0, On = 1, Auto = 2 }
 
- 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 QPushButtonPrivate
static QPushButtonPrivateget (QPushButton *b)
 
- 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)
 
- 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
 

Detailed Description

Definition at line 104 of file qcommandlinkbutton.cpp.

Constructors and Destructors

◆ QCommandLinkButtonPrivate()

QCommandLinkButtonPrivate::QCommandLinkButtonPrivate ( )
inline

Definition at line 109 of file qcommandlinkbutton.cpp.

Functions

◆ bottomMargin()

int QCommandLinkButtonPrivate::bottomMargin ( ) const
inline

Definition at line 130 of file qcommandlinkbutton.cpp.

Referenced by descriptionRect().

130 { return 10; }

◆ descriptionFont()

QFont QCommandLinkButtonPrivate::descriptionFont ( ) const

Definition at line 168 of file qcommandlinkbutton.cpp.

Referenced by descriptionHeight(), and QCommandLinkButtonPrivate().

169 {
170  Q_Q(const QCommandLinkButton);
171  QFont font = q->font();
172  font.setPointSizeF(9.0);
173 
174  // Note the font will be resolved against
175  // QPainters font, so we need to restore the mask
176  int resolve_mask = font.resolve_mask;
177  QFont modifiedFont = q->font().resolve(font);
178  modifiedFont.detach();
179  modifiedFont.resolve_mask = resolve_mask;
180  return modifiedFont;
181 }
#define Q_Q(Class)
Definition: qglobal.h:2483
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
Definition: qfont.cpp:1983
uint resolve_mask
Definition: qfont.h:344
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
void detach()
Detaches the font object from common font data.
Definition: qfont.cpp:803
void setPointSizeF(qreal)
Sets the point size to pointSize.
Definition: qfont.cpp:1121
The QCommandLinkButton widget provides a Vista style command link button.

◆ descriptionHeight()

int QCommandLinkButtonPrivate::descriptionHeight ( int  width) const

Definition at line 242 of file qcommandlinkbutton.cpp.

Referenced by QCommandLinkButtonPrivate().

243 {
244  // Calc width of actual paragraph
245  int lineWidth = widgetWidth - textOffset() - rightMargin();
246 
247  qreal descriptionheight = 0;
248  if (!description.isEmpty()) {
250  layout.setFont(descriptionFont());
251  layout.beginLayout();
252  while (true) {
253  QTextLine line = layout.createLine();
254  if (!line.isValid())
255  break;
256  line.setLineWidth(lineWidth);
257  line.setPosition(QPointF(0, descriptionheight));
258  descriptionheight += line.height();
259  }
260  layout.endLayout();
261  }
262  return qCeil(descriptionheight);
263 }
double qreal
Definition: qglobal.h:1193
void setPosition(const QPointF &pos)
Moves the line to position pos.
int qCeil(qreal v)
Definition: qmath.h:63
QLayout * layout
Definition: qwidget_p.h:704
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
The QTextLine class represents a line of text inside a QTextLayout.
Definition: qtextlayout.h:197
void setLineWidth(qreal width)
Lays out the line with the given width.
bool isValid() const
Returns true if this text line is valid; otherwise returns false.
Definition: qtextlayout.h:201
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
The QTextLayout class is used to lay out and render text.
Definition: qtextlayout.h:105
qreal height() const
Returns the line&#39;s height.

◆ descriptionOffset()

int QCommandLinkButtonPrivate::descriptionOffset ( ) const

Definition at line 210 of file qcommandlinkbutton.cpp.

Referenced by descriptionRect(), and QCommandLinkButtonPrivate().

211 {
212  QFontMetrics fm(titleFont());
213  return topMargin() + fm.height();
214 }
The QFontMetrics class provides font metrics information.
Definition: qfontmetrics.h:65

◆ descriptionRect()

QRect QCommandLinkButtonPrivate::descriptionRect ( ) const

Definition at line 197 of file qcommandlinkbutton.cpp.

Referenced by QCommandLinkButtonPrivate().

198 {
199  Q_Q(const QCommandLinkButton);
200  return q->rect().adjusted(textOffset(), descriptionOffset(),
201  -rightMargin(), -bottomMargin());
202 }
#define Q_Q(Class)
Definition: qglobal.h:2483
The QCommandLinkButton widget provides a Vista style command link button.

◆ init()

void QCommandLinkButtonPrivate::init ( )

Definition at line 225 of file qcommandlinkbutton.cpp.

Referenced by QCommandLinkButtonPrivate().

226 {
229  q->setAttribute(Qt::WA_Hover);
230 
232  policy.setHeightForWidth(true);
233  q->setSizePolicy(policy);
234 
235  q->setIconSize(QSize(20, 20));
236  QStyleOptionButton opt;
237  q->initStyleOption(&opt);
238  q->setIcon(q->style()->standardIcon(QStyle::SP_CommandLink, &opt));
239 }
#define Q_Q(Class)
Definition: qglobal.h:2483
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
The QCommandLinkButton widget provides a Vista style command link button.
The QStyleOptionButton class is used to describe the parameters for drawing buttons.
Definition: qstyleoption.h:279

◆ leftMargin()

int QCommandLinkButtonPrivate::leftMargin ( ) const
inline

Definition at line 128 of file qcommandlinkbutton.cpp.

Referenced by textOffset().

128 { return 7; }

◆ mergedColors()

QColor QCommandLinkButtonPrivate::mergedColors ( const QColor a,
const QColor b,
int  value = 50 
) const

Definition at line 137 of file qcommandlinkbutton.cpp.

Referenced by QCommandLinkButtonPrivate().

138 {
139  Q_ASSERT(value >= 0);
140  Q_ASSERT(value <= 255);
141  QColor tmp = a;
142  tmp.setRed((tmp.red() * value) / 255 + (b.red() * (255 - value)) / 255);
143  tmp.setGreen((tmp.green() * value) / 255 + (b.green() * (255 - value)) / 255);
144  tmp.setBlue((tmp.blue() * value) / 255 + (b.blue() * (255 - value)) / 255);
145  return tmp;
146 }
void setRed(int red)
Sets the red color component of this color to red.
Definition: qcolor.cpp:1143
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
void setGreen(int green)
Sets the green color component of this color to green.
Definition: qcolor.cpp:1170
long ASN1_INTEGER_get ASN1_INTEGER * a
ushort red
Returns the red color component of this color.
Definition: qcolor.h:243
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void setBlue(int blue)
Sets the blue color component of this color to blue.
Definition: qcolor.cpp:1199
ushort blue
Returns the blue color component of this color.
Definition: qcolor.h:245
ushort green
Returns the green color component of this color.
Definition: qcolor.h:244

◆ rightMargin()

int QCommandLinkButtonPrivate::rightMargin ( ) const
inline

Definition at line 129 of file qcommandlinkbutton.cpp.

Referenced by descriptionHeight(), descriptionRect(), and titleRect().

129 { return 4; }

◆ textOffset()

int QCommandLinkButtonPrivate::textOffset ( ) const

Definition at line 204 of file qcommandlinkbutton.cpp.

Referenced by descriptionHeight(), descriptionRect(), QCommandLinkButtonPrivate(), and titleRect().

205 {
206  Q_Q(const QCommandLinkButton);
207  return q->icon().actualSize(q->iconSize()).width() + leftMargin() + 6;
208 }
#define Q_Q(Class)
Definition: qglobal.h:2483
The QCommandLinkButton widget provides a Vista style command link button.

◆ titleFont()

QFont QCommandLinkButtonPrivate::titleFont ( ) const

Definition at line 148 of file qcommandlinkbutton.cpp.

Referenced by descriptionOffset(), QCommandLinkButtonPrivate(), and titleRect().

149 {
150  Q_Q(const QCommandLinkButton);
151  QFont font = q->font();
152  if (usingVistaStyle()) {
153  font.setPointSizeF(12.0);
154  } else {
155  font.setBold(true);
156  font.setPointSizeF(9.0);
157  }
158 
159  // Note the font will be resolved against
160  // QPainters font, so we need to restore the mask
161  int resolve_mask = font.resolve_mask;
162  QFont modifiedFont = q->font().resolve(font);
163  modifiedFont.detach();
164  modifiedFont.resolve_mask = resolve_mask;
165  return modifiedFont;
166 }
#define Q_Q(Class)
Definition: qglobal.h:2483
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
Definition: qfont.cpp:1983
void setBold(bool)
If enable is true sets the font&#39;s weight to QFont::Bold ; otherwise sets the weight to QFont::Normal...
Definition: qfont.h:352
uint resolve_mask
Definition: qfont.h:344
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
void detach()
Detaches the font object from common font data.
Definition: qfont.cpp:803
void setPointSizeF(qreal)
Sets the point size to pointSize.
Definition: qfont.cpp:1121
The QCommandLinkButton widget provides a Vista style command link button.

◆ titleRect()

QRect QCommandLinkButtonPrivate::titleRect ( ) const

Definition at line 183 of file qcommandlinkbutton.cpp.

Referenced by QCommandLinkButtonPrivate().

184 {
185  Q_Q(const QCommandLinkButton);
186  QRect r = q->rect().adjusted(textOffset(), topMargin(), -rightMargin(), 0);
187  if (description.isEmpty())
188  {
189  QFontMetrics fm(titleFont());
190  r.setTop(r.top() + qMax(0, (q->icon().actualSize(q->iconSize()).height()
191  - fm.height()) / 2));
192  }
193 
194  return r;
195 }
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition: qrect.h:431
The QFontMetrics class provides font metrics information.
Definition: qfontmetrics.h:65
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
void setTop(int pos)
Sets the top edge of the rectangle to the given y coordinate.
Definition: qrect.h:261
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
The QCommandLinkButton widget provides a Vista style command link button.

◆ titleSize()

qreal QCommandLinkButtonPrivate::titleSize ( ) const

◆ topMargin()

int QCommandLinkButtonPrivate::topMargin ( ) const
inline

Definition at line 127 of file qcommandlinkbutton.cpp.

Referenced by descriptionOffset(), and titleRect().

127 { return 10; }

◆ usingVistaStyle()

bool QCommandLinkButtonPrivate::usingVistaStyle ( ) const

Definition at line 216 of file qcommandlinkbutton.cpp.

Referenced by QCommandLinkButtonPrivate(), and titleFont().

217 {
218  Q_Q(const QCommandLinkButton);
219  //### This is a hack to detect if we are indeed running Vista style themed and not in classic
220  // When we add api to query for this, we should change this implementation to use it.
221  return q->style()->inherits("QWindowsVistaStyle")
222  && !q->style()->pixelMetric(QStyle::PM_ButtonShiftHorizontal);
223 }
#define Q_Q(Class)
Definition: qglobal.h:2483
The QCommandLinkButton widget provides a Vista style command link button.

Properties

◆ currentColor

QColor QCommandLinkButtonPrivate::currentColor

Definition at line 133 of file qcommandlinkbutton.cpp.

◆ description

QString QCommandLinkButtonPrivate::description

Definition at line 132 of file qcommandlinkbutton.cpp.

Referenced by descriptionHeight(), and titleRect().


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