Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I1a63523de158757964b6fb5ea026cf69a6c5ddcf
@ -47,9 +47,6 @@ tt {
|
||||
text-align: left
|
||||
}
|
||||
|
||||
.main {
|
||||
display: none;
|
||||
}
|
||||
/*
|
||||
-----------
|
||||
links
|
||||
|
@ -160,7 +160,9 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
|
||||
mimeData->setData(hotSpotMimeDataKey(),
|
||||
QByteArray::number(hotSpot.x()) + ' ' + QByteArray::number(hotSpot.y()));
|
||||
|
||||
QPixmap pixmap(child->size());
|
||||
qreal dpr = window()->windowHandle()->devicePixelRatio();
|
||||
QPixmap pixmap(child->size() * dpr);
|
||||
pixmap.setDevicePixelRatio(dpr);
|
||||
child->render(&pixmap);
|
||||
|
||||
QDrag *drag = new QDrag(this);
|
||||
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 524 B After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 892 B After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 789 B |
@ -52,5 +52,5 @@ greaterThan(MSC_VER, 1899) {
|
||||
QMAKE_CFLAGS_WARN_ON += -w44456 -w44457 -w44458
|
||||
QMAKE_CFLAGS_AVX2 = -arch:AVX2
|
||||
QMAKE_CXXFLAGS += -Zc:strictStrings -Zc:throwingNew
|
||||
QMAKE_CXXFLAGS_WARN_ON += -w44456 -w44457 -w44458 -wd4577
|
||||
QMAKE_CXXFLAGS_WARN_ON += -w44456 -w44457 -w44458 -wd4577 -wd4467
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
|
||||
% localHostName() % '\n';
|
||||
|
||||
const QByteArray lockFileName = QFile::encodeName(fileName);
|
||||
const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0644);
|
||||
const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0666);
|
||||
if (fd < 0) {
|
||||
switch (errno) {
|
||||
case EEXIST:
|
||||
@ -229,7 +229,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
|
||||
bool QLockFilePrivate::removeStaleLock()
|
||||
{
|
||||
const QByteArray lockFileName = QFile::encodeName(fileName);
|
||||
const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY, 0644);
|
||||
const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY, 0666);
|
||||
if (fd < 0) // gone already?
|
||||
return false;
|
||||
bool success = setNativeLocks(fileName, fd) && (::unlink(lockFileName) == 0);
|
||||
|
@ -539,9 +539,6 @@ void QMapDataBase::freeData(QMapDataBase *d)
|
||||
|
||||
Constructs a copy of \a other.
|
||||
|
||||
This function is only available if Qt is configured with STL
|
||||
compatibility enabled.
|
||||
|
||||
\sa toStdMap()
|
||||
*/
|
||||
|
||||
@ -558,9 +555,6 @@ void QMapDataBase::freeData(QMapDataBase *d)
|
||||
/*! \fn std::map<Key, T> QMap::toStdMap() const
|
||||
|
||||
Returns an STL map equivalent to this QMap.
|
||||
|
||||
This function is only available if Qt is configured with STL
|
||||
compatibility enabled.
|
||||
*/
|
||||
|
||||
/*! \fn QMap::~QMap()
|
||||
|
@ -448,6 +448,11 @@ void QWindowSystemInterface::unregisterTouchDevice(const QTouchDevice *device)
|
||||
QTouchDevicePrivate::unregisterDevice(device);
|
||||
}
|
||||
|
||||
bool QWindowSystemInterface::isTouchDeviceRegistered(const QTouchDevice *device)
|
||||
{
|
||||
return QTouchDevicePrivate::isRegistered(device);
|
||||
}
|
||||
|
||||
void QWindowSystemInterface::handleTouchEvent(QWindow *w, QTouchDevice *device,
|
||||
const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
|
||||
{
|
||||
|
@ -130,6 +130,7 @@ public:
|
||||
|
||||
static void registerTouchDevice(const QTouchDevice *device);
|
||||
static void unregisterTouchDevice(const QTouchDevice *device);
|
||||
static bool isTouchDeviceRegistered(const QTouchDevice *device);
|
||||
static void handleTouchEvent(QWindow *w, QTouchDevice *device,
|
||||
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
|
||||
static void handleTouchEvent(QWindow *w, ulong timestamp, QTouchDevice *device,
|
||||
|
@ -527,9 +527,10 @@ QString QColor::name(NameFormat format) const
|
||||
{
|
||||
switch (format) {
|
||||
case HexRgb:
|
||||
return QString::asprintf("#%02x%02x%02x", red(), green(), blue());
|
||||
return QLatin1Char('#') + QString::number(rgba() | 0x1000000, 16).rightRef(6);
|
||||
case HexArgb:
|
||||
return QString::asprintf("#%02x%02x%02x%02x", alpha(), red(), green(), blue());
|
||||
// it's called rgba() but it does return AARRGGBB
|
||||
return QLatin1Char('#') + QString::number(rgba() | 0x100000000, 16).rightRef(8);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
@ -2801,6 +2801,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
|
||||
req.fallBackFamilies.clear();
|
||||
}
|
||||
|
||||
Q_ASSERT(fe);
|
||||
if (fe->symbol || (d->request.styleStrategy & QFont::NoFontMerging)) {
|
||||
for (int i = 0; i < QChar::ScriptCount; ++i) {
|
||||
if (!d->engineData->engines[i]) {
|
||||
|
@ -294,7 +294,7 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
|
||||
// handle non-getsockopt cases first
|
||||
if (opt == QNativeSocketEngine::BindExclusively || opt == QNativeSocketEngine::NonBlockingSocketOption
|
||||
|| opt == QNativeSocketEngine::BroadcastSocketOption)
|
||||
return true;
|
||||
return -1;
|
||||
|
||||
int n, level;
|
||||
int v = -1;
|
||||
|
@ -400,9 +400,13 @@ void QEvdevTouchScreenHandler::unregisterTouchDevice()
|
||||
if (!m_device)
|
||||
return;
|
||||
|
||||
QWindowSystemInterface::unregisterTouchDevice(m_device);
|
||||
// At app exit the cleanup may have already been done, avoid
|
||||
// double delete by checking the list first.
|
||||
if (QWindowSystemInterface::isTouchDeviceRegistered(m_device)) {
|
||||
QWindowSystemInterface::unregisterTouchDevice(m_device);
|
||||
delete m_device;
|
||||
}
|
||||
|
||||
delete m_device;
|
||||
m_device = Q_NULLPTR;
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,9 @@
|
||||
#include "qcocoadrag.h"
|
||||
#include "qmacclipboard.h"
|
||||
#include "qcocoahelpers.h"
|
||||
#ifndef QT_NO_WIDGETS
|
||||
#include <QtWidgets/qwidget.h>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -187,7 +190,18 @@ QPixmap QCocoaDrag::dragPixmap(QDrag *drag, QPoint &hotSpot) const
|
||||
const int width = fm.width(s);
|
||||
const int height = fm.height();
|
||||
if (width > 0 && height > 0) {
|
||||
pm = QPixmap(width, height);
|
||||
qreal dpr = 1.0;
|
||||
if (const QWindow *sourceWindow = qobject_cast<QWindow *>(drag->source())) {
|
||||
dpr = sourceWindow->devicePixelRatio();
|
||||
}
|
||||
#ifndef QT_NO_WIDGETS
|
||||
else if (const QWidget *sourceWidget = qobject_cast<QWidget *>(drag->source())) {
|
||||
if (const QWindow *sourceWindow = sourceWidget->window()->windowHandle())
|
||||
dpr = sourceWindow->devicePixelRatio();
|
||||
}
|
||||
#endif
|
||||
pm = QPixmap(width * dpr, height * dpr);
|
||||
pm.setDevicePixelRatio(dpr);
|
||||
QPainter p(&pm);
|
||||
p.fillRect(0, 0, pm.width(), pm.height(), Qt::color0);
|
||||
p.setPen(Qt::color1);
|
||||
|
@ -322,10 +322,59 @@ void QWinRTWindow::setWindowState(Qt::WindowState state)
|
||||
if (d->state == state)
|
||||
return;
|
||||
|
||||
#if _MSC_VER >= 1900
|
||||
if (state == Qt::WindowFullScreen) {
|
||||
HRESULT hr;
|
||||
boolean success;
|
||||
hr = QEventDispatcherWinRT::runOnXamlThread([&hr, &success]() {
|
||||
ComPtr<IApplicationViewStatics2> applicationViewStatics;
|
||||
hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_ApplicationView).Get(),
|
||||
IID_PPV_ARGS(&applicationViewStatics));
|
||||
RETURN_HR_IF_FAILED("Could not access application view statics.");
|
||||
ComPtr<IApplicationView> view;
|
||||
hr = applicationViewStatics->GetForCurrentView(&view);
|
||||
RETURN_HR_IF_FAILED("Could not access application view.");
|
||||
ComPtr<IApplicationView3> view3;
|
||||
hr = view.As(&view3);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = view3->TryEnterFullScreenMode(&success);
|
||||
return hr;
|
||||
});
|
||||
if (FAILED(hr) || !success) {
|
||||
qCDebug(lcQpaWindows) << "Failed to enter full screen mode.";
|
||||
return;
|
||||
}
|
||||
d->state = state;
|
||||
return;
|
||||
}
|
||||
|
||||
if (d->state == Qt::WindowFullScreen) {
|
||||
HRESULT hr;
|
||||
hr = QEventDispatcherWinRT::runOnXamlThread([&hr]() {
|
||||
ComPtr<IApplicationViewStatics2> applicationViewStatics;
|
||||
hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_ApplicationView).Get(),
|
||||
IID_PPV_ARGS(&applicationViewStatics));
|
||||
RETURN_HR_IF_FAILED("Could not access application view statics.");
|
||||
ComPtr<IApplicationView> view;
|
||||
hr = applicationViewStatics->GetForCurrentView(&view);
|
||||
RETURN_HR_IF_FAILED("Could not access application view.");
|
||||
ComPtr<IApplicationView3> view3;
|
||||
hr = view.As(&view3);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = view3->ExitFullScreenMode();
|
||||
return hr;
|
||||
});
|
||||
if (FAILED(hr)) {
|
||||
qCDebug(lcQpaWindows) << "Failed to exit full screen mode.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // _MSC_VER >= 1900
|
||||
|
||||
if (state == Qt::WindowMinimized)
|
||||
setUIElementVisibility(d->uiElement.Get(), false);
|
||||
|
||||
if (d->state == Qt::WindowMinimized)
|
||||
if (d->state == Qt::WindowMinimized || state == Qt::WindowNoState || state == Qt::WindowActive)
|
||||
setUIElementVisibility(d->uiElement.Get(), true);
|
||||
|
||||
d->state = state;
|
||||
|
@ -1293,8 +1293,13 @@ void TestMethods::invokeTests(QObject *testObject) const
|
||||
m_initTestCaseDataMethod.invoke(testObject, Qt::DirectConnection);
|
||||
|
||||
QScopedPointer<WatchDog> watchDog;
|
||||
if (!debuggerPresent())
|
||||
if (!debuggerPresent()
|
||||
#ifdef QTESTLIB_USE_VALGRIND
|
||||
&& QBenchmarkGlobalData::current->mode() != QBenchmarkGlobalData::CallgrindChildProcess
|
||||
#endif
|
||||
) {
|
||||
watchDog.reset(new WatchDog);
|
||||
}
|
||||
|
||||
if (!QTestResult::skipCurrentTest() && !QTest::currentTestFailed()) {
|
||||
if (m_initTestCaseMethod.isValid())
|
||||
|
@ -84,10 +84,14 @@ namespace {
|
||||
const QHash<QString, DomProperty *> properties = propertyMap(node->elementProperty());
|
||||
output << "new QSpacerItem(";
|
||||
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
if (properties.contains(QLatin1String("sizeHint"))) {
|
||||
const DomSize *sizeHint = properties.value(QLatin1String("sizeHint"))->elementSize();
|
||||
output << sizeHint->elementWidth() << ", " << sizeHint->elementHeight() << ", ";
|
||||
w = sizeHint->elementWidth();
|
||||
h = sizeHint->elementHeight();
|
||||
}
|
||||
output << w << ", " << h << ", ";
|
||||
|
||||
// size type
|
||||
QString sizeType = properties.contains(QLatin1String("sizeType")) ?
|
||||
|
@ -140,60 +140,59 @@ void QTabBarPrivate::updateMacBorderMetrics()
|
||||
}
|
||||
|
||||
/*!
|
||||
Initialize \a option with the values from the tab at \a tabIndex. This method
|
||||
is useful for subclasses when they need a QStyleOptionTab,
|
||||
but don't want to fill in all the information themselves.
|
||||
|
||||
\sa QStyleOption::initFrom(), QTabWidget::initStyleOption()
|
||||
\internal
|
||||
This is basically QTabBar::initStyleOption() but
|
||||
without the expensive QFontMetrics::elidedText() call.
|
||||
*/
|
||||
void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const
|
||||
|
||||
void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex) const
|
||||
{
|
||||
Q_D(const QTabBar);
|
||||
int totalTabs = d->tabList.size();
|
||||
Q_Q(const QTabBar);
|
||||
const int totalTabs = tabList.size();
|
||||
|
||||
if (!option || (tabIndex < 0 || tabIndex >= totalTabs))
|
||||
return;
|
||||
|
||||
const QTabBarPrivate::Tab &tab = d->tabList.at(tabIndex);
|
||||
option->initFrom(this);
|
||||
const QTabBarPrivate::Tab &tab = tabList.at(tabIndex);
|
||||
option->initFrom(q);
|
||||
option->state &= ~(QStyle::State_HasFocus | QStyle::State_MouseOver);
|
||||
option->rect = tabRect(tabIndex);
|
||||
bool isCurrent = tabIndex == d->currentIndex;
|
||||
option->rect = q->tabRect(tabIndex);
|
||||
const bool isCurrent = tabIndex == currentIndex;
|
||||
option->row = 0;
|
||||
if (tabIndex == d->pressedIndex)
|
||||
if (tabIndex == pressedIndex)
|
||||
option->state |= QStyle::State_Sunken;
|
||||
if (isCurrent)
|
||||
option->state |= QStyle::State_Selected;
|
||||
if (isCurrent && hasFocus())
|
||||
if (isCurrent && q->hasFocus())
|
||||
option->state |= QStyle::State_HasFocus;
|
||||
if (!tab.enabled)
|
||||
option->state &= ~QStyle::State_Enabled;
|
||||
if (isActiveWindow())
|
||||
if (q->isActiveWindow())
|
||||
option->state |= QStyle::State_Active;
|
||||
if (!d->dragInProgress && option->rect == d->hoverRect)
|
||||
if (!dragInProgress && option->rect == hoverRect)
|
||||
option->state |= QStyle::State_MouseOver;
|
||||
option->shape = d->shape;
|
||||
option->shape = shape;
|
||||
option->text = tab.text;
|
||||
|
||||
if (tab.textColor.isValid())
|
||||
option->palette.setColor(foregroundRole(), tab.textColor);
|
||||
option->palette.setColor(q->foregroundRole(), tab.textColor);
|
||||
|
||||
option->icon = tab.icon;
|
||||
option->iconSize = iconSize(); // Will get the default value then.
|
||||
option->iconSize = q->iconSize(); // Will get the default value then.
|
||||
|
||||
option->leftButtonSize = tab.leftWidget ? tab.leftWidget->size() : QSize();
|
||||
option->rightButtonSize = tab.rightWidget ? tab.rightWidget->size() : QSize();
|
||||
option->documentMode = d->documentMode;
|
||||
option->documentMode = documentMode;
|
||||
|
||||
if (tabIndex > 0 && tabIndex - 1 == d->currentIndex)
|
||||
if (tabIndex > 0 && tabIndex - 1 == currentIndex)
|
||||
option->selectedPosition = QStyleOptionTab::PreviousIsSelected;
|
||||
else if (tabIndex + 1 < totalTabs && tabIndex + 1 == d->currentIndex)
|
||||
else if (tabIndex + 1 < totalTabs && tabIndex + 1 == currentIndex)
|
||||
option->selectedPosition = QStyleOptionTab::NextIsSelected;
|
||||
else
|
||||
option->selectedPosition = QStyleOptionTab::NotAdjacent;
|
||||
|
||||
bool paintBeginning = (tabIndex == 0) || (d->dragInProgress && tabIndex == d->pressedIndex + 1);
|
||||
bool paintEnd = (tabIndex == totalTabs - 1) || (d->dragInProgress && tabIndex == d->pressedIndex - 1);
|
||||
const bool paintBeginning = (tabIndex == 0) || (dragInProgress && tabIndex == pressedIndex + 1);
|
||||
const bool paintEnd = (tabIndex == totalTabs - 1) || (dragInProgress && tabIndex == pressedIndex - 1);
|
||||
if (paintBeginning) {
|
||||
if (paintEnd)
|
||||
option->position = QStyleOptionTab::OnlyOneTab;
|
||||
@ -206,7 +205,7 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const
|
||||
}
|
||||
|
||||
#ifndef QT_NO_TABWIDGET
|
||||
if (const QTabWidget *tw = qobject_cast<const QTabWidget *>(parentWidget())) {
|
||||
if (const QTabWidget *tw = qobject_cast<const QTabWidget *>(q->parentWidget())) {
|
||||
option->features |= QStyleOptionTab::HasFrame;
|
||||
if (tw->cornerWidget(Qt::TopLeftCorner) || tw->cornerWidget(Qt::BottomLeftCorner))
|
||||
option->cornerWidgets |= QStyleOptionTab::LeftCornerWidget;
|
||||
@ -214,6 +213,19 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const
|
||||
option->cornerWidgets |= QStyleOptionTab::RightCornerWidget;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
Initialize \a option with the values from the tab at \a tabIndex. This method
|
||||
is useful for subclasses when they need a QStyleOptionTab,
|
||||
but don't want to fill in all the information themselves.
|
||||
|
||||
\sa QStyleOption::initFrom(), QTabWidget::initStyleOption()
|
||||
*/
|
||||
void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const
|
||||
{
|
||||
Q_D(const QTabBar);
|
||||
d->initBasicStyleOption(option, tabIndex);
|
||||
|
||||
QRect textRect = style()->subElementRect(QStyle::SE_TabBarTabText, option, this);
|
||||
option->text = fontMetrics().elidedText(option->text, d->elideMode, textRect.width(),
|
||||
@ -1094,6 +1106,7 @@ void QTabBar::setTabText(int index, const QString &text)
|
||||
{
|
||||
Q_D(QTabBar);
|
||||
if (QTabBarPrivate::Tab *tab = d->at(index)) {
|
||||
d->textSizes.remove(tab->text);
|
||||
tab->text = text;
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
releaseShortcut(tab->shortcutId);
|
||||
@ -1453,7 +1466,7 @@ QSize QTabBar::tabSizeHint(int index) const
|
||||
Q_D(const QTabBar);
|
||||
if (const QTabBarPrivate::Tab *tab = d->at(index)) {
|
||||
QStyleOptionTab opt;
|
||||
initStyleOption(&opt, index);
|
||||
d->initBasicStyleOption(&opt, index);
|
||||
opt.text = d->tabList.at(index).text;
|
||||
QSize iconSize = tab->icon.isNull() ? QSize(0, 0) : opt.iconSize;
|
||||
int hframe = style()->pixelMetric(QStyle::PM_TabBarTabHSpace, &opt, this);
|
||||
@ -1479,13 +1492,16 @@ QSize QTabBar::tabSizeHint(int index) const
|
||||
if (!opt.icon.isNull())
|
||||
padding += 4;
|
||||
|
||||
QHash<QString, QSize>::iterator it = d->textSizes.find(tab->text);
|
||||
if (it == d->textSizes.end())
|
||||
it = d->textSizes.insert(tab->text, fm.size(Qt::TextShowMnemonic, tab->text));
|
||||
const int textWidth = it.value().width();
|
||||
QSize csz;
|
||||
if (verticalTabs(d->shape)) {
|
||||
csz = QSize( qMax(maxWidgetWidth, qMax(fm.height(), iconSize.height())) + vframe,
|
||||
fm.size(Qt::TextShowMnemonic, tab->text).width() + iconSize.width() + hframe + widgetHeight + padding);
|
||||
textWidth + iconSize.width() + hframe + widgetHeight + padding);
|
||||
} else {
|
||||
csz = QSize(fm.size(Qt::TextShowMnemonic, tab->text).width() + iconSize.width() + hframe
|
||||
+ widgetWidth + padding,
|
||||
csz = QSize(textWidth + iconSize.width() + hframe + widgetWidth + padding,
|
||||
qMax(maxWidgetHeight, qMax(fm.height(), iconSize.height())) + vframe);
|
||||
}
|
||||
|
||||
@ -2157,15 +2173,21 @@ void QTabBarPrivate::setCurrentNextEnabledIndex(int offset)
|
||||
void QTabBar::changeEvent(QEvent *event)
|
||||
{
|
||||
Q_D(QTabBar);
|
||||
if (event->type() == QEvent::StyleChange) {
|
||||
switch (event->type()) {
|
||||
case QEvent::StyleChange:
|
||||
if (!d->elideModeSetByUser)
|
||||
d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this));
|
||||
if (!d->useScrollButtonsSetByUser)
|
||||
d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this);
|
||||
// fallthrough
|
||||
case QEvent::FontChange:
|
||||
d->textSizes.clear();
|
||||
d->refresh();
|
||||
} else if (event->type() == QEvent::FontChange) {
|
||||
d->refresh();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
QWidget::changeEvent(event);
|
||||
}
|
||||
|
||||
@ -2208,6 +2230,7 @@ void QTabBar::setElideMode(Qt::TextElideMode mode)
|
||||
Q_D(QTabBar);
|
||||
d->elideMode = mode;
|
||||
d->elideModeSetByUser = true;
|
||||
d->textSizes.clear();
|
||||
d->refresh();
|
||||
}
|
||||
|
||||
|
@ -165,6 +165,7 @@ public:
|
||||
#endif //QT_NO_ANIMATION
|
||||
};
|
||||
QList<Tab> tabList;
|
||||
mutable QHash<QString, QSize> textSizes;
|
||||
|
||||
int calculateNewPosition(int from, int to, int index) const;
|
||||
void slide(int from, int to);
|
||||
@ -198,6 +199,8 @@ public:
|
||||
void autoHideTabs();
|
||||
QRect normalizedScrollRect(int index = -1);
|
||||
|
||||
void initBasicStyleOption(QStyleOptionTab *option, int tabIndex) const;
|
||||
|
||||
void makeVisible(int index);
|
||||
QSize iconSize;
|
||||
Qt::TextElideMode elideMode;
|
||||
|
@ -763,6 +763,7 @@ void tst_QProcess::restartProcess()
|
||||
// Reading and writing to a process is not supported on Qt/CE
|
||||
void tst_QProcess::closeWriteChannel()
|
||||
{
|
||||
QByteArray testData("Data to read");
|
||||
QProcess more;
|
||||
more.start("testProcessEOF/testProcessEOF");
|
||||
|
||||
@ -770,19 +771,21 @@ void tst_QProcess::closeWriteChannel()
|
||||
QVERIFY(!more.waitForReadyRead(250));
|
||||
QCOMPARE(more.error(), QProcess::Timedout);
|
||||
|
||||
QVERIFY(more.write("Data to read") != -1);
|
||||
QCOMPARE(more.write(testData), qint64(testData.size()));
|
||||
|
||||
QVERIFY(!more.waitForReadyRead(250));
|
||||
QCOMPARE(more.error(), QProcess::Timedout);
|
||||
|
||||
more.closeWriteChannel();
|
||||
|
||||
QVERIFY(more.waitForReadyRead(5000));
|
||||
QVERIFY(more.readAll().startsWith("Data to read"));
|
||||
// During closeWriteChannel() call, we might also get an I/O completion
|
||||
// on the read pipe. So, take this into account before waiting for
|
||||
// the new incoming data.
|
||||
while (more.bytesAvailable() < testData.size())
|
||||
QVERIFY(more.waitForReadyRead(5000));
|
||||
QCOMPARE(more.readAll(), testData);
|
||||
|
||||
if (more.state() == QProcess::Running)
|
||||
more.write("q");
|
||||
QVERIFY(more.waitForFinished(5000));
|
||||
QVERIFY(more.waitForFinished(5000));
|
||||
QCOMPARE(more.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(more.exitCode(), 0);
|
||||
}
|
||||
|
@ -500,6 +500,8 @@ private slots:
|
||||
void fromLocal8Bit();
|
||||
void local8Bit_data();
|
||||
void local8Bit();
|
||||
void invalidToLocal8Bit_data();
|
||||
void invalidToLocal8Bit();
|
||||
void nullFromLocal8Bit();
|
||||
void fromLatin1Roundtrip_data();
|
||||
void fromLatin1Roundtrip();
|
||||
@ -4298,6 +4300,66 @@ void tst_QString::local8Bit()
|
||||
QCOMPARE(local8Bit.toLocal8Bit(), QByteArray(result));
|
||||
}
|
||||
|
||||
void tst_QString::invalidToLocal8Bit_data()
|
||||
{
|
||||
QTest::addColumn<QString>("unicode");
|
||||
QTest::addColumn<QByteArray>("expect"); // Initial validly-converted prefix
|
||||
|
||||
{
|
||||
const QChar malformed[] = { 'A', 0xd800, 'B', 0 };
|
||||
const char expected[] = "A";
|
||||
QTest::newRow("LoneHighSurrogate")
|
||||
<< QString(malformed, sizeof(malformed) / sizeof(QChar))
|
||||
// Don't include the terminating '\0' of expected:
|
||||
<< QByteArray(expected, sizeof(expected) / sizeof(char) - 1);
|
||||
}
|
||||
{
|
||||
const QChar malformed[] = { 'A', 0xdc00, 'B', 0 };
|
||||
const char expected[] = "A";
|
||||
QTest::newRow("LoneLowSurrogate")
|
||||
<< QString(malformed, sizeof(malformed) / sizeof(QChar))
|
||||
<< QByteArray(expected, sizeof(expected) / sizeof(char) - 1);
|
||||
}
|
||||
{
|
||||
const QChar malformed[] = { 'A', 0xd800, 0xd801, 'B', 0 };
|
||||
const char expected[] = "A";
|
||||
QTest::newRow("DoubleHighSurrogate")
|
||||
<< QString(malformed, sizeof(malformed) / sizeof(QChar))
|
||||
<< QByteArray(expected, sizeof(expected) / sizeof(char) - 1);
|
||||
}
|
||||
{
|
||||
const QChar malformed[] = { 'A', 0xdc00, 0xdc01, 'B', 0 };
|
||||
const char expected[] = "A";
|
||||
QTest::newRow("DoubleLowSurrogate")
|
||||
<< QString(malformed, sizeof(malformed) / sizeof(QChar))
|
||||
<< QByteArray(expected, sizeof(expected) / sizeof(char) - 1);
|
||||
}
|
||||
{
|
||||
const QChar malformed[] = { 'A', 0xdc00, 0xd800, 'B', 0 };
|
||||
const char expected[] = "A";
|
||||
QTest::newRow("ReversedSurrogates") // low before high
|
||||
<< QString(malformed, sizeof(malformed) / sizeof(QChar))
|
||||
<< QByteArray(expected, sizeof(expected) / sizeof(char) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QString::invalidToLocal8Bit()
|
||||
{
|
||||
QFETCH(QString, unicode);
|
||||
QFETCH(QByteArray, expect);
|
||||
QByteArray local = unicode.toLocal8Bit();
|
||||
/*
|
||||
The main concern of this test is to check that any error-reporting that
|
||||
toLocal8Bit() prompts on failure isn't dependent on outputting the data
|
||||
it's converting via toLocal8Bit(), which would be apt to recurse. So the
|
||||
real purpose of this QVERIFY(), for all that we should indeed check we get
|
||||
the borked output that matches what we can reliably expect (despite
|
||||
variation in how codecs respond to errors), is to verify that we got here
|
||||
- i.e. we didn't crash in such a recursive stack over-flow.
|
||||
*/
|
||||
QVERIFY(local.startsWith(expect));
|
||||
}
|
||||
|
||||
void tst_QString::nullFromLocal8Bit()
|
||||
{
|
||||
QString a;
|
||||
|
@ -279,6 +279,8 @@ void tst_QColor::name_data()
|
||||
QTest::newRow("global color darkMagenta") << QColor(Qt::darkMagenta) << "#800080" << QColor::HexRgb;
|
||||
QTest::newRow("global color darkYellow") << QColor(Qt::darkYellow) << "#808000" << QColor::HexRgb;
|
||||
QTest::newRow("transparent red") << QColor(255, 0, 0, 102) << "#66ff0000" << QColor::HexArgb;
|
||||
QTest::newRow("fully_transparent_green_rgb") << QColor(0, 0, 255, 0) << "#0000ff" << QColor::HexRgb;
|
||||
QTest::newRow("fully_transparent_green_argb") << QColor(0, 0, 255, 0) << "#000000ff" << QColor::HexArgb;
|
||||
}
|
||||
|
||||
void tst_QColor::name()
|
||||
|
@ -111,6 +111,7 @@ void tst_PlatformSocketEngine::construction()
|
||||
QCOMPARE(socketDevice.peerAddress(), QHostAddress());
|
||||
QCOMPARE(socketDevice.peerPort(), quint16(0));
|
||||
QCOMPARE(socketDevice.error(), QAbstractSocket::UnknownSocketError);
|
||||
QCOMPARE(socketDevice.option(QNativeSocketEngine::NonBlockingSocketOption), -1);
|
||||
|
||||
QTest::ignoreMessage(QtWarningMsg, PLATFORMSOCKETENGINESTRING "::bytesAvailable() was called in QAbstractSocket::UnconnectedState");
|
||||
QCOMPARE(socketDevice.bytesAvailable(), -1);
|
||||
|
@ -155,7 +155,7 @@ public:
|
||||
|
||||
vboxLayout->addLayout(gridLayout);
|
||||
|
||||
spacerItem = new QSpacerItem(QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
spacerItem = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
|
||||
vboxLayout->addItem(spacerItem);
|
||||
|
||||
@ -166,7 +166,7 @@ public:
|
||||
hboxLayout->setContentsMargins(1, 1, 1, 1);
|
||||
hboxLayout->setObjectName(QStringLiteral("hboxLayout"));
|
||||
hboxLayout->setObjectName(QStringLiteral(""));
|
||||
spacerItem1 = new QSpacerItem(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
spacerItem1 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
||||
hboxLayout->addItem(spacerItem1);
|
||||
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
|
||||
verticalLayout->addLayout(formLayout);
|
||||
|
||||
spacerItem = new QSpacerItem(QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
spacerItem = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
|
||||
verticalLayout->addItem(spacerItem);
|
||||
|
||||
|
@ -397,6 +397,7 @@ void tst_QGraphicsProxyWidget::setWidget()
|
||||
QGraphicsScene scene;
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Fusion")));
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
QPointer<SubQGraphicsProxyWidget> proxy = new SubQGraphicsProxyWidget;
|
||||
SubQGraphicsProxyWidget parentProxy;
|
||||
@ -419,7 +420,7 @@ void tst_QGraphicsProxyWidget::setWidget()
|
||||
#endif
|
||||
widget->setPalette(QPalette(Qt::magenta));
|
||||
widget->setLayoutDirection(Qt::RightToLeft);
|
||||
widget->setStyle(QStyleFactory::create(QLatin1String("Fusion")));
|
||||
widget->setStyle(style.data());
|
||||
widget->setFont(QFont("Times"));
|
||||
widget->setVisible(true);
|
||||
QApplication::setActiveWindow(widget);
|
||||
|
@ -1,5 +1,6 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = \
|
||||
qcolor \
|
||||
qpainter \
|
||||
qregion \
|
||||
qtransform \
|
||||
|
7
tests/benchmarks/gui/painting/qcolor/qcolor.pro
Normal file
@ -0,0 +1,7 @@
|
||||
QT += testlib
|
||||
QT += gui-private
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET = tst_bench_qcolor
|
||||
|
||||
SOURCES += tst_qcolor.cpp
|
67
tests/benchmarks/gui/painting/qcolor/tst_qcolor.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <qtest.h>
|
||||
#include <QColor>
|
||||
|
||||
|
||||
class tst_QColor : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void nameRgb();
|
||||
void nameArgb();
|
||||
};
|
||||
|
||||
void tst_QColor::nameRgb()
|
||||
{
|
||||
QColor color(128, 255, 10);
|
||||
QCOMPARE(color.name(), QStringLiteral("#80ff0a"));
|
||||
QBENCHMARK {
|
||||
color.name();
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QColor::nameArgb()
|
||||
{
|
||||
QColor color(128, 255, 0, 102);
|
||||
QCOMPARE(color.name(QColor::HexArgb), QStringLiteral("#6680ff00"));
|
||||
QBENCHMARK {
|
||||
color.name(QColor::HexArgb);
|
||||
}
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QColor)
|
||||
|
||||
#include "tst_qcolor.moc"
|