Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ibe5b4aa249863a54007180f3684dc5ce1b23cb7bbb10
commit
a5ea2f7e99
File diff suppressed because it is too large
Load Diff
|
|
@ -2,7 +2,7 @@
|
|||
* MD4C: Markdown parser for C
|
||||
* (http://github.com/mity/md4c)
|
||||
*
|
||||
* Copyright (c) 2016-2019 Martin Mitas
|
||||
* Copyright (c) 2016-2020 Martin Mitas
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
|
@ -135,7 +135,16 @@ typedef enum MD_SPANTYPE {
|
|||
* Note: Recognized only when MD_FLAG_LATEXMATHSPANS is enabled.
|
||||
*/
|
||||
MD_SPAN_LATEXMATH,
|
||||
MD_SPAN_LATEXMATH_DISPLAY
|
||||
MD_SPAN_LATEXMATH_DISPLAY,
|
||||
|
||||
/* Wiki links
|
||||
* Note: Recognized only when MD_FLAG_WIKILINKS is enabled.
|
||||
*/
|
||||
MD_SPAN_WIKILINK,
|
||||
|
||||
/* <u>...</u>
|
||||
* Note: Recognized only when MD_FLAG_UNDERLINE is enabled. */
|
||||
MD_SPAN_U
|
||||
} MD_SPANTYPE;
|
||||
|
||||
/* Text is the actual textual contents of span. */
|
||||
|
|
@ -268,6 +277,10 @@ typedef struct MD_SPAN_IMG_DETAIL {
|
|||
MD_ATTRIBUTE title;
|
||||
} MD_SPAN_IMG_DETAIL;
|
||||
|
||||
/* Detailed info for MD_SPAN_WIKILINK. */
|
||||
typedef struct MD_SPAN_WIKILINK {
|
||||
MD_ATTRIBUTE target;
|
||||
} MD_SPAN_WIKILINK_DETAIL;
|
||||
|
||||
/* Flags specifying extensions/deviations from CommonMark specification.
|
||||
*
|
||||
|
|
@ -286,6 +299,8 @@ typedef struct MD_SPAN_IMG_DETAIL {
|
|||
#define MD_FLAG_PERMISSIVEWWWAUTOLINKS 0x0400 /* Enable WWW autolinks (even without any scheme prefix, if they begin with 'www.') */
|
||||
#define MD_FLAG_TASKLISTS 0x0800 /* Enable task list extension. */
|
||||
#define MD_FLAG_LATEXMATHSPANS 0x1000 /* Enable $ and $$ containing LaTeX equations. */
|
||||
#define MD_FLAG_WIKILINKS 0x2000 /* Enable wiki links extension. */
|
||||
#define MD_FLAG_UNDERLINE 0x4000 /* Enable underline extension (and disables '_' for normal emphasis). */
|
||||
|
||||
#define MD_FLAG_PERMISSIVEAUTOLINKS (MD_FLAG_PERMISSIVEEMAILAUTOLINKS | MD_FLAG_PERMISSIVEURLAUTOLINKS | MD_FLAG_PERMISSIVEWWWAUTOLINKS)
|
||||
#define MD_FLAG_NOHTML (MD_FLAG_NOHTMLBLOCKS | MD_FLAG_NOHTMLSPANS)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
"License": "MIT License",
|
||||
"LicenseId": "MIT",
|
||||
"LicenseFile": "LICENSE.md",
|
||||
"Version": "0.3.4",
|
||||
"DownloadLocation": "https://github.com/mity/md4c/releases/tag/release-0.3.4",
|
||||
"Copyright": "Copyright © 2016-2019 Martin Mitáš"
|
||||
"Version": "0.4.3",
|
||||
"DownloadLocation": "https://github.com/mity/md4c/releases/tag/release-0.4.3",
|
||||
"Copyright": "Copyright © 2016-2020 Martin Mitáš"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2217,7 +2217,7 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt
|
|||
{
|
||||
const int controlTop = int(6 * factor);
|
||||
const int controlHeight = int(height - controlTop - 3 * factor);
|
||||
int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
|
||||
int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, option);
|
||||
QSize iconSize = tb->icon.actualSize(QSize(iconExtent, iconExtent));
|
||||
if (tb->icon.isNull())
|
||||
iconSize = QSize(controlHeight, controlHeight);
|
||||
|
|
|
|||
|
|
@ -3453,7 +3453,7 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
|
|||
{
|
||||
const int controlTop = 6;
|
||||
const int controlHeight = height - controlTop - 3;
|
||||
const int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
|
||||
const int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, option);
|
||||
QSize iconSize = tb->icon.actualSize(QSize(iconExtent, iconExtent));
|
||||
if (tb->icon.isNull())
|
||||
iconSize = QSize(controlHeight, controlHeight);
|
||||
|
|
@ -3575,7 +3575,7 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt
|
|||
sz.rheight() += int(borderSize.bottom() + borderSize.top() - margin
|
||||
+ qreal(1) / factor - 1);
|
||||
}
|
||||
const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1);
|
||||
const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin, option) + 1);
|
||||
sz += QSize(qMax(pixelMetric(QStyle::PM_ScrollBarExtent, option, widget)
|
||||
+ textMargins, 23), 0); //arrow button
|
||||
}
|
||||
|
|
|
|||
|
|
@ -346,7 +346,8 @@ void QWellArray::paintCell(QPainter* p, int row, int col, const QRect &rect)
|
|||
|
||||
const QPalette & g = palette();
|
||||
QStyleOptionFrame opt;
|
||||
int dfw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
opt.initFrom(this);
|
||||
int dfw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, &opt);
|
||||
opt.lineWidth = dfw;
|
||||
opt.midLineWidth = 1;
|
||||
opt.rect = rect.adjusted(b, b, -b, -b);
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@
|
|||
# include "qshortcut.h"
|
||||
#endif
|
||||
#include "qstyle.h"
|
||||
#include "qstyleoption.h"
|
||||
#include "qvarlengtharray.h"
|
||||
#if defined(Q_OS_MACX)
|
||||
#include <QtCore/QMetaMethod>
|
||||
|
|
@ -897,7 +898,9 @@ QWizardLayoutInfo QWizardPrivate::layoutInfoForCurrentPage()
|
|||
|
||||
QWizardLayoutInfo info;
|
||||
|
||||
const int layoutHorizontalSpacing = style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
|
||||
QStyleOption option;
|
||||
option.initFrom(q);
|
||||
const int layoutHorizontalSpacing = style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing, &option);
|
||||
info.topLevelMarginLeft = style->pixelMetric(QStyle::PM_LayoutLeftMargin, nullptr, q);
|
||||
info.topLevelMarginRight = style->pixelMetric(QStyle::PM_LayoutRightMargin, nullptr, q);
|
||||
info.topLevelMarginTop = style->pixelMetric(QStyle::PM_LayoutTopMargin, nullptr, q);
|
||||
|
|
@ -909,7 +912,7 @@ QWizardLayoutInfo QWizardPrivate::layoutInfoForCurrentPage()
|
|||
info.hspacing = (layoutHorizontalSpacing == -1)
|
||||
? style->layoutSpacing(QSizePolicy::DefaultType, QSizePolicy::DefaultType, Qt::Horizontal)
|
||||
: layoutHorizontalSpacing;
|
||||
info.vspacing = style->pixelMetric(QStyle::PM_LayoutVerticalSpacing);
|
||||
info.vspacing = style->pixelMetric(QStyle::PM_LayoutVerticalSpacing, &option);
|
||||
info.buttonSpacing = (layoutHorizontalSpacing == -1)
|
||||
? style->layoutSpacing(QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Horizontal)
|
||||
: layoutHorizontalSpacing;
|
||||
|
|
|
|||
|
|
@ -87,8 +87,8 @@ public:
|
|||
Q_ASSERT(style);
|
||||
if (widget) //###
|
||||
m_styleOption.initFrom(widget);
|
||||
m_defaultSpacing[0] = style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
|
||||
m_defaultSpacing[1] = style->pixelMetric(QStyle::PM_LayoutVerticalSpacing);
|
||||
m_defaultSpacing[0] = style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing, &m_styleOption);
|
||||
m_defaultSpacing[1] = style->pixelMetric(QStyle::PM_LayoutVerticalSpacing, &m_styleOption);
|
||||
}
|
||||
|
||||
inline void invalidate() { m_valid = false; m_style = nullptr; m_widget = nullptr; }
|
||||
|
|
|
|||
|
|
@ -80,7 +80,9 @@ qreal QGraphicsLayoutStyleInfo::perItemSpacing(QLayoutPolicy::ControlType contro
|
|||
qreal QGraphicsLayoutStyleInfo::spacing(Qt::Orientation orientation) const
|
||||
{
|
||||
Q_ASSERT(style());
|
||||
return style()->pixelMetric(orientation == Qt::Horizontal ? QStyle::PM_LayoutHorizontalSpacing : QStyle::PM_LayoutVerticalSpacing);
|
||||
return style()->pixelMetric(orientation == Qt::Horizontal
|
||||
? QStyle::PM_LayoutHorizontalSpacing : QStyle::PM_LayoutVerticalSpacing,
|
||||
&m_styleOption);
|
||||
}
|
||||
|
||||
qreal QGraphicsLayoutStyleInfo::windowMargin(Qt::Orientation orientation) const
|
||||
|
|
|
|||
|
|
@ -615,7 +615,7 @@ void QGraphicsWidget::unsetWindowFrameMargins()
|
|||
QStyleOptionTitleBar bar;
|
||||
d->initStyleOptionTitleBar(&bar);
|
||||
QStyle *style = this->style();
|
||||
qreal margin = style->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth);
|
||||
const qreal margin = style->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, &bar);
|
||||
qreal titleBarHeight = d->titleBarHeight(bar);
|
||||
setWindowFrameMargins(margin, titleBarHeight, margin, margin);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -3235,8 +3235,10 @@ void QAbstractItemView::setIndexWidget(const QModelIndex &index, QWidget *widget
|
|||
widget->installEventFilter(this);
|
||||
widget->show();
|
||||
dataChanged(index, index); // update the geometry
|
||||
if (!d->delayedPendingLayout)
|
||||
if (!d->delayedPendingLayout) {
|
||||
widget->setGeometry(visualRect(index));
|
||||
d->doDelayedItemsLayout(); // relayout due to updated geometry
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1122,7 +1122,7 @@ QRect QItemDelegate::textRectangle(QPainter * /*painter*/, const QRect &rect,
|
|||
QSizeF fpSize = d->doTextLayout(rect.width());
|
||||
const QSize size = QSize(qCeil(fpSize.width()), qCeil(fpSize.height()));
|
||||
// ###: textRectangle should take style option as argument
|
||||
const int textMargin = QApplication::style()->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1;
|
||||
const int textMargin = QApplication::style()->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr) + 1;
|
||||
return QRect(0, 0, size.width() + 2 * textMargin, size.height());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1728,8 +1728,11 @@ void QListViewPrivate::prepareItemsLayout()
|
|||
layoutBounds = QRect(QPoint(), q->maximumViewportSize());
|
||||
|
||||
int frameAroundContents = 0;
|
||||
if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents))
|
||||
frameAroundContents = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth) * 2;
|
||||
if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents)) {
|
||||
QStyleOption option;
|
||||
option.initFrom(q);
|
||||
frameAroundContents = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, &option) * 2;
|
||||
}
|
||||
|
||||
// maximumViewportSize() already takes scrollbar into account if policy is
|
||||
// Qt::ScrollBarAlwaysOn but scrollbar extent must be deduced if policy
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
|
|||
QIcon::Active, QIcon::Off);
|
||||
}
|
||||
|
||||
int size = proxy()->pixelMetric(QStyle::PM_SmallIconSize);
|
||||
const int size = proxy()->pixelMetric(QStyle::PM_SmallIconSize, opt);
|
||||
QIcon::Mode mode = opt->state & State_Enabled ?
|
||||
(opt->state & State_Raised ? QIcon::Active : QIcon::Normal)
|
||||
: QIcon::Disabled;
|
||||
|
|
@ -477,7 +477,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
|
|||
if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
|
||||
int lw = frame->lineWidth;
|
||||
if (lw <= 0)
|
||||
lw = proxy()->pixelMetric(PM_DockWidgetFrameWidth);
|
||||
lw = proxy()->pixelMetric(PM_DockWidgetFrameWidth, opt);
|
||||
|
||||
qDrawShadePanel(p, frame->rect, frame->palette, false, lw);
|
||||
}
|
||||
|
|
@ -563,8 +563,8 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
|
|||
int bsx = 0;
|
||||
int bsy = 0;
|
||||
if (opt->state & State_Sunken) {
|
||||
bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
|
||||
bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
|
||||
bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt);
|
||||
bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt);
|
||||
}
|
||||
p->save();
|
||||
p->translate(sx + bsx, sy + bsy);
|
||||
|
|
@ -994,7 +994,7 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int
|
|||
}
|
||||
|
||||
if (wrapText && option->features & QStyleOptionViewItem::HasCheckIndicator)
|
||||
bounds.setWidth(bounds.width() - proxyStyle->pixelMetric(QStyle::PM_IndicatorWidth) - 2 * textMargin);
|
||||
bounds.setWidth(bounds.width() - proxyStyle->pixelMetric(QStyle::PM_IndicatorWidth, option) - 2 * textMargin);
|
||||
|
||||
const int lineWidth = bounds.width();
|
||||
const QSizeF size = viewItemTextLayout(textLayout, lineWidth);
|
||||
|
|
@ -1240,7 +1240,7 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *w
|
|||
if (!opt->icon.isNull()) {
|
||||
QSize iconSize = opt->iconSize;
|
||||
if (!iconSize.isValid()) {
|
||||
int iconExtent = proxyStyle->pixelMetric(QStyle::PM_SmallIconSize);
|
||||
int iconExtent = proxyStyle->pixelMetric(QStyle::PM_SmallIconSize, opt);
|
||||
iconSize = QSize(iconExtent, iconExtent);
|
||||
}
|
||||
QSize tabIconSize = opt->icon.actualSize(iconSize,
|
||||
|
|
@ -1490,7 +1490,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
|
|||
| Qt::TextSingleLine;
|
||||
if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
|
||||
alignment |= Qt::TextHideMnemonic;
|
||||
int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
|
||||
int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, opt);
|
||||
QPixmap pix = mbi->icon.pixmap(qt_getWindow(widget), QSize(iconExtent, iconExtent), (mbi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
|
||||
if (!pix.isNull())
|
||||
proxy()->drawItemPixmap(p,mbi->rect, alignment, pix);
|
||||
|
|
@ -1646,7 +1646,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
|
|||
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
|
||||
QRect rect = header->rect;
|
||||
if (!header->icon.isNull()) {
|
||||
int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
|
||||
int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, opt);
|
||||
QPixmap pixmap
|
||||
= header->icon.pixmap(qt_getWindow(widget), QSize(iconExtent, iconExtent), (header->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
|
||||
int pixw = pixmap.width() / pixmap.devicePixelRatio();
|
||||
|
|
@ -3863,8 +3863,8 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
|
|||
if (opt->activeSubControls & QStyle::SC_MdiCloseButton && (opt->state & State_Sunken)) {
|
||||
btnOpt.state |= State_Sunken;
|
||||
btnOpt.state &= ~State_Raised;
|
||||
bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
|
||||
bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
|
||||
bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt);
|
||||
bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt);
|
||||
} else {
|
||||
btnOpt.state |= State_Raised;
|
||||
btnOpt.state &= ~State_Sunken;
|
||||
|
|
@ -3880,8 +3880,8 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
|
|||
if (opt->activeSubControls & QStyle::SC_MdiNormalButton && (opt->state & State_Sunken)) {
|
||||
btnOpt.state |= State_Sunken;
|
||||
btnOpt.state &= ~State_Raised;
|
||||
bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
|
||||
bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
|
||||
bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt);
|
||||
bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt);
|
||||
} else {
|
||||
btnOpt.state |= State_Raised;
|
||||
btnOpt.state &= ~State_Sunken;
|
||||
|
|
@ -3897,8 +3897,8 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
|
|||
if (opt->activeSubControls & QStyle::SC_MdiMinButton && (opt->state & State_Sunken)) {
|
||||
btnOpt.state |= State_Sunken;
|
||||
btnOpt.state &= ~State_Raised;
|
||||
bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
|
||||
bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
|
||||
bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt);
|
||||
bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt);
|
||||
} else {
|
||||
btnOpt.state |= State_Raised;
|
||||
btnOpt.state &= ~State_Sunken;
|
||||
|
|
@ -4781,12 +4781,12 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
|
|||
} else if (widget) {
|
||||
isWindow = widget->isWindow();
|
||||
}
|
||||
ret = proxy()->pixelMetric(isWindow ? PM_DefaultTopLevelMargin : PM_DefaultChildMargin);
|
||||
ret = proxy()->pixelMetric(isWindow ? PM_DefaultTopLevelMargin : PM_DefaultChildMargin, opt);
|
||||
}
|
||||
break;
|
||||
case PM_LayoutHorizontalSpacing:
|
||||
case PM_LayoutVerticalSpacing:
|
||||
ret = proxy()->pixelMetric(PM_DefaultLayoutSpacing);
|
||||
ret = proxy()->pixelMetric(PM_DefaultLayoutSpacing, opt);
|
||||
break;
|
||||
|
||||
case PM_DefaultTopLevelMargin:
|
||||
|
|
@ -4937,7 +4937,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
|
|||
} else {
|
||||
h = mi->fontMetrics.height() + 8;
|
||||
if (!mi->icon.isNull()) {
|
||||
int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
|
||||
int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, opt);
|
||||
h = qMax(h, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 4);
|
||||
}
|
||||
}
|
||||
|
|
@ -4963,7 +4963,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
|
|||
case CT_ComboBox:
|
||||
if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
|
||||
int fw = cmb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0;
|
||||
const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1);
|
||||
const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin, opt) + 1);
|
||||
// QItemDelegate::sizeHint expands the textMargins two times, thus the 2*textMargins...
|
||||
int other = qMax(23, 2*textMargins + proxy()->pixelMetric(QStyle::PM_ScrollBarExtent, opt, widget));
|
||||
sz = QSize(sz.width() + fw + other, sz.height() + fw);
|
||||
|
|
@ -5214,8 +5214,8 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
|
|||
if (widget) {
|
||||
if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) {
|
||||
mask->region = widget->rect();
|
||||
int vmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin),
|
||||
hmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin);
|
||||
const int vmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin, opt);
|
||||
const int hmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin, opt);
|
||||
mask->region -= QRect(widget->rect().adjusted(hmargin, vmargin, -hmargin, -vmargin));
|
||||
}
|
||||
}
|
||||
|
|
@ -5228,7 +5228,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
|
|||
ret = true;
|
||||
if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) {
|
||||
mask->region = opt->rect;
|
||||
int margin = proxy()->pixelMetric(PM_DefaultFrameWidth) * 2;
|
||||
const int margin = proxy()->pixelMetric(PM_DefaultFrameWidth, opt) * 2;
|
||||
mask->region -= opt->rect.adjusted(margin, margin, -margin, -margin);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3349,8 +3349,8 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom
|
|||
switch (subControl) {
|
||||
case SC_SliderHandle: {
|
||||
if (slider->orientation == Qt::Horizontal) {
|
||||
rect.setHeight(proxy()->pixelMetric(PM_SliderThickness));
|
||||
rect.setWidth(proxy()->pixelMetric(PM_SliderLength));
|
||||
rect.setHeight(proxy()->pixelMetric(PM_SliderThickness, option));
|
||||
rect.setWidth(proxy()->pixelMetric(PM_SliderLength, option));
|
||||
int centerY = slider->rect.center().y() - rect.height() / 2;
|
||||
if (slider->tickPosition & QSlider::TicksAbove)
|
||||
centerY += tickSize;
|
||||
|
|
@ -3358,8 +3358,8 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom
|
|||
centerY -= tickSize;
|
||||
rect.moveTop(centerY);
|
||||
} else {
|
||||
rect.setWidth(proxy()->pixelMetric(PM_SliderThickness));
|
||||
rect.setHeight(proxy()->pixelMetric(PM_SliderLength));
|
||||
rect.setWidth(proxy()->pixelMetric(PM_SliderThickness, option));
|
||||
rect.setHeight(proxy()->pixelMetric(PM_SliderLength, option));
|
||||
int centerX = slider->rect.center().x() - rect.width() / 2;
|
||||
if (slider->tickPosition & QSlider::TicksAbove)
|
||||
centerX += tickSize;
|
||||
|
|
|
|||
|
|
@ -1003,13 +1003,13 @@ QSize QPixmapStyle::pushButtonSizeFromContents(const QStyleOption *option,
|
|||
return d->computeSize(desc, w, h);
|
||||
}
|
||||
|
||||
QSize QPixmapStyle::lineEditSizeFromContents(const QStyleOption *,
|
||||
QSize QPixmapStyle::lineEditSizeFromContents(const QStyleOption *option,
|
||||
const QSize &contentsSize, const QWidget *) const
|
||||
{
|
||||
Q_D(const QPixmapStyle);
|
||||
|
||||
const QPixmapStyleDescriptor &desc = d->descriptors.value(LE_Enabled);
|
||||
const int border = 2 * proxy()->pixelMetric(PM_DefaultFrameWidth);
|
||||
const int border = 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, option);
|
||||
|
||||
int w = contentsSize.width() + border + desc.margins.left() + desc.margins.right();
|
||||
int h = contentsSize.height() + border + desc.margins.top() + desc.margins.bottom();
|
||||
|
|
|
|||
|
|
@ -2232,7 +2232,9 @@ QSize QCalendarWidget::minimumSizeHint() const
|
|||
int rows = 7;
|
||||
int cols = 8;
|
||||
|
||||
const int marginH = (style()->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1) * 2;
|
||||
QStyleOption option;
|
||||
option.initFrom(this);
|
||||
const int marginH = (style()->pixelMetric(QStyle::PM_FocusFrameHMargin, &option) + 1) * 2;
|
||||
|
||||
if (horizontalHeaderFormat() == QCalendarWidget::NoHorizontalHeader) {
|
||||
rows = 6;
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ public:
|
|||
setAttribute(Qt::WA_NoMousePropagation);
|
||||
}
|
||||
QSize sizeHint() const override {
|
||||
return QSize(20, style()->pixelMetric(QStyle::PM_MenuScrollerHeight));
|
||||
return QSize(20, style()->pixelMetric(QStyle::PM_MenuScrollerHeight, nullptr, this));
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ bool QCommandLinkButtonPrivate::usingVistaStyle() const
|
|||
//### This is a hack to detect if we are indeed running Vista style themed and not in classic
|
||||
// When we add api to query for this, we should change this implementation to use it.
|
||||
return q->style()->inherits("QWindowsVistaStyle")
|
||||
&& !q->style()->pixelMetric(QStyle::PM_ButtonShiftHorizontal);
|
||||
&& q->style()->pixelMetric(QStyle::PM_ButtonShiftHorizontal, nullptr) == 0;
|
||||
}
|
||||
|
||||
void QCommandLinkButtonPrivate::init()
|
||||
|
|
@ -355,8 +355,10 @@ void QCommandLinkButton::paintEvent(QPaintEvent *)
|
|||
option.icon = QIcon(); //we draw this ourselves
|
||||
QSize pixmapSize = icon().actualSize(iconSize());
|
||||
|
||||
int vOffset = isDown() ? style()->pixelMetric(QStyle::PM_ButtonShiftVertical) : 0;
|
||||
int hOffset = isDown() ? style()->pixelMetric(QStyle::PM_ButtonShiftHorizontal) : 0;
|
||||
const int vOffset = isDown()
|
||||
? style()->pixelMetric(QStyle::PM_ButtonShiftVertical, &option) : 0;
|
||||
const int hOffset = isDown()
|
||||
? style()->pixelMetric(QStyle::PM_ButtonShiftHorizontal, &option) : 0;
|
||||
|
||||
//Draw icon
|
||||
p.drawControl(QStyle::CE_PushButton, option);
|
||||
|
|
|
|||
|
|
@ -86,8 +86,10 @@ void QFocusFramePrivate::updateSize()
|
|||
if (!widget)
|
||||
return;
|
||||
|
||||
int vmargin = q->style()->pixelMetric(QStyle::PM_FocusFrameVMargin),
|
||||
hmargin = q->style()->pixelMetric(QStyle::PM_FocusFrameHMargin);
|
||||
QStyleOption opt;
|
||||
q->initStyleOption(&opt);
|
||||
int vmargin = q->style()->pixelMetric(QStyle::PM_FocusFrameVMargin, &opt),
|
||||
hmargin = q->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, &opt);
|
||||
QPoint pos(widget->x(), widget->y());
|
||||
if (q->parentWidget() != widget->parentWidget())
|
||||
pos = widget->parentWidget()->mapTo(q->parentWidget(), pos);
|
||||
|
|
@ -98,8 +100,6 @@ void QFocusFramePrivate::updateSize()
|
|||
|
||||
q->setGeometry(geom);
|
||||
QStyleHintReturnMask mask;
|
||||
QStyleOption opt;
|
||||
q->initStyleOption(&opt);
|
||||
if (q->style()->styleHint(QStyle::SH_FocusFrame_Mask, &opt, q, &mask))
|
||||
q->setMask(mask.region);
|
||||
}
|
||||
|
|
@ -263,8 +263,8 @@ QFocusFrame::paintEvent(QPaintEvent *)
|
|||
QStylePainter p(this);
|
||||
QStyleOption option;
|
||||
initStyleOption(&option);
|
||||
int vmargin = style()->pixelMetric(QStyle::PM_FocusFrameVMargin);
|
||||
int hmargin = style()->pixelMetric(QStyle::PM_FocusFrameHMargin);
|
||||
const int vmargin = style()->pixelMetric(QStyle::PM_FocusFrameVMargin, &option);
|
||||
const int hmargin = style()->pixelMetric(QStyle::PM_FocusFrameHMargin, &option);
|
||||
QWidgetPrivate *wd = qt_widget_private(d->widget);
|
||||
QRect rect = wd->clipRect().adjusted(0, 0, hmargin*2, vmargin*2);
|
||||
p.setClipRect(rect);
|
||||
|
|
|
|||
|
|
@ -491,9 +491,9 @@ QSize QGroupBox::minimumSizeHint() const
|
|||
int baseWidth = metrics.horizontalAdvance(d->title) + metrics.horizontalAdvance(QLatin1Char(' '));
|
||||
int baseHeight = metrics.height();
|
||||
if (d->checkable) {
|
||||
baseWidth += style()->pixelMetric(QStyle::PM_IndicatorWidth);
|
||||
baseWidth += style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing);
|
||||
baseHeight = qMax(baseHeight, style()->pixelMetric(QStyle::PM_IndicatorHeight));
|
||||
baseWidth += style()->pixelMetric(QStyle::PM_IndicatorWidth, &option);
|
||||
baseWidth += style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing, &option);
|
||||
baseHeight = qMax(baseHeight, style()->pixelMetric(QStyle::PM_IndicatorHeight, &option));
|
||||
}
|
||||
|
||||
QSize size = style()->sizeFromContents(QStyle::CT_GroupBox, &option, QSize(baseWidth, baseHeight), this);
|
||||
|
|
|
|||
|
|
@ -2073,7 +2073,7 @@ void QLineEdit::paintEvent(QPaintEvent *)
|
|||
if (d->cursorVisible && !d->control->isReadOnly())
|
||||
flags |= QWidgetLineControl::DrawCursor;
|
||||
|
||||
d->control->setCursorWidth(style()->pixelMetric(QStyle::PM_TextCursorWidth));
|
||||
d->control->setCursorWidth(style()->pixelMetric(QStyle::PM_TextCursorWidth, &panel));
|
||||
d->control->draw(&p, topLeft, r, flags);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2844,7 +2844,7 @@ void QMenu::paintEvent(QPaintEvent *e)
|
|||
frame.rect = rect();
|
||||
frame.palette = palette();
|
||||
frame.state = QStyle::State_None;
|
||||
frame.lineWidth = style()->pixelMetric(QStyle::PM_MenuPanelWidth);
|
||||
frame.lineWidth = style()->pixelMetric(QStyle::PM_MenuPanelWidth, &frame);
|
||||
frame.midLineWidth = 0;
|
||||
style()->drawPrimitive(QStyle::PE_FrameMenu, &frame, &p, this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1014,7 +1014,7 @@ void QMenuBar::paintEvent(QPaintEvent *e)
|
|||
frame.rect = rect();
|
||||
frame.palette = palette();
|
||||
frame.state = QStyle::State_None;
|
||||
frame.lineWidth = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth);
|
||||
frame.lineWidth = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, &frame);
|
||||
frame.midLineWidth = 0;
|
||||
style()->drawPrimitive(QStyle::PE_PanelMenuBar, &frame, &p, this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,9 @@ void QToolBarExtension::paintEvent(QPaintEvent *)
|
|||
|
||||
QSize QToolBarExtension::sizeHint() const
|
||||
{
|
||||
int ext = style()->pixelMetric(QStyle::PM_ToolBarExtensionExtent);
|
||||
QStyleOption opt;
|
||||
opt.initFrom(this);
|
||||
const int ext = style()->pixelMetric(QStyle::PM_ToolBarExtensionExtent, &opt);
|
||||
return QSize(ext, ext);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2463,7 +2463,7 @@ void QWidgetTextControl::setCursorWidth(int width)
|
|||
Q_UNUSED(width);
|
||||
#else
|
||||
if (width == -1)
|
||||
width = QApplication::style()->pixelMetric(QStyle::PM_TextCursorWidth);
|
||||
width = QApplication::style()->pixelMetric(QStyle::PM_TextCursorWidth, nullptr);
|
||||
d->doc->documentLayout()->setProperty("cursorWidth", width);
|
||||
#endif
|
||||
d->repaintCursor();
|
||||
|
|
|
|||
|
|
@ -556,8 +556,14 @@ void tst_QTcpSocket::bind_data()
|
|||
|
||||
// try to bind to a privileged ports
|
||||
// we should fail if we're not root (unless the ports are in use!)
|
||||
#ifdef Q_OS_DARWIN
|
||||
// Alas, some quirk (starting from macOS 10.14): bind with port number 1
|
||||
// fails with IPv4 (not IPv6 though, see below).
|
||||
QTest::newRow("127.0.0.1:1") << "127.0.0.1" << 1 << false << QString();
|
||||
#else
|
||||
QTest::newRow("127.0.0.1:1") << "127.0.0.1" << 1 << QtNetworkSettings::canBindToLowPorts()
|
||||
<< (QtNetworkSettings::canBindToLowPorts() ? "127.0.0.1" : QString());
|
||||
#endif // Q_OS_DARWIN
|
||||
if (testIpv6)
|
||||
QTest::newRow("[::]:1") << "::" << 1 << QtNetworkSettings::canBindToLowPorts()
|
||||
<< (QtNetworkSettings::canBindToLowPorts() ? "::" : QString());
|
||||
|
|
@ -579,7 +585,7 @@ void tst_QTcpSocket::bind()
|
|||
QTcpSocket dummySocket; // used only to "use up" a file descriptor
|
||||
dummySocket.bind();
|
||||
|
||||
QTcpSocket *socket = newSocket();
|
||||
std::unique_ptr<QTcpSocket> socket(newSocket());
|
||||
quint16 boundPort;
|
||||
qintptr fd;
|
||||
|
||||
|
|
@ -645,9 +651,24 @@ void tst_QTcpSocket::bind()
|
|||
QCOMPARE(acceptedSocket->peerPort(), boundPort);
|
||||
QCOMPARE(socket->localAddress(), remoteAddr);
|
||||
QCOMPARE(socket->socketDescriptor(), fd);
|
||||
#ifdef Q_OS_DARWIN
|
||||
// Normally, we don't see this problem: macOS sometimes does not
|
||||
// allow us to immediately re-use a port, thinking connection is
|
||||
// still alive. With fixed port 1 (we testing starting from
|
||||
// macOS 10.14), this problem shows, making the test flaky:
|
||||
// we run this 'bind' with port 1 several times (different
|
||||
// test cases) and the problem manifests itself as
|
||||
// "The bound address is already in use, tried port 1".
|
||||
QTestEventLoop cleanupHelper;
|
||||
auto client = socket.get();
|
||||
connect(client, &QTcpSocket::disconnected, [&cleanupHelper, client](){
|
||||
client->close();
|
||||
cleanupHelper.exitLoop();
|
||||
});
|
||||
acceptedSocket->close();
|
||||
cleanupHelper.enterLoopMSecs(100);
|
||||
#endif // Q_OS_DARWIN
|
||||
}
|
||||
|
||||
delete socket;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -976,6 +976,7 @@ void tst_QTreeView::indexWidget()
|
|||
QStandardItemModel treeModel;
|
||||
initStandardTreeModel(&treeModel);
|
||||
view.setModel(&treeModel);
|
||||
view.resize(300, 400); // make sure the width of the view is larger than the widgets below
|
||||
|
||||
QModelIndex index = view.model()->index(0, 0);
|
||||
|
||||
|
|
@ -1004,6 +1005,7 @@ void tst_QTreeView::indexWidget()
|
|||
|
||||
//now let's try to do that later when the widget is already shown
|
||||
view.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
index = view.model()->index(1, 0);
|
||||
QVERIFY(!view.indexWidget(index));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue