Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I129dd579f92cb2592a38ca043472b45cb926ae12
This commit is contained in:
commit
e164d61ca8
@ -118,9 +118,9 @@ void ClassWizard::accept()
|
|||||||
block += "public:\n";
|
block += "public:\n";
|
||||||
|
|
||||||
if (field("qobjectCtor").toBool()) {
|
if (field("qobjectCtor").toBool()) {
|
||||||
block += " " + className + "(QObject *parent = 0);\n";
|
block += " " + className + "(QObject *parent = nullptr);\n";
|
||||||
} else if (field("qwidgetCtor").toBool()) {
|
} else if (field("qwidgetCtor").toBool()) {
|
||||||
block += " " + className + "(QWidget *parent = 0);\n";
|
block += " " + className + "(QWidget *parent = nullptr);\n";
|
||||||
} else if (field("defaultCtor").toBool()) {
|
} else if (field("defaultCtor").toBool()) {
|
||||||
block += " " + className + "();\n";
|
block += " " + className + "();\n";
|
||||||
if (field("copyCtor").toBool()) {
|
if (field("copyCtor").toBool()) {
|
||||||
|
@ -67,7 +67,7 @@ class ClassWizard : public QWizard
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ClassWizard(QWidget *parent = 0);
|
ClassWizard(QWidget *parent = nullptr);
|
||||||
|
|
||||||
void accept() override;
|
void accept() override;
|
||||||
};
|
};
|
||||||
@ -79,7 +79,7 @@ class IntroPage : public QWizardPage
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IntroPage(QWidget *parent = 0);
|
IntroPage(QWidget *parent = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *label;
|
QLabel *label;
|
||||||
@ -92,7 +92,7 @@ class ClassInfoPage : public QWizardPage
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ClassInfoPage(QWidget *parent = 0);
|
ClassInfoPage(QWidget *parent = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *classNameLabel;
|
QLabel *classNameLabel;
|
||||||
@ -114,7 +114,7 @@ class CodeStylePage : public QWizardPage
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CodeStylePage(QWidget *parent = 0);
|
CodeStylePage(QWidget *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initializePage() override;
|
void initializePage() override;
|
||||||
@ -135,7 +135,7 @@ class OutputFilesPage : public QWizardPage
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OutputFilesPage(QWidget *parent = 0);
|
OutputFilesPage(QWidget *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initializePage() override;
|
void initializePage() override;
|
||||||
@ -154,7 +154,7 @@ class ConclusionPage : public QWizardPage
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConclusionPage(QWidget *parent = 0);
|
ConclusionPage(QWidget *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initializePage() override;
|
void initializePage() override;
|
||||||
|
@ -68,7 +68,7 @@ class FindDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FindDialog(QWidget *parent = 0);
|
FindDialog(QWidget *parent = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *label;
|
QLabel *label;
|
||||||
|
@ -68,7 +68,7 @@ class Window : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Window(QWidget *parent = 0);
|
Window(QWidget *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void browse();
|
void browse();
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
Page_Conclusion };
|
Page_Conclusion };
|
||||||
//! [2]
|
//! [2]
|
||||||
|
|
||||||
LicenseWizard(QWidget *parent = 0);
|
LicenseWizard(QWidget *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showHelp();
|
void showHelp();
|
||||||
@ -86,7 +86,7 @@ class IntroPage : public QWizardPage
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IntroPage(QWidget *parent = 0);
|
IntroPage(QWidget *parent = nullptr);
|
||||||
|
|
||||||
int nextId() const override;
|
int nextId() const override;
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ class EvaluatePage : public QWizardPage
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EvaluatePage(QWidget *parent = 0);
|
EvaluatePage(QWidget *parent = nullptr);
|
||||||
|
|
||||||
int nextId() const override;
|
int nextId() const override;
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ class RegisterPage : public QWizardPage
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RegisterPage(QWidget *parent = 0);
|
RegisterPage(QWidget *parent = nullptr);
|
||||||
|
|
||||||
int nextId() const override;
|
int nextId() const override;
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ class DetailsPage : public QWizardPage
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DetailsPage(QWidget *parent = 0);
|
DetailsPage(QWidget *parent = nullptr);
|
||||||
|
|
||||||
int nextId() const override;
|
int nextId() const override;
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ class ConclusionPage : public QWizardPage
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConclusionPage(QWidget *parent = 0);
|
ConclusionPage(QWidget *parent = nullptr);
|
||||||
|
|
||||||
void initializePage() override;
|
void initializePage() override;
|
||||||
int nextId() const override;
|
int nextId() const override;
|
||||||
|
@ -66,7 +66,7 @@ class Dialog : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Dialog(QWidget *parent = 0);
|
Dialog(QWidget *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void setInteger();
|
void setInteger();
|
||||||
|
@ -65,7 +65,7 @@ class GeneralTab : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GeneralTab(const QFileInfo &fileInfo, QWidget *parent = 0);
|
explicit GeneralTab(const QFileInfo &fileInfo, QWidget *parent = nullptr);
|
||||||
};
|
};
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ class PermissionsTab : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PermissionsTab(const QFileInfo &fileInfo, QWidget *parent = 0);
|
explicit PermissionsTab(const QFileInfo &fileInfo, QWidget *parent = nullptr);
|
||||||
};
|
};
|
||||||
//! [1]
|
//! [1]
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ class ApplicationsTab : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ApplicationsTab(const QFileInfo &fileInfo, QWidget *parent = 0);
|
explicit ApplicationsTab(const QFileInfo &fileInfo, QWidget *parent = nullptr);
|
||||||
};
|
};
|
||||||
//! [2]
|
//! [2]
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ class TabDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TabDialog(const QString &fileName, QWidget *parent = 0);
|
explicit TabDialog(const QString &fileName, QWidget *parent = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTabWidget *tabWidget;
|
QTabWidget *tabWidget;
|
||||||
|
@ -63,7 +63,7 @@ class BlurPicker: public QGraphicsView
|
|||||||
Q_PROPERTY(qreal index READ index WRITE setIndex)
|
Q_PROPERTY(qreal index READ index WRITE setIndex)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BlurPicker(QWidget *parent = 0);
|
BlurPicker(QWidget *parent = nullptr);
|
||||||
|
|
||||||
qreal index() const;
|
qreal index() const;
|
||||||
void setIndex(qreal);
|
void setIndex(qreal);
|
||||||
|
@ -62,7 +62,7 @@ class FadeMessage: public QGraphicsView
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FadeMessage(QWidget *parent = 0);
|
FadeMessage(QWidget *parent = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupScene();
|
void setupScene();
|
||||||
|
@ -50,26 +50,23 @@
|
|||||||
|
|
||||||
#include "imagewidget.h"
|
#include "imagewidget.h"
|
||||||
|
|
||||||
#include <QtWidgets>
|
#include <QDir>
|
||||||
|
#include <QImageReader>
|
||||||
|
#include <QGestureEvent>
|
||||||
|
#include <QPainter>
|
||||||
|
|
||||||
Q_LOGGING_CATEGORY(lcExample, "qt.examples.imagegestures")
|
Q_LOGGING_CATEGORY(lcExample, "qt.examples.imagegestures")
|
||||||
|
|
||||||
//! [constructor]
|
//! [constructor]
|
||||||
ImageWidget::ImageWidget(QWidget *parent)
|
ImageWidget::ImageWidget(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent), position(0), horizontalOffset(0), verticalOffset(0)
|
||||||
position(0),
|
, rotationAngle(0), scaleFactor(1), currentStepScaleFactor(1)
|
||||||
horizontalOffset(0),
|
|
||||||
verticalOffset(0),
|
|
||||||
rotationAngle(0),
|
|
||||||
scaleFactor(1),
|
|
||||||
currentStepScaleFactor(1)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
setMinimumSize(QSize(100,100));
|
setMinimumSize(QSize(100, 100));
|
||||||
}
|
}
|
||||||
//! [constructor]
|
//! [constructor]
|
||||||
|
|
||||||
void ImageWidget::grabGestures(const QList<Qt::GestureType> &gestures)
|
void ImageWidget::grabGestures(const QVector<Qt::GestureType> &gestures)
|
||||||
{
|
{
|
||||||
//! [enable gestures]
|
//! [enable gestures]
|
||||||
for (Qt::GestureType gesture : gestures)
|
for (Qt::GestureType gesture : gestures)
|
||||||
@ -96,11 +93,11 @@ void ImageWidget::paintEvent(QPaintEvent*)
|
|||||||
const qreal wh = height();
|
const qreal wh = height();
|
||||||
const qreal ww = width();
|
const qreal ww = width();
|
||||||
|
|
||||||
p.translate(ww/2, wh/2);
|
p.translate(ww / 2, wh / 2);
|
||||||
p.translate(horizontalOffset, verticalOffset);
|
p.translate(horizontalOffset, verticalOffset);
|
||||||
p.rotate(rotationAngle);
|
p.rotate(rotationAngle);
|
||||||
p.scale(currentStepScaleFactor * scaleFactor, currentStepScaleFactor * scaleFactor);
|
p.scale(currentStepScaleFactor * scaleFactor, currentStepScaleFactor * scaleFactor);
|
||||||
p.translate(-iw/2, -ih/2);
|
p.translate(-iw / 2, -ih / 2);
|
||||||
p.drawImage(0, 0, currentImage);
|
p.drawImage(0, 0, currentImage);
|
||||||
}
|
}
|
||||||
//! [paint method]
|
//! [paint method]
|
||||||
@ -198,8 +195,7 @@ void ImageWidget::openDirectory(const QString &path)
|
|||||||
{
|
{
|
||||||
this->path = path;
|
this->path = path;
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
QStringList nameFilters;
|
const QStringList nameFilters{"*.jpg", "*.png"};
|
||||||
nameFilters << "*.jpg" << "*.png";
|
|
||||||
files = dir.entryList(nameFilters, QDir::Files|QDir::Readable, QDir::Name);
|
files = dir.entryList(nameFilters, QDir::Files|QDir::Readable, QDir::Name);
|
||||||
|
|
||||||
position = 0;
|
position = 0;
|
||||||
@ -207,7 +203,7 @@ void ImageWidget::openDirectory(const QString &path)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage ImageWidget::loadImage(const QString &fileName)
|
QImage ImageWidget::loadImage(const QString &fileName) const
|
||||||
{
|
{
|
||||||
QImageReader reader(fileName);
|
QImageReader reader(fileName);
|
||||||
reader.setAutoTransform(true);
|
reader.setAutoTransform(true);
|
||||||
|
@ -51,9 +51,9 @@
|
|||||||
#ifndef IMAGEWIDGET_H
|
#ifndef IMAGEWIDGET_H
|
||||||
#define IMAGEWIDGET_H
|
#define IMAGEWIDGET_H
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QtWidgets>
|
#include <QLoggingCategory>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QGestureEvent;
|
class QGestureEvent;
|
||||||
@ -70,9 +70,9 @@ class ImageWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ImageWidget(QWidget *parent = 0);
|
ImageWidget(QWidget *parent = nullptr);
|
||||||
void openDirectory(const QString &path);
|
void openDirectory(const QString &path);
|
||||||
void grabGestures(const QList<Qt::GestureType> &gestures);
|
void grabGestures(const QVector<Qt::GestureType> &gestures);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *event) override;
|
bool event(QEvent *event) override;
|
||||||
@ -87,7 +87,7 @@ private:
|
|||||||
void swipeTriggered(QSwipeGesture*);
|
void swipeTriggered(QSwipeGesture*);
|
||||||
//! [class definition begin]
|
//! [class definition begin]
|
||||||
|
|
||||||
QImage loadImage(const QString &fileName);
|
QImage loadImage(const QString &fileName) const;
|
||||||
void loadImage();
|
void loadImage();
|
||||||
void goNextImage();
|
void goNextImage();
|
||||||
void goPrevImage();
|
void goPrevImage();
|
||||||
|
@ -102,7 +102,7 @@ int main(int argc, char *argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Qt::GestureType> gestures;
|
QVector<Qt::GestureType> gestures;
|
||||||
if (!commandLineParser.isSet(disablePanOption))
|
if (!commandLineParser.isSet(disablePanOption))
|
||||||
gestures << Qt::PanGesture;
|
gestures << Qt::PanGesture;
|
||||||
if (!commandLineParser.isSet(disablePinchOption))
|
if (!commandLineParser.isSet(disablePinchOption))
|
||||||
|
@ -72,7 +72,7 @@ void MainWidget::openDirectory(const QString &path)
|
|||||||
imageWidget->openDirectory(path);
|
imageWidget->openDirectory(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::grabGestures(const QList<Qt::GestureType> &gestures)
|
void MainWidget::grabGestures(const QVector<Qt::GestureType> &gestures)
|
||||||
{
|
{
|
||||||
imageWidget->grabGestures(gestures);
|
imageWidget->grabGestures(gestures);
|
||||||
}
|
}
|
||||||
|
@ -60,8 +60,8 @@ class MainWidget : public QMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWidget(QWidget *parent = 0);
|
MainWidget(QWidget *parent = nullptr);
|
||||||
void grabGestures(const QList<Qt::GestureType> &gestures);
|
void grabGestures(const QVector<Qt::GestureType> &gestures);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void openDirectory(const QString &path);
|
void openDirectory(const QString &path);
|
||||||
|
@ -69,8 +69,9 @@ static qreal normalizeAngle(qreal angle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
Mouse::Mouse()
|
Mouse::Mouse() : color(QRandomGenerator::global()->bounded(256),
|
||||||
: color(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256))
|
QRandomGenerator::global()->bounded(256),
|
||||||
|
QRandomGenerator::global()->bounded(256))
|
||||||
{
|
{
|
||||||
setRotation(QRandomGenerator::global()->bounded(360 * 16));
|
setRotation(QRandomGenerator::global()->bounded(360 * 16));
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ int main(int argc, char* argv[])
|
|||||||
model->setHorizontalHeaderLabels(list);
|
model->setHorizontalHeaderLabels(list);
|
||||||
|
|
||||||
int row = 0;
|
int row = 0;
|
||||||
QStandardItem *newItem = 0;
|
QStandardItem *newItem = nullptr;
|
||||||
while (!stream.atEnd()) {
|
while (!stream.atEnd()) {
|
||||||
line = stream.readLine();
|
line = stream.readLine();
|
||||||
if (!line.startsWith('#') && line.contains(',')) {
|
if (!line.startsWith('#') && line.contains(',')) {
|
||||||
|
@ -132,7 +132,7 @@ bool Model::hasChildren(const QModelIndex &parent) const
|
|||||||
Qt::ItemFlags Model::flags(const QModelIndex &index) const
|
Qt::ItemFlags Model::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return 0;
|
return {};
|
||||||
return Qt::ItemIsDragEnabled|QAbstractItemModel::flags(index);
|
return Qt::ItemIsDragEnabled|QAbstractItemModel::flags(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ Model::Node *Model::node(int row, Node *parent) const
|
|||||||
|
|
||||||
Model::Node *Model::parent(Node *child) const
|
Model::Node *Model::parent(Node *child) const
|
||||||
{
|
{
|
||||||
return child ? child->parent : 0;
|
return child ? child->parent : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Model::row(Node *node) const
|
int Model::row(Node *node) const
|
||||||
|
@ -48,7 +48,8 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QtWidgets>
|
#include <QApplication>
|
||||||
|
#include <QTableWidget>
|
||||||
|
|
||||||
#include "stardelegate.h"
|
#include "stardelegate.h"
|
||||||
#include "stareditor.h"
|
#include "stareditor.h"
|
||||||
@ -57,7 +58,7 @@
|
|||||||
//! [0]
|
//! [0]
|
||||||
void populateTableWidget(QTableWidget *tableWidget)
|
void populateTableWidget(QTableWidget *tableWidget)
|
||||||
{
|
{
|
||||||
static const struct {
|
static constexpr struct {
|
||||||
const char *title;
|
const char *title;
|
||||||
const char *genre;
|
const char *genre;
|
||||||
const char *artist;
|
const char *artist;
|
||||||
@ -70,12 +71,12 @@ void populateTableWidget(QTableWidget *tableWidget)
|
|||||||
{ "Sex Bomb", "Pop", "Tom Jones", 3 },
|
{ "Sex Bomb", "Pop", "Tom Jones", 3 },
|
||||||
{ "Barbie Girl", "Pop", "Aqua", 5 },
|
{ "Barbie Girl", "Pop", "Aqua", 5 },
|
||||||
//! [2]
|
//! [2]
|
||||||
{ 0, 0, 0, 0 }
|
{ nullptr, nullptr, nullptr, 0 }
|
||||||
//! [2] //! [3]
|
//! [2] //! [3]
|
||||||
};
|
};
|
||||||
//! [3] //! [4]
|
//! [3] //! [4]
|
||||||
|
|
||||||
for (int row = 0; staticData[row].title != 0; ++row) {
|
for (int row = 0; staticData[row].title != nullptr; ++row) {
|
||||||
QTableWidgetItem *item0 = new QTableWidgetItem(staticData[row].title);
|
QTableWidgetItem *item0 = new QTableWidgetItem(staticData[row].title);
|
||||||
QTableWidgetItem *item1 = new QTableWidgetItem(staticData[row].genre);
|
QTableWidgetItem *item1 = new QTableWidgetItem(staticData[row].genre);
|
||||||
QTableWidgetItem *item2 = new QTableWidgetItem(staticData[row].artist);
|
QTableWidgetItem *item2 = new QTableWidgetItem(staticData[row].artist);
|
||||||
|
@ -262,7 +262,7 @@ PathDeformWidget::PathDeformWidget(QWidget *parent, bool smallScreen)
|
|||||||
QHBoxLayout *mainLayout = new QHBoxLayout(this);
|
QHBoxLayout *mainLayout = new QHBoxLayout(this);
|
||||||
mainLayout->addWidget(m_renderer);
|
mainLayout->addWidget(m_renderer);
|
||||||
|
|
||||||
m_controls = new PathDeformControls(0, m_renderer, smallScreen);
|
m_controls = new PathDeformControls(nullptr, m_renderer, smallScreen);
|
||||||
m_controls->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
|
m_controls->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
|
||||||
|
|
||||||
if (!smallScreen)
|
if (!smallScreen)
|
||||||
|
@ -70,7 +70,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindowBase
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = 0);
|
MainWindow(QWidget *parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void on_clearAction_triggered();
|
void on_clearAction_triggered();
|
||||||
|
@ -102,9 +102,9 @@ uint ShadeWidget::colorAt(int x)
|
|||||||
generateShade();
|
generateShade();
|
||||||
|
|
||||||
QPolygonF pts = m_hoverPoints->points();
|
QPolygonF pts = m_hoverPoints->points();
|
||||||
for (int i=1; i < pts.size(); ++i) {
|
for (int i = 1; i < pts.size(); ++i) {
|
||||||
if (pts.at(i-1).x() <= x && pts.at(i).x() >= x) {
|
if (pts.at(i - 1).x() <= x && pts.at(i).x() >= x) {
|
||||||
QLineF l(pts.at(i-1), pts.at(i));
|
QLineF l(pts.at(i - 1), pts.at(i));
|
||||||
l.setLength(l.length() * ((x - l.x1()) / l.dx()));
|
l.setLength(l.length() * ((x - l.x1()) / l.dx()));
|
||||||
return m_shade.pixel(qRound(qMin(l.x2(), (qreal(m_shade.width() - 1)))),
|
return m_shade.pixel(qRound(qMin(l.x2(), (qreal(m_shade.width() - 1)))),
|
||||||
qRound(qMin(l.y2(), qreal(m_shade.height() - 1))));
|
qRound(qMin(l.y2(), qreal(m_shade.height() - 1))));
|
||||||
@ -118,9 +118,9 @@ void ShadeWidget::setGradientStops(const QGradientStops &stops)
|
|||||||
if (m_shade_type == ARGBShade) {
|
if (m_shade_type == ARGBShade) {
|
||||||
m_alpha_gradient = QLinearGradient(0, 0, width(), 0);
|
m_alpha_gradient = QLinearGradient(0, 0, width(), 0);
|
||||||
|
|
||||||
for (int i=0; i<stops.size(); ++i) {
|
for (const auto &stop : stops) {
|
||||||
QColor c = stops.at(i).second;
|
QColor c = stop.second;
|
||||||
m_alpha_gradient.setColorAt(stops.at(i).first, QColor(c.red(), c.green(), c.blue()));
|
m_alpha_gradient.setColorAt(stop.first, QColor(c.red(), c.green(), c.blue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_shade = QImage();
|
m_shade = QImage();
|
||||||
@ -223,13 +223,13 @@ void GradientEditor::pointsUpdated()
|
|||||||
std::sort(points.begin(), points.end(), x_less_than);
|
std::sort(points.begin(), points.end(), x_less_than);
|
||||||
|
|
||||||
for (int i = 0; i < points.size(); ++i) {
|
for (int i = 0; i < points.size(); ++i) {
|
||||||
qreal x = int(points.at(i).x());
|
const int x = int(points.at(i).x());
|
||||||
if (i + 1 < points.size() && x == points.at(i + 1).x())
|
if (i + 1 < points.size() && x == int(points.at(i + 1).x()))
|
||||||
continue;
|
continue;
|
||||||
QColor color((0x00ff0000 & m_red_shade->colorAt(int(x))) >> 16,
|
QColor color((0x00ff0000 & m_red_shade->colorAt(x)) >> 16,
|
||||||
(0x0000ff00 & m_green_shade->colorAt(int(x))) >> 8,
|
(0x0000ff00 & m_green_shade->colorAt(x)) >> 8,
|
||||||
(0x000000ff & m_blue_shade->colorAt(int(x))),
|
(0x000000ff & m_blue_shade->colorAt(x)),
|
||||||
(0xff000000 & m_alpha_shade->colorAt(int(x))) >> 24);
|
(0xff000000 & m_alpha_shade->colorAt(x)) >> 24);
|
||||||
|
|
||||||
if (x / w > 1)
|
if (x / w > 1)
|
||||||
return;
|
return;
|
||||||
@ -568,8 +568,8 @@ void GradientRenderer::paint(QPainter *p)
|
|||||||
g = QConicalGradient(pts.at(0), angle);
|
g = QConicalGradient(pts.at(0), angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < m_stops.size(); ++i)
|
for (const auto &stop : qAsConst(m_stops))
|
||||||
g.setColorAt(m_stops.at(i).first, m_stops.at(i).second);
|
g.setColorAt(stop.first, stop.second);
|
||||||
|
|
||||||
g.setSpread(m_spread);
|
g.setSpread(m_spread);
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class GradientWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GradientWidget(QWidget *parent);
|
GradientWidget(QWidget *parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setDefault1() { setDefault(1); }
|
void setDefault1() { setDefault(1); }
|
||||||
|
@ -58,8 +58,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
GradientWidget gradientWidget(0);
|
GradientWidget gradientWidget;
|
||||||
QStyle *arthurStyle = new ArthurStyle();
|
QStyle *arthurStyle = new ArthurStyle;
|
||||||
gradientWidget.setStyle(arthurStyle);
|
gradientWidget.setStyle(arthurStyle);
|
||||||
const QList<QWidget *> widgets = gradientWidget.findChildren<QWidget *>();
|
const QList<QWidget *> widgets = gradientWidget.findChildren<QWidget *>();
|
||||||
for (QWidget *w : widgets) {
|
for (QWidget *w : widgets) {
|
||||||
|
@ -60,7 +60,7 @@ class RenderArea : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit RenderArea(const QPainterPath &path, QWidget *parent = 0);
|
explicit RenderArea(const QPainterPath &path, QWidget *parent = nullptr);
|
||||||
|
|
||||||
QSize minimumSizeHint() const override;
|
QSize minimumSizeHint() const override;
|
||||||
QSize sizeHint() const override;
|
QSize sizeHint() const override;
|
||||||
|
@ -48,11 +48,9 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "pathstroke.h"
|
||||||
#include "arthurstyle.h"
|
#include "arthurstyle.h"
|
||||||
#include "arthurwidgets.h"
|
#include "arthurwidgets.h"
|
||||||
#include "pathstroke.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
extern void draw_round_rect(QPainter *p, const QRect &bounds, int radius);
|
extern void draw_round_rect(QPainter *p, const QRect &bounds, int radius);
|
||||||
|
|
||||||
@ -164,24 +162,39 @@ void PathStrokeControls::createCommonControls(QWidget* parent)
|
|||||||
|
|
||||||
|
|
||||||
// Connections
|
// Connections
|
||||||
connect(flatCap, &QAbstractButton::clicked, m_renderer, &PathStrokeRenderer::setFlatCap);
|
connect(flatCap, &QAbstractButton::clicked,
|
||||||
connect(squareCap, &QAbstractButton::clicked, m_renderer, &PathStrokeRenderer::setSquareCap);
|
m_renderer, &PathStrokeRenderer::setFlatCap);
|
||||||
connect(roundCap, &QAbstractButton::clicked, m_renderer, &PathStrokeRenderer::setRoundCap);
|
connect(squareCap, &QAbstractButton::clicked,
|
||||||
|
m_renderer, &PathStrokeRenderer::setSquareCap);
|
||||||
|
connect(roundCap, &QAbstractButton::clicked,
|
||||||
|
m_renderer, &PathStrokeRenderer::setRoundCap);
|
||||||
|
|
||||||
connect(bevelJoin, &QAbstractButton::clicked, m_renderer, &PathStrokeRenderer::setBevelJoin);
|
connect(bevelJoin, &QAbstractButton::clicked,
|
||||||
connect(miterJoin, &QAbstractButton::clicked, m_renderer, &PathStrokeRenderer::setMiterJoin);
|
m_renderer, &PathStrokeRenderer::setBevelJoin);
|
||||||
connect(svgMiterJoin, &QAbstractButton::clicked, m_renderer, &PathStrokeRenderer::setSvgMiterJoin);
|
connect(miterJoin, &QAbstractButton::clicked,
|
||||||
connect(roundJoin, &QAbstractButton::clicked, m_renderer, &PathStrokeRenderer::setRoundJoin);
|
m_renderer, &PathStrokeRenderer::setMiterJoin);
|
||||||
|
connect(svgMiterJoin, &QAbstractButton::clicked,
|
||||||
|
m_renderer, &PathStrokeRenderer::setSvgMiterJoin);
|
||||||
|
connect(roundJoin, &QAbstractButton::clicked,
|
||||||
|
m_renderer, &PathStrokeRenderer::setRoundJoin);
|
||||||
|
|
||||||
connect(curveMode, &QAbstractButton::clicked, m_renderer, &PathStrokeRenderer::setCurveMode);
|
connect(curveMode, &QAbstractButton::clicked,
|
||||||
connect(lineMode, &QAbstractButton::clicked, m_renderer, &PathStrokeRenderer::setLineMode);
|
m_renderer, &PathStrokeRenderer::setCurveMode);
|
||||||
|
connect(lineMode, &QAbstractButton::clicked,
|
||||||
|
m_renderer, &PathStrokeRenderer::setLineMode);
|
||||||
|
|
||||||
connect(solidLine, &QAbstractButton::clicked, m_renderer, &PathStrokeRenderer::setSolidLine);
|
connect(solidLine, &QAbstractButton::clicked,
|
||||||
connect(dashLine, &QAbstractButton::clicked, m_renderer, &PathStrokeRenderer::setDashLine);
|
m_renderer, &PathStrokeRenderer::setSolidLine);
|
||||||
connect(dotLine, &QAbstractButton::clicked, m_renderer, &PathStrokeRenderer::setDotLine);
|
connect(dashLine, &QAbstractButton::clicked,
|
||||||
connect(dashDotLine, &QAbstractButton::clicked, m_renderer, &PathStrokeRenderer::setDashDotLine);
|
m_renderer, &PathStrokeRenderer::setDashLine);
|
||||||
connect(dashDotDotLine, &QAbstractButton::clicked, m_renderer, &PathStrokeRenderer::setDashDotDotLine);
|
connect(dotLine, &QAbstractButton::clicked,
|
||||||
connect(customDashLine, &QAbstractButton::clicked, m_renderer, &PathStrokeRenderer::setCustomDashLine);
|
m_renderer, &PathStrokeRenderer::setDotLine);
|
||||||
|
connect(dashDotLine, &QAbstractButton::clicked,
|
||||||
|
m_renderer, &PathStrokeRenderer::setDashDotLine);
|
||||||
|
connect(dashDotDotLine, &QAbstractButton::clicked,
|
||||||
|
m_renderer, &PathStrokeRenderer::setDashDotDotLine);
|
||||||
|
connect(customDashLine, &QAbstractButton::clicked,
|
||||||
|
m_renderer, &PathStrokeRenderer::setCustomDashLine);
|
||||||
|
|
||||||
// Set the defaults:
|
// Set the defaults:
|
||||||
flatCap->setChecked(true);
|
flatCap->setChecked(true);
|
||||||
@ -247,15 +260,20 @@ void PathStrokeControls::layoutForDesktop()
|
|||||||
|
|
||||||
|
|
||||||
// Set up connections
|
// Set up connections
|
||||||
connect(animated, &QAbstractButton::toggled, m_renderer, &PathStrokeRenderer::setAnimation);
|
connect(animated, &QAbstractButton::toggled,
|
||||||
|
m_renderer, &PathStrokeRenderer::setAnimation);
|
||||||
|
|
||||||
connect(penWidth, &QAbstractSlider::valueChanged, m_renderer, &PathStrokeRenderer::setPenWidth);
|
connect(penWidth, &QAbstractSlider::valueChanged,
|
||||||
|
m_renderer, &PathStrokeRenderer::setPenWidth);
|
||||||
|
|
||||||
connect(showSourceButton, &QAbstractButton::clicked, m_renderer, &ArthurFrame::showSource);
|
connect(showSourceButton, &QAbstractButton::clicked,
|
||||||
|
m_renderer, &ArthurFrame::showSource);
|
||||||
#if QT_CONFIG(opengl)
|
#if QT_CONFIG(opengl)
|
||||||
connect(enableOpenGLButton, &QAbstractButton::clicked, m_renderer, &ArthurFrame::enableOpenGL);
|
connect(enableOpenGLButton, &QAbstractButton::clicked,
|
||||||
|
m_renderer, &ArthurFrame::enableOpenGL);
|
||||||
#endif
|
#endif
|
||||||
connect(whatsThisButton, &QAbstractButton::clicked, m_renderer, &ArthurFrame::setDescriptionEnabled);
|
connect(whatsThisButton, &QAbstractButton::clicked,
|
||||||
|
m_renderer, &ArthurFrame::setDescriptionEnabled);
|
||||||
connect(m_renderer, &ArthurFrame::descriptionEnabledChanged,
|
connect(m_renderer, &ArthurFrame::descriptionEnabledChanged,
|
||||||
whatsThisButton, &QAbstractButton::setChecked);
|
whatsThisButton, &QAbstractButton::setChecked);
|
||||||
|
|
||||||
@ -296,11 +314,11 @@ void PathStrokeControls::layoutForSmallScreens()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Layouts:
|
// Layouts:
|
||||||
QHBoxLayout *penWidthLayout = new QHBoxLayout(0);
|
QHBoxLayout *penWidthLayout = new QHBoxLayout;
|
||||||
penWidthLayout->addWidget(penWidthLabel, 0, Qt::AlignRight);
|
penWidthLayout->addWidget(penWidthLabel, 0, Qt::AlignRight);
|
||||||
penWidthLayout->addWidget(penWidth);
|
penWidthLayout->addWidget(penWidth);
|
||||||
|
|
||||||
QVBoxLayout *leftLayout = new QVBoxLayout(0);
|
QVBoxLayout *leftLayout = new QVBoxLayout;
|
||||||
leftLayout->addWidget(m_capGroup);
|
leftLayout->addWidget(m_capGroup);
|
||||||
leftLayout->addWidget(m_joinGroup);
|
leftLayout->addWidget(m_joinGroup);
|
||||||
#if QT_CONFIG(opengl)
|
#if QT_CONFIG(opengl)
|
||||||
@ -308,7 +326,7 @@ void PathStrokeControls::layoutForSmallScreens()
|
|||||||
#endif
|
#endif
|
||||||
leftLayout->addLayout(penWidthLayout);
|
leftLayout->addLayout(penWidthLayout);
|
||||||
|
|
||||||
QVBoxLayout *rightLayout = new QVBoxLayout(0);
|
QVBoxLayout *rightLayout = new QVBoxLayout;
|
||||||
rightLayout->addWidget(m_styleGroup);
|
rightLayout->addWidget(m_styleGroup);
|
||||||
rightLayout->addWidget(m_pathModeGroup);
|
rightLayout->addWidget(m_pathModeGroup);
|
||||||
|
|
||||||
@ -356,7 +374,7 @@ PathStrokeWidget::PathStrokeWidget(bool smallScreen)
|
|||||||
// Widget construction and property setting
|
// Widget construction and property setting
|
||||||
m_renderer = new PathStrokeRenderer(this, smallScreen);
|
m_renderer = new PathStrokeRenderer(this, smallScreen);
|
||||||
|
|
||||||
m_controls = new PathStrokeControls(0, m_renderer, smallScreen);
|
m_controls = new PathStrokeControls(nullptr, m_renderer, smallScreen);
|
||||||
|
|
||||||
// Layouting
|
// Layouting
|
||||||
QHBoxLayout *viewLayout = new QHBoxLayout(this);
|
QHBoxLayout *viewLayout = new QHBoxLayout(this);
|
||||||
@ -383,10 +401,10 @@ void PathStrokeWidget::hideControls()
|
|||||||
m_controls->hide();
|
m_controls->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathStrokeWidget::setStyle( QStyle * style )
|
void PathStrokeWidget::setStyle(QStyle *style)
|
||||||
{
|
{
|
||||||
QWidget::setStyle(style);
|
QWidget::setStyle(style);
|
||||||
if (m_controls != 0)
|
if (m_controls != nullptr)
|
||||||
{
|
{
|
||||||
m_controls->setStyle(style);
|
m_controls->setStyle(style);
|
||||||
|
|
||||||
@ -516,7 +534,7 @@ void PathStrokeRenderer::updatePoints()
|
|||||||
qreal bottom = height() - pad;
|
qreal bottom = height() - pad;
|
||||||
|
|
||||||
Q_ASSERT(m_points.size() == m_vectors.size());
|
Q_ASSERT(m_points.size() == m_vectors.size());
|
||||||
for (int i=0; i<m_points.size(); ++i) {
|
for (int i = 0; i < m_points.size(); ++i) {
|
||||||
QPointF pos = m_points.at(i);
|
QPointF pos = m_points.at(i);
|
||||||
QPointF vec = m_vectors.at(i);
|
QPointF vec = m_vectors.at(i);
|
||||||
pos += vec;
|
pos += vec;
|
||||||
@ -540,7 +558,7 @@ void PathStrokeRenderer::mousePressEvent(QMouseEvent *e)
|
|||||||
setDescriptionEnabled(false);
|
setDescriptionEnabled(false);
|
||||||
m_activePoint = -1;
|
m_activePoint = -1;
|
||||||
qreal distance = -1;
|
qreal distance = -1;
|
||||||
for (int i=0; i<m_points.size(); ++i) {
|
for (int i = 0; i < m_points.size(); ++i) {
|
||||||
qreal d = QLineF(e->pos(), m_points.at(i)).length();
|
qreal d = QLineF(e->pos(), m_points.at(i)).length();
|
||||||
if ((distance < 0 && d < 8 * m_pointSize) || d < distance) {
|
if ((distance < 0 && d < 8 * m_pointSize) || d < distance) {
|
||||||
distance = d;
|
distance = d;
|
||||||
@ -673,7 +691,6 @@ bool PathStrokeRenderer::event(QEvent *e)
|
|||||||
m_fingerPointMapping.clear();
|
m_fingerPointMapping.clear();
|
||||||
setAnimation(m_wasAnimated);
|
setAnimation(m_wasAnimated);
|
||||||
return true;
|
return true;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ class PathStrokeWidget : public QWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
PathStrokeWidget(bool smallScreen);
|
PathStrokeWidget(bool smallScreen);
|
||||||
void setStyle ( QStyle * style );
|
void setStyle(QStyle *style);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PathStrokeRenderer *m_renderer;
|
PathStrokeRenderer *m_renderer;
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
void drawHoverRect(QPainter *painter, const QRect &rect) const;
|
void drawHoverRect(QPainter *painter, const QRect &rect) const;
|
||||||
|
|
||||||
void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
|
void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
|
||||||
QPainter *painter, const QWidget *widget = 0) const override;
|
QPainter *painter, const QWidget *widget = nullptr) const override;
|
||||||
void drawControl(ControlElement element, const QStyleOption *option,
|
void drawControl(ControlElement element, const QStyleOption *option,
|
||||||
QPainter *painter, const QWidget *widget) const override;
|
QPainter *painter, const QWidget *widget) const override;
|
||||||
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
|
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
|
||||||
|
@ -136,7 +136,7 @@ void ArthurFrame::createGlWindow()
|
|||||||
|
|
||||||
void ArthurFrame::paintEvent(QPaintEvent *e)
|
void ArthurFrame::paintEvent(QPaintEvent *e)
|
||||||
{
|
{
|
||||||
static QImage *static_image = 0;
|
static QImage *static_image = nullptr;
|
||||||
|
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ void ArthurFrame::showSource()
|
|||||||
|
|
||||||
const QString html = QStringLiteral("<html><pre>") + contents + QStringLiteral("</pre></html>");
|
const QString html = QStringLiteral("<html><pre>") + contents + QStringLiteral("</pre></html>");
|
||||||
|
|
||||||
QTextBrowser *sourceViewer = new QTextBrowser(0);
|
QTextBrowser *sourceViewer = new QTextBrowser;
|
||||||
sourceViewer->setWindowTitle(tr("Source: %1").arg(m_sourceFileName.midRef(5)));
|
sourceViewer->setWindowTitle(tr("Source: %1").arg(m_sourceFileName.midRef(5)));
|
||||||
sourceViewer->setParent(this, Qt::Dialog);
|
sourceViewer->setParent(this, Qt::Dialog);
|
||||||
sourceViewer->setAttribute(Qt::WA_DeleteOnClose);
|
sourceViewer->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
#include <QOffscreenSurface>
|
#include <QOffscreenSurface>
|
||||||
#include <QOpenGLFunctions>
|
#include <QOpenGLFunctions>
|
||||||
|
|
||||||
QFboPaintDevice::QFboPaintDevice(const QSize& size, bool flipped, bool clearOnInit,
|
QFboPaintDevice::QFboPaintDevice(const QSize &size, bool flipped, bool clearOnInit,
|
||||||
QOpenGLFramebufferObject::Attachment attachment)
|
QOpenGLFramebufferObject::Attachment attachment)
|
||||||
: QOpenGLPaintDevice(size)
|
: QOpenGLPaintDevice(size)
|
||||||
{
|
{
|
||||||
@ -97,8 +97,8 @@ GLuint QFboPaintDevice::takeTexture()
|
|||||||
|
|
||||||
QImage QFboPaintDevice::toImage() const
|
QImage QFboPaintDevice::toImage() const
|
||||||
{
|
{
|
||||||
QOpenGLContext* currentContext = QOpenGLContext::currentContext();
|
QOpenGLContext *currentContext = QOpenGLContext::currentContext();
|
||||||
QSurface* currentSurface = currentContext ? currentContext->surface() : 0;
|
QSurface *currentSurface = currentContext ? currentContext->surface() : nullptr;
|
||||||
|
|
||||||
context()->makeCurrent(m_surface);
|
context()->makeCurrent(m_surface);
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
class QFboPaintDevice : public QOpenGLPaintDevice {
|
class QFboPaintDevice : public QOpenGLPaintDevice {
|
||||||
public:
|
public:
|
||||||
QFboPaintDevice(const QSize&, bool flipped = false, bool clearOnInit = true,
|
QFboPaintDevice(const QSize &size, bool flipped = false, bool clearOnInit = true,
|
||||||
QOpenGLFramebufferObject::Attachment = QOpenGLFramebufferObject::CombinedDepthStencil);
|
QOpenGLFramebufferObject::Attachment = QOpenGLFramebufferObject::CombinedDepthStencil);
|
||||||
~QFboPaintDevice();
|
~QFboPaintDevice();
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QOpenGLFramebufferObject *m_framebufferObject;
|
QOpenGLFramebufferObject *m_framebufferObject;
|
||||||
QSurface* m_surface;
|
QSurface *m_surface;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QT_NO_OPENGL
|
#endif // QT_NO_OPENGL
|
||||||
|
@ -262,8 +262,8 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
|
|||||||
case QEvent::Paint:
|
case QEvent::Paint:
|
||||||
{
|
{
|
||||||
QWidget *that_widget = m_widget;
|
QWidget *that_widget = m_widget;
|
||||||
m_widget = 0;
|
m_widget = nullptr;
|
||||||
QApplication::sendEvent(object, event);
|
QCoreApplication::sendEvent(object, event);
|
||||||
m_widget = that_widget;
|
m_widget = that_widget;
|
||||||
paintPoints();
|
paintPoints();
|
||||||
return true;
|
return true;
|
||||||
|
@ -70,7 +70,7 @@ class RenderArea : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RenderArea(QWidget *parent = 0);
|
RenderArea(QWidget *parent = nullptr);
|
||||||
|
|
||||||
void setOperations(const QList<Operation> &operations);
|
void setOperations(const QList<Operation> &operations);
|
||||||
void setShape(const QPainterPath &shape);
|
void setShape(const QPainterPath &shape);
|
||||||
|
@ -640,7 +640,7 @@ void TextEdit::textStyle(int styleIndex)
|
|||||||
{
|
{
|
||||||
QTextCursor cursor = textEdit->textCursor();
|
QTextCursor cursor = textEdit->textCursor();
|
||||||
QTextListFormat::Style style = QTextListFormat::ListStyleUndefined;
|
QTextListFormat::Style style = QTextListFormat::ListStyleUndefined;
|
||||||
QTextBlockFormat::MarkerType marker = QTextBlockFormat::NoMarker;
|
QTextBlockFormat::MarkerType marker = QTextBlockFormat::MarkerType::NoMarker;
|
||||||
|
|
||||||
switch (styleIndex) {
|
switch (styleIndex) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -657,14 +657,14 @@ void TextEdit::textStyle(int styleIndex)
|
|||||||
style = cursor.currentList()->format().style();
|
style = cursor.currentList()->format().style();
|
||||||
else
|
else
|
||||||
style = QTextListFormat::ListDisc;
|
style = QTextListFormat::ListDisc;
|
||||||
marker = QTextBlockFormat::Unchecked;
|
marker = QTextBlockFormat::MarkerType::Unchecked;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
if (cursor.currentList())
|
if (cursor.currentList())
|
||||||
style = cursor.currentList()->format().style();
|
style = cursor.currentList()->format().style();
|
||||||
else
|
else
|
||||||
style = QTextListFormat::ListDisc;
|
style = QTextListFormat::ListDisc;
|
||||||
marker = QTextBlockFormat::Checked;
|
marker = QTextBlockFormat::MarkerType::Checked;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
style = QTextListFormat::ListDecimal;
|
style = QTextListFormat::ListDecimal;
|
||||||
@ -823,14 +823,14 @@ void TextEdit::cursorPositionChanged()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (textEdit->textCursor().block().blockFormat().marker()) {
|
switch (textEdit->textCursor().block().blockFormat().marker()) {
|
||||||
case QTextBlockFormat::NoMarker:
|
case QTextBlockFormat::MarkerType::NoMarker:
|
||||||
actionToggleCheckState->setChecked(false);
|
actionToggleCheckState->setChecked(false);
|
||||||
break;
|
break;
|
||||||
case QTextBlockFormat::Unchecked:
|
case QTextBlockFormat::MarkerType::Unchecked:
|
||||||
comboStyle->setCurrentIndex(4);
|
comboStyle->setCurrentIndex(4);
|
||||||
actionToggleCheckState->setChecked(false);
|
actionToggleCheckState->setChecked(false);
|
||||||
break;
|
break;
|
||||||
case QTextBlockFormat::Checked:
|
case QTextBlockFormat::MarkerType::Checked:
|
||||||
comboStyle->setCurrentIndex(5);
|
comboStyle->setCurrentIndex(5);
|
||||||
actionToggleCheckState->setChecked(true);
|
actionToggleCheckState->setChecked(true);
|
||||||
break;
|
break;
|
||||||
|
@ -64,7 +64,7 @@ class RectObject : public QGraphicsObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RectObject(const QString &text, qreal x, qreal y, qreal width, qreal height, QBrush brush, QGraphicsItem *parent = 0)
|
RectObject(const QString &text, qreal x, qreal y, qreal width, qreal height, QBrush brush, QGraphicsItem *parent = nullptr)
|
||||||
: QGraphicsObject(parent)
|
: QGraphicsObject(parent)
|
||||||
, m_text(text)
|
, m_text(text)
|
||||||
, m_rect(x, y, width, height)
|
, m_rect(x, y, width, height)
|
||||||
|
@ -48,13 +48,18 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QtWidgets>
|
#include <QApplication>
|
||||||
|
#include <QEventTransition>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QStateMachine>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
class Window : public QWidget
|
class Window : public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Window(QWidget *parent = 0)
|
Window(QWidget *parent = nullptr)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
QPushButton *button = new QPushButton(this);
|
QPushButton *button = new QPushButton(this);
|
||||||
|
@ -57,10 +57,7 @@ class Factorial : public QObject
|
|||||||
Q_PROPERTY(int x READ x WRITE setX)
|
Q_PROPERTY(int x READ x WRITE setX)
|
||||||
Q_PROPERTY(int fac READ fac WRITE setFac)
|
Q_PROPERTY(int fac READ fac WRITE setFac)
|
||||||
public:
|
public:
|
||||||
Factorial(QObject *parent = 0)
|
using QObject::QObject;
|
||||||
: QObject(parent), m_x(-1), m_fac(1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int x() const
|
int x() const
|
||||||
{
|
{
|
||||||
@ -89,8 +86,8 @@ Q_SIGNALS:
|
|||||||
void xChanged(int value);
|
void xChanged(int value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_x;
|
int m_x = -1;
|
||||||
int m_fac;
|
int m_fac = 1;
|
||||||
};
|
};
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
|
@ -48,7 +48,13 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QtWidgets>
|
#include <QApplication>
|
||||||
|
#include <QFinalState>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QStateMachine>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
class LightWidget : public QWidget
|
class LightWidget : public QWidget
|
||||||
@ -56,7 +62,7 @@ class LightWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool on READ isOn WRITE setOn)
|
Q_PROPERTY(bool on READ isOn WRITE setOn)
|
||||||
public:
|
public:
|
||||||
LightWidget(const QColor &color, QWidget *parent = 0)
|
LightWidget(const QColor &color, QWidget *parent = nullptr)
|
||||||
: QWidget(parent), m_color(color), m_on(false) {}
|
: QWidget(parent), m_color(color), m_on(false) {}
|
||||||
|
|
||||||
bool isOn() const
|
bool isOn() const
|
||||||
@ -94,7 +100,7 @@ private:
|
|||||||
class TrafficLightWidget : public QWidget
|
class TrafficLightWidget : public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TrafficLightWidget(QWidget *parent = 0)
|
TrafficLightWidget(QWidget *parent = nullptr)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||||
@ -125,7 +131,7 @@ private:
|
|||||||
//! [1]
|
//! [1]
|
||||||
|
|
||||||
//! [2]
|
//! [2]
|
||||||
QState *createLightState(LightWidget *light, int duration, QState *parent = 0)
|
QState *createLightState(LightWidget *light, int duration, QState *parent = nullptr)
|
||||||
{
|
{
|
||||||
QState *lightState = new QState(parent);
|
QState *lightState = new QState(parent);
|
||||||
QTimer *timer = new QTimer(lightState);
|
QTimer *timer = new QTimer(lightState);
|
||||||
|
@ -62,7 +62,7 @@ class ScribbleArea : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScribbleArea(QWidget *parent = 0);
|
ScribbleArea(QWidget *parent = nullptr);
|
||||||
|
|
||||||
bool openImage(const QString &fileName);
|
bool openImage(const QString &fileName);
|
||||||
bool saveImage(const QString &fileName, const char *fileFormat);
|
bool saveImage(const QString &fileName, const char *fileFormat);
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
#include <QTouchEvent>
|
#include <QTouchEvent>
|
||||||
|
|
||||||
GraphicsView::GraphicsView(QGraphicsScene *scene, QWidget *parent)
|
GraphicsView::GraphicsView(QGraphicsScene *scene, QWidget *parent)
|
||||||
: QGraphicsView(scene, parent), totalScaleFactor(1)
|
: QGraphicsView(scene, parent)
|
||||||
{
|
{
|
||||||
viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
|
viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
|
||||||
setDragMode(ScrollHandDrag);
|
setDragMode(ScrollHandDrag);
|
||||||
@ -83,8 +83,8 @@ bool GraphicsView::viewportEvent(QEvent *event)
|
|||||||
totalScaleFactor *= currentScaleFactor;
|
totalScaleFactor *= currentScaleFactor;
|
||||||
currentScaleFactor = 1;
|
currentScaleFactor = 1;
|
||||||
}
|
}
|
||||||
setTransform(QTransform().scale(totalScaleFactor * currentScaleFactor,
|
setTransform(QTransform::fromScale(totalScaleFactor * currentScaleFactor,
|
||||||
totalScaleFactor * currentScaleFactor));
|
totalScaleFactor * currentScaleFactor));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -56,10 +56,10 @@ class GraphicsView : public QGraphicsView
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GraphicsView(QGraphicsScene *scene = 0, QWidget *parent = 0);
|
GraphicsView(QGraphicsScene *scene = nullptr, QWidget *parent = nullptr);
|
||||||
|
|
||||||
bool viewportEvent(QEvent *event) override;
|
bool viewportEvent(QEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
qreal totalScaleFactor;
|
qreal totalScaleFactor = 1;
|
||||||
};
|
};
|
||||||
|
@ -51,11 +51,10 @@
|
|||||||
#include "graphicsview.h"
|
#include "graphicsview.h"
|
||||||
#include "mouse.h"
|
#include "mouse.h"
|
||||||
|
|
||||||
#include <QtWidgets>
|
#include <QApplication>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include <math.h>
|
static constexpr int MouseCount = 7;
|
||||||
|
|
||||||
static const int MouseCount = 7;
|
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
@ -56,8 +56,8 @@
|
|||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <qmath.h>
|
#include <qmath.h>
|
||||||
|
|
||||||
const qreal Pi = M_PI;
|
constexpr qreal Pi = M_PI;
|
||||||
const qreal TwoPi = 2 * M_PI;
|
constexpr qreal TwoPi = 2 * M_PI;
|
||||||
|
|
||||||
static qreal normalizeAngle(qreal angle)
|
static qreal normalizeAngle(qreal angle)
|
||||||
{
|
{
|
||||||
@ -69,9 +69,9 @@ static qreal normalizeAngle(qreal angle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
Mouse::Mouse()
|
Mouse::Mouse() : color(QRandomGenerator::global()->bounded(256),
|
||||||
: angle(0), speed(0), mouseEyeDirection(0),
|
QRandomGenerator::global()->bounded(256),
|
||||||
color(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256))
|
QRandomGenerator::global()->bounded(256))
|
||||||
{
|
{
|
||||||
setTransform(QTransform().rotate(QRandomGenerator::global()->bounded(360 * 16)), true);
|
setTransform(QTransform().rotate(QRandomGenerator::global()->bounded(360 * 16)), true);
|
||||||
startTimer(1000 / 33);
|
startTimer(1000 / 33);
|
||||||
|
@ -70,9 +70,9 @@ protected:
|
|||||||
void timerEvent(QTimerEvent *event) override;
|
void timerEvent(QTimerEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
qreal angle;
|
qreal angle = 0;
|
||||||
qreal speed;
|
qreal speed = 0;
|
||||||
qreal mouseEyeDirection;
|
qreal mouseEyeDirection = 0;
|
||||||
QColor color;
|
QColor color;
|
||||||
};
|
};
|
||||||
//! [0]
|
//! [0]
|
||||||
|
@ -65,7 +65,7 @@ class AddressBook : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AddressBook(QWidget *parent = 0);
|
AddressBook(QWidget *parent = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLineEdit *nameLine;
|
QLineEdit *nameLine;
|
||||||
|
@ -66,7 +66,7 @@ class AddressBook : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AddressBook(QWidget *parent = 0);
|
AddressBook(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! [slots]
|
//! [slots]
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -66,7 +66,7 @@ class AddressBook : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AddressBook(QWidget *parent = 0);
|
AddressBook(QWidget *parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void addContact();
|
void addContact();
|
||||||
|
@ -66,7 +66,7 @@ class AddressBook : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AddressBook(QWidget *parent = 0);
|
AddressBook(QWidget *parent = nullptr);
|
||||||
//! [Mode enum]
|
//! [Mode enum]
|
||||||
enum Mode { NavigationMode, AddingMode, EditingMode };
|
enum Mode { NavigationMode, AddingMode, EditingMode };
|
||||||
//! [Mode enum]
|
//! [Mode enum]
|
||||||
|
@ -69,7 +69,7 @@ class AddressBook : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AddressBook(QWidget *parent = 0);
|
AddressBook(QWidget *parent = nullptr);
|
||||||
enum Mode { NavigationMode, AddingMode, EditingMode };
|
enum Mode { NavigationMode, AddingMode, EditingMode };
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -63,7 +63,7 @@ class FindDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FindDialog(QWidget *parent = 0);
|
FindDialog(QWidget *parent = nullptr);
|
||||||
QString getFindText();
|
QString getFindText();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -68,7 +68,7 @@ class AddressBook : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AddressBook(QWidget *parent = 0);
|
AddressBook(QWidget *parent = nullptr);
|
||||||
enum Mode { NavigationMode, AddingMode, EditingMode };
|
enum Mode { NavigationMode, AddingMode, EditingMode };
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -63,7 +63,7 @@ class FindDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FindDialog(QWidget *parent = 0);
|
FindDialog(QWidget *parent = nullptr);
|
||||||
QString getFindText();
|
QString getFindText();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -68,7 +68,7 @@ class AddressBook : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AddressBook(QWidget *parent = 0);
|
AddressBook(QWidget *parent = nullptr);
|
||||||
enum Mode { NavigationMode, AddingMode, EditingMode };
|
enum Mode { NavigationMode, AddingMode, EditingMode };
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -63,7 +63,7 @@ class FindDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FindDialog(QWidget *parent = 0);
|
FindDialog(QWidget *parent = nullptr);
|
||||||
QString getFindText();
|
QString getFindText();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -56,7 +56,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
QTableView tableView;
|
QTableView tableView;
|
||||||
MyModel myModel(0);
|
MyModel myModel;
|
||||||
tableView.setModel(&myModel);
|
tableView.setModel(&myModel);
|
||||||
tableView.show();
|
tableView.show();
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
@ -69,7 +69,7 @@ private:
|
|||||||
private slots:
|
private slots:
|
||||||
void selectionChangedSlot(const QItemSelection &newSelection, const QItemSelection &oldSelection);
|
void selectionChangedSlot(const QItemSelection &newSelection, const QItemSelection &oldSelection);
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = 0);
|
MainWindow(QWidget *parent = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
@ -72,7 +72,7 @@ class Notepad : public QMainWindow
|
|||||||
|
|
||||||
//! [4]
|
//! [4]
|
||||||
public:
|
public:
|
||||||
explicit Notepad(QWidget *parent = 0);
|
explicit Notepad(QWidget *parent = nullptr);
|
||||||
//! [4]
|
//! [4]
|
||||||
//! [5]
|
//! [5]
|
||||||
~Notepad();
|
~Notepad();
|
||||||
|
@ -50,16 +50,14 @@
|
|||||||
|
|
||||||
#include "openglwindow.h"
|
#include "openglwindow.h"
|
||||||
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QMouseEvent>
|
|
||||||
#include <QKeyEvent>
|
|
||||||
#include <QFocusEvent>
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QWidget>
|
#include <QFocusEvent>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
#include <QKeyEvent>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
|
||||||
// Making use of the class from the opengl example in gui.
|
// Making use of the class from the opengl example in gui.
|
||||||
@ -67,13 +65,10 @@ class Window : public OpenGLWindow
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Window()
|
using OpenGLWindow::OpenGLWindow;
|
||||||
: m_mouseDown(false)
|
|
||||||
, m_focus(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void render(QPainter *p) override {
|
void render(QPainter *p) override
|
||||||
|
{
|
||||||
QLinearGradient g(0, 0, 0, height());
|
QLinearGradient g(0, 0, 0, height());
|
||||||
g.setColorAt(0, QColor("lightsteelblue"));
|
g.setColorAt(0, QColor("lightsteelblue"));
|
||||||
g.setColorAt(1, Qt::black);
|
g.setColorAt(1, Qt::black);
|
||||||
@ -93,15 +88,15 @@ public:
|
|||||||
p->restore();
|
p->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_focus) {
|
if (m_focus)
|
||||||
p->drawText(20, height() - 20, QLatin1String("Window has focus!"));
|
p->drawText(20, height() - 20, QLatin1String("Window has focus!"));
|
||||||
}
|
|
||||||
|
|
||||||
p->setRenderHint(QPainter::Antialiasing);
|
p->setRenderHint(QPainter::Antialiasing);
|
||||||
p->drawPolyline(m_polygon);
|
p->drawPolyline(m_polygon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mousePressEvent(QMouseEvent *e) override {
|
void mousePressEvent(QMouseEvent *e) override
|
||||||
|
{
|
||||||
if (!m_mouseDown) {
|
if (!m_mouseDown) {
|
||||||
m_mouseDown = true;
|
m_mouseDown = true;
|
||||||
m_polygon.clear();
|
m_polygon.clear();
|
||||||
@ -110,14 +105,16 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mouseMoveEvent(QMouseEvent *e) override {
|
void mouseMoveEvent(QMouseEvent *e) override
|
||||||
|
{
|
||||||
if (m_mouseDown) {
|
if (m_mouseDown) {
|
||||||
m_polygon.append(e->pos());
|
m_polygon.append(e->pos());
|
||||||
renderLater();
|
renderLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mouseReleaseEvent(QMouseEvent *e) override {
|
void mouseReleaseEvent(QMouseEvent *e) override
|
||||||
|
{
|
||||||
if (m_mouseDown) {
|
if (m_mouseDown) {
|
||||||
m_mouseDown = false;
|
m_mouseDown = false;
|
||||||
m_polygon.append(e->pos());
|
m_polygon.append(e->pos());
|
||||||
@ -125,33 +122,35 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void focusInEvent(QFocusEvent *) override {
|
void focusInEvent(QFocusEvent *) override
|
||||||
|
{
|
||||||
m_focus = true;
|
m_focus = true;
|
||||||
renderLater();
|
renderLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void focusOutEvent(QFocusEvent *) override {
|
void focusOutEvent(QFocusEvent *) override
|
||||||
|
{
|
||||||
m_focus = false;
|
m_focus = false;
|
||||||
m_polygon.clear();
|
m_polygon.clear();
|
||||||
renderLater();
|
renderLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void keyPressEvent(QKeyEvent *e) override {
|
void keyPressEvent(QKeyEvent *e) override
|
||||||
|
{
|
||||||
m_key = e->text();
|
m_key = e->text();
|
||||||
renderLater();
|
renderLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void keyReleaseEvent(QKeyEvent *) override {
|
void keyReleaseEvent(QKeyEvent *) override
|
||||||
|
{
|
||||||
m_key = QString();
|
m_key = QString();
|
||||||
renderLater();
|
renderLater();
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
QPolygon m_polygon;
|
QPolygon m_polygon;
|
||||||
bool m_mouseDown;
|
|
||||||
|
|
||||||
bool m_focus;
|
|
||||||
|
|
||||||
QString m_key;
|
QString m_key;
|
||||||
|
bool m_mouseDown = false;
|
||||||
|
bool m_focus = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -162,7 +161,7 @@ int main(int argc, char *argv[])
|
|||||||
QWidget *widget = new QWidget;
|
QWidget *widget = new QWidget;
|
||||||
QHBoxLayout *layout = new QHBoxLayout(widget);
|
QHBoxLayout *layout = new QHBoxLayout(widget);
|
||||||
|
|
||||||
Window *window = new Window();
|
Window *window = new Window;
|
||||||
|
|
||||||
QWidget *container = QWidget::createWindowContainer(window);
|
QWidget *container = QWidget::createWindowContainer(window);
|
||||||
container->setMinimumSize(300, 300);
|
container->setMinimumSize(300, 300);
|
||||||
|
@ -758,9 +758,7 @@ defineTest(qtConfLibrary_pkgConfig) {
|
|||||||
!qtConfResolveLibs($${1}.libs, $$libs): \
|
!qtConfResolveLibs($${1}.libs, $$libs): \
|
||||||
return(false)
|
return(false)
|
||||||
contains($${1}.libs, ".*\\.$${QMAKE_EXTENSION_STATICLIB}$") {
|
contains($${1}.libs, ".*\\.$${QMAKE_EXTENSION_STATICLIB}$") {
|
||||||
qtRunLoggedCommand("$$pkg_config --static --libs-only-L $$args", libpaths)|return(false)
|
qtRunLoggedCommand("$$pkg_config --static --libs $$args", libs)|return(false)
|
||||||
qtRunLoggedCommand("$$pkg_config --static --libs-only-l $$args", libs)|return(false)
|
|
||||||
eval(libs = $$libpaths $$libs)
|
|
||||||
!qtConfResolveLibs($${1}.libs, $$libs): \
|
!qtConfResolveLibs($${1}.libs, $$libs): \
|
||||||
return(false)
|
return(false)
|
||||||
}
|
}
|
||||||
|
@ -159,8 +159,12 @@ defineTest(qtAddToolEnv) {
|
|||||||
!isEmpty(cmd): cmd = "$$cmd "
|
!isEmpty(cmd): cmd = "$$cmd "
|
||||||
equals(ds, /) {
|
equals(ds, /) {
|
||||||
batch_name = $${batch_name}.sh
|
batch_name = $${batch_name}.sh
|
||||||
|
equals(QMAKE_HOST.os, Darwin):exists(/bin/bash): \
|
||||||
|
shell = /bin/bash
|
||||||
|
else: \
|
||||||
|
shell = /bin/sh
|
||||||
batch_cont = \
|
batch_cont = \
|
||||||
"$$LITERAL_HASH!/bin/sh" \
|
"$$LITERAL_HASH!$$shell" \
|
||||||
$$batch_sets \
|
$$batch_sets \
|
||||||
"exec $$cmd\"$@\""
|
"exec $$cmd\"$@\""
|
||||||
# It would be nicer to use the '.' command (without 'exec' above),
|
# It would be nicer to use the '.' command (without 'exec' above),
|
||||||
|
@ -16,7 +16,7 @@ PROVIDER_NAME = qt$$lower($$MODULE)
|
|||||||
INCLUDEPATH += $$absolute_path($$TRACEGEN_DIR, $$OUT_PWD)
|
INCLUDEPATH += $$absolute_path($$TRACEGEN_DIR, $$OUT_PWD)
|
||||||
HEADER_PATH = $$OUT_PWD/$$TRACEGEN_DIR/$${PROVIDER_NAME}_tracepoints_p$${first(QMAKE_EXT_H)}
|
HEADER_PATH = $$OUT_PWD/$$TRACEGEN_DIR/$${PROVIDER_NAME}_tracepoints_p$${first(QMAKE_EXT_H)}
|
||||||
|
|
||||||
!force_bootstrap:if(qtConfig(lttng)|qtConfig(etw)) {
|
if(qtConfig(lttng)|qtConfig(etw)) {
|
||||||
SOURCE_PATH = $$OUT_PWD/$$TRACEGEN_DIR/$${PROVIDER_NAME}_tracepoints$${first(QMAKE_EXT_CPP)}
|
SOURCE_PATH = $$OUT_PWD/$$TRACEGEN_DIR/$${PROVIDER_NAME}_tracepoints$${first(QMAKE_EXT_CPP)}
|
||||||
|
|
||||||
isEmpty(BUILDS)|build_pass {
|
isEmpty(BUILDS)|build_pass {
|
||||||
|
@ -27,8 +27,8 @@ distclean: clean_all
|
|||||||
$(EXPORT_SUBTARGETS): % : %-build
|
$(EXPORT_SUBTARGETS): % : %-build
|
||||||
|
|
||||||
# Generic targets
|
# Generic targets
|
||||||
%_first: $(firstword $(call targets, %)) ;
|
%_first: $(EXPORT_PRE_TARGETDEPS) $(firstword $(call targets, %)) ;
|
||||||
%_all: $(call targets, %) ;
|
%_all: $(EXPORT_PRE_TARGETDEPS) $(call targets, %) ;
|
||||||
|
|
||||||
# Actions
|
# Actions
|
||||||
%-build: ACTION = build
|
%-build: ACTION = build
|
||||||
|
@ -29,6 +29,8 @@ cmd = "$$QMAKE_QMAKE $$system_quote($$_PRO_FILE_) -spec macx-xcode $$args"
|
|||||||
debug(1, "Generating Xcode project in $$OUT_PWD using '$$cmd'")
|
debug(1, "Generating Xcode project in $$OUT_PWD using '$$cmd'")
|
||||||
system("$$QMAKE_CD $$system_quote($$OUT_PWD) && $$cmd")
|
system("$$QMAKE_CD $$system_quote($$OUT_PWD) && $$cmd")
|
||||||
|
|
||||||
|
QMAKE_EXTRA_VARIABLES += PRE_TARGETDEPS
|
||||||
|
|
||||||
# Subtargets
|
# Subtargets
|
||||||
|
|
||||||
for(build, BUILDS): \
|
for(build, BUILDS): \
|
||||||
|
@ -568,6 +568,23 @@ static QString getRelocatablePrefix()
|
|||||||
#error "The chosen platform / config does not support querying for a dynamic prefix."
|
#error "The chosen platform / config does not support querying for a dynamic prefix."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(Q_OS_LINUX) && !defined(QT_STATIC) && defined(__GLIBC__)
|
||||||
|
// QTBUG-78948: libQt5Core.so may be located in subdirectories below libdir.
|
||||||
|
// See "Hardware capabilities" in the ld.so documentation and the Qt 5.3.0
|
||||||
|
// changelog regarding SSE2 support.
|
||||||
|
const QString libdir = QString::fromLatin1(
|
||||||
|
qt_configure_strs + qt_configure_str_offsets[QLibraryInfo::LibrariesPath - 1]);
|
||||||
|
QDir prefixDir(prefixPath);
|
||||||
|
while (!prefixDir.exists(libdir)) {
|
||||||
|
prefixDir.cdUp();
|
||||||
|
prefixPath = prefixDir.absolutePath();
|
||||||
|
if (prefixDir.isRoot()) {
|
||||||
|
prefixPath.clear();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Q_ASSERT_X(!prefixPath.isEmpty(), "getRelocatablePrefix",
|
Q_ASSERT_X(!prefixPath.isEmpty(), "getRelocatablePrefix",
|
||||||
"Failed to find the Qt prefix path.");
|
"Failed to find the Qt prefix path.");
|
||||||
return prefixPath;
|
return prefixPath;
|
||||||
|
@ -232,7 +232,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
\row \li DocumentsLocation
|
\row \li DocumentsLocation
|
||||||
\li "~/Documents"
|
\li "~/Documents"
|
||||||
\row \li FontsLocation
|
\row \li FontsLocation
|
||||||
\li "~/.fonts"
|
\li "~/.fonts", "~/.local/share/fonts", "/usr/local/share/fonts", "/usr/share/fonts"
|
||||||
\row \li ApplicationsLocation
|
\row \li ApplicationsLocation
|
||||||
\li "~/.local/share/applications", "/usr/local/share/applications", "/usr/share/applications"
|
\li "~/.local/share/applications", "/usr/local/share/applications", "/usr/share/applications"
|
||||||
\row \li MusicLocation
|
\row \li MusicLocation
|
||||||
|
@ -339,6 +339,9 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
|
|||||||
break;
|
break;
|
||||||
case FontsLocation:
|
case FontsLocation:
|
||||||
dirs += QDir::homePath() + QLatin1String("/.fonts");
|
dirs += QDir::homePath() + QLatin1String("/.fonts");
|
||||||
|
dirs += xdgDataDirs();
|
||||||
|
for (int i = 1; i < dirs.count(); ++i)
|
||||||
|
dirs[i].append(QLatin1String("/fonts"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -3861,6 +3861,9 @@ int QDateTime::offsetFromUtc() const
|
|||||||
|
|
||||||
QString QDateTime::timeZoneAbbreviation() const
|
QString QDateTime::timeZoneAbbreviation() const
|
||||||
{
|
{
|
||||||
|
if (!isValid())
|
||||||
|
return QString();
|
||||||
|
|
||||||
switch (getSpec(d)) {
|
switch (getSpec(d)) {
|
||||||
case Qt::UTC:
|
case Qt::UTC:
|
||||||
return QLatin1String("UTC");
|
return QLatin1String("UTC");
|
||||||
@ -3895,6 +3898,9 @@ QString QDateTime::timeZoneAbbreviation() const
|
|||||||
|
|
||||||
bool QDateTime::isDaylightTime() const
|
bool QDateTime::isDaylightTime() const
|
||||||
{
|
{
|
||||||
|
if (!isValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
switch (getSpec(d)) {
|
switch (getSpec(d)) {
|
||||||
case Qt::UTC:
|
case Qt::UTC:
|
||||||
case Qt::OffsetFromUTC:
|
case Qt::OffsetFromUTC:
|
||||||
@ -4761,17 +4767,24 @@ QDateTime QDateTime::toTimeZone(const QTimeZone &timeZone) const
|
|||||||
Returns \c true if this datetime is equal to the \a other datetime;
|
Returns \c true if this datetime is equal to the \a other datetime;
|
||||||
otherwise returns \c false.
|
otherwise returns \c false.
|
||||||
|
|
||||||
|
Since 5.14, all invalid datetimes are equal to one another and differ from
|
||||||
|
all other datetimes.
|
||||||
|
|
||||||
\sa operator!=()
|
\sa operator!=()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool QDateTime::operator==(const QDateTime &other) const
|
bool QDateTime::operator==(const QDateTime &other) const
|
||||||
{
|
{
|
||||||
if (getSpec(d) == Qt::LocalTime
|
if (!isValid())
|
||||||
&& getStatus(d) == getStatus(other.d)) {
|
return !other.isValid();
|
||||||
|
if (!other.isValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (getSpec(d) == Qt::LocalTime && getStatus(d) == getStatus(other.d))
|
||||||
return getMSecs(d) == getMSecs(other.d);
|
return getMSecs(d) == getMSecs(other.d);
|
||||||
}
|
|
||||||
// Convert to UTC and compare
|
// Convert to UTC and compare
|
||||||
return (toMSecsSinceEpoch() == other.toMSecsSinceEpoch());
|
return toMSecsSinceEpoch() == other.toMSecsSinceEpoch();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -4780,8 +4793,9 @@ bool QDateTime::operator==(const QDateTime &other) const
|
|||||||
Returns \c true if this datetime is different from the \a other
|
Returns \c true if this datetime is different from the \a other
|
||||||
datetime; otherwise returns \c false.
|
datetime; otherwise returns \c false.
|
||||||
|
|
||||||
Two datetimes are different if either the date, the time, or the
|
Two datetimes are different if either the date, the time, or the time zone
|
||||||
time zone components are different.
|
components are different. Since 5.14, any invalid datetime is less than all
|
||||||
|
valid datetimes.
|
||||||
|
|
||||||
\sa operator==()
|
\sa operator==()
|
||||||
*/
|
*/
|
||||||
@ -4793,12 +4807,16 @@ bool QDateTime::operator==(const QDateTime &other) const
|
|||||||
|
|
||||||
bool QDateTime::operator<(const QDateTime &other) const
|
bool QDateTime::operator<(const QDateTime &other) const
|
||||||
{
|
{
|
||||||
if (getSpec(d) == Qt::LocalTime
|
if (!isValid())
|
||||||
&& getStatus(d) == getStatus(other.d)) {
|
return other.isValid();
|
||||||
|
if (!other.isValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (getSpec(d) == Qt::LocalTime && getStatus(d) == getStatus(other.d))
|
||||||
return getMSecs(d) < getMSecs(other.d);
|
return getMSecs(d) < getMSecs(other.d);
|
||||||
}
|
|
||||||
// Convert to UTC and compare
|
// Convert to UTC and compare
|
||||||
return (toMSecsSinceEpoch() < other.toMSecsSinceEpoch());
|
return toMSecsSinceEpoch() < other.toMSecsSinceEpoch();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -5849,7 +5867,7 @@ uint qHash(const QDateTime &key, uint seed)
|
|||||||
// QDate/QTime/spec/offset because QDateTime::operator== converts both arguments
|
// QDate/QTime/spec/offset because QDateTime::operator== converts both arguments
|
||||||
// to the same timezone. If we don't, qHash would return different hashes for
|
// to the same timezone. If we don't, qHash would return different hashes for
|
||||||
// two QDateTimes that are equivalent once converted to the same timezone.
|
// two QDateTimes that are equivalent once converted to the same timezone.
|
||||||
return qHash(key.toMSecsSinceEpoch(), seed);
|
return key.isValid() ? qHash(key.toMSecsSinceEpoch(), seed) : seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \fn uint qHash(const QDate &key, uint seed = 0)
|
/*! \fn uint qHash(const QDate &key, uint seed = 0)
|
||||||
|
@ -583,6 +583,13 @@ struct BezierEase : public QEasingCurveFunction
|
|||||||
qWarning("QEasingCurve: Invalid bezier curve");
|
qWarning("QEasingCurve: Invalid bezier curve");
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The bezier computation is not always precise on the endpoints, so handle explicitly
|
||||||
|
if (!(x > 0))
|
||||||
|
return 0;
|
||||||
|
if (!(x < 1))
|
||||||
|
return 1;
|
||||||
|
|
||||||
SingleCubicBezier *singleCubicBezier = 0;
|
SingleCubicBezier *singleCubicBezier = 0;
|
||||||
getBezierSegment(singleCubicBezier, x);
|
getBezierSegment(singleCubicBezier, x);
|
||||||
|
|
||||||
@ -998,6 +1005,11 @@ struct BackEase : public QEasingCurveFunction
|
|||||||
|
|
||||||
qreal value(qreal t) override
|
qreal value(qreal t) override
|
||||||
{
|
{
|
||||||
|
// The *Back() functions are not always precise on the endpoints, so handle explicitly
|
||||||
|
if (!(t > 0))
|
||||||
|
return 0;
|
||||||
|
if (!(t < 1))
|
||||||
|
return 1;
|
||||||
qreal o = (_o < 0) ? qreal(1.70158) : _o;
|
qreal o = (_o < 0) ? qreal(1.70158) : _o;
|
||||||
switch(_t) {
|
switch(_t) {
|
||||||
case QEasingCurve::InBack:
|
case QEasingCurve::InBack:
|
||||||
|
@ -871,8 +871,12 @@ bool QDBusConnection::disconnect(const QString &service, const QString &path, co
|
|||||||
This function does not replace existing objects: if there is already an object registered at
|
This function does not replace existing objects: if there is already an object registered at
|
||||||
path \a path, this function will return false. Use unregisterObject() to unregister it first.
|
path \a path, this function will return false. Use unregisterObject() to unregister it first.
|
||||||
|
|
||||||
|
The ExportChildObjects flag exports child objects on D-Bus based on the
|
||||||
|
path of the registered objects and the QObject::objectName of the child.
|
||||||
|
Therefore, it is important for the child object to have an object name.
|
||||||
|
|
||||||
You cannot register an object as a child object of an object that
|
You cannot register an object as a child object of an object that
|
||||||
was registered with QDBusConnection::ExportChildObjects.
|
was registered with ExportChildObjects.
|
||||||
*/
|
*/
|
||||||
bool QDBusConnection::registerObject(const QString &path, QObject *object, RegisterOptions options)
|
bool QDBusConnection::registerObject(const QString &path, QObject *object, RegisterOptions options)
|
||||||
{
|
{
|
||||||
@ -891,8 +895,12 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis
|
|||||||
This function does not replace existing objects: if there is already an object registered at
|
This function does not replace existing objects: if there is already an object registered at
|
||||||
path \a path, this function will return false. Use unregisterObject() to unregister it first.
|
path \a path, this function will return false. Use unregisterObject() to unregister it first.
|
||||||
|
|
||||||
|
The ExportChildObjects flag exports child objects on D-Bus based on the
|
||||||
|
path of the registered objects and the QObject::objectName of the child.
|
||||||
|
Therefore, it is important for the child object to have an object name.
|
||||||
|
|
||||||
You cannot register an object as a child object of an object that
|
You cannot register an object as a child object of an object that
|
||||||
was registered with QDBusConnection::ExportChildObjects.
|
was registered with ExportChildObjects.
|
||||||
*/
|
*/
|
||||||
bool QDBusConnection::registerObject(const QString &path, const QString &interface, QObject *object, RegisterOptions options)
|
bool QDBusConnection::registerObject(const QString &path, const QString &interface, QObject *object, RegisterOptions options)
|
||||||
{
|
{
|
||||||
|
@ -414,7 +414,7 @@ QFrameInfo QMoviePrivate::infoForFrame(int frameNumber)
|
|||||||
} else {
|
} else {
|
||||||
// We've read all frames now. Return an end marker
|
// We've read all frames now. Return an end marker
|
||||||
haveReadAll = true;
|
haveReadAll = true;
|
||||||
return QFrameInfo::endMarker();
|
return frameNumber == greatestFrameNumber + 1 ? QFrameInfo::endMarker() : QFrameInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ public:
|
|||||||
void setGamma(float);
|
void setGamma(float);
|
||||||
|
|
||||||
bool writeImage(const QImage& img, int x, int y);
|
bool writeImage(const QImage& img, int x, int y);
|
||||||
bool writeImage(const QImage& img, volatile int compression_in, const QString &description, int x, int y);
|
bool writeImage(const QImage& img, int compression_in, const QString &description, int x, int y);
|
||||||
bool writeImage(const QImage& img)
|
bool writeImage(const QImage& img)
|
||||||
{ return writeImage(img, 0, 0); }
|
{ return writeImage(img, 0, 0); }
|
||||||
bool writeImage(const QImage& img, int compression, const QString &description)
|
bool writeImage(const QImage& img, int compression, const QString &description)
|
||||||
@ -900,7 +900,7 @@ bool QPNGImageWriter::writeImage(const QImage& image, int off_x, int off_y)
|
|||||||
return writeImage(image, -1, QString(), off_x, off_y);
|
return writeImage(image, -1, QString(), off_x, off_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QPNGImageWriter::writeImage(const QImage& image, volatile int compression_in, const QString &description,
|
bool QPNGImageWriter::writeImage(const QImage& image, int compression_in, const QString &description,
|
||||||
int off_x_in, int off_y_in)
|
int off_x_in, int off_y_in)
|
||||||
{
|
{
|
||||||
QPoint offset = image.offset();
|
QPoint offset = image.offset();
|
||||||
|
@ -617,6 +617,7 @@ bool QWindowSystemInterface::isTouchDeviceRegistered(const QTouchDevice *device)
|
|||||||
static int g_nextPointId = 1;
|
static int g_nextPointId = 1;
|
||||||
|
|
||||||
// map from device-independent point id (arbitrary) to "Qt point" ids
|
// map from device-independent point id (arbitrary) to "Qt point" ids
|
||||||
|
QMutex QWindowSystemInterfacePrivate::pointIdMapMutex;
|
||||||
typedef QMap<quint64, int> PointIdMap;
|
typedef QMap<quint64, int> PointIdMap;
|
||||||
Q_GLOBAL_STATIC(PointIdMap, g_pointIdMap)
|
Q_GLOBAL_STATIC(PointIdMap, g_pointIdMap)
|
||||||
|
|
||||||
@ -634,6 +635,8 @@ Q_GLOBAL_STATIC(PointIdMap, g_pointIdMap)
|
|||||||
*/
|
*/
|
||||||
static int acquireCombinedPointId(quint8 deviceId, int pointId)
|
static int acquireCombinedPointId(quint8 deviceId, int pointId)
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex);
|
||||||
|
|
||||||
quint64 combinedId64 = (quint64(deviceId) << 32) + pointId;
|
quint64 combinedId64 = (quint64(deviceId) << 32) + pointId;
|
||||||
auto it = g_pointIdMap->constFind(combinedId64);
|
auto it = g_pointIdMap->constFind(combinedId64);
|
||||||
int uid;
|
int uid;
|
||||||
@ -693,6 +696,8 @@ QList<QTouchEvent::TouchPoint>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (states == Qt::TouchPointReleased) {
|
if (states == Qt::TouchPointReleased) {
|
||||||
|
QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex);
|
||||||
|
|
||||||
// All points on deviceId have been released.
|
// All points on deviceId have been released.
|
||||||
// Remove all points associated with that device from g_pointIdMap.
|
// Remove all points associated with that device from g_pointIdMap.
|
||||||
// (On other devices, some touchpoints might still be pressed.
|
// (On other devices, some touchpoints might still be pressed.
|
||||||
@ -712,6 +717,7 @@ QList<QTouchEvent::TouchPoint>
|
|||||||
|
|
||||||
void QWindowSystemInterfacePrivate::clearPointIdMap()
|
void QWindowSystemInterfacePrivate::clearPointIdMap()
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex);
|
||||||
g_pointIdMap->clear();
|
g_pointIdMap->clear();
|
||||||
g_nextPointId = 1;
|
g_nextPointId = 1;
|
||||||
}
|
}
|
||||||
|
@ -528,6 +528,7 @@ public:
|
|||||||
|
|
||||||
static QWaitCondition eventsFlushed;
|
static QWaitCondition eventsFlushed;
|
||||||
static QMutex flushEventMutex;
|
static QMutex flushEventMutex;
|
||||||
|
static QMutex pointIdMapMutex;
|
||||||
static QAtomicInt eventAccepted;
|
static QAtomicInt eventAccepted;
|
||||||
|
|
||||||
static QList<QTouchEvent::TouchPoint>
|
static QList<QTouchEvent::TouchPoint>
|
||||||
|
@ -660,7 +660,7 @@ QTextBlock QAbstractTextDocumentLayout::blockWithMarkerAt(const QPointF &pos) co
|
|||||||
{
|
{
|
||||||
QTextBlock block = document()->firstBlock();
|
QTextBlock block = document()->firstBlock();
|
||||||
while (block.isValid()) {
|
while (block.isValid()) {
|
||||||
if (block.blockFormat().marker() != QTextBlockFormat::NoMarker) {
|
if (block.blockFormat().marker() != QTextBlockFormat::MarkerType::NoMarker) {
|
||||||
QRectF blockBr = blockBoundingRect(block);
|
QRectF blockBr = blockBoundingRect(block);
|
||||||
QTextBlockFormat blockFmt = block.blockFormat();
|
QTextBlockFormat blockFmt = block.blockFormat();
|
||||||
QFontMetrics fm(block.charFormat().font());
|
QFontMetrics fm(block.charFormat().font());
|
||||||
|
@ -2194,11 +2194,11 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
|
|||||||
|
|
||||||
QBrush brush = context.palette.brush(QPalette::Text);
|
QBrush brush = context.palette.brush(QPalette::Text);
|
||||||
|
|
||||||
bool marker = bl.blockFormat().marker() != QTextBlockFormat::NoMarker;
|
bool marker = bl.blockFormat().marker() != QTextBlockFormat::MarkerType::NoMarker;
|
||||||
if (marker) {
|
if (marker) {
|
||||||
int adj = fontMetrics.lineSpacing() / 6;
|
int adj = fontMetrics.lineSpacing() / 6;
|
||||||
r.adjust(-adj, 0, -adj, 0);
|
r.adjust(-adj, 0, -adj, 0);
|
||||||
if (bl.blockFormat().marker() == QTextBlockFormat::Checked) {
|
if (bl.blockFormat().marker() == QTextBlockFormat::MarkerType::Checked) {
|
||||||
// ### Qt6: render with QStyle / PE_IndicatorCheckBox. We don't currently
|
// ### Qt6: render with QStyle / PE_IndicatorCheckBox. We don't currently
|
||||||
// have access to that here, because it would be a widget dependency.
|
// have access to that here, because it would be a widget dependency.
|
||||||
painter->setPen(QPen(painter->pen().color(), 2));
|
painter->setPen(QPen(painter->pen().color(), 2));
|
||||||
|
@ -627,7 +627,7 @@ public:
|
|||||||
LineDistanceHeight = 4
|
LineDistanceHeight = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MarkerType {
|
enum class MarkerType {
|
||||||
NoMarker = 0,
|
NoMarker = 0,
|
||||||
Unchecked = 1,
|
Unchecked = 1,
|
||||||
Checked = 2
|
Checked = 2
|
||||||
|
@ -190,8 +190,8 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
|
|||||||
m_listItem = true;
|
m_listItem = true;
|
||||||
MD_BLOCK_LI_DETAIL *detail = static_cast<MD_BLOCK_LI_DETAIL *>(det);
|
MD_BLOCK_LI_DETAIL *detail = static_cast<MD_BLOCK_LI_DETAIL *>(det);
|
||||||
m_markerType = detail->is_task ?
|
m_markerType = detail->is_task ?
|
||||||
(detail->task_mark == ' ' ? QTextBlockFormat::Unchecked : QTextBlockFormat::Checked) :
|
(detail->task_mark == ' ' ? QTextBlockFormat::MarkerType::Unchecked : QTextBlockFormat::MarkerType::Checked) :
|
||||||
QTextBlockFormat::NoMarker;
|
QTextBlockFormat::MarkerType::NoMarker;
|
||||||
qCDebug(lcMD) << "LI";
|
qCDebug(lcMD) << "LI";
|
||||||
} break;
|
} break;
|
||||||
case MD_BLOCK_UL: {
|
case MD_BLOCK_UL: {
|
||||||
@ -549,7 +549,7 @@ void QTextMarkdownImporter::insertBlock()
|
|||||||
blockFormat.setTopMargin(m_paragraphMargin);
|
blockFormat.setTopMargin(m_paragraphMargin);
|
||||||
blockFormat.setBottomMargin(m_paragraphMargin);
|
blockFormat.setBottomMargin(m_paragraphMargin);
|
||||||
}
|
}
|
||||||
if (m_markerType == QTextBlockFormat::NoMarker)
|
if (m_markerType == QTextBlockFormat::MarkerType::NoMarker)
|
||||||
blockFormat.clearProperty(QTextFormat::BlockMarker);
|
blockFormat.clearProperty(QTextFormat::BlockMarker);
|
||||||
else
|
else
|
||||||
blockFormat.setMarker(m_markerType);
|
blockFormat.setMarker(m_markerType);
|
||||||
|
@ -128,7 +128,7 @@ private:
|
|||||||
Features m_features;
|
Features m_features;
|
||||||
QTextImageFormat m_imageFormat;
|
QTextImageFormat m_imageFormat;
|
||||||
QTextListFormat m_listFormat;
|
QTextListFormat m_listFormat;
|
||||||
QTextBlockFormat::MarkerType m_markerType = QTextBlockFormat::NoMarker;
|
QTextBlockFormat::MarkerType m_markerType = QTextBlockFormat::MarkerType::NoMarker;
|
||||||
bool m_needsInsertBlock = false;
|
bool m_needsInsertBlock = false;
|
||||||
bool m_needsInsertList = false;
|
bool m_needsInsertList = false;
|
||||||
bool m_listItem = false; // true from the beginning of LI to the end of the first P
|
bool m_listItem = false; // true from the beginning of LI to the end of the first P
|
||||||
|
@ -327,10 +327,10 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (blockFmt.marker()) {
|
switch (blockFmt.marker()) {
|
||||||
case QTextBlockFormat::Checked:
|
case QTextBlockFormat::MarkerType::Checked:
|
||||||
bullet += " [x]";
|
bullet += " [x]";
|
||||||
break;
|
break;
|
||||||
case QTextBlockFormat::Unchecked:
|
case QTextBlockFormat::MarkerType::Unchecked:
|
||||||
bullet += " [ ]";
|
bullet += " [ ]";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -358,7 +358,7 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc
|
|||||||
int precedingSpaces = 0;
|
int precedingSpaces = 0;
|
||||||
int exportedIndex = 0;
|
int exportedIndex = 0;
|
||||||
for (int i=0; i <= fragmentText.count(); ++i) {
|
for (int i=0; i <= fragmentText.count(); ++i) {
|
||||||
QChar character = fragmentText[i];
|
QChar character = (i == fragmentText.count() ? QChar() : fragmentText.at(i));
|
||||||
bool isSpace = character.unicode() == ' ';
|
bool isSpace = character.unicode() == ' ';
|
||||||
|
|
||||||
// find more than one space. -> <text:s text:c="2" />
|
// find more than one space. -> <text:s text:c="2" />
|
||||||
|
@ -98,8 +98,8 @@ void QEvdevTouchManager::addDevice(const QString &deviceNode)
|
|||||||
qCDebug(qLcEvdevTouch, "evdevtouch: Adding device at %ls", qUtf16Printable(deviceNode));
|
qCDebug(qLcEvdevTouch, "evdevtouch: Adding device at %ls", qUtf16Printable(deviceNode));
|
||||||
auto handler = qt_make_unique<QEvdevTouchScreenHandlerThread>(deviceNode, m_spec);
|
auto handler = qt_make_unique<QEvdevTouchScreenHandlerThread>(deviceNode, m_spec);
|
||||||
if (handler) {
|
if (handler) {
|
||||||
m_activeDevices.add(deviceNode, std::move(handler));
|
|
||||||
connect(handler.get(), &QEvdevTouchScreenHandlerThread::touchDeviceRegistered, this, &QEvdevTouchManager::updateInputDeviceCount);
|
connect(handler.get(), &QEvdevTouchScreenHandlerThread::touchDeviceRegistered, this, &QEvdevTouchManager::updateInputDeviceCount);
|
||||||
|
m_activeDevices.add(deviceNode, std::move(handler));
|
||||||
} else {
|
} else {
|
||||||
qWarning("evdevtouch: Failed to open touch device %ls", qUtf16Printable(deviceNode));
|
qWarning("evdevtouch: Failed to open touch device %ls", qUtf16Printable(deviceNode));
|
||||||
}
|
}
|
||||||
|
@ -171,12 +171,8 @@ QT_USE_NAMESPACE
|
|||||||
// This function will only be called when NSApp is actually running.
|
// This function will only be called when NSApp is actually running.
|
||||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
||||||
{
|
{
|
||||||
// The reflection delegate gets precedence
|
if ([reflectionDelegate respondsToSelector:_cmd])
|
||||||
if (reflectionDelegate) {
|
return [reflectionDelegate applicationShouldTerminate:sender];
|
||||||
if ([reflectionDelegate respondsToSelector:@selector(applicationShouldTerminate:)])
|
|
||||||
return [reflectionDelegate applicationShouldTerminate:sender];
|
|
||||||
return NSTerminateNow;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([self canQuit]) {
|
if ([self canQuit]) {
|
||||||
if (!startedQuit) {
|
if (!startedQuit) {
|
||||||
@ -227,10 +223,6 @@ QT_USE_NAMESPACE
|
|||||||
application depends on.
|
application depends on.
|
||||||
*/
|
*/
|
||||||
NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager];
|
NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager];
|
||||||
[eventManager setEventHandler:self
|
|
||||||
andSelector:@selector(appleEventQuit:withReplyEvent:)
|
|
||||||
forEventClass:kCoreEventClass
|
|
||||||
andEventID:kAEQuitApplication];
|
|
||||||
[eventManager setEventHandler:self
|
[eventManager setEventHandler:self
|
||||||
andSelector:@selector(getUrl:withReplyEvent:)
|
andSelector:@selector(getUrl:withReplyEvent:)
|
||||||
forEventClass:kInternetEventClass
|
forEventClass:kInternetEventClass
|
||||||
@ -241,7 +233,6 @@ QT_USE_NAMESPACE
|
|||||||
- (void)removeAppleEventHandlers
|
- (void)removeAppleEventHandlers
|
||||||
{
|
{
|
||||||
NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager];
|
NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager];
|
||||||
[eventManager removeEventHandlerForEventClass:kCoreEventClass andEventID:kAEQuitApplication];
|
|
||||||
[eventManager removeEventHandlerForEventClass:kInternetEventClass andEventID:kAEGetURL];
|
[eventManager removeEventHandlerForEventClass:kInternetEventClass andEventID:kAEGetURL];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,26 +273,22 @@ QT_USE_NAMESPACE
|
|||||||
QWindowSystemInterface::handleFileOpenEvent(qtFileName);
|
QWindowSystemInterface::handleFileOpenEvent(qtFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reflectionDelegate &&
|
if ([reflectionDelegate respondsToSelector:_cmd])
|
||||||
[reflectionDelegate respondsToSelector:@selector(application:openFiles:)])
|
|
||||||
[reflectionDelegate application:sender openFiles:filenames];
|
[reflectionDelegate application:sender openFiles:filenames];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
|
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
|
||||||
{
|
{
|
||||||
// If we have a reflection delegate, that will get to call the shots.
|
if ([reflectionDelegate respondsToSelector:_cmd])
|
||||||
if (reflectionDelegate
|
|
||||||
&& [reflectionDelegate respondsToSelector:
|
|
||||||
@selector(applicationShouldTerminateAfterLastWindowClosed:)])
|
|
||||||
return [reflectionDelegate applicationShouldTerminateAfterLastWindowClosed:sender];
|
return [reflectionDelegate applicationShouldTerminateAfterLastWindowClosed:sender];
|
||||||
|
|
||||||
return NO; // Someday qApp->quitOnLastWindowClosed(); when QApp and NSApp work closer together.
|
return NO; // Someday qApp->quitOnLastWindowClosed(); when QApp and NSApp work closer together.
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidBecomeActive:(NSNotification *)notification
|
- (void)applicationDidBecomeActive:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
if (reflectionDelegate
|
if ([reflectionDelegate respondsToSelector:_cmd])
|
||||||
&& [reflectionDelegate respondsToSelector:@selector(applicationDidBecomeActive:)])
|
|
||||||
[reflectionDelegate applicationDidBecomeActive:notification];
|
[reflectionDelegate applicationDidBecomeActive:notification];
|
||||||
|
|
||||||
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationActive);
|
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationActive);
|
||||||
@ -309,8 +296,7 @@ QT_USE_NAMESPACE
|
|||||||
|
|
||||||
- (void)applicationDidResignActive:(NSNotification *)notification
|
- (void)applicationDidResignActive:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
if (reflectionDelegate
|
if ([reflectionDelegate respondsToSelector:_cmd])
|
||||||
&& [reflectionDelegate respondsToSelector:@selector(applicationDidResignActive:)])
|
|
||||||
[reflectionDelegate applicationDidResignActive:notification];
|
[reflectionDelegate applicationDidResignActive:notification];
|
||||||
|
|
||||||
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationInactive);
|
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationInactive);
|
||||||
@ -318,10 +304,7 @@ QT_USE_NAMESPACE
|
|||||||
|
|
||||||
- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
|
- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
|
||||||
{
|
{
|
||||||
Q_UNUSED(theApplication);
|
if ([reflectionDelegate respondsToSelector:_cmd])
|
||||||
Q_UNUSED(flag);
|
|
||||||
if (reflectionDelegate
|
|
||||||
&& [reflectionDelegate respondsToSelector:@selector(applicationShouldHandleReopen:hasVisibleWindows:)])
|
|
||||||
return [reflectionDelegate applicationShouldHandleReopen:theApplication hasVisibleWindows:flag];
|
return [reflectionDelegate applicationShouldHandleReopen:theApplication hasVisibleWindows:flag];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -354,16 +337,13 @@ QT_USE_NAMESPACE
|
|||||||
|
|
||||||
- (BOOL)respondsToSelector:(SEL)aSelector
|
- (BOOL)respondsToSelector:(SEL)aSelector
|
||||||
{
|
{
|
||||||
BOOL result = [super respondsToSelector:aSelector];
|
return [super respondsToSelector:aSelector] || [reflectionDelegate respondsToSelector:aSelector];
|
||||||
if (!result && reflectionDelegate)
|
|
||||||
result = [reflectionDelegate respondsToSelector:aSelector];
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)forwardInvocation:(NSInvocation *)invocation
|
- (void)forwardInvocation:(NSInvocation *)invocation
|
||||||
{
|
{
|
||||||
SEL invocationSelector = [invocation selector];
|
SEL invocationSelector = [invocation selector];
|
||||||
if (reflectionDelegate && [reflectionDelegate respondsToSelector:invocationSelector])
|
if ([reflectionDelegate respondsToSelector:invocationSelector])
|
||||||
[invocation invokeWithTarget:reflectionDelegate];
|
[invocation invokeWithTarget:reflectionDelegate];
|
||||||
else
|
else
|
||||||
[self doesNotRecognizeSelector:invocationSelector];
|
[self doesNotRecognizeSelector:invocationSelector];
|
||||||
@ -375,14 +355,6 @@ QT_USE_NAMESPACE
|
|||||||
NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
|
NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
|
||||||
QWindowSystemInterface::handleFileOpenEvent(QUrl(QString::fromNSString(urlString)));
|
QWindowSystemInterface::handleFileOpenEvent(QUrl(QString::fromNSString(urlString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)appleEventQuit:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
Q_UNUSED(replyEvent);
|
|
||||||
[NSApp terminate:self];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation QCocoaApplicationDelegate (Menus)
|
@implementation QCocoaApplicationDelegate (Menus)
|
||||||
|
@ -560,17 +560,26 @@ void QCALayerBackingStore::flush(QWindow *flushedWindow, const QRegion ®ion,
|
|||||||
flushedView.layer.contents = nil;
|
flushedView.layer.contents = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
qCInfo(lcQpaBackingStore) << "Flushing" << backBufferSurface
|
if (flushedView == backingStoreView) {
|
||||||
<< "to" << flushedView.layer << "of" << flushedView;
|
qCInfo(lcQpaBackingStore) << "Flushing" << backBufferSurface
|
||||||
|
<< "to" << flushedView.layer << "of" << flushedView;
|
||||||
|
flushedView.layer.contents = backBufferSurface;
|
||||||
|
} else {
|
||||||
|
auto subviewRect = [flushedView convertRect:flushedView.bounds toView:backingStoreView];
|
||||||
|
auto scale = flushedView.layer.contentsScale;
|
||||||
|
subviewRect = CGRectApplyAffineTransform(subviewRect, CGAffineTransformMakeScale(scale, scale));
|
||||||
|
|
||||||
flushedView.layer.contents = backBufferSurface;
|
// We make a copy of the image data up front, which means we don't
|
||||||
|
// need to mark the IOSurface as being in use. FIXME: Investigate
|
||||||
|
// if there's a cheaper way to get sub-image data to a layer.
|
||||||
|
m_buffers.back()->lock(QPlatformGraphicsBuffer::SWReadAccess);
|
||||||
|
QImage subImage = m_buffers.back()->asImage()->copy(QRectF::fromCGRect(subviewRect).toRect());
|
||||||
|
m_buffers.back()->unlock();
|
||||||
|
|
||||||
if (flushedView != backingStoreView) {
|
qCInfo(lcQpaBackingStore) << "Flushing" << subImage
|
||||||
const CGSize backingStoreSize = backingStoreView.bounds.size;
|
<< "to" << flushedView.layer << "of subview" << flushedView;
|
||||||
flushedView.layer.contentsRect = CGRectApplyAffineTransform(
|
QCFType<CGImageRef> cgImage = subImage.toCGImage();
|
||||||
[flushedView convertRect:flushedView.bounds toView:backingStoreView],
|
flushedView.layer.contents = (__bridge id)static_cast<CGImageRef>(cgImage);
|
||||||
// The contentsRect is in unit coordinate system
|
|
||||||
CGAffineTransformMakeScale(1.0 / backingStoreSize.width, 1.0 / backingStoreSize.height));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since we may receive multiple flushes before a new frame is started, we do not
|
// Since we may receive multiple flushes before a new frame is started, we do not
|
||||||
|
@ -152,6 +152,18 @@
|
|||||||
"features": [
|
"features": [
|
||||||
"disable_program_cache"
|
"disable_program_cache"
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"id": 13,
|
||||||
|
"description": "Disable DesktopGL on Windows with Mobile Intel(R) 4 Series Express Chipset Family graphics card (QTBUG-58772)",
|
||||||
|
"vendor_id": "0x8086",
|
||||||
|
"device_id": [ "0x2A42" ],
|
||||||
|
"os": {
|
||||||
|
"type": "win"
|
||||||
|
},
|
||||||
|
"features": [
|
||||||
|
"disable_desktopgl"
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -115,12 +115,21 @@ static QDebug operator<<(QDebug d, const QMimeData *mimeData)
|
|||||||
|
|
||||||
IDataObject *QWindowsClipboardRetrievalMimeData::retrieveDataObject() const
|
IDataObject *QWindowsClipboardRetrievalMimeData::retrieveDataObject() const
|
||||||
{
|
{
|
||||||
|
enum : int { attempts = 3 };
|
||||||
IDataObject * pDataObj = nullptr;
|
IDataObject * pDataObj = nullptr;
|
||||||
if (OleGetClipboard(&pDataObj) == S_OK) {
|
// QTBUG-53979, retry in case the other application has clipboard locked
|
||||||
if (QWindowsContext::verbose > 1)
|
for (int i = 1; i <= attempts; ++i) {
|
||||||
qCDebug(lcQpaMime) << __FUNCTION__ << pDataObj;
|
if (SUCCEEDED(OleGetClipboard(&pDataObj))) {
|
||||||
return pDataObj;
|
if (QWindowsContext::verbose > 1)
|
||||||
|
qCDebug(lcQpaMime) << __FUNCTION__ << pDataObj;
|
||||||
|
return pDataObj;
|
||||||
|
}
|
||||||
|
qCWarning(lcQpaMime, i == attempts
|
||||||
|
? "Unable to obtain clipboard."
|
||||||
|
: "Retrying to obtain clipboard.");
|
||||||
|
QThread::msleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -773,7 +773,7 @@ void QXcbScreen::updateRefreshRate(xcb_randr_mode_t mode)
|
|||||||
xcb_randr_mode_info_t *modeInfo = modesIter.data;
|
xcb_randr_mode_info_t *modeInfo = modesIter.data;
|
||||||
if (modeInfo->id == mode) {
|
if (modeInfo->id == mode) {
|
||||||
const uint32_t dotCount = modeInfo->htotal * modeInfo->vtotal;
|
const uint32_t dotCount = modeInfo->htotal * modeInfo->vtotal;
|
||||||
m_refreshRate = (dotCount != 0) ? modeInfo->dot_clock / dotCount : 0;
|
m_refreshRate = (dotCount != 0) ? modeInfo->dot_clock / qreal(dotCount) : 0;
|
||||||
m_mode = mode;
|
m_mode = mode;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ private:
|
|||||||
QRect m_availableGeometry;
|
QRect m_availableGeometry;
|
||||||
Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation;
|
Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation;
|
||||||
QXcbCursor *m_cursor;
|
QXcbCursor *m_cursor;
|
||||||
int m_refreshRate = 60;
|
qreal m_refreshRate = 60.0;
|
||||||
QEdidParser m_edid;
|
QEdidParser m_edid;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,16 +65,7 @@
|
|||||||
|
|
||||||
Q_DECLARE_METATYPE(MYSQL_RES*)
|
Q_DECLARE_METATYPE(MYSQL_RES*)
|
||||||
Q_DECLARE_METATYPE(MYSQL*)
|
Q_DECLARE_METATYPE(MYSQL*)
|
||||||
|
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
Q_DECLARE_METATYPE(MYSQL_STMT*)
|
Q_DECLARE_METATYPE(MYSQL_STMT*)
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MYSQL_VERSION_ID >= 40100
|
|
||||||
# define Q_CLIENT_MULTI_STATEMENTS CLIENT_MULTI_STATEMENTS
|
|
||||||
#else
|
|
||||||
# define Q_CLIENT_MULTI_STATEMENTS 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// MySQL above version 8 removed my_bool typedef while MariaDB kept it,
|
// MySQL above version 8 removed my_bool typedef while MariaDB kept it,
|
||||||
// by redefining it we can regain source compatibility.
|
// by redefining it we can regain source compatibility.
|
||||||
@ -199,10 +190,8 @@ protected:
|
|||||||
bool nextResult() override;
|
bool nextResult() override;
|
||||||
void detachFromResultSet() override;
|
void detachFromResultSet() override;
|
||||||
|
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
bool prepare(const QString &stmt) override;
|
bool prepare(const QString &stmt) override;
|
||||||
bool exec() override;
|
bool exec() override;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class QMYSQLResultPrivate: public QSqlResultPrivate
|
class QMYSQLResultPrivate: public QSqlResultPrivate
|
||||||
@ -217,9 +206,7 @@ public:
|
|||||||
result(0),
|
result(0),
|
||||||
rowsAffected(0),
|
rowsAffected(0),
|
||||||
hasBlobs(false)
|
hasBlobs(false)
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
, stmt(0), meta(0), inBinds(0), outBinds(0)
|
, stmt(0), meta(0), inBinds(0), outBinds(0)
|
||||||
#endif
|
|
||||||
, preparedQuery(false)
|
, preparedQuery(false)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@ -247,13 +234,11 @@ public:
|
|||||||
|
|
||||||
QVector<QMyField> fields;
|
QVector<QMyField> fields;
|
||||||
|
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
MYSQL_STMT* stmt;
|
MYSQL_STMT* stmt;
|
||||||
MYSQL_RES* meta;
|
MYSQL_RES* meta;
|
||||||
|
|
||||||
MYSQL_BIND *inBinds;
|
MYSQL_BIND *inBinds;
|
||||||
MYSQL_BIND *outBinds;
|
MYSQL_BIND *outBinds;
|
||||||
#endif
|
|
||||||
|
|
||||||
bool preparedQuery;
|
bool preparedQuery;
|
||||||
};
|
};
|
||||||
@ -261,11 +246,9 @@ public:
|
|||||||
#if QT_CONFIG(textcodec)
|
#if QT_CONFIG(textcodec)
|
||||||
static QTextCodec* codec(MYSQL* mysql)
|
static QTextCodec* codec(MYSQL* mysql)
|
||||||
{
|
{
|
||||||
#if MYSQL_VERSION_ID >= 32321
|
|
||||||
QTextCodec* heuristicCodec = QTextCodec::codecForName(mysql_character_set_name(mysql));
|
QTextCodec* heuristicCodec = QTextCodec::codecForName(mysql_character_set_name(mysql));
|
||||||
if (heuristicCodec)
|
if (heuristicCodec)
|
||||||
return heuristicCodec;
|
return heuristicCodec;
|
||||||
#endif
|
|
||||||
return QTextCodec::codecForLocale();
|
return QTextCodec::codecForLocale();
|
||||||
}
|
}
|
||||||
#endif // textcodec
|
#endif // textcodec
|
||||||
@ -350,8 +333,6 @@ static QSqlField qToField(MYSQL_FIELD *field, QTextCodec *tc)
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
|
|
||||||
static QSqlError qMakeStmtError(const QString& err, QSqlError::ErrorType type,
|
static QSqlError qMakeStmtError(const QString& err, QSqlError::ErrorType type,
|
||||||
MYSQL_STMT* stmt)
|
MYSQL_STMT* stmt)
|
||||||
{
|
{
|
||||||
@ -445,7 +426,6 @@ bool QMYSQLResultPrivate::bindInValues()
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
QMYSQLResult::QMYSQLResult(const QMYSQLDriver* db)
|
QMYSQLResult::QMYSQLResult(const QMYSQLDriver* db)
|
||||||
: QSqlResult(*new QMYSQLResultPrivate(this, db))
|
: QSqlResult(*new QMYSQLResultPrivate(this, db))
|
||||||
@ -460,11 +440,9 @@ QMYSQLResult::~QMYSQLResult()
|
|||||||
QVariant QMYSQLResult::handle() const
|
QVariant QMYSQLResult::handle() const
|
||||||
{
|
{
|
||||||
Q_D(const QMYSQLResult);
|
Q_D(const QMYSQLResult);
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
if(d->preparedQuery)
|
if(d->preparedQuery)
|
||||||
return d->meta ? QVariant::fromValue(d->meta) : QVariant::fromValue(d->stmt);
|
return d->meta ? QVariant::fromValue(d->meta) : QVariant::fromValue(d->stmt);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
return QVariant::fromValue(d->result);
|
return QVariant::fromValue(d->result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,15 +454,12 @@ void QMYSQLResult::cleanup()
|
|||||||
|
|
||||||
// must iterate trough leftover result sets from multi-selects or stored procedures
|
// must iterate trough leftover result sets from multi-selects or stored procedures
|
||||||
// if this isn't done subsequent queries will fail with "Commands out of sync"
|
// if this isn't done subsequent queries will fail with "Commands out of sync"
|
||||||
#if MYSQL_VERSION_ID >= 40100
|
|
||||||
while (driver() && d->drv_d_func()->mysql && mysql_next_result(d->drv_d_func()->mysql) == 0) {
|
while (driver() && d->drv_d_func()->mysql && mysql_next_result(d->drv_d_func()->mysql) == 0) {
|
||||||
MYSQL_RES *res = mysql_store_result(d->drv_d_func()->mysql);
|
MYSQL_RES *res = mysql_store_result(d->drv_d_func()->mysql);
|
||||||
if (res)
|
if (res)
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
if (d->stmt) {
|
if (d->stmt) {
|
||||||
if (mysql_stmt_close(d->stmt))
|
if (mysql_stmt_close(d->stmt))
|
||||||
qWarning("QMYSQLResult::cleanup: unable to free statement handle");
|
qWarning("QMYSQLResult::cleanup: unable to free statement handle");
|
||||||
@ -509,7 +484,6 @@ void QMYSQLResult::cleanup()
|
|||||||
delete[] d->inBinds;
|
delete[] d->inBinds;
|
||||||
d->inBinds = 0;
|
d->inBinds = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
d->hasBlobs = false;
|
d->hasBlobs = false;
|
||||||
d->fields.clear();
|
d->fields.clear();
|
||||||
@ -536,7 +510,6 @@ bool QMYSQLResult::fetch(int i)
|
|||||||
if (at() == i)
|
if (at() == i)
|
||||||
return true;
|
return true;
|
||||||
if (d->preparedQuery) {
|
if (d->preparedQuery) {
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
mysql_stmt_data_seek(d->stmt, i);
|
mysql_stmt_data_seek(d->stmt, i);
|
||||||
|
|
||||||
int nRC = mysql_stmt_fetch(d->stmt);
|
int nRC = mysql_stmt_fetch(d->stmt);
|
||||||
@ -550,9 +523,6 @@ bool QMYSQLResult::fetch(int i)
|
|||||||
"Unable to fetch data"), QSqlError::StatementError, d->stmt));
|
"Unable to fetch data"), QSqlError::StatementError, d->stmt));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
mysql_data_seek(d->result, i);
|
mysql_data_seek(d->result, i);
|
||||||
d->row = mysql_fetch_row(d->result);
|
d->row = mysql_fetch_row(d->result);
|
||||||
@ -570,7 +540,6 @@ bool QMYSQLResult::fetchNext()
|
|||||||
if (!driver())
|
if (!driver())
|
||||||
return false;
|
return false;
|
||||||
if (d->preparedQuery) {
|
if (d->preparedQuery) {
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
int nRC = mysql_stmt_fetch(d->stmt);
|
int nRC = mysql_stmt_fetch(d->stmt);
|
||||||
if (nRC) {
|
if (nRC) {
|
||||||
#ifdef MYSQL_DATA_TRUNCATED
|
#ifdef MYSQL_DATA_TRUNCATED
|
||||||
@ -582,9 +551,6 @@ bool QMYSQLResult::fetchNext()
|
|||||||
"Unable to fetch data"), QSqlError::StatementError, d->stmt));
|
"Unable to fetch data"), QSqlError::StatementError, d->stmt));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
d->row = mysql_fetch_row(d->result);
|
d->row = mysql_fetch_row(d->result);
|
||||||
if (!d->row)
|
if (!d->row)
|
||||||
@ -607,11 +573,7 @@ bool QMYSQLResult::fetchLast()
|
|||||||
|
|
||||||
my_ulonglong numRows;
|
my_ulonglong numRows;
|
||||||
if (d->preparedQuery) {
|
if (d->preparedQuery) {
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
numRows = mysql_stmt_num_rows(d->stmt);
|
numRows = mysql_stmt_num_rows(d->stmt);
|
||||||
#else
|
|
||||||
numRows = 0;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
numRows = mysql_num_rows(d->result);
|
numRows = mysql_num_rows(d->result);
|
||||||
}
|
}
|
||||||
@ -788,11 +750,7 @@ int QMYSQLResult::size()
|
|||||||
Q_D(const QMYSQLResult);
|
Q_D(const QMYSQLResult);
|
||||||
if (driver() && isSelect())
|
if (driver() && isSelect())
|
||||||
if (d->preparedQuery)
|
if (d->preparedQuery)
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
return mysql_stmt_num_rows(d->stmt);
|
return mysql_stmt_num_rows(d->stmt);
|
||||||
#else
|
|
||||||
return -1;
|
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
return int(mysql_num_rows(d->result));
|
return int(mysql_num_rows(d->result));
|
||||||
else
|
else
|
||||||
@ -821,11 +779,9 @@ QVariant QMYSQLResult::lastInsertId() const
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
if (d->preparedQuery) {
|
if (d->preparedQuery) {
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
quint64 id = mysql_stmt_insert_id(d->stmt);
|
quint64 id = mysql_stmt_insert_id(d->stmt);
|
||||||
if (id)
|
if (id)
|
||||||
return QVariant(id);
|
return QVariant(id);
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
quint64 id = mysql_insert_id(d->drv_d_func()->mysql);
|
quint64 id = mysql_insert_id(d->drv_d_func()->mysql);
|
||||||
if (id)
|
if (id)
|
||||||
@ -842,11 +798,7 @@ QSqlRecord QMYSQLResult::record() const
|
|||||||
if (!isActive() || !isSelect() || !driver())
|
if (!isActive() || !isSelect() || !driver())
|
||||||
return info;
|
return info;
|
||||||
|
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
res = d->preparedQuery ? d->meta : d->result;
|
res = d->preparedQuery ? d->meta : d->result;
|
||||||
#else
|
|
||||||
res = d->result;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!mysql_errno(d->drv_d_func()->mysql)) {
|
if (!mysql_errno(d->drv_d_func()->mysql)) {
|
||||||
mysql_field_seek(res, 0);
|
mysql_field_seek(res, 0);
|
||||||
@ -865,7 +817,7 @@ bool QMYSQLResult::nextResult()
|
|||||||
Q_D(QMYSQLResult);
|
Q_D(QMYSQLResult);
|
||||||
if (!driver())
|
if (!driver())
|
||||||
return false;
|
return false;
|
||||||
#if MYSQL_VERSION_ID >= 40100
|
|
||||||
setAt(-1);
|
setAt(-1);
|
||||||
setActive(false);
|
setActive(false);
|
||||||
|
|
||||||
@ -908,9 +860,6 @@ bool QMYSQLResult::nextResult()
|
|||||||
|
|
||||||
setActive(true);
|
setActive(true);
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMYSQLResult::virtual_hook(int id, void *data)
|
void QMYSQLResult::virtual_hook(int id, void *data)
|
||||||
@ -918,9 +867,6 @@ void QMYSQLResult::virtual_hook(int id, void *data)
|
|||||||
QSqlResult::virtual_hook(id, data);
|
QSqlResult::virtual_hook(id, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
|
|
||||||
static MYSQL_TIME *toMySqlDate(QDate date, QTime time, QVariant::Type type)
|
static MYSQL_TIME *toMySqlDate(QDate date, QTime time, QVariant::Type type)
|
||||||
{
|
{
|
||||||
Q_ASSERT(type == QVariant::Time || type == QVariant::Date
|
Q_ASSERT(type == QVariant::Time || type == QVariant::Date
|
||||||
@ -949,7 +895,7 @@ bool QMYSQLResult::prepare(const QString& query)
|
|||||||
Q_D(QMYSQLResult);
|
Q_D(QMYSQLResult);
|
||||||
if (!driver())
|
if (!driver())
|
||||||
return false;
|
return false;
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
cleanup();
|
cleanup();
|
||||||
if (!d->drv_d_func()->preparedQuerysEnabled)
|
if (!d->drv_d_func()->preparedQuerysEnabled)
|
||||||
return QSqlResult::prepare(query);
|
return QSqlResult::prepare(query);
|
||||||
@ -983,9 +929,6 @@ bool QMYSQLResult::prepare(const QString& query)
|
|||||||
setSelect(d->bindInValues());
|
setSelect(d->bindInValues());
|
||||||
d->preparedQuery = true;
|
d->preparedQuery = true;
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QMYSQLResult::exec()
|
bool QMYSQLResult::exec()
|
||||||
@ -1155,7 +1098,7 @@ bool QMYSQLResult::exec()
|
|||||||
setActive(true);
|
setActive(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static int qMySqlConnectionCount = 0;
|
static int qMySqlConnectionCount = 0;
|
||||||
@ -1164,18 +1107,16 @@ static bool qMySqlInitHandledByUser = false;
|
|||||||
static void qLibraryInit()
|
static void qLibraryInit()
|
||||||
{
|
{
|
||||||
#ifndef Q_NO_MYSQL_EMBEDDED
|
#ifndef Q_NO_MYSQL_EMBEDDED
|
||||||
# if MYSQL_VERSION_ID >= 40000
|
|
||||||
if (qMySqlInitHandledByUser || qMySqlConnectionCount > 1)
|
if (qMySqlInitHandledByUser || qMySqlConnectionCount > 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
# if (MYSQL_VERSION_ID >= 40110 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50003
|
# if MYSQL_VERSION_ID >= 50003
|
||||||
if (mysql_library_init(0, 0, 0)) {
|
if (mysql_library_init(0, 0, 0)) {
|
||||||
# else
|
# else
|
||||||
if (mysql_server_init(0, 0, 0)) {
|
if (mysql_server_init(0, 0, 0)) {
|
||||||
# endif
|
# endif
|
||||||
qWarning("QMYSQLDriver::qServerInit: unable to start server.");
|
qWarning("QMYSQLDriver::qServerInit: unable to start server.");
|
||||||
}
|
}
|
||||||
# endif // MYSQL_VERSION_ID
|
|
||||||
#endif // Q_NO_MYSQL_EMBEDDED
|
#endif // Q_NO_MYSQL_EMBEDDED
|
||||||
|
|
||||||
#if defined(MARIADB_BASE_VERSION) || defined(MARIADB_VERSION_ID)
|
#if defined(MARIADB_BASE_VERSION) || defined(MARIADB_VERSION_ID)
|
||||||
@ -1187,12 +1128,10 @@ static void qLibraryEnd()
|
|||||||
{
|
{
|
||||||
#if !defined(MARIADB_BASE_VERSION) && !defined(MARIADB_VERSION_ID)
|
#if !defined(MARIADB_BASE_VERSION) && !defined(MARIADB_VERSION_ID)
|
||||||
# if !defined(Q_NO_MYSQL_EMBEDDED)
|
# if !defined(Q_NO_MYSQL_EMBEDDED)
|
||||||
# if MYSQL_VERSION_ID > 40000
|
# if MYSQL_VERSION_ID >= 50003
|
||||||
# if (MYSQL_VERSION_ID >= 40110 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50003
|
mysql_library_end();
|
||||||
mysql_library_end();
|
# else
|
||||||
# else
|
mysql_server_end();
|
||||||
mysql_server_end();
|
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
@ -1271,17 +1210,9 @@ bool QMYSQLDriver::hasFeature(DriverFeature f) const
|
|||||||
return true;
|
return true;
|
||||||
case PreparedQueries:
|
case PreparedQueries:
|
||||||
case PositionalPlaceholders:
|
case PositionalPlaceholders:
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
return d->preparedQuerysEnabled;
|
return d->preparedQuerysEnabled;
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
case MultipleResultSets:
|
case MultipleResultSets:
|
||||||
#if MYSQL_VERSION_ID >= 40100
|
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1322,7 +1253,7 @@ bool QMYSQLDriver::open(const QString& db,
|
|||||||
we have to enable CLIEN_MULTI_STATEMENTS here, otherwise _any_
|
we have to enable CLIEN_MULTI_STATEMENTS here, otherwise _any_
|
||||||
stored procedure call will fail.
|
stored procedure call will fail.
|
||||||
*/
|
*/
|
||||||
unsigned int optionFlags = Q_CLIENT_MULTI_STATEMENTS;
|
unsigned int optionFlags = CLIENT_MULTI_STATEMENTS;
|
||||||
const QStringList opts(connOpts.split(QLatin1Char(';'), QString::SkipEmptyParts));
|
const QStringList opts(connOpts.split(QLatin1Char(';'), QString::SkipEmptyParts));
|
||||||
QString unixSocket;
|
QString unixSocket;
|
||||||
QString sslCert;
|
QString sslCert;
|
||||||
@ -1330,12 +1261,10 @@ bool QMYSQLDriver::open(const QString& db,
|
|||||||
QString sslKey;
|
QString sslKey;
|
||||||
QString sslCAPath;
|
QString sslCAPath;
|
||||||
QString sslCipher;
|
QString sslCipher;
|
||||||
#if MYSQL_VERSION_ID >= 50000
|
|
||||||
my_bool reconnect=false;
|
my_bool reconnect=false;
|
||||||
uint connectTimeout = 0;
|
uint connectTimeout = 0;
|
||||||
uint readTimeout = 0;
|
uint readTimeout = 0;
|
||||||
uint writeTimeout = 0;
|
uint writeTimeout = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
// extract the real options from the string
|
// extract the real options from the string
|
||||||
for (int i = 0; i < opts.count(); ++i) {
|
for (int i = 0; i < opts.count(); ++i) {
|
||||||
@ -1346,18 +1275,15 @@ bool QMYSQLDriver::open(const QString& db,
|
|||||||
QString opt = tmp.left(idx).simplified();
|
QString opt = tmp.left(idx).simplified();
|
||||||
if (opt == QLatin1String("UNIX_SOCKET"))
|
if (opt == QLatin1String("UNIX_SOCKET"))
|
||||||
unixSocket = val;
|
unixSocket = val;
|
||||||
#if MYSQL_VERSION_ID >= 50000
|
|
||||||
else if (opt == QLatin1String("MYSQL_OPT_RECONNECT")) {
|
else if (opt == QLatin1String("MYSQL_OPT_RECONNECT")) {
|
||||||
if (val == QLatin1String("TRUE") || val == QLatin1String("1") || val.isEmpty())
|
if (val == QLatin1String("TRUE") || val == QLatin1String("1") || val.isEmpty())
|
||||||
reconnect = true;
|
reconnect = true;
|
||||||
} else if (opt == QLatin1String("MYSQL_OPT_CONNECT_TIMEOUT")) {
|
} else if (opt == QLatin1String("MYSQL_OPT_CONNECT_TIMEOUT"))
|
||||||
connectTimeout = val.toInt();
|
connectTimeout = val.toInt();
|
||||||
} else if (opt == QLatin1String("MYSQL_OPT_READ_TIMEOUT")) {
|
else if (opt == QLatin1String("MYSQL_OPT_READ_TIMEOUT"))
|
||||||
readTimeout = val.toInt();
|
readTimeout = val.toInt();
|
||||||
} else if (opt == QLatin1String("MYSQL_OPT_WRITE_TIMEOUT")) {
|
else if (opt == QLatin1String("MYSQL_OPT_WRITE_TIMEOUT"))
|
||||||
writeTimeout = val.toInt();
|
writeTimeout = val.toInt();
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (opt == QLatin1String("SSL_KEY"))
|
else if (opt == QLatin1String("SSL_KEY"))
|
||||||
sslKey = val;
|
sslKey = val;
|
||||||
else if (opt == QLatin1String("SSL_CERT"))
|
else if (opt == QLatin1String("SSL_CERT"))
|
||||||
@ -1442,7 +1368,7 @@ bool QMYSQLDriver::open(const QString& db,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (MYSQL_VERSION_ID >= 40113 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50007
|
#if MYSQL_VERSION_ID >= 50007
|
||||||
if (mysql_get_client_version() >= 50503 && mysql_get_server_version(d->mysql) >= 50503) {
|
if (mysql_get_client_version() >= 50503 && mysql_get_server_version(d->mysql) >= 50503) {
|
||||||
// force the communication to be utf8mb4 (only utf8mb4 supports 4-byte characters)
|
// force the communication to be utf8mb4 (only utf8mb4 supports 4-byte characters)
|
||||||
mysql_set_character_set(d->mysql, "utf8mb4");
|
mysql_set_character_set(d->mysql, "utf8mb4");
|
||||||
@ -1457,20 +1383,15 @@ bool QMYSQLDriver::open(const QString& db,
|
|||||||
d->tc = codec(d->mysql);
|
d->tc = codec(d->mysql);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif // MYSQL_VERSION_ID >= 50007
|
||||||
|
|
||||||
#if MYSQL_VERSION_ID >= 40108
|
|
||||||
d->preparedQuerysEnabled = mysql_get_client_version() >= 40108
|
d->preparedQuerysEnabled = mysql_get_client_version() >= 40108
|
||||||
&& mysql_get_server_version(d->mysql) >= 40100;
|
&& mysql_get_server_version(d->mysql) >= 40100;
|
||||||
#else
|
|
||||||
d->preparedQuerysEnabled = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if QT_CONFIG(thread)
|
#if QT_CONFIG(thread)
|
||||||
mysql_thread_init();
|
mysql_thread_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
setOpenError(false);
|
setOpenError(false);
|
||||||
return true;
|
return true;
|
||||||
@ -1499,46 +1420,21 @@ QStringList QMYSQLDriver::tables(QSql::TableType type) const
|
|||||||
{
|
{
|
||||||
Q_D(const QMYSQLDriver);
|
Q_D(const QMYSQLDriver);
|
||||||
QStringList tl;
|
QStringList tl;
|
||||||
#if MYSQL_VERSION_ID >= 40100
|
QSqlQuery q(createResult());
|
||||||
if( mysql_get_server_version(d->mysql) < 50000)
|
if (type & QSql::Tables) {
|
||||||
{
|
QString sql = QLatin1String("select table_name from information_schema.tables where table_schema = '") + QLatin1String(d->mysql->db) + QLatin1String("' and table_type = 'BASE TABLE'");
|
||||||
#endif
|
q.exec(sql);
|
||||||
if (!isOpen())
|
|
||||||
return tl;
|
|
||||||
if (!(type & QSql::Tables))
|
|
||||||
return tl;
|
|
||||||
|
|
||||||
MYSQL_RES* tableRes = mysql_list_tables(d->mysql, NULL);
|
while (q.next())
|
||||||
MYSQL_ROW row;
|
tl.append(q.value(0).toString());
|
||||||
int i = 0;
|
}
|
||||||
while (tableRes) {
|
if (type & QSql::Views) {
|
||||||
mysql_data_seek(tableRes, i);
|
QString sql = QLatin1String("select table_name from information_schema.tables where table_schema = '") + QLatin1String(d->mysql->db) + QLatin1String("' and table_type = 'VIEW'");
|
||||||
row = mysql_fetch_row(tableRes);
|
q.exec(sql);
|
||||||
if (!row)
|
|
||||||
break;
|
while (q.next())
|
||||||
tl.append(toUnicode(d->tc, row[0]));
|
tl.append(q.value(0).toString());
|
||||||
i++;
|
|
||||||
}
|
|
||||||
mysql_free_result(tableRes);
|
|
||||||
#if MYSQL_VERSION_ID >= 40100
|
|
||||||
} else {
|
|
||||||
QSqlQuery q(createResult());
|
|
||||||
if(type & QSql::Tables) {
|
|
||||||
QString sql = QLatin1String("select table_name from information_schema.tables where table_schema = '") + QLatin1String(d->mysql->db) + QLatin1String("' and table_type = 'BASE TABLE'");
|
|
||||||
q.exec(sql);
|
|
||||||
|
|
||||||
while(q.next())
|
|
||||||
tl.append(q.value(0).toString());
|
|
||||||
}
|
|
||||||
if(type & QSql::Views) {
|
|
||||||
QString sql = QLatin1String("select table_name from information_schema.tables where table_schema = '") + QLatin1String(d->mysql->db) + QLatin1String("' and table_type = 'VIEW'");
|
|
||||||
q.exec(sql);
|
|
||||||
|
|
||||||
while(q.next())
|
|
||||||
tl.append(q.value(0).toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return tl;
|
return tl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,6 +328,20 @@ static const int closeButtonSize = 14;
|
|||||||
static const qreal closeButtonCornerRadius = 2.0;
|
static const qreal closeButtonCornerRadius = 2.0;
|
||||||
#endif // QT_CONFIG(tabbar)
|
#endif // QT_CONFIG(tabbar)
|
||||||
|
|
||||||
|
#ifndef QT_NO_ACCESSIBILITY // This ifdef to avoid "unused function" warning.
|
||||||
|
QBrush brushForToolButton(bool isOnKeyWindow)
|
||||||
|
{
|
||||||
|
// When a toolbutton in a toolbar is in the 'ON' state, we draw a
|
||||||
|
// partially transparent background. The colors must be different
|
||||||
|
// for 'Aqua' and 'DarkAqua' appearances though.
|
||||||
|
if (isDarkMode())
|
||||||
|
return isOnKeyWindow ? QColor(73, 73, 73, 100) : QColor(56, 56, 56, 100);
|
||||||
|
|
||||||
|
return isOnKeyWindow ? QColor(0, 0, 0, 28) : QColor(0, 0, 0, 21);
|
||||||
|
}
|
||||||
|
#endif // QT_NO_ACCESSIBILITY
|
||||||
|
|
||||||
|
|
||||||
static const int headerSectionArrowHeight = 6;
|
static const int headerSectionArrowHeight = 6;
|
||||||
static const int headerSectionSeparatorInset = 2;
|
static const int headerSectionSeparatorInset = 2;
|
||||||
|
|
||||||
@ -5603,8 +5617,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
|
|||||||
if (view)
|
if (view)
|
||||||
isKey = [view.window isKeyWindow];
|
isKey = [view.window isKeyWindow];
|
||||||
|
|
||||||
QBrush brush(isKey ? QColor(0, 0, 0, 28)
|
QBrush brush(brushForToolButton(isKey));
|
||||||
: QColor(0, 0, 0, 21));
|
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
path.addRoundedRect(QRectF(tb->rect.x(), tb->rect.y(), tb->rect.width(), tb->rect.height() + 4), 4, 4);
|
path.addRoundedRect(QRectF(tb->rect.x(), tb->rect.y(), tb->rect.width(), tb->rect.height() + 4), 4, 4);
|
||||||
p->setRenderHint(QPainter::Antialiasing);
|
p->setRenderHint(QPainter::Antialiasing);
|
||||||
|
11
src/src.pro
11
src/src.pro
@ -70,7 +70,7 @@ src_winmain.depends = sub-corelib # just for the module .pri file
|
|||||||
|
|
||||||
src_corelib.subdir = $$PWD/corelib
|
src_corelib.subdir = $$PWD/corelib
|
||||||
src_corelib.target = sub-corelib
|
src_corelib.target = sub-corelib
|
||||||
src_corelib.depends = src_tools_moc src_tools_rcc
|
src_corelib.depends = src_tools_moc src_tools_rcc src_tools_tracegen
|
||||||
|
|
||||||
src_xml.subdir = $$PWD/xml
|
src_xml.subdir = $$PWD/xml
|
||||||
src_xml.target = sub-xml
|
src_xml.target = sub-xml
|
||||||
@ -157,17 +157,12 @@ src_android.subdir = $$PWD/android
|
|||||||
src_3rdparty_freetype.depends += src_corelib
|
src_3rdparty_freetype.depends += src_corelib
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SUBDIRS += src_tools_bootstrap src_tools_moc src_tools_rcc
|
SUBDIRS += src_tools_bootstrap src_tools_moc src_tools_rcc src_tools_tracegen
|
||||||
qtConfig(regularexpression):pcre2 {
|
qtConfig(regularexpression):pcre2 {
|
||||||
SUBDIRS += src_3rdparty_pcre2
|
SUBDIRS += src_3rdparty_pcre2
|
||||||
src_corelib.depends += src_3rdparty_pcre2
|
src_corelib.depends += src_3rdparty_pcre2
|
||||||
}
|
}
|
||||||
TOOLS = src_tools_moc src_tools_rcc src_tools_qlalr
|
TOOLS = src_tools_moc src_tools_rcc src_tools_tracegen src_tools_qlalr
|
||||||
!force_bootstrap:if(qtConfig(lttng)|qtConfig(etw)) {
|
|
||||||
SUBDIRS += src_tools_tracegen
|
|
||||||
src_corelib.depends += src_tools_tracegen
|
|
||||||
TOOLS += src_tools_tracegen
|
|
||||||
}
|
|
||||||
SUBDIRS += src_corelib src_tools_qlalr
|
SUBDIRS += src_corelib src_tools_qlalr
|
||||||
win32:SUBDIRS += src_winmain
|
win32:SUBDIRS += src_winmain
|
||||||
qtConfig(network) {
|
qtConfig(network) {
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#include <qvector.h>
|
#include <qvector.h>
|
||||||
#include <qstring.h>
|
#include <qstring.h>
|
||||||
|
#include <qstringlist.h>
|
||||||
#include <qtypeinfo.h>
|
#include <qtypeinfo.h>
|
||||||
|
|
||||||
struct Tracepoint
|
struct Tracepoint
|
||||||
|
@ -788,10 +788,12 @@ void QOpenGLWidgetPrivate::initialize()
|
|||||||
if (initialized)
|
if (initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get our toplevel's context with which we will share in order to make the
|
// If no global shared context get our toplevel's context with which we
|
||||||
// texture usable by the underlying window's backingstore.
|
// will share in order to make the texture usable by the underlying window's backingstore.
|
||||||
QWidget *tlw = q->window();
|
QWidget *tlw = q->window();
|
||||||
QOpenGLContext *shareContext = get(tlw)->shareContext();
|
QOpenGLContext *shareContext = qt_gl_global_share_context();
|
||||||
|
if (!shareContext)
|
||||||
|
shareContext = get(tlw)->shareContext();
|
||||||
// If shareContext is null, showing content on-screen will not work.
|
// If shareContext is null, showing content on-screen will not work.
|
||||||
// However, offscreen rendering and grabFramebuffer() will stay fully functional.
|
// However, offscreen rendering and grabFramebuffer() will stay fully functional.
|
||||||
|
|
||||||
|
@ -7664,7 +7664,7 @@ void QWidget::show()
|
|||||||
else if (defaultState == Qt::WindowMaximized)
|
else if (defaultState == Qt::WindowMaximized)
|
||||||
showMaximized();
|
showMaximized();
|
||||||
else
|
else
|
||||||
setVisible(true); // FIXME: Why not showNormal(), like QWindow::show()?
|
setVisible(true); // Don't call showNormal() as not to clobber Qt::Window(Max/Min)imized
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \internal
|
/*! \internal
|
||||||
|
@ -88,6 +88,7 @@
|
|||||||
#include <private/qstylehelper_p.h>
|
#include <private/qstylehelper_p.h>
|
||||||
#include <private/qdrawhelper_p.h>
|
#include <private/qdrawhelper_p.h>
|
||||||
#include <private/qapplication_p.h>
|
#include <private/qapplication_p.h>
|
||||||
|
#include <private/qwidget_p.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -364,6 +365,11 @@ static void qt_fusion_draw_mdibutton(QPainter *painter, const QStyleOptionTitleB
|
|||||||
painter->drawPoint(tmp.right() , tmp.bottom() - 1);
|
painter->drawPoint(tmp.right() , tmp.bottom() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QWindow *qt_getWindow(const QWidget *widget)
|
||||||
|
{
|
||||||
|
return widget ? QWidgetPrivate::get(widget)->windowHandle(QWidgetPrivate::WindowHandleMode::Closest) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
@ -995,7 +1001,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
|
|||||||
d->tabBarcloseButtonIcon = proxy()->standardIcon(SP_DialogCloseButton, option, widget);
|
d->tabBarcloseButtonIcon = proxy()->standardIcon(SP_DialogCloseButton, option, widget);
|
||||||
if ((option->state & State_Enabled) && (option->state & State_MouseOver))
|
if ((option->state & State_Enabled) && (option->state & State_MouseOver))
|
||||||
proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
|
proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
|
||||||
QPixmap pixmap = d->tabBarcloseButtonIcon.pixmap(QSize(16, 16), QIcon::Normal, QIcon::On);
|
QPixmap pixmap = d->tabBarcloseButtonIcon.pixmap(qt_getWindow(widget), QSize(16, 16), QIcon::Normal, QIcon::On);
|
||||||
proxy()->drawItemPixmap(painter, option->rect, Qt::AlignCenter, pixmap);
|
proxy()->drawItemPixmap(painter, option->rect, Qt::AlignCenter, pixmap);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1035,7 +1041,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
|||||||
if (!cb->currentIcon.isNull()) {
|
if (!cb->currentIcon.isNull()) {
|
||||||
QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
|
QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
|
||||||
: QIcon::Disabled;
|
: QIcon::Disabled;
|
||||||
QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);
|
QPixmap pixmap = cb->currentIcon.pixmap(qt_getWindow(widget), cb->iconSize, mode);
|
||||||
QRect iconRect(editRect);
|
QRect iconRect(editRect);
|
||||||
iconRect.setWidth(cb->iconSize.width() + 4);
|
iconRect.setWidth(cb->iconSize.width() + 4);
|
||||||
iconRect = alignedRect(cb->direction,
|
iconRect = alignedRect(cb->direction,
|
||||||
@ -1647,9 +1653,9 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
|||||||
iconSize = combo->iconSize();
|
iconSize = combo->iconSize();
|
||||||
#endif
|
#endif
|
||||||
if (checked)
|
if (checked)
|
||||||
pixmap = menuItem->icon.pixmap(iconSize, mode, QIcon::On);
|
pixmap = menuItem->icon.pixmap(qt_getWindow(widget), iconSize, mode, QIcon::On);
|
||||||
else
|
else
|
||||||
pixmap = menuItem->icon.pixmap(iconSize, mode);
|
pixmap = menuItem->icon.pixmap(qt_getWindow(widget), iconSize, mode);
|
||||||
|
|
||||||
const int pixw = pixmap.width() / pixmap.devicePixelRatio();
|
const int pixw = pixmap.width() / pixmap.devicePixelRatio();
|
||||||
const int pixh = pixmap.height() / pixmap.devicePixelRatio();
|
const int pixh = pixmap.height() / pixmap.devicePixelRatio();
|
||||||
@ -1783,7 +1789,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
|||||||
if (button->state & State_On)
|
if (button->state & State_On)
|
||||||
state = QIcon::On;
|
state = QIcon::On;
|
||||||
|
|
||||||
QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state);
|
QPixmap pixmap = button->icon.pixmap(qt_getWindow(widget), button->iconSize, mode, state);
|
||||||
int w = pixmap.width() / pixmap.devicePixelRatio();
|
int w = pixmap.width() / pixmap.devicePixelRatio();
|
||||||
int h = pixmap.height() / pixmap.devicePixelRatio();
|
int h = pixmap.height() / pixmap.devicePixelRatio();
|
||||||
|
|
||||||
|
@ -1144,11 +1144,14 @@ void QAbstractScrollArea::paintEvent(QPaintEvent*)
|
|||||||
mouse press events for the viewport() widget. The event is passed
|
mouse press events for the viewport() widget. The event is passed
|
||||||
in \a e.
|
in \a e.
|
||||||
|
|
||||||
|
The default implementation calls QWidget::mousePressEvent() for
|
||||||
|
default popup handling.
|
||||||
|
|
||||||
\sa QWidget::mousePressEvent()
|
\sa QWidget::mousePressEvent()
|
||||||
*/
|
*/
|
||||||
void QAbstractScrollArea::mousePressEvent(QMouseEvent *e)
|
void QAbstractScrollArea::mousePressEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
e->ignore();
|
QWidget::mousePressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -389,9 +389,13 @@ bool QGroupBox::event(QEvent *e)
|
|||||||
void QGroupBox::childEvent(QChildEvent *c)
|
void QGroupBox::childEvent(QChildEvent *c)
|
||||||
{
|
{
|
||||||
Q_D(QGroupBox);
|
Q_D(QGroupBox);
|
||||||
if (c->type() != QEvent::ChildAdded || !c->child()->isWidgetType())
|
/*
|
||||||
|
Children might have been enabled after being added to the group box, in which case
|
||||||
|
the childEvent handler ran too early, and we need to disabled children again.
|
||||||
|
*/
|
||||||
|
if (!(c->added() || c->polished()) || !c->child()->isWidgetType())
|
||||||
return;
|
return;
|
||||||
QWidget *w = (QWidget*)c->child();
|
QWidget *w = static_cast<QWidget*>(c->child());
|
||||||
if (w->isWindow())
|
if (w->isWindow())
|
||||||
return;
|
return;
|
||||||
if (d->checkable) {
|
if (d->checkable) {
|
||||||
|
@ -237,7 +237,7 @@ void QTextEditPrivate::_q_hoveredBlockWithMarkerChanged(const QTextBlock &block)
|
|||||||
Qt::CursorShape cursor = cursorToRestoreAfterHover;
|
Qt::CursorShape cursor = cursorToRestoreAfterHover;
|
||||||
if (block.isValid() && !q->isReadOnly()) {
|
if (block.isValid() && !q->isReadOnly()) {
|
||||||
QTextBlockFormat::MarkerType marker = block.blockFormat().marker();
|
QTextBlockFormat::MarkerType marker = block.blockFormat().marker();
|
||||||
if (marker != QTextBlockFormat::NoMarker) {
|
if (marker != QTextBlockFormat::MarkerType::NoMarker) {
|
||||||
if (viewport->cursor().shape() != Qt::PointingHandCursor)
|
if (viewport->cursor().shape() != Qt::PointingHandCursor)
|
||||||
cursorToRestoreAfterHover = viewport->cursor().shape();
|
cursorToRestoreAfterHover = viewport->cursor().shape();
|
||||||
cursor = Qt::PointingHandCursor;
|
cursor = Qt::PointingHandCursor;
|
||||||
@ -772,6 +772,7 @@ void QTextEdit::setAlignment(Qt::Alignment a)
|
|||||||
QTextCursor cursor = d->control->textCursor();
|
QTextCursor cursor = d->control->textCursor();
|
||||||
cursor.mergeBlockFormat(fmt);
|
cursor.mergeBlockFormat(fmt);
|
||||||
d->control->setTextCursor(cursor);
|
d->control->setTextCursor(cursor);
|
||||||
|
d->relayoutDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -1810,11 +1810,11 @@ void QWidgetTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton but
|
|||||||
if (markerBlock == blockWithMarkerUnderMouse) {
|
if (markerBlock == blockWithMarkerUnderMouse) {
|
||||||
auto fmt = blockWithMarkerUnderMouse.blockFormat();
|
auto fmt = blockWithMarkerUnderMouse.blockFormat();
|
||||||
switch (fmt.marker()) {
|
switch (fmt.marker()) {
|
||||||
case QTextBlockFormat::Unchecked :
|
case QTextBlockFormat::MarkerType::Unchecked :
|
||||||
fmt.setMarker(QTextBlockFormat::Checked);
|
fmt.setMarker(QTextBlockFormat::MarkerType::Checked);
|
||||||
break;
|
break;
|
||||||
case QTextBlockFormat::Checked:
|
case QTextBlockFormat::MarkerType::Checked:
|
||||||
fmt.setMarker(QTextBlockFormat::Unchecked);
|
fmt.setMarker(QTextBlockFormat::MarkerType::Unchecked);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -360,6 +360,7 @@ void tst_QDateTime::ctor()
|
|||||||
|
|
||||||
void tst_QDateTime::operator_eq()
|
void tst_QDateTime::operator_eq()
|
||||||
{
|
{
|
||||||
|
QVERIFY(QDateTime() != QDateTime(QDate(1970, 1, 1), QTime(0, 0))); // QTBUG-79006
|
||||||
QDateTime dt1(QDate(2004, 3, 24), QTime(23, 45, 57), Qt::UTC);
|
QDateTime dt1(QDate(2004, 3, 24), QTime(23, 45, 57), Qt::UTC);
|
||||||
QDateTime dt2(QDate(2005, 3, 11), QTime(), Qt::UTC);
|
QDateTime dt2(QDate(2005, 3, 11), QTime(), Qt::UTC);
|
||||||
dt2 = dt1;
|
dt2 = dt1;
|
||||||
@ -1675,29 +1676,30 @@ void tst_QDateTime::currentDateTimeUtc2()
|
|||||||
void tst_QDateTime::toSecsSinceEpoch_data()
|
void tst_QDateTime::toSecsSinceEpoch_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<QString>("dateTimeStr");
|
QTest::addColumn<QString>("dateTimeStr");
|
||||||
QTest::addColumn<bool>("res");
|
QTest::addColumn<bool>("valid");
|
||||||
|
|
||||||
QTest::newRow( "data1" ) << str( 1800, 1, 1, 12, 0, 0 ) << false;
|
QTest::newRow( "data1" ) << str( 1800, 1, 1, 12, 0, 0 ) << true;
|
||||||
QTest::newRow( "data2" ) << str( 1969, 1, 1, 12, 0, 0 ) << false;
|
QTest::newRow( "data2" ) << str( 1969, 1, 1, 12, 0, 0 ) << true;
|
||||||
QTest::newRow( "data3" ) << str( 2002, 1, 1, 12, 0, 0 ) << true;
|
QTest::newRow( "data3" ) << str( 2002, 1, 1, 12, 0, 0 ) << true;
|
||||||
QTest::newRow( "data4" ) << str( 2002, 6, 1, 12, 0, 0 ) << true;
|
QTest::newRow( "data4" ) << str( 2002, 6, 1, 12, 0, 0 ) << true;
|
||||||
QTest::newRow( "data5" ) << QString("INVALID") << false;
|
QTest::newRow( "data5" ) << QString("INVALID") << false;
|
||||||
QTest::newRow( "data6" ) << str( 2038, 1, 1, 12, 0, 0 ) << true;
|
QTest::newRow( "data6" ) << str( 2038, 1, 1, 12, 0, 0 ) << true;
|
||||||
QTest::newRow( "data7" ) << str( 2063, 4, 5, 12, 0, 0 ) << true; // the day of First Contact
|
QTest::newRow( "data7" ) << str( 2063, 4, 5, 12, 0, 0 ) << true; // the day of First Contact
|
||||||
QTest::newRow( "data8" ) << str( 2107, 1, 1, 12, 0, 0 )
|
QTest::newRow( "data8" ) << str( 2107, 1, 1, 12, 0, 0 ) << true;
|
||||||
<< bool( sizeof(uint) > 32 && sizeof(time_t) > 32 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QDateTime::toSecsSinceEpoch()
|
void tst_QDateTime::toSecsSinceEpoch()
|
||||||
{
|
{
|
||||||
QFETCH( QString, dateTimeStr );
|
QFETCH(const QString, dateTimeStr);
|
||||||
QDateTime datetime = dt( dateTimeStr );
|
const QDateTime datetime = dt(dateTimeStr);
|
||||||
|
QFETCH(const bool, valid);
|
||||||
|
QCOMPARE(datetime.isValid(), valid);
|
||||||
|
|
||||||
qint64 asSecsSinceEpoch = datetime.toSecsSinceEpoch();
|
if (valid) {
|
||||||
QCOMPARE(asSecsSinceEpoch, datetime.toMSecsSinceEpoch() / 1000);
|
const qint64 asSecsSinceEpoch = datetime.toSecsSinceEpoch();
|
||||||
|
QCOMPARE(asSecsSinceEpoch, datetime.toMSecsSinceEpoch() / 1000);
|
||||||
QDateTime datetime2 = QDateTime::fromSecsSinceEpoch(asSecsSinceEpoch);
|
QCOMPARE(QDateTime::fromSecsSinceEpoch(asSecsSinceEpoch), datetime);
|
||||||
QCOMPARE(datetime, datetime2);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_DEPRECATED_SINCE(5, 8)
|
#if QT_DEPRECATED_SINCE(5, 8)
|
||||||
@ -1725,14 +1727,10 @@ void tst_QDateTime::toTime_t()
|
|||||||
uint asTime_t = datetime.toTime_t();
|
uint asTime_t = datetime.toTime_t();
|
||||||
QFETCH( bool, res );
|
QFETCH( bool, res );
|
||||||
if (res) {
|
if (res) {
|
||||||
QVERIFY( asTime_t != (uint)-1 );
|
QVERIFY(asTime_t != uint(-1));
|
||||||
|
QCOMPARE(QDateTime::fromTime_t(asTime_t), datetime);
|
||||||
} else {
|
} else {
|
||||||
QVERIFY( asTime_t == (uint)-1 );
|
QCOMPARE(asTime_t, uint(-1));
|
||||||
}
|
|
||||||
|
|
||||||
if ( asTime_t != (uint) -1 ) {
|
|
||||||
QDateTime datetime2 = QDateTime::fromTime_t( asTime_t );
|
|
||||||
QCOMPARE(datetime, datetime2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1929,8 +1927,8 @@ void tst_QDateTime::operator_eqeq_data()
|
|||||||
|
|
||||||
QDateTime dateTime1(QDate(2012, 6, 20), QTime(14, 33, 2, 500));
|
QDateTime dateTime1(QDate(2012, 6, 20), QTime(14, 33, 2, 500));
|
||||||
QDateTime dateTime1a = dateTime1.addMSecs(1);
|
QDateTime dateTime1a = dateTime1.addMSecs(1);
|
||||||
QDateTime dateTime2(QDate(2012, 20, 6), QTime(14, 33, 2, 500));
|
QDateTime dateTime2(QDate(2012, 20, 6), QTime(14, 33, 2, 500)); // Invalid
|
||||||
QDateTime dateTime2a = dateTime2.addMSecs(-1);
|
QDateTime dateTime2a = dateTime2.addMSecs(-1); // Still invalid
|
||||||
QDateTime dateTime3(QDate(1970, 1, 1), QTime(0, 0, 0, 0), Qt::UTC); // UTC epoch
|
QDateTime dateTime3(QDate(1970, 1, 1), QTime(0, 0, 0, 0), Qt::UTC); // UTC epoch
|
||||||
QDateTime dateTime3a = dateTime3.addDays(1);
|
QDateTime dateTime3a = dateTime3.addDays(1);
|
||||||
QDateTime dateTime3b = dateTime3.addDays(-1);
|
QDateTime dateTime3b = dateTime3.addDays(-1);
|
||||||
@ -1946,7 +1944,7 @@ void tst_QDateTime::operator_eqeq_data()
|
|||||||
QTest::newRow("data2") << dateTime1a << dateTime1a << true << false;
|
QTest::newRow("data2") << dateTime1a << dateTime1a << true << false;
|
||||||
QTest::newRow("data3") << dateTime1 << dateTime2 << false << false;
|
QTest::newRow("data3") << dateTime1 << dateTime2 << false << false;
|
||||||
QTest::newRow("data4") << dateTime1 << dateTime1a << false << false;
|
QTest::newRow("data4") << dateTime1 << dateTime1a << false << false;
|
||||||
QTest::newRow("data5") << dateTime2 << dateTime2a << false << false;
|
QTest::newRow("data5") << dateTime2 << dateTime2a << true << false;
|
||||||
QTest::newRow("data6") << dateTime2 << dateTime3 << false << false;
|
QTest::newRow("data6") << dateTime2 << dateTime3 << false << false;
|
||||||
QTest::newRow("data7") << dateTime3 << dateTime3a << false << false;
|
QTest::newRow("data7") << dateTime3 << dateTime3a << false << false;
|
||||||
QTest::newRow("data8") << dateTime3 << dateTime3b << false << false;
|
QTest::newRow("data8") << dateTime3 << dateTime3b << false << false;
|
||||||
|
@ -404,6 +404,11 @@ void tst_QEasingCurve::valueForProgress()
|
|||||||
const qreal error = qAbs(ex - curve.valueForProgress(at.at(i)/qreal(100)));
|
const qreal error = qAbs(ex - curve.valueForProgress(at.at(i)/qreal(100)));
|
||||||
QVERIFY(error <= errorBound);
|
QVERIFY(error <= errorBound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type != QEasingCurve::SineCurve && type != QEasingCurve::CosineCurve) {
|
||||||
|
QVERIFY( !(curve.valueForProgress(0) > 0) );
|
||||||
|
QVERIFY( !(curve.valueForProgress(1) < 1) );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -632,6 +637,9 @@ void tst_QEasingCurve::bezierSpline()
|
|||||||
QCOMPARE(value, ex);
|
QCOMPARE(value, ex);
|
||||||
QVERIFY(error <= errorBound);
|
QVERIFY(error <= errorBound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVERIFY( !(bezierEasingCurve.valueForProgress(0) > 0) );
|
||||||
|
QVERIFY( !(bezierEasingCurve.valueForProgress(1) < 1) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QEasingCurve::tcbSpline_data()
|
void tst_QEasingCurve::tcbSpline_data()
|
||||||
@ -691,6 +699,9 @@ void tst_QEasingCurve::tcbSpline()
|
|||||||
QCOMPARE(value, ex);
|
QCOMPARE(value, ex);
|
||||||
QVERIFY(error <= errorBound);
|
QVERIFY(error <= errorBound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVERIFY( !(tcbEasingCurve.valueForProgress(0) > 0) );
|
||||||
|
QVERIFY( !(tcbEasingCurve.valueForProgress(1) < 1) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*This is single precision code for a cubic root used inside the spline easing curve.
|
/*This is single precision code for a cubic root used inside the spline easing curve.
|
||||||
|
@ -62,6 +62,7 @@ private slots:
|
|||||||
#ifndef QT_NO_WIDGETS
|
#ifndef QT_NO_WIDGETS
|
||||||
void infiniteLoop();
|
void infiniteLoop();
|
||||||
#endif
|
#endif
|
||||||
|
void emptyMovie();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Testing get/set functions
|
// Testing get/set functions
|
||||||
@ -220,5 +221,13 @@ void tst_QMovie::infiniteLoop()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void tst_QMovie::emptyMovie()
|
||||||
|
{
|
||||||
|
QMovie movie;
|
||||||
|
movie.setCacheMode(QMovie::CacheAll);
|
||||||
|
movie.jumpToFrame(100);
|
||||||
|
QCOMPARE(movie.currentFrameNumber(), -1);
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_MAIN(tst_QMovie)
|
QTEST_MAIN(tst_QMovie)
|
||||||
#include "tst_qmovie.moc"
|
#include "tst_qmovie.moc"
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user