Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ica69de99be9c8af4d28a52e4b69e6af748ed983c
This commit is contained in:
commit
6f27bb1352
@ -4,9 +4,6 @@ targetinfofile ~= s/pro$/target.txt/
|
|||||||
win32 {
|
win32 {
|
||||||
ext = .exe
|
ext = .exe
|
||||||
} else:wasm {
|
} else:wasm {
|
||||||
equals(WASM_OBJECT_FILES, 1): \
|
|
||||||
ext = .o
|
|
||||||
else: \
|
|
||||||
ext = .wasm
|
ext = .wasm
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
#include <QScreen>
|
||||||
|
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QCommandLineOption>
|
#include <QCommandLineOption>
|
||||||
@ -68,7 +68,7 @@ int main(int argc, char *argv[])
|
|||||||
parser.process(app);
|
parser.process(app);
|
||||||
|
|
||||||
MainWindow mainWindow;
|
MainWindow mainWindow;
|
||||||
const QRect availableGeometry = QApplication::desktop()->availableGeometry(&mainWindow);
|
const QRect availableGeometry = mainWindow.screen()->availableGeometry();
|
||||||
mainWindow.resize(availableGeometry.width() / 3, availableGeometry.height() / 2);
|
mainWindow.resize(availableGeometry.width() / 3, availableGeometry.height() / 2);
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QScreen>
|
||||||
|
|
||||||
#include "httpwindow.h"
|
#include "httpwindow.h"
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ int main(int argc, char *argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
HttpWindow httpWin;
|
HttpWindow httpWin;
|
||||||
const QRect availableSize = QApplication::desktop()->availableGeometry(&httpWin);
|
const QRect availableSize = httpWin.screen()->availableGeometry();
|
||||||
httpWin.resize(availableSize.width() / 5, availableSize.height() / 5);
|
httpWin.resize(availableSize.width() / 5, availableSize.height() / 5);
|
||||||
httpWin.move((availableSize.width() - httpWin.width()) / 2, (availableSize.height() - httpWin.height()) / 2);
|
httpWin.move((availableSize.width() - httpWin.width()) / 2, (availableSize.height() - httpWin.height()) / 2);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QDesktopWidget>
|
#include <QScreen>
|
||||||
#include <QSurfaceFormat>
|
#include <QSurfaceFormat>
|
||||||
#include <QOpenGLContext>
|
#include <QOpenGLContext>
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
@ -90,7 +90,7 @@ int main( int argc, char ** argv )
|
|||||||
// The rendering for the four QOpenGLWidgets happens on four separate threads.
|
// The rendering for the four QOpenGLWidgets happens on four separate threads.
|
||||||
|
|
||||||
GLWidget topLevelGlWidget;
|
GLWidget topLevelGlWidget;
|
||||||
QPoint pos = QApplication::desktop()->availableGeometry(&topLevelGlWidget).topLeft() + QPoint(200, 200);
|
QPoint pos = topLevelGlWidget.screen()->availableGeometry().topLeft() + QPoint(200, 200);
|
||||||
topLevelGlWidget.setWindowTitle(QStringLiteral("Threaded QOpenGLWidget example top level"));
|
topLevelGlWidget.setWindowTitle(QStringLiteral("Threaded QOpenGLWidget example top level"));
|
||||||
topLevelGlWidget.resize(200, 200);
|
topLevelGlWidget.resize(200, 200);
|
||||||
topLevelGlWidget.move(pos);
|
topLevelGlWidget.move(pos);
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
#include <QScreen>
|
||||||
|
|
||||||
#include "screenshot.h"
|
#include "screenshot.h"
|
||||||
|
|
||||||
@ -58,7 +58,8 @@ int main(int argc, char *argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
Screenshot screenshot;
|
Screenshot screenshot;
|
||||||
screenshot.move(QApplication::desktop()->availableGeometry(&screenshot).topLeft() + QPoint(20, 20));
|
screenshot.move(screenshot.screen()->availableGeometry().topLeft() + QPoint(20, 20));
|
||||||
screenshot.show();
|
screenshot.show();
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ Screenshot::Screenshot()
|
|||||||
screenshotLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
screenshotLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
screenshotLabel->setAlignment(Qt::AlignCenter);
|
screenshotLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
const QRect screenGeometry = QApplication::desktop()->screenGeometry(this);
|
const QRect screenGeometry = screen()->geometry();
|
||||||
screenshotLabel->setMinimumSize(screenGeometry.width() / 8, screenGeometry.height() / 8);
|
screenshotLabel->setMinimumSize(screenGeometry.width() / 8, screenGeometry.height() / 8);
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QScreen>
|
||||||
#include <QStyleHints>
|
#include <QStyleHints>
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
@ -73,7 +73,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Dialog dialog;
|
Dialog dialog;
|
||||||
if (!QGuiApplication::styleHints()->showIsFullScreen() && !QGuiApplication::styleHints()->showIsMaximized()) {
|
if (!QGuiApplication::styleHints()->showIsFullScreen() && !QGuiApplication::styleHints()->showIsMaximized()) {
|
||||||
const QRect availableGeometry = QApplication::desktop()->availableGeometry(&dialog);
|
const QRect availableGeometry = dialog.screen()->availableGeometry();
|
||||||
dialog.resize(availableGeometry.width() / 3, availableGeometry.height() * 2 / 3);
|
dialog.resize(availableGeometry.width() / 3, availableGeometry.height() * 2 / 3);
|
||||||
dialog.move((availableGeometry.width() - dialog.width()) / 2,
|
dialog.move((availableGeometry.width() - dialog.width()) / 2,
|
||||||
(availableGeometry.height() - dialog.height()) / 2);
|
(availableGeometry.height() - dialog.height()) / 2);
|
||||||
|
@ -49,9 +49,9 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QFileSystemModel>
|
#include <QFileSystemModel>
|
||||||
#include <QFileIconProvider>
|
#include <QFileIconProvider>
|
||||||
|
#include <QScreen>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QCommandLineOption>
|
#include <QCommandLineOption>
|
||||||
@ -92,7 +92,7 @@ int main(int argc, char *argv[])
|
|||||||
tree.setAnimated(false);
|
tree.setAnimated(false);
|
||||||
tree.setIndentation(20);
|
tree.setIndentation(20);
|
||||||
tree.setSortingEnabled(true);
|
tree.setSortingEnabled(true);
|
||||||
const QSize availableSize = QApplication::desktop()->availableGeometry(&tree).size();
|
const QSize availableSize = tree.screen()->availableGeometry().size();
|
||||||
tree.resize(availableSize / 2);
|
tree.resize(availableSize / 2);
|
||||||
tree.setColumnWidth(0, tree.width() / 3);
|
tree.setColumnWidth(0, tree.width() / 3);
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ void MainWindow::readSettings()
|
|||||||
QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName());
|
QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName());
|
||||||
const QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
|
const QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
|
||||||
if (geometry.isEmpty()) {
|
if (geometry.isEmpty()) {
|
||||||
const QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
|
const QRect availableGeometry = screen()->availableGeometry();
|
||||||
resize(availableGeometry.width() / 3, availableGeometry.height() / 2);
|
resize(availableGeometry.width() / 3, availableGeometry.height() / 2);
|
||||||
move((availableGeometry.width() - width()) / 2,
|
move((availableGeometry.width() - width()) / 2,
|
||||||
(availableGeometry.height() - height()) / 2);
|
(availableGeometry.height() - height()) / 2);
|
||||||
|
@ -464,7 +464,7 @@ void MainWindow::readSettings()
|
|||||||
QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName());
|
QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName());
|
||||||
const QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
|
const QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
|
||||||
if (geometry.isEmpty()) {
|
if (geometry.isEmpty()) {
|
||||||
const QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
|
const QRect availableGeometry = screen()->availableGeometry();
|
||||||
resize(availableGeometry.width() / 3, availableGeometry.height() / 2);
|
resize(availableGeometry.width() / 3, availableGeometry.height() / 2);
|
||||||
move((availableGeometry.width() - width()) / 2,
|
move((availableGeometry.width() - width()) / 2,
|
||||||
(availableGeometry.height() - height()) / 2);
|
(availableGeometry.height() - height()) / 2);
|
||||||
|
@ -167,7 +167,7 @@ void MainWindow::tile(const QMainWindow *previous)
|
|||||||
if (!topFrameWidth)
|
if (!topFrameWidth)
|
||||||
topFrameWidth = 40;
|
topFrameWidth = 40;
|
||||||
const QPoint pos = previous->pos() + 2 * QPoint(topFrameWidth, topFrameWidth);
|
const QPoint pos = previous->pos() + 2 * QPoint(topFrameWidth, topFrameWidth);
|
||||||
if (QApplication::desktop()->availableGeometry(this).contains(rect().bottomRight() + pos))
|
if (screen()->availableGeometry().contains(rect().bottomRight() + pos))
|
||||||
move(pos);
|
move(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ void MainWindow::readSettings()
|
|||||||
QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName());
|
QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName());
|
||||||
const QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
|
const QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
|
||||||
if (geometry.isEmpty()) {
|
if (geometry.isEmpty()) {
|
||||||
const QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
|
const QRect availableGeometry = screen()->availableGeometry();
|
||||||
resize(availableGeometry.width() / 3, availableGeometry.height() / 2);
|
resize(availableGeometry.width() / 3, availableGeometry.height() / 2);
|
||||||
move((availableGeometry.width() - width()) / 2,
|
move((availableGeometry.width() - width()) / 2,
|
||||||
(availableGeometry.height() - height()) / 2);
|
(availableGeometry.height() - height()) / 2);
|
||||||
|
@ -51,9 +51,9 @@
|
|||||||
#include "textedit.h"
|
#include "textedit.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QCommandLineOption>
|
#include <QCommandLineOption>
|
||||||
|
#include <QScreen>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -72,7 +72,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
TextEdit mw;
|
TextEdit mw;
|
||||||
|
|
||||||
const QRect availableGeometry = QApplication::desktop()->availableGeometry(&mw);
|
const QRect availableGeometry = mw.screen()->availableGeometry();
|
||||||
mw.resize(availableGeometry.width() / 2, (availableGeometry.height() * 2) / 3);
|
mw.resize(availableGeometry.width() / 2, (availableGeometry.height() * 2) / 3);
|
||||||
mw.move((availableGeometry.width() - mw.width()) / 2,
|
mw.move((availableGeometry.width() - mw.width()) / 2,
|
||||||
(availableGeometry.height() - mw.height()) / 2);
|
(availableGeometry.height() - mw.height()) / 2);
|
||||||
|
@ -54,12 +54,12 @@
|
|||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
#include <QScreen>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ MainWindow::MainWindow()
|
|||||||
|
|
||||||
setWindowTitle(tr("Codecs"));
|
setWindowTitle(tr("Codecs"));
|
||||||
|
|
||||||
const QRect screenGeometry = QApplication::desktop()->screenGeometry(this);
|
const QRect screenGeometry = screen()->geometry();
|
||||||
resize(screenGeometry.width() / 2, screenGeometry.height() * 2 / 3);
|
resize(screenGeometry.width() / 2, screenGeometry.height() * 2 / 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ void MainWindow::encodingDialog()
|
|||||||
{
|
{
|
||||||
if (!m_encodingDialog) {
|
if (!m_encodingDialog) {
|
||||||
m_encodingDialog = new EncodingDialog(this);
|
m_encodingDialog = new EncodingDialog(this);
|
||||||
const QRect screenGeometry = QApplication::desktop()->screenGeometry(this);
|
const QRect screenGeometry = screen()->geometry();
|
||||||
m_encodingDialog->setMinimumWidth(screenGeometry.width() / 4);
|
m_encodingDialog->setMinimumWidth(screenGeometry.width() / 4);
|
||||||
}
|
}
|
||||||
m_encodingDialog->show();
|
m_encodingDialog->show();
|
||||||
|
@ -52,12 +52,12 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QScreen>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ PreviewForm::PreviewForm(QWidget *parent)
|
|||||||
mainLayout->addWidget(statusLabel, 2, 0, 1, 2);
|
mainLayout->addWidget(statusLabel, 2, 0, 1, 2);
|
||||||
mainLayout->addWidget(buttonBox, 3, 0, 1, 2);
|
mainLayout->addWidget(buttonBox, 3, 0, 1, 2);
|
||||||
|
|
||||||
const QRect screenGeometry = QApplication::desktop()->screenGeometry(this);
|
const QRect screenGeometry = screen()->geometry();
|
||||||
resize(screenGeometry.width() * 2 / 5, screenGeometry.height() / 2);
|
resize(screenGeometry.width() * 2 / 5, screenGeometry.height() / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,12 +54,12 @@
|
|||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QScreen>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
|||||||
fallbacksAct->setChecked(true);
|
fallbacksAct->setChecked(true);
|
||||||
|
|
||||||
setWindowTitle(QCoreApplication::applicationName());
|
setWindowTitle(QCoreApplication::applicationName());
|
||||||
const QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
|
const QRect availableGeometry = screen()->availableGeometry();
|
||||||
adjustSize();
|
adjustSize();
|
||||||
move((availableGeometry.width() - width()) / 2, (availableGeometry.height() - height()) / 2);
|
move((availableGeometry.width() - width()) / 2, (availableGeometry.height() - height()) / 2);
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,8 @@
|
|||||||
#include "variantdelegate.h"
|
#include "variantdelegate.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
#include <QScreen>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
SettingsTree::SettingsTree(QWidget *parent)
|
SettingsTree::SettingsTree(QWidget *parent)
|
||||||
@ -93,7 +93,7 @@ void SettingsTree::setSettingsObject(const SettingsPtr &newSettings)
|
|||||||
|
|
||||||
QSize SettingsTree::sizeHint() const
|
QSize SettingsTree::sizeHint() const
|
||||||
{
|
{
|
||||||
const QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
|
const QRect availableGeometry = screen()->availableGeometry();
|
||||||
return QSize(availableGeometry.width() * 2 / 3, availableGeometry.height() * 2 / 3);
|
return QSize(availableGeometry.width() * 2 / 3, availableGeometry.height() * 2 / 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@
|
|||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QScreen>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
@ -302,7 +303,7 @@ QString FontInfoDialog::text() const
|
|||||||
|
|
||||||
void MainWindow::showInfo()
|
void MainWindow::showInfo()
|
||||||
{
|
{
|
||||||
const QRect screenGeometry = QApplication::desktop()->screenGeometry(this);
|
const QRect screenGeometry = screen()->geometry();
|
||||||
FontInfoDialog *dialog = new FontInfoDialog(this);
|
FontInfoDialog *dialog = new FontInfoDialog(this);
|
||||||
dialog->setWindowTitle(tr("Fonts"));
|
dialog->setWindowTitle(tr("Fonts"));
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QDesktopWidget>
|
#include <QScreen>
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ int main(int argc, char *argv[])
|
|||||||
if (!commandLineParser.positionalArguments().isEmpty())
|
if (!commandLineParser.positionalArguments().isEmpty())
|
||||||
mainWin.loadImages(commandLineParser.positionalArguments());
|
mainWin.loadImages(commandLineParser.positionalArguments());
|
||||||
|
|
||||||
const QRect availableGeometry = QApplication::desktop()->availableGeometry(&mainWin);
|
const QRect availableGeometry = mainWin.screen()->availableGeometry();
|
||||||
mainWin.resize(availableGeometry.width() / 2, availableGeometry.height() * 2 / 3);
|
mainWin.resize(availableGeometry.width() / 2, availableGeometry.height() * 2 / 3);
|
||||||
mainWin.move((availableGeometry.width() - mainWin.width()) / 2, (availableGeometry.height() - mainWin.height()) / 2);
|
mainWin.move((availableGeometry.width() - mainWin.width()) / 2, (availableGeometry.height() - mainWin.height()) / 2);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ MainWindow::MainWindow()
|
|||||||
statusBar()->showMessage(tr("Ready"));
|
statusBar()->showMessage(tr("Ready"));
|
||||||
|
|
||||||
setWindowTitle(tr("DOM Bookmarks"));
|
setWindowTitle(tr("DOM Bookmarks"));
|
||||||
const QSize availableSize = QApplication::desktop()->availableGeometry(this).size();
|
const QSize availableSize = screen()->availableGeometry().size();
|
||||||
resize(availableSize.width() / 2, availableSize.height() / 3);
|
resize(availableSize.width() / 2, availableSize.height() / 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ MainWindow::MainWindow()
|
|||||||
statusBar()->showMessage(tr("Ready"));
|
statusBar()->showMessage(tr("Ready"));
|
||||||
|
|
||||||
setWindowTitle(tr("SAX Bookmarks"));
|
setWindowTitle(tr("SAX Bookmarks"));
|
||||||
const QSize availableSize = QApplication::desktop()->availableGeometry(this).size();
|
const QSize availableSize = screen()->availableGeometry().size();
|
||||||
resize(availableSize.width() / 2, availableSize.height() / 3);
|
resize(availableSize.width() / 2, availableSize.height() / 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ MainWindow::MainWindow()
|
|||||||
statusBar()->showMessage(tr("Ready"));
|
statusBar()->showMessage(tr("Ready"));
|
||||||
|
|
||||||
setWindowTitle(tr("QXmlStream Bookmarks"));
|
setWindowTitle(tr("QXmlStream Bookmarks"));
|
||||||
const QSize availableSize = QApplication::desktop()->availableGeometry(this).size();
|
const QSize availableSize = screen()->availableGeometry().size();
|
||||||
resize(availableSize.width() / 2, availableSize.height() / 3);
|
resize(availableSize.width() / 2, availableSize.height() / 3);
|
||||||
}
|
}
|
||||||
//! [0]
|
//! [0]
|
||||||
|
@ -1086,6 +1086,14 @@ Mozilla License) is included. The data is then also used in QNetworkCookieJar::v
|
|||||||
"win32_system_libs": {
|
"win32_system_libs": {
|
||||||
"label": "Windows System Libraries",
|
"label": "Windows System Libraries",
|
||||||
"condition": "config.win32 && libs.advapi32 && libs.gdi32 && libs.kernel32 && libs.netapi32 && libs.ole32 && libs.shell32 && libs.uuid && libs.user32 && libs.winmm && libs.ws2_32"
|
"condition": "config.win32 && libs.advapi32 && libs.gdi32 && libs.kernel32 && libs.netapi32 && libs.ole32 && libs.shell32 && libs.uuid && libs.user32 && libs.winmm && libs.ws2_32"
|
||||||
|
},
|
||||||
|
"cborstream": {
|
||||||
|
"label": "CBOR stream I/O",
|
||||||
|
"purpose": "Provides support for reading and writing the CBOR binary format.
|
||||||
|
|
||||||
|
Note that this is required for plugin loading. Qt GUI needs QPA plugins for basic operation.",
|
||||||
|
"section": "Utilities",
|
||||||
|
"output": [ "publicFeature" ]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@
|
|||||||
#else
|
#else
|
||||||
# define QT_FEATURE_alloca_malloc_h -1
|
# define QT_FEATURE_alloca_malloc_h -1
|
||||||
#endif
|
#endif
|
||||||
|
#define QT_FEATURE_cborstream -1
|
||||||
#define QT_CRYPTOGRAPHICHASH_ONLY_SHA1
|
#define QT_CRYPTOGRAPHICHASH_ONLY_SHA1
|
||||||
#define QT_FEATURE_cxx11_random (QT_HAS_INCLUDE(<random>) ? 1 : -1)
|
#define QT_FEATURE_cxx11_random (QT_HAS_INCLUDE(<random>) ? 1 : -1)
|
||||||
#define QT_NO_DATASTREAM
|
#define QT_NO_DATASTREAM
|
||||||
|
@ -47,12 +47,11 @@
|
|||||||
#include "qoperatingsystemversion.h"
|
#include "qoperatingsystemversion.h"
|
||||||
#include "qoperatingsystemversion_p.h"
|
#include "qoperatingsystemversion_p.h"
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINRT)
|
#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINRT)
|
||||||
#include "qoperatingsystemversion_win_p.h"
|
# include "qoperatingsystemversion_win_p.h"
|
||||||
# if QT_CONFIG(settings)
|
# ifndef Q_OS_WINRT
|
||||||
# include "qsettings.h"
|
# include "private/qwinregistry_p.h"
|
||||||
# include "qvariant.h"
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif // Q_OS_WIN || Q_OS_CYGWIN
|
||||||
#include <private/qlocale_tools_p.h>
|
#include <private/qlocale_tools_p.h>
|
||||||
|
|
||||||
#include <qmutex.h>
|
#include <qmutex.h>
|
||||||
@ -2206,28 +2205,25 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion()
|
|||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static QString readRegistryString(const QString &key, const QString &subKey)
|
static QString readVersionRegistryString(const wchar_t *subKey)
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(settings)
|
#if !defined(QT_BUILD_QMAKE) && !defined(Q_OS_WINRT)
|
||||||
QSettings settings(key, QSettings::NativeFormat);
|
return QWinRegistryKey(HKEY_LOCAL_MACHINE, LR"(SOFTWARE\Microsoft\Windows NT\CurrentVersion)")
|
||||||
return settings.value(subKey).toString();
|
.stringValue(subKey);
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(key);
|
|
||||||
Q_UNUSED(subKey);
|
Q_UNUSED(subKey);
|
||||||
return QString();
|
return QString();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString windowsVersionKey() { return QStringLiteral(R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion)"); }
|
|
||||||
|
|
||||||
static inline QString windows10ReleaseId()
|
static inline QString windows10ReleaseId()
|
||||||
{
|
{
|
||||||
return readRegistryString(windowsVersionKey(), QStringLiteral("ReleaseId"));
|
return readVersionRegistryString(L"ReleaseId");
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString windows7Build()
|
static inline QString windows7Build()
|
||||||
{
|
{
|
||||||
return readRegistryString(windowsVersionKey(), QStringLiteral("CurrentBuild"));
|
return readVersionRegistryString(L"CurrentBuild");
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString winSp_helper()
|
static QString winSp_helper()
|
||||||
@ -3094,6 +3090,7 @@ QByteArray QSysInfo::machineUniqueId()
|
|||||||
}
|
}
|
||||||
#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||||
// Let's poke at the registry
|
// Let's poke at the registry
|
||||||
|
// ### Qt 6: Use new helpers from qwinregistry.cpp (once bootstrap builds are obsolete)
|
||||||
HKEY key = NULL;
|
HKEY key = NULL;
|
||||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Cryptography", 0, KEY_READ | KEY_WOW64_64KEY, &key)
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Cryptography", 0, KEY_READ | KEY_WOW64_64KEY, &key)
|
||||||
== ERROR_SUCCESS) {
|
== ERROR_SUCCESS) {
|
||||||
|
@ -1575,9 +1575,12 @@ public:
|
|||||||
MatchContains = 1,
|
MatchContains = 1,
|
||||||
MatchStartsWith = 2,
|
MatchStartsWith = 2,
|
||||||
MatchEndsWith = 3,
|
MatchEndsWith = 3,
|
||||||
MatchRegExp = 4,
|
#if QT_DEPRECATED_SINCE(5, 15)
|
||||||
|
MatchRegExp Q_DECL_ENUMERATOR_DEPRECATED_X("MatchRegExp is deprecated. Use MatchRegularExpression instead") = 4,
|
||||||
|
#endif
|
||||||
MatchWildcard = 5,
|
MatchWildcard = 5,
|
||||||
MatchFixedString = 8,
|
MatchFixedString = 8,
|
||||||
|
MatchRegularExpression = 9,
|
||||||
MatchCaseSensitive = 16,
|
MatchCaseSensitive = 16,
|
||||||
MatchWrap = 32,
|
MatchWrap = 32,
|
||||||
MatchRecursive = 64
|
MatchRecursive = 64
|
||||||
|
@ -2849,7 +2849,15 @@
|
|||||||
\value MatchEndsWith The search term matches the end of the item.
|
\value MatchEndsWith The search term matches the end of the item.
|
||||||
\value MatchCaseSensitive The search is case sensitive.
|
\value MatchCaseSensitive The search is case sensitive.
|
||||||
\value MatchRegExp Performs string-based matching using a regular
|
\value MatchRegExp Performs string-based matching using a regular
|
||||||
expression as the search term.
|
expression as the search term. Uses the deprecated QRegExp class.
|
||||||
|
\e{This enum value is deprecated since Qt 5.15.}
|
||||||
|
\value MatchRegularExpression Performs string-based matching using a regular
|
||||||
|
expression as the search term. Uses QRegularExpression.
|
||||||
|
When using this flag, a QRegularExpression object can be passed as
|
||||||
|
parameter and will directly be used to perform the search. The case
|
||||||
|
sensitivity flag will be ignored as the QRegularExpression object is
|
||||||
|
expected to be fully configured.
|
||||||
|
This enum value was added in Qt 5.15.
|
||||||
\value MatchWildcard Performs string-based matching using a string with
|
\value MatchWildcard Performs string-based matching using a string with
|
||||||
wildcards as the search term.
|
wildcards as the search term.
|
||||||
\value MatchWrap Perform a search that wraps around, so that when
|
\value MatchWrap Perform a search that wraps around, so that when
|
||||||
@ -2857,7 +2865,7 @@
|
|||||||
the first item and continues until all items have been examined.
|
the first item and continues until all items have been examined.
|
||||||
\value MatchRecursive Searches the entire hierarchy.
|
\value MatchRecursive Searches the entire hierarchy.
|
||||||
|
|
||||||
\sa QString::compare(), QRegExp
|
\sa QString::compare(), QRegExp, QRegularExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -136,6 +136,8 @@ static void mergeKeySets(NameSet *dest, const QStringList &src)
|
|||||||
** Wrappers for the insane windows registry API
|
** Wrappers for the insane windows registry API
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// ### Qt 6: Use new helpers from qwinregistry.cpp (once bootstrap builds are obsolete)
|
||||||
|
|
||||||
// Open a key with the specified "perms".
|
// Open a key with the specified "perms".
|
||||||
// "access" is to explicitly use the 32- or 64-bit branch.
|
// "access" is to explicitly use the 32- or 64-bit branch.
|
||||||
static HKEY openKey(HKEY parentHandle, REGSAM perms, const QString &rSubKey, REGSAM access = 0)
|
static HKEY openKey(HKEY parentHandle, REGSAM perms, const QString &rSubKey, REGSAM access = 0)
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
#include <qvector.h>
|
#include <qvector.h>
|
||||||
#include <qregexp.h>
|
#include <qregexp.h>
|
||||||
|
#include <qregularexpression.h>
|
||||||
#include <qstack.h>
|
#include <qstack.h>
|
||||||
#include <qbitarray.h>
|
#include <qbitarray.h>
|
||||||
#include <qdatetime.h>
|
#include <qdatetime.h>
|
||||||
@ -2358,6 +2359,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
|
|||||||
bool wrap = flags & Qt::MatchWrap;
|
bool wrap = flags & Qt::MatchWrap;
|
||||||
bool allHits = (hits == -1);
|
bool allHits = (hits == -1);
|
||||||
QString text; // only convert to a string if it is needed
|
QString text; // only convert to a string if it is needed
|
||||||
|
QRegularExpression rx; // only create it if needed
|
||||||
const int column = start.column();
|
const int column = start.column();
|
||||||
QModelIndex p = parent(start);
|
QModelIndex p = parent(start);
|
||||||
int from = start.row();
|
int from = start.row();
|
||||||
@ -2374,17 +2376,39 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
|
|||||||
if (matchType == Qt::MatchExactly) {
|
if (matchType == Qt::MatchExactly) {
|
||||||
if (value == v)
|
if (value == v)
|
||||||
result.append(idx);
|
result.append(idx);
|
||||||
} else { // QString based matching
|
} else { // QString or regular expression based matching
|
||||||
|
if (matchType == Qt::MatchRegularExpression) {
|
||||||
|
if (rx.pattern().isEmpty()) {
|
||||||
|
if (value.type() == QVariant::RegularExpression) {
|
||||||
|
rx = value.toRegularExpression();
|
||||||
|
} else {
|
||||||
|
rx.setPattern(value.toString());
|
||||||
|
if (cs == Qt::CaseInsensitive)
|
||||||
|
rx.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (matchType == Qt::MatchWildcard) {
|
||||||
|
if (rx.pattern().isEmpty())
|
||||||
|
rx.setPattern(QRegularExpression::wildcardToRegularExpression(value.toString()));
|
||||||
|
if (cs == Qt::CaseInsensitive)
|
||||||
|
rx.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
|
||||||
|
} else {
|
||||||
if (text.isEmpty()) // lazy conversion
|
if (text.isEmpty()) // lazy conversion
|
||||||
text = value.toString();
|
text = value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
QString t = v.toString();
|
QString t = v.toString();
|
||||||
switch (matchType) {
|
switch (matchType) {
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 15)
|
||||||
case Qt::MatchRegExp:
|
case Qt::MatchRegExp:
|
||||||
if (QRegExp(text, cs).exactMatch(t))
|
if (QRegExp(text, cs).exactMatch(t))
|
||||||
result.append(idx);
|
result.append(idx);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
case Qt::MatchRegularExpression:
|
||||||
|
Q_FALLTHROUGH();
|
||||||
case Qt::MatchWildcard:
|
case Qt::MatchWildcard:
|
||||||
if (QRegExp(text, cs, QRegExp::Wildcard).exactMatch(t))
|
if (t.contains(rx))
|
||||||
result.append(idx);
|
result.append(idx);
|
||||||
break;
|
break;
|
||||||
case Qt::MatchStartsWith:
|
case Qt::MatchStartsWith:
|
||||||
|
@ -88,8 +88,10 @@ win32 {
|
|||||||
SOURCES += kernel/qeventdispatcher_winrt.cpp
|
SOURCES += kernel/qeventdispatcher_winrt.cpp
|
||||||
HEADERS += kernel/qeventdispatcher_winrt_p.h
|
HEADERS += kernel/qeventdispatcher_winrt_p.h
|
||||||
} else {
|
} else {
|
||||||
SOURCES += kernel/qeventdispatcher_win.cpp
|
SOURCES += kernel/qeventdispatcher_win.cpp \
|
||||||
HEADERS += kernel/qeventdispatcher_win_p.h
|
kernel/qwinregistry.cpp
|
||||||
|
HEADERS += kernel/qeventdispatcher_win_p.h \
|
||||||
|
kernel/qwinregistry_p.h
|
||||||
}
|
}
|
||||||
|
|
||||||
!winrt: LIBS_PRIVATE += -lversion
|
!winrt: LIBS_PRIVATE += -lversion
|
||||||
|
120
src/corelib/kernel/qwinregistry.cpp
Normal file
120
src/corelib/kernel/qwinregistry.cpp
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2019 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the QtCore module of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 3 requirements
|
||||||
|
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 2.0 or (at your option) the GNU General
|
||||||
|
** Public license version 3 or any later version approved by the KDE Free
|
||||||
|
** Qt Foundation. The licenses are as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||||
|
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "qwinregistry_p.h"
|
||||||
|
|
||||||
|
#include <QtCore/qvarlengtharray.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
QWinRegistryKey::QWinRegistryKey() :
|
||||||
|
m_key(nullptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open a key with the specified permissions (KEY_READ/KEY_WRITE).
|
||||||
|
// "access" is to explicitly use the 32- or 64-bit branch.
|
||||||
|
QWinRegistryKey::QWinRegistryKey(HKEY parentHandle, QStringView subKey,
|
||||||
|
REGSAM permissions, REGSAM access)
|
||||||
|
{
|
||||||
|
if (RegOpenKeyEx(parentHandle, reinterpret_cast<const wchar_t *>(subKey.utf16()),
|
||||||
|
0, permissions | access, &m_key) != ERROR_SUCCESS) {
|
||||||
|
m_key = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QWinRegistryKey::~QWinRegistryKey()
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWinRegistryKey::close()
|
||||||
|
{
|
||||||
|
if (isValid()) {
|
||||||
|
RegCloseKey(m_key);
|
||||||
|
m_key = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QWinRegistryKey::stringValue(QStringView subKey) const
|
||||||
|
{
|
||||||
|
QString result;
|
||||||
|
if (!isValid())
|
||||||
|
return result;
|
||||||
|
DWORD type;
|
||||||
|
DWORD size;
|
||||||
|
auto subKeyC = reinterpret_cast<const wchar_t *>(subKey.utf16());
|
||||||
|
if (RegQueryValueEx(m_key, subKeyC, nullptr, &type, nullptr, &size) != ERROR_SUCCESS
|
||||||
|
|| (type != REG_SZ && type != REG_EXPAND_SZ) || size <= 2) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
// Reserve more for rare cases where trailing '\0' are missing in registry,
|
||||||
|
// otherwise chop off the '\0' received.
|
||||||
|
QString buffer(int(size / sizeof(wchar_t)), Qt::Uninitialized);
|
||||||
|
if (RegQueryValueEx(m_key, subKeyC, nullptr, &type,
|
||||||
|
reinterpret_cast<LPBYTE>(buffer.data()), &size) == ERROR_SUCCESS) {
|
||||||
|
if (buffer.endsWith(QChar::Null))
|
||||||
|
buffer.chop(1);
|
||||||
|
} else {
|
||||||
|
buffer.clear();
|
||||||
|
}
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPair<DWORD, bool> QWinRegistryKey::dwordValue(QStringView subKey) const
|
||||||
|
{
|
||||||
|
if (!isValid())
|
||||||
|
return qMakePair(0, false);
|
||||||
|
DWORD type;
|
||||||
|
auto subKeyC = reinterpret_cast<const wchar_t *>(subKey.utf16());
|
||||||
|
if (RegQueryValueEx(m_key, subKeyC, nullptr, &type, nullptr, nullptr) != ERROR_SUCCESS
|
||||||
|
|| type != REG_DWORD) {
|
||||||
|
return qMakePair(0, false);
|
||||||
|
}
|
||||||
|
DWORD value = 0;
|
||||||
|
DWORD size = sizeof(value);
|
||||||
|
const bool ok =
|
||||||
|
RegQueryValueEx(m_key, subKeyC, nullptr, nullptr,
|
||||||
|
reinterpret_cast<unsigned char *>(&value), &size) == ERROR_SUCCESS;
|
||||||
|
return qMakePair(value, ok);
|
||||||
|
}
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
89
src/corelib/kernel/qwinregistry_p.h
Normal file
89
src/corelib/kernel/qwinregistry_p.h
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2019 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the QtCore module of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 3 requirements
|
||||||
|
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 2.0 or (at your option) the GNU General
|
||||||
|
** Public license version 3 or any later version approved by the KDE Free
|
||||||
|
** Qt Foundation. The licenses are as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||||
|
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QWINREGISTRY_H
|
||||||
|
#define QWINREGISTRY_H
|
||||||
|
|
||||||
|
//
|
||||||
|
// W A R N I N G
|
||||||
|
// -------------
|
||||||
|
//
|
||||||
|
// This file is not part of the Qt API. It exists purely as an
|
||||||
|
// implementation detail. This header file may change from version to
|
||||||
|
// version without notice, or even be removed.
|
||||||
|
//
|
||||||
|
// We mean it.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <QtCore/qpair.h>
|
||||||
|
#include <QtCore/qstring.h>
|
||||||
|
#include <QtCore/qstringview.h>
|
||||||
|
#include <QtCore/qt_windows.h>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class Q_CORE_EXPORT QWinRegistryKey
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Q_DISABLE_COPY(QWinRegistryKey)
|
||||||
|
|
||||||
|
QWinRegistryKey();
|
||||||
|
explicit QWinRegistryKey(HKEY parentHandle, QStringView subKey,
|
||||||
|
REGSAM permissions = KEY_READ, REGSAM access = 0);
|
||||||
|
~QWinRegistryKey();
|
||||||
|
|
||||||
|
QWinRegistryKey(QWinRegistryKey &&other) noexcept { swap(other); }
|
||||||
|
QWinRegistryKey &operator=(QWinRegistryKey &&other) noexcept { swap(other); return *this; }
|
||||||
|
|
||||||
|
void swap(QWinRegistryKey &other) noexcept { qSwap(m_key, other.m_key); }
|
||||||
|
|
||||||
|
bool isValid() const { return m_key != nullptr; }
|
||||||
|
operator HKEY() const { return m_key; }
|
||||||
|
void close();
|
||||||
|
|
||||||
|
QString stringValue(QStringView subKey) const;
|
||||||
|
QPair<DWORD, bool> dwordValue(QStringView subKey) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
HKEY m_key;
|
||||||
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // QWINREGISTRY_H
|
@ -47,6 +47,8 @@
|
|||||||
#include <QtCore/qstring.h>
|
#include <QtCore/qstring.h>
|
||||||
#include <QtCore/qstringview.h>
|
#include <QtCore/qstringview.h>
|
||||||
|
|
||||||
|
QT_REQUIRE_CONFIG(cborstream);
|
||||||
|
|
||||||
// See qcborcommon.h for why we check
|
// See qcborcommon.h for why we check
|
||||||
#if defined(QT_X11_DEFINES_FOUND)
|
#if defined(QT_X11_DEFINES_FOUND)
|
||||||
# undef True
|
# undef True
|
||||||
|
@ -42,7 +42,10 @@
|
|||||||
#include "qdatastream.h"
|
#include "qdatastream.h"
|
||||||
#include "qcborarray.h"
|
#include "qcborarray.h"
|
||||||
#include "qcbormap.h"
|
#include "qcbormap.h"
|
||||||
|
|
||||||
|
#if QT_CONFIG(cborstream)
|
||||||
#include "qcborstream.h"
|
#include "qcborstream.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <qendian.h>
|
#include <qendian.h>
|
||||||
#include <qlocale.h>
|
#include <qlocale.h>
|
||||||
@ -758,6 +761,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
using namespace QtCbor;
|
using namespace QtCbor;
|
||||||
|
|
||||||
|
#if QT_CONFIG(cborstream)
|
||||||
// in qcborstream.cpp
|
// in qcborstream.cpp
|
||||||
extern void qt_cbor_stream_set_error(QCborStreamReaderPrivate *d, QCborError error);
|
extern void qt_cbor_stream_set_error(QCborStreamReaderPrivate *d, QCborError error);
|
||||||
|
|
||||||
@ -799,6 +803,7 @@ static void writeDoubleToCbor(QCborStreamWriter &writer, double d, QCborValue::E
|
|||||||
|
|
||||||
writer.append(d);
|
writer.append(d);
|
||||||
}
|
}
|
||||||
|
#endif // QT_CONFIG(cborstream)
|
||||||
|
|
||||||
static inline int typeOrder(Element e1, Element e2)
|
static inline int typeOrder(Element e1, Element e2)
|
||||||
{
|
{
|
||||||
@ -1221,6 +1226,7 @@ int QCborMap::compare(const QCborMap &other) const noexcept
|
|||||||
return compareContainer(d.data(), other.d.data());
|
return compareContainer(d.data(), other.d.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_CONFIG(cborstream)
|
||||||
static void encodeToCbor(QCborStreamWriter &writer, const QCborContainerPrivate *d, qsizetype idx,
|
static void encodeToCbor(QCborStreamWriter &writer, const QCborContainerPrivate *d, qsizetype idx,
|
||||||
QCborValue::EncodingOptions opt)
|
QCborValue::EncodingOptions opt)
|
||||||
{
|
{
|
||||||
@ -1632,6 +1638,7 @@ void QCborContainerPrivate::decodeFromCbor(QCborStreamReader &reader)
|
|||||||
if (reader.lastError() == QCborError::NoError)
|
if (reader.lastError() == QCborError::NoError)
|
||||||
reader.leaveContainer();
|
reader.leaveContainer();
|
||||||
}
|
}
|
||||||
|
#endif // QT_CONFIG(cborstream)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Creates a QCborValue with byte array value \a ba. The value can later be
|
Creates a QCborValue with byte array value \a ba. The value can later be
|
||||||
@ -2330,6 +2337,7 @@ QCborValueRef QCborValue::operator[](qint64 key)
|
|||||||
return { container, index };
|
return { container, index };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_CONFIG(cborstream)
|
||||||
/*!
|
/*!
|
||||||
Decodes one item from the CBOR stream found in \a reader and returns the
|
Decodes one item from the CBOR stream found in \a reader and returns the
|
||||||
equivalent representation. This function is recursive: if the item is a map
|
equivalent representation. This function is recursive: if the item is a map
|
||||||
@ -2567,6 +2575,7 @@ void QCborValueRef::toCbor(QCborStreamWriter &writer, QCborValue::EncodingOption
|
|||||||
{
|
{
|
||||||
concrete().toCbor(writer, opt);
|
concrete().toCbor(writer, opt);
|
||||||
}
|
}
|
||||||
|
#endif // QT_CONFIG(cborstream)
|
||||||
|
|
||||||
void QCborValueRef::assign(QCborValueRef that, const QCborValue &other)
|
void QCborValueRef::assign(QCborValueRef that, const QCborValue &other)
|
||||||
{
|
{
|
||||||
|
@ -285,6 +285,7 @@ public:
|
|||||||
static QCborValue fromJsonValue(const QJsonValue &v);
|
static QCborValue fromJsonValue(const QJsonValue &v);
|
||||||
QJsonValue toJsonValue() const;
|
QJsonValue toJsonValue() const;
|
||||||
|
|
||||||
|
#if QT_CONFIG(cborstream)
|
||||||
static QCborValue fromCbor(QCborStreamReader &reader);
|
static QCborValue fromCbor(QCborStreamReader &reader);
|
||||||
static QCborValue fromCbor(const QByteArray &ba, QCborParserError *error = nullptr);
|
static QCborValue fromCbor(const QByteArray &ba, QCborParserError *error = nullptr);
|
||||||
static QCborValue fromCbor(const char *data, qsizetype len, QCborParserError *error = nullptr)
|
static QCborValue fromCbor(const char *data, qsizetype len, QCborParserError *error = nullptr)
|
||||||
@ -293,6 +294,7 @@ public:
|
|||||||
{ return fromCbor(QByteArray(reinterpret_cast<const char *>(data), int(len)), error); }
|
{ return fromCbor(QByteArray(reinterpret_cast<const char *>(data), int(len)), error); }
|
||||||
QByteArray toCbor(EncodingOptions opt = NoTransformation);
|
QByteArray toCbor(EncodingOptions opt = NoTransformation);
|
||||||
void toCbor(QCborStreamWriter &writer, EncodingOptions opt = NoTransformation);
|
void toCbor(QCborStreamWriter &writer, EncodingOptions opt = NoTransformation);
|
||||||
|
#endif
|
||||||
|
|
||||||
QString toDiagnosticNotation(DiagnosticNotationOptions opts = Compact) const;
|
QString toDiagnosticNotation(DiagnosticNotationOptions opts = Compact) const;
|
||||||
|
|
||||||
@ -435,9 +437,11 @@ public:
|
|||||||
QVariant toVariant() const { return concrete().toVariant(); }
|
QVariant toVariant() const { return concrete().toVariant(); }
|
||||||
QJsonValue toJsonValue() const;
|
QJsonValue toJsonValue() const;
|
||||||
|
|
||||||
|
#if QT_CONFIG(cborstream)
|
||||||
QByteArray toCbor(QCborValue::EncodingOptions opt = QCborValue::NoTransformation)
|
QByteArray toCbor(QCborValue::EncodingOptions opt = QCborValue::NoTransformation)
|
||||||
{ return concrete().toCbor(opt); }
|
{ return concrete().toCbor(opt); }
|
||||||
void toCbor(QCborStreamWriter &writer, QCborValue::EncodingOptions opt = QCborValue::NoTransformation);
|
void toCbor(QCborStreamWriter &writer, QCborValue::EncodingOptions opt = QCborValue::NoTransformation);
|
||||||
|
#endif
|
||||||
|
|
||||||
QString toDiagnosticNotation(QCborValue::DiagnosticNotationOptions opt = QCborValue::Compact)
|
QString toDiagnosticNotation(QCborValue::DiagnosticNotationOptions opt = QCborValue::Compact)
|
||||||
{ return concrete().toDiagnosticNotation(opt); }
|
{ return concrete().toDiagnosticNotation(opt); }
|
||||||
|
@ -6,7 +6,6 @@ HEADERS += \
|
|||||||
serialization/qcbormap.h \
|
serialization/qcbormap.h \
|
||||||
serialization/qcborvalue.h \
|
serialization/qcborvalue.h \
|
||||||
serialization/qcborvalue_p.h \
|
serialization/qcborvalue_p.h \
|
||||||
serialization/qcborstream.h \
|
|
||||||
serialization/qdatastream.h \
|
serialization/qdatastream.h \
|
||||||
serialization/qdatastream_p.h \
|
serialization/qdatastream_p.h \
|
||||||
serialization/qjson_p.h \
|
serialization/qjson_p.h \
|
||||||
@ -23,7 +22,6 @@ HEADERS += \
|
|||||||
serialization/qxmlutils_p.h
|
serialization/qxmlutils_p.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
serialization/qcborstream.cpp \
|
|
||||||
serialization/qcbordiagnostic.cpp \
|
serialization/qcbordiagnostic.cpp \
|
||||||
serialization/qcborvalue.cpp \
|
serialization/qcborvalue.cpp \
|
||||||
serialization/qdatastream.cpp \
|
serialization/qdatastream.cpp \
|
||||||
@ -39,6 +37,14 @@ SOURCES += \
|
|||||||
serialization/qxmlstream.cpp \
|
serialization/qxmlstream.cpp \
|
||||||
serialization/qxmlutils.cpp
|
serialization/qxmlutils.cpp
|
||||||
|
|
||||||
|
qtConfig(cborstream): {
|
||||||
|
SOURCES += \
|
||||||
|
serialization/qcborstream.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
serialization/qcborstream.h
|
||||||
|
}
|
||||||
|
|
||||||
false: SOURCES += \
|
false: SOURCES += \
|
||||||
serialization/qcborarray.cpp \
|
serialization/qcborarray.cpp \
|
||||||
serialization/qcbormap.cpp
|
serialization/qcbormap.cpp
|
||||||
|
@ -46,13 +46,14 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
|
|
||||||
#ifndef Q_OS_WINRT
|
#ifndef Q_OS_WINRT
|
||||||
|
#include <private/qwinregistry_p.h>
|
||||||
// The registry-based timezone backend is not available on WinRT, which falls back to equivalent APIs.
|
// The registry-based timezone backend is not available on WinRT, which falls back to equivalent APIs.
|
||||||
#define QT_USE_REGISTRY_TIMEZONE 1
|
#define QT_USE_REGISTRY_TIMEZONE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Private
|
Private
|
||||||
|
|
||||||
@ -71,8 +72,8 @@ QT_BEGIN_NAMESPACE
|
|||||||
// Vista introduced support for historic data, see MSDN docs on DYNAMIC_TIME_ZONE_INFORMATION
|
// Vista introduced support for historic data, see MSDN docs on DYNAMIC_TIME_ZONE_INFORMATION
|
||||||
// http://msdn.microsoft.com/en-gb/library/windows/desktop/ms724253%28v=vs.85%29.aspx
|
// http://msdn.microsoft.com/en-gb/library/windows/desktop/ms724253%28v=vs.85%29.aspx
|
||||||
#ifdef QT_USE_REGISTRY_TIMEZONE
|
#ifdef QT_USE_REGISTRY_TIMEZONE
|
||||||
static const char tzRegPath[] = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones";
|
static const wchar_t tzRegPath[] = LR"(SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones)";
|
||||||
static const char currTzRegPath[] = "SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation";
|
static const wchar_t currTzRegPath[] = LR"(SYSTEM\CurrentControlSet\Control\TimeZoneInformation)";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -138,27 +139,6 @@ bool equalTzi(const TIME_ZONE_INFORMATION &tzi1, const TIME_ZONE_INFORMATION &tz
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef QT_USE_REGISTRY_TIMEZONE
|
#ifdef QT_USE_REGISTRY_TIMEZONE
|
||||||
bool openRegistryKey(const QString &keyPath, HKEY *key)
|
|
||||||
{
|
|
||||||
return RegOpenKeyEx(HKEY_LOCAL_MACHINE, reinterpret_cast<const wchar_t*>(keyPath.utf16()),
|
|
||||||
0, KEY_READ, key) == ERROR_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString readRegistryString(const HKEY &key, const wchar_t *value)
|
|
||||||
{
|
|
||||||
wchar_t buffer[MAX_PATH] = {0};
|
|
||||||
DWORD size = sizeof(wchar_t) * MAX_PATH;
|
|
||||||
RegQueryValueEx(key, value, nullptr, nullptr, reinterpret_cast<LPBYTE>(buffer), &size);
|
|
||||||
return QString::fromWCharArray(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
int readRegistryValue(const HKEY &key, const wchar_t *value)
|
|
||||||
{
|
|
||||||
DWORD buffer;
|
|
||||||
DWORD size = sizeof(buffer);
|
|
||||||
RegQueryValueEx(key, value, nullptr, nullptr, reinterpret_cast<LPBYTE>(&buffer), &size);
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWinTimeZonePrivate::QWinTransitionRule readRegistryRule(const HKEY &key,
|
QWinTimeZonePrivate::QWinTransitionRule readRegistryRule(const HKEY &key,
|
||||||
const wchar_t *value, bool *ok)
|
const wchar_t *value, bool *ok)
|
||||||
@ -185,12 +165,11 @@ TIME_ZONE_INFORMATION getRegistryTzi(const QByteArray &windowsId, bool *ok)
|
|||||||
TIME_ZONE_INFORMATION tzi;
|
TIME_ZONE_INFORMATION tzi;
|
||||||
REG_TZI_FORMAT regTzi;
|
REG_TZI_FORMAT regTzi;
|
||||||
DWORD regTziSize = sizeof(regTzi);
|
DWORD regTziSize = sizeof(regTzi);
|
||||||
HKEY key = NULL;
|
const QString tziKeyPath = QString::fromWCharArray(tzRegPath) + QLatin1Char('\\')
|
||||||
const QString tziKeyPath = QString::fromUtf8(tzRegPath) + QLatin1Char('\\')
|
|
||||||
+ QString::fromUtf8(windowsId);
|
+ QString::fromUtf8(windowsId);
|
||||||
|
|
||||||
if (openRegistryKey(tziKeyPath, &key)) {
|
QWinRegistryKey key(HKEY_LOCAL_MACHINE, tziKeyPath);
|
||||||
|
if (key.isValid()) {
|
||||||
DWORD size = sizeof(tzi.DaylightName);
|
DWORD size = sizeof(tzi.DaylightName);
|
||||||
RegQueryValueEx(key, L"Dlt", nullptr, nullptr, reinterpret_cast<LPBYTE>(tzi.DaylightName), &size);
|
RegQueryValueEx(key, L"Dlt", nullptr, nullptr, reinterpret_cast<LPBYTE>(tzi.DaylightName), &size);
|
||||||
|
|
||||||
@ -206,8 +185,6 @@ TIME_ZONE_INFORMATION getRegistryTzi(const QByteArray &windowsId, bool *ok)
|
|||||||
tzi.DaylightDate = regTzi.DaylightDate;
|
tzi.DaylightDate = regTzi.DaylightDate;
|
||||||
*ok = true;
|
*ok = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegCloseKey(key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tzi;
|
return tzi;
|
||||||
@ -299,8 +276,8 @@ QList<QByteArray> availableWindowsIds()
|
|||||||
#ifdef QT_USE_REGISTRY_TIMEZONE
|
#ifdef QT_USE_REGISTRY_TIMEZONE
|
||||||
// TODO Consider caching results in a global static, very unlikely to change.
|
// TODO Consider caching results in a global static, very unlikely to change.
|
||||||
QList<QByteArray> list;
|
QList<QByteArray> list;
|
||||||
HKEY key = NULL;
|
QWinRegistryKey key(HKEY_LOCAL_MACHINE, tzRegPath);
|
||||||
if (openRegistryKey(QString::fromUtf8(tzRegPath), &key)) {
|
if (key.isValid()) {
|
||||||
DWORD idCount = 0;
|
DWORD idCount = 0;
|
||||||
if (RegQueryInfoKey(key, 0, 0, 0, &idCount, 0, 0, 0, 0, 0, 0, 0) == ERROR_SUCCESS
|
if (RegQueryInfoKey(key, 0, 0, 0, &idCount, 0, 0, 0, 0, 0, 0, 0) == ERROR_SUCCESS
|
||||||
&& idCount > 0) {
|
&& idCount > 0) {
|
||||||
@ -311,7 +288,6 @@ QList<QByteArray> availableWindowsIds()
|
|||||||
list.append(QString::fromWCharArray(buffer).toUtf8());
|
list.append(QString::fromWCharArray(buffer).toUtf8());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RegCloseKey(key);
|
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
#else // QT_USE_REGISTRY_TIMEZONE
|
#else // QT_USE_REGISTRY_TIMEZONE
|
||||||
@ -325,15 +301,10 @@ QByteArray windowsSystemZoneId()
|
|||||||
{
|
{
|
||||||
#ifdef QT_USE_REGISTRY_TIMEZONE
|
#ifdef QT_USE_REGISTRY_TIMEZONE
|
||||||
// On Vista and later is held in the value TimeZoneKeyName in key currTzRegPath
|
// On Vista and later is held in the value TimeZoneKeyName in key currTzRegPath
|
||||||
QString id;
|
const QString id = QWinRegistryKey(HKEY_LOCAL_MACHINE, currTzRegPath)
|
||||||
HKEY key = NULL;
|
.stringValue(L"TimeZoneKeyName");
|
||||||
QString tziKeyPath = QString::fromUtf8(currTzRegPath);
|
|
||||||
if (openRegistryKey(tziKeyPath, &key)) {
|
|
||||||
id = readRegistryString(key, L"TimeZoneKeyName");
|
|
||||||
RegCloseKey(key);
|
|
||||||
if (!id.isEmpty())
|
if (!id.isEmpty())
|
||||||
return std::move(id).toUtf8();
|
return id.toUtf8();
|
||||||
}
|
|
||||||
|
|
||||||
// On XP we have to iterate over the zones until we find a match on
|
// On XP we have to iterate over the zones until we find a match on
|
||||||
// names/offsets with the current data
|
// names/offsets with the current data
|
||||||
@ -575,22 +546,22 @@ void QWinTimeZonePrivate::init(const QByteArray &ianaId)
|
|||||||
if (!m_windowsId.isEmpty()) {
|
if (!m_windowsId.isEmpty()) {
|
||||||
#ifdef QT_USE_REGISTRY_TIMEZONE
|
#ifdef QT_USE_REGISTRY_TIMEZONE
|
||||||
// Open the base TZI for the time zone
|
// Open the base TZI for the time zone
|
||||||
HKEY baseKey = NULL;
|
const QString baseKeyPath = QString::fromWCharArray(tzRegPath) + QLatin1Char('\\')
|
||||||
const QString baseKeyPath = QString::fromUtf8(tzRegPath) + QLatin1Char('\\')
|
|
||||||
+ QString::fromUtf8(m_windowsId);
|
+ QString::fromUtf8(m_windowsId);
|
||||||
if (openRegistryKey(baseKeyPath, &baseKey)) {
|
QWinRegistryKey baseKey(HKEY_LOCAL_MACHINE, baseKeyPath);
|
||||||
|
if (baseKey.isValid()) {
|
||||||
// Load the localized names
|
// Load the localized names
|
||||||
m_displayName = readRegistryString(baseKey, L"Display");
|
m_displayName = baseKey.stringValue(L"Display");
|
||||||
m_standardName = readRegistryString(baseKey, L"Std");
|
m_standardName = baseKey.stringValue(L"Std");
|
||||||
m_daylightName = readRegistryString(baseKey, L"Dlt");
|
m_daylightName = baseKey.stringValue(L"Dlt");
|
||||||
// On Vista and later the optional dynamic key holds historic data
|
// On Vista and later the optional dynamic key holds historic data
|
||||||
const QString dynamicKeyPath = baseKeyPath + QLatin1String("\\Dynamic DST");
|
const QString dynamicKeyPath = baseKeyPath + QLatin1String("\\Dynamic DST");
|
||||||
HKEY dynamicKey = NULL;
|
QWinRegistryKey dynamicKey(HKEY_LOCAL_MACHINE, dynamicKeyPath);
|
||||||
if (openRegistryKey(dynamicKeyPath, &dynamicKey)) {
|
if (dynamicKey.isValid()) {
|
||||||
// Find out the start and end years stored, then iterate over them
|
// Find out the start and end years stored, then iterate over them
|
||||||
int startYear = readRegistryValue(dynamicKey, L"FirstEntry");
|
const auto startYear = dynamicKey.dwordValue(L"FirstEntry");
|
||||||
int endYear = readRegistryValue(dynamicKey, L"LastEntry");
|
const auto endYear = dynamicKey.dwordValue(L"LastEntry");
|
||||||
for (int year = startYear; year <= endYear; ++year) {
|
for (int year = int(startYear.first); year <= int(endYear.first); ++year) {
|
||||||
bool ruleOk;
|
bool ruleOk;
|
||||||
QWinTransitionRule rule = readRegistryRule(dynamicKey,
|
QWinTransitionRule rule = readRegistryRule(dynamicKey,
|
||||||
reinterpret_cast<LPCWSTR>(QString::number(year).utf16()),
|
reinterpret_cast<LPCWSTR>(QString::number(year).utf16()),
|
||||||
@ -611,7 +582,6 @@ void QWinTimeZonePrivate::init(const QByteArray &ianaId)
|
|||||||
m_tranRules.append(rule);
|
m_tranRules.append(rule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RegCloseKey(dynamicKey);
|
|
||||||
} else {
|
} else {
|
||||||
// No dynamic data so use the base data
|
// No dynamic data so use the base data
|
||||||
bool ruleOk;
|
bool ruleOk;
|
||||||
@ -620,7 +590,6 @@ void QWinTimeZonePrivate::init(const QByteArray &ianaId)
|
|||||||
if (ruleOk)
|
if (ruleOk)
|
||||||
m_tranRules.append(rule);
|
m_tranRules.append(rule);
|
||||||
}
|
}
|
||||||
RegCloseKey(baseKey);
|
|
||||||
}
|
}
|
||||||
#else // QT_USE_REGISTRY_TIMEZONE
|
#else // QT_USE_REGISTRY_TIMEZONE
|
||||||
if (gTimeZones->isEmpty())
|
if (gTimeZones->isEmpty())
|
||||||
|
@ -525,6 +525,11 @@ void QRhiGles2::destroy()
|
|||||||
ensureContext();
|
ensureContext();
|
||||||
executeDeferredReleases();
|
executeDeferredReleases();
|
||||||
|
|
||||||
|
if (vao) {
|
||||||
|
f->glDeleteVertexArrays(1, &vao);
|
||||||
|
vao = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint shader : m_shaderCache)
|
for (uint shader : m_shaderCache)
|
||||||
f->glDeleteShader(shader);
|
f->glDeleteShader(shader);
|
||||||
m_shaderCache.clear();
|
m_shaderCache.clear();
|
||||||
@ -1151,6 +1156,13 @@ const QRhiNativeHandles *QRhiGles2::nativeHandles(QRhiCommandBuffer *cb)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void addBoundaryCommand(QGles2CommandBuffer *cbD, QGles2CommandBuffer::Command::Cmd type)
|
||||||
|
{
|
||||||
|
QGles2CommandBuffer::Command cmd;
|
||||||
|
cmd.cmd = type;
|
||||||
|
cbD->commands.append(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
void QRhiGles2::beginExternal(QRhiCommandBuffer *cb)
|
void QRhiGles2::beginExternal(QRhiCommandBuffer *cb)
|
||||||
{
|
{
|
||||||
if (ofr.active) {
|
if (ofr.active) {
|
||||||
@ -1166,6 +1178,9 @@ void QRhiGles2::beginExternal(QRhiCommandBuffer *cb)
|
|||||||
QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
|
QGles2CommandBuffer *cbD = QRHI_RES(QGles2CommandBuffer, cb);
|
||||||
executeCommandBuffer(cbD);
|
executeCommandBuffer(cbD);
|
||||||
cbD->resetCommands();
|
cbD->resetCommands();
|
||||||
|
|
||||||
|
if (vao)
|
||||||
|
f->glBindVertexArray(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRhiGles2::endExternal(QRhiCommandBuffer *cb)
|
void QRhiGles2::endExternal(QRhiCommandBuffer *cb)
|
||||||
@ -1183,17 +1198,12 @@ void QRhiGles2::endExternal(QRhiCommandBuffer *cb)
|
|||||||
enqueueBarriersForPass(cbD);
|
enqueueBarriersForPass(cbD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addBoundaryCommand(cbD, QGles2CommandBuffer::Command::ResetFrame);
|
||||||
|
|
||||||
if (cbD->currentTarget)
|
if (cbD->currentTarget)
|
||||||
enqueueBindFramebuffer(cbD->currentTarget, cbD);
|
enqueueBindFramebuffer(cbD->currentTarget, cbD);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addBoundaryCommand(QGles2CommandBuffer *cb, QGles2CommandBuffer::Command::Cmd type)
|
|
||||||
{
|
|
||||||
QGles2CommandBuffer::Command cmd;
|
|
||||||
cmd.cmd = type;
|
|
||||||
cb->commands.append(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRhi::FrameOpResult QRhiGles2::beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags)
|
QRhi::FrameOpResult QRhiGles2::beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags)
|
||||||
{
|
{
|
||||||
Q_UNUSED(flags);
|
Q_UNUSED(flags);
|
||||||
@ -1913,6 +1923,10 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
|
|||||||
if (vao)
|
if (vao)
|
||||||
f->glBindVertexArray(0);
|
f->glBindVertexArray(0);
|
||||||
break;
|
break;
|
||||||
|
case QGles2CommandBuffer::Command::ResetFrame:
|
||||||
|
if (vao)
|
||||||
|
f->glBindVertexArray(vao);
|
||||||
|
break;
|
||||||
case QGles2CommandBuffer::Command::Viewport:
|
case QGles2CommandBuffer::Command::Viewport:
|
||||||
f->glViewport(GLint(cmd.args.viewport.x), GLint(cmd.args.viewport.y), GLsizei(cmd.args.viewport.w), GLsizei(cmd.args.viewport.h));
|
f->glViewport(GLint(cmd.args.viewport.x), GLint(cmd.args.viewport.y), GLsizei(cmd.args.viewport.w), GLsizei(cmd.args.viewport.h));
|
||||||
f->glDepthRangef(cmd.args.viewport.d0, cmd.args.viewport.d1);
|
f->glDepthRangef(cmd.args.viewport.d0, cmd.args.viewport.d1);
|
||||||
|
@ -300,6 +300,7 @@ struct QGles2CommandBuffer : public QRhiCommandBuffer
|
|||||||
enum Cmd {
|
enum Cmd {
|
||||||
BeginFrame,
|
BeginFrame,
|
||||||
EndFrame,
|
EndFrame,
|
||||||
|
ResetFrame,
|
||||||
Viewport,
|
Viewport,
|
||||||
Scissor,
|
Scissor,
|
||||||
BlendConstants,
|
BlendConstants,
|
||||||
|
@ -432,88 +432,142 @@ template class QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>;
|
|||||||
template class QCoreTextFontDatabaseEngineFactory<QFontEngineFT>;
|
template class QCoreTextFontDatabaseEngineFactory<QFontEngineFT>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family)
|
CTFontDescriptorRef descriptorForFamily(const QString &familyName)
|
||||||
|
{
|
||||||
|
return CTFontDescriptorCreateWithAttributes(CFDictionaryRef(@{
|
||||||
|
(id)kCTFontFamilyNameAttribute: familyName.toNSString()
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
CTFontDescriptorRef descriptorForFamily(const char *familyName)
|
||||||
|
{
|
||||||
|
return descriptorForFamily(QString::fromLatin1(familyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
CFArrayRef fallbacksForDescriptor(CTFontDescriptorRef descriptor)
|
||||||
|
{
|
||||||
|
QCFType<CTFontRef> font = CTFontCreateWithFontDescriptor(descriptor, 0.0, nullptr);
|
||||||
|
if (!font) {
|
||||||
|
qCWarning(lcQpaFonts) << "Failed to create fallback font for" << descriptor;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFArrayRef cascadeList = CFArrayRef(CTFontCopyDefaultCascadeListForLanguages(font,
|
||||||
|
(CFArrayRef)[NSUserDefaults.standardUserDefaults stringArrayForKey:@"AppleLanguages"]));
|
||||||
|
|
||||||
|
if (!cascadeList) {
|
||||||
|
qCWarning(lcQpaFonts) << "Failed to create fallback cascade list for" << descriptor;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cascadeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFArrayRef QCoreTextFontDatabase::fallbacksForFamily(const QString &family)
|
||||||
{
|
{
|
||||||
if (family.isEmpty())
|
if (family.isEmpty())
|
||||||
return QStringList();
|
return nullptr;
|
||||||
|
|
||||||
auto attributes = @{ id(kCTFontFamilyNameAttribute): family.toNSString() };
|
QCFType<CTFontDescriptorRef> fontDescriptor = descriptorForFamily(family);
|
||||||
QCFType<CTFontDescriptorRef> fontDescriptor = CTFontDescriptorCreateWithAttributes(CFDictionaryRef(attributes));
|
|
||||||
if (!fontDescriptor) {
|
if (!fontDescriptor) {
|
||||||
qCWarning(lcQpaFonts) << "Failed to create fallback font descriptor for" << family;
|
qCWarning(lcQpaFonts) << "Failed to create fallback font descriptor for" << family;
|
||||||
return QStringList();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QCFType<CTFontRef> font = CTFontCreateWithFontDescriptor(fontDescriptor, 12.0, 0);
|
// If the font is not available we want to fall back to the style hint.
|
||||||
if (!font) {
|
// By creating a matching font descriptor we can verify whether the font
|
||||||
qCWarning(lcQpaFonts) << "Failed to create fallback font for" << family;
|
// is available or not, and avoid CTFontCreateWithFontDescriptor picking
|
||||||
return QStringList();
|
// a default font for us based on incomplete information.
|
||||||
}
|
fontDescriptor = CTFontDescriptorCreateMatchingFontDescriptor(fontDescriptor, 0);
|
||||||
|
if (!fontDescriptor)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
QCFType<CFArrayRef> cascadeList = CFArrayRef(CTFontCopyDefaultCascadeListForLanguages(font,
|
return fallbacksForDescriptor(fontDescriptor);
|
||||||
(CFArrayRef)[NSUserDefaults.standardUserDefaults stringArrayForKey:@"AppleLanguages"]));
|
}
|
||||||
if (!cascadeList) {
|
|
||||||
qCWarning(lcQpaFonts) << "Failed to create fallback cascade list for" << family;
|
|
||||||
return QStringList();
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList fallbackList;
|
CTFontDescriptorRef descriptorForFontType(CTFontUIFontType uiType)
|
||||||
const int numCascades = CFArrayGetCount(cascadeList);
|
{
|
||||||
for (int i = 0; i < numCascades; ++i) {
|
static const CGFloat kDefaultSizeForRequestedUIType = 0.0;
|
||||||
CTFontDescriptorRef fontFallback = CTFontDescriptorRef(CFArrayGetValueAtIndex(cascadeList, i));
|
QCFType<CTFontRef> ctFont = CTFontCreateUIFontForLanguage(
|
||||||
QCFString fallbackFamilyName = CFStringRef(CTFontDescriptorCopyAttribute(fontFallback, kCTFontFamilyNameAttribute));
|
uiType, kDefaultSizeForRequestedUIType, nullptr);
|
||||||
fallbackList.append(QString::fromCFString(fallbackFamilyName));
|
return CTFontCopyFontDescriptor(ctFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fallbackList;
|
CTFontDescriptorRef descriptorForStyle(QFont::StyleHint styleHint)
|
||||||
|
{
|
||||||
|
switch (styleHint) {
|
||||||
|
case QFont::SansSerif: return descriptorForFamily("Helvetica");
|
||||||
|
case QFont::Serif: return descriptorForFamily("Times New Roman");
|
||||||
|
case QFont::Monospace: return descriptorForFamily("Menlo");
|
||||||
|
#ifdef Q_OS_MACOS
|
||||||
|
case QFont::Cursive: return descriptorForFamily("Apple Chancery");
|
||||||
|
#endif
|
||||||
|
case QFont::Fantasy: return descriptorForFamily("Zapfino");
|
||||||
|
case QFont::TypeWriter: return descriptorForFamily("American Typewriter");
|
||||||
|
case QFont::AnyStyle: Q_FALLTHROUGH();
|
||||||
|
case QFont::System: return descriptorForFontType(kCTFontUIFontSystem);
|
||||||
|
default: return nullptr; // No matching font on this platform
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
|
QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(style);
|
Q_UNUSED(style);
|
||||||
|
|
||||||
|
qCDebug(lcQpaFonts).nospace() << "Resolving fallbacks families for"
|
||||||
|
<< (!family.isEmpty() ? qPrintable(QLatin1String(" family '%1' with").arg(family)) : "")
|
||||||
|
<< " style hint " << styleHint;
|
||||||
|
|
||||||
QMacAutoReleasePool pool;
|
QMacAutoReleasePool pool;
|
||||||
|
|
||||||
QStringList fallbackList = fallbacksForFamily(family);
|
QStringList fallbackList;
|
||||||
|
|
||||||
if (fallbackList.isEmpty()) {
|
QCFType<CFArrayRef> fallbackFonts = fallbacksForFamily(family);
|
||||||
|
if (!fallbackFonts || !CFArrayGetCount(fallbackFonts)) {
|
||||||
// We were not able to find a fallback for the specific family,
|
// We were not able to find a fallback for the specific family,
|
||||||
// or the family was empty, so we fall back to the style hint.
|
// or the family was empty, so we fall back to the style hint.
|
||||||
QString styleFamily = [styleHint]{
|
if (!family.isEmpty())
|
||||||
switch (styleHint) {
|
qCDebug(lcQpaFonts) << "No fallbacks found. Using style hint instead";
|
||||||
case QFont::SansSerif: return QStringLiteral("Helvetica");
|
|
||||||
case QFont::Serif: return QStringLiteral("Times New Roman");
|
if (QCFType<CTFontDescriptorRef> styleDescriptor = descriptorForStyle(styleHint)) {
|
||||||
case QFont::Monospace: return QStringLiteral("Menlo");
|
CFMutableArrayRef tmp = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
|
||||||
#ifdef Q_OS_MACOS
|
CFArrayAppendValue(tmp, styleDescriptor);
|
||||||
case QFont::Cursive: return QStringLiteral("Apple Chancery");
|
QCFType<CFArrayRef> styleFallbacks = fallbacksForDescriptor(styleDescriptor);
|
||||||
#endif
|
CFArrayAppendArray(tmp, styleFallbacks, CFRangeMake(0, CFArrayGetCount(styleFallbacks)));
|
||||||
case QFont::Fantasy: return QStringLiteral("Zapfino");
|
fallbackFonts = tmp;
|
||||||
case QFont::TypeWriter: return QStringLiteral("American Typewriter");
|
|
||||||
case QFont::AnyStyle: Q_FALLTHROUGH();
|
|
||||||
case QFont::System: {
|
|
||||||
QCFType<CTFontRef> font = CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, 12.0, NULL);
|
|
||||||
return static_cast<QString>(QCFString(CTFontCopyFullName(font)));
|
|
||||||
}
|
|
||||||
default: return QString(); // No matching font on this platform
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
if (!styleFamily.isEmpty()) {
|
|
||||||
fallbackList = fallbacksForFamily(styleFamily);
|
|
||||||
if (!fallbackList.contains(styleFamily))
|
|
||||||
fallbackList.prepend(styleFamily);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fallbackList.isEmpty())
|
if (!fallbackFonts)
|
||||||
return fallbackList;
|
return fallbackList;
|
||||||
|
|
||||||
// .Apple Symbols Fallback will be at the beginning of the list and we will
|
const int numberOfFallbacks = CFArrayGetCount(fallbackFonts);
|
||||||
// detect that this has glyphs for Arabic and other writing systems.
|
for (int i = 0; i < numberOfFallbacks; ++i) {
|
||||||
// Since it is a symbol font, it should be the last resort, so that
|
auto fallbackDescriptor = CTFontDescriptorRef(CFArrayGetValueAtIndex(fallbackFonts, i));
|
||||||
// the proper fonts for these writing systems are preferred.
|
auto fallbackFamilyName = QCFString(CTFontDescriptorCopyAttribute(fallbackDescriptor, kCTFontFamilyNameAttribute));
|
||||||
int symbolIndex = fallbackList.indexOf(QLatin1String(".Apple Symbols Fallback"));
|
|
||||||
if (symbolIndex >= 0)
|
if (!isFamilyPopulated(fallbackFamilyName)) {
|
||||||
fallbackList.move(symbolIndex, fallbackList.size() - 1);
|
// We need to populate, or at least register the fallback fonts,
|
||||||
|
// otherwise the Qt font database may not know they exist.
|
||||||
|
if (isPrivateFontFamily(fallbackFamilyName))
|
||||||
|
const_cast<QCoreTextFontDatabase *>(this)->populateFromDescriptor(fallbackDescriptor);
|
||||||
|
else
|
||||||
|
registerFontFamily(fallbackFamilyName);
|
||||||
|
}
|
||||||
|
|
||||||
|
fallbackList.append(fallbackFamilyName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Some fallback fonts will have have an order in the list returned
|
||||||
|
// by Core Text that would indicate they should be preferred for e.g.
|
||||||
|
// Arabic, or Emoji, while in reality only supporting a tiny subset
|
||||||
|
// of the required glyphs, or representing them by question marks.
|
||||||
|
// Move these to the end, so that the proper fonts are preferred.
|
||||||
|
for (const char *family : { ".Apple Symbols Fallback", ".Noto Sans Universal" }) {
|
||||||
|
int index = fallbackList.indexOf(QLatin1String(family));
|
||||||
|
if (index >= 0)
|
||||||
|
fallbackList.move(index, fallbackList.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
// Since we are only returning a list of default fonts for the current language, we do not
|
// Since we are only returning a list of default fonts for the current language, we do not
|
||||||
@ -529,18 +583,11 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
|
|||||||
fallbackList.append(QStringLiteral("Apple Symbols"));
|
fallbackList.append(QStringLiteral("Apple Symbols"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Since iOS 13, the cascade list may contain meta-fonts which have not been
|
|
||||||
// populated to the database, such as ".AppleJapaneseFont". It is important that we
|
|
||||||
// include this in the fallback list, in order to get fallback support for all
|
|
||||||
// languages
|
|
||||||
for (const QString &fallback : fallbackList) {
|
|
||||||
if (!QPlatformFontDatabase::isFamilyPopulated(fallback))
|
|
||||||
const_cast<QCoreTextFontDatabase *>(this)->populateFamily(fallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern QStringList qt_sort_families_by_writing_system(QChar::Script, const QStringList &);
|
extern QStringList qt_sort_families_by_writing_system(QChar::Script, const QStringList &);
|
||||||
fallbackList = qt_sort_families_by_writing_system(script, fallbackList);
|
fallbackList = qt_sort_families_by_writing_system(script, fallbackList);
|
||||||
|
|
||||||
|
qCDebug(lcQpaFonts).nospace() << "Fallback families ordered by script " << script << ": " << fallbackList;
|
||||||
|
|
||||||
return fallbackList;
|
return fallbackList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,10 +747,8 @@ static CTFontDescriptorRef fontDescriptorFromTheme(QPlatformTheme::Font f)
|
|||||||
}
|
}
|
||||||
#endif // Q_OS_IOS, Q_OS_TVOS, Q_OS_WATCHOS
|
#endif // Q_OS_IOS, Q_OS_TVOS, Q_OS_WATCHOS
|
||||||
|
|
||||||
// OSX default case and iOS fallback case
|
// macOS default case and iOS fallback case
|
||||||
CTFontUIFontType fontType = fontTypeFromTheme(f);
|
return descriptorForFontType(fontTypeFromTheme(f));
|
||||||
QCFType<CTFontRef> ctFont = CTFontCreateUIFontForLanguage(fontType, 0.0, NULL);
|
|
||||||
return CTFontCopyFontDescriptor(ctFont);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QHash<QPlatformTheme::Font, QFont *> &QCoreTextFontDatabase::themeFonts() const
|
const QHash<QPlatformTheme::Font, QFont *> &QCoreTextFontDatabase::themeFonts() const
|
||||||
@ -736,8 +781,8 @@ QFont *QCoreTextFontDatabase::themeFont(QPlatformTheme::Font f) const
|
|||||||
QFont QCoreTextFontDatabase::defaultFont() const
|
QFont QCoreTextFontDatabase::defaultFont() const
|
||||||
{
|
{
|
||||||
if (defaultFontName.isEmpty()) {
|
if (defaultFontName.isEmpty()) {
|
||||||
QCFType<CTFontRef> font = CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, 12.0, NULL);
|
QCFType<CTFontDescriptorRef> systemFont = descriptorForFontType(kCTFontUIFontSystem);
|
||||||
defaultFontName = (QString) QCFString(CTFontCopyFullName(font));
|
defaultFontName = QCFString(CTFontDescriptorCopyAttribute(systemFont, kCTFontFamilyNameAttribute));
|
||||||
}
|
}
|
||||||
|
|
||||||
return QFont(defaultFontName);
|
return QFont(defaultFontName);
|
||||||
|
@ -92,7 +92,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName = QString());
|
void populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName = QString());
|
||||||
static QStringList fallbacksForFamily(const QString &family);
|
static CFArrayRef fallbacksForFamily(const QString &family);
|
||||||
|
|
||||||
mutable QString defaultFontName;
|
mutable QString defaultFontName;
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include <QtCore/QtEndian>
|
#include <QtCore/QtEndian>
|
||||||
#include <QtCore/QThreadStorage>
|
#include <QtCore/QThreadStorage>
|
||||||
#include <QtCore/private/qsystemlibrary_p.h>
|
#include <QtCore/private/qsystemlibrary_p.h>
|
||||||
|
#include <QtCore/private/qwinregistry_p.h>
|
||||||
|
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
@ -1210,33 +1211,8 @@ static int QT_WIN_CALLBACK populateFontFamilies(const LOGFONT *logFont, const TE
|
|||||||
|
|
||||||
void QWindowsFontDatabase::addDefaultEUDCFont()
|
void QWindowsFontDatabase::addDefaultEUDCFont()
|
||||||
{
|
{
|
||||||
QString path;
|
const QString path = QWinRegistryKey(HKEY_CURRENT_USER, LR"(EUDC\1252)")
|
||||||
{
|
.stringValue(L"SystemDefaultEUDCFont");
|
||||||
HKEY key;
|
|
||||||
if (RegOpenKeyEx(HKEY_CURRENT_USER,
|
|
||||||
L"EUDC\\1252",
|
|
||||||
0,
|
|
||||||
KEY_READ,
|
|
||||||
&key) != ERROR_SUCCESS) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
WCHAR value[MAX_PATH];
|
|
||||||
DWORD bufferSize = sizeof(value);
|
|
||||||
ZeroMemory(value, bufferSize);
|
|
||||||
|
|
||||||
if (RegQueryValueEx(key,
|
|
||||||
L"SystemDefaultEUDCFont",
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
reinterpret_cast<LPBYTE>(value),
|
|
||||||
&bufferSize) == ERROR_SUCCESS) {
|
|
||||||
path = QString::fromWCharArray(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
RegCloseKey(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!path.isEmpty()) {
|
if (!path.isEmpty()) {
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
@ -2105,28 +2081,6 @@ int QWindowsFontDatabase::defaultVerticalDPI()
|
|||||||
return vDPI;
|
return vDPI;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QWindowsFontDatabase::readRegistryString(HKEY parentHandle, const wchar_t *keyPath, const wchar_t *keyName)
|
|
||||||
{
|
|
||||||
QString result;
|
|
||||||
HKEY handle = 0;
|
|
||||||
if (RegOpenKeyEx(parentHandle, keyPath, 0, KEY_READ, &handle) == ERROR_SUCCESS) {
|
|
||||||
// get the size and type of the value
|
|
||||||
DWORD dataType;
|
|
||||||
DWORD dataSize;
|
|
||||||
if (RegQueryValueEx(handle, keyName, 0, &dataType, 0, &dataSize) == ERROR_SUCCESS) {
|
|
||||||
if (dataType == REG_SZ || dataType == REG_EXPAND_SZ) {
|
|
||||||
dataSize += 2; // '\0' missing?
|
|
||||||
QVarLengthArray<unsigned char> data(dataSize);
|
|
||||||
data[dataSize - 2] = data[dataSize - 1] = '\0';
|
|
||||||
if (RegQueryValueEx(handle, keyName, 0, 0, data.data(), &dataSize) == ERROR_SUCCESS)
|
|
||||||
result = QString::fromWCharArray(reinterpret_cast<const wchar_t *>(data.data()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RegCloseKey(handle);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QWindowsFontDatabase::isPrivateFontFamily(const QString &family) const
|
bool QWindowsFontDatabase::isPrivateFontFamily(const QString &family) const
|
||||||
{
|
{
|
||||||
return m_eudcFonts.contains(family) || QPlatformFontDatabase::isPrivateFontFamily(family);
|
return m_eudcFonts.contains(family) || QPlatformFontDatabase::isPrivateFontFamily(family);
|
||||||
|
@ -133,8 +133,6 @@ public:
|
|||||||
static void setFontOptions(unsigned options);
|
static void setFontOptions(unsigned options);
|
||||||
static unsigned fontOptions();
|
static unsigned fontOptions();
|
||||||
|
|
||||||
static QString readRegistryString(HKEY parentHandle, const wchar_t *keyPath, const wchar_t *keyName);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void removeApplicationFonts();
|
void removeApplicationFonts();
|
||||||
void addDefaultEUDCFont();
|
void addDefaultEUDCFont();
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
#include <private/qstringiterator_p.h>
|
#include <private/qstringiterator_p.h>
|
||||||
#include <QtCore/private/qsystemlibrary_p.h>
|
#include <QtCore/private/qsystemlibrary_p.h>
|
||||||
|
#include <QtCore/private/qwinregistry_p.h>
|
||||||
#include <QtGui/private/qguiapplication_p.h>
|
#include <QtGui/private/qguiapplication_p.h>
|
||||||
#include <qpa/qplatformintegration.h>
|
#include <qpa/qplatformintegration.h>
|
||||||
#include <QtGui/private/qhighdpiscaling_p.h>
|
#include <QtGui/private/qhighdpiscaling_p.h>
|
||||||
@ -945,10 +946,10 @@ void QWindowsFontEngineDirectWrite::initFontInfo(const QFontDef &request,
|
|||||||
|
|
||||||
QString QWindowsFontEngineDirectWrite::fontNameSubstitute(const QString &familyName)
|
QString QWindowsFontEngineDirectWrite::fontNameSubstitute(const QString &familyName)
|
||||||
{
|
{
|
||||||
const wchar_t key[] = L"Software\\Microsoft\\Windows NT\\CurrentVersion\\FontSubstitutes";
|
|
||||||
const QString substitute =
|
const QString substitute =
|
||||||
QWindowsFontDatabase::readRegistryString(HKEY_LOCAL_MACHINE, key,
|
QWinRegistryKey(HKEY_LOCAL_MACHINE,
|
||||||
reinterpret_cast<const wchar_t *>(familyName.utf16()));
|
LR"(Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes)")
|
||||||
|
.stringValue(familyName);
|
||||||
return substitute.isEmpty() ? familyName : substitute;
|
return substitute.isEmpty() ? familyName : substitute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,12 +62,11 @@ extern "C" { // Otherwise it won't find CWKeychain* symbols at link time
|
|||||||
#include <ifaddrs.h>
|
#include <ifaddrs.h>
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSListener) : NSObject <CWEventDelegate>
|
@interface QT_MANGLE_NAMESPACE(QNSListener) : NSObject <CWEventDelegate>
|
||||||
|
|
||||||
@property (assign) QCoreWlanEngine* engine;
|
@property (assign) QCoreWlanEngine* engine;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSListener);
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSListener) {
|
@implementation QNSListener {
|
||||||
NSNotificationCenter *notificationCenter;
|
NSNotificationCenter *notificationCenter;
|
||||||
CWWiFiClient *client;
|
CWWiFiClient *client;
|
||||||
QCoreWlanEngine *engine;
|
QCoreWlanEngine *engine;
|
||||||
@ -88,7 +87,7 @@ extern "C" { // Otherwise it won't find CWKeychain* symbols at link time
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QT_MANGLE_NAMESPACE(QNSListener) *listener = 0;
|
static QNSListener *listener = 0;
|
||||||
|
|
||||||
-(void)dealloc
|
-(void)dealloc
|
||||||
{
|
{
|
||||||
@ -415,7 +414,7 @@ void QCoreWlanEngine::initialize()
|
|||||||
QMacAutoReleasePool pool;
|
QMacAutoReleasePool pool;
|
||||||
|
|
||||||
if ([[CWWiFiClient interfaceNames] count] > 0 && !listener) {
|
if ([[CWWiFiClient interfaceNames] count] > 0 && !listener) {
|
||||||
listener = [[QT_MANGLE_NAMESPACE(QNSListener) alloc] init];
|
listener = [QNSListener alloc] init];
|
||||||
listener.engine = this;
|
listener.engine = this;
|
||||||
hasWifi = true;
|
hasWifi = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -44,9 +44,9 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <qpa/qplatformaccessibility.h>
|
#include <qpa/qplatformaccessibility.h>
|
||||||
|
|
||||||
#ifndef QT_NO_ACCESSIBILITY
|
#include "qcocoaaccessibilityelement.h"
|
||||||
|
|
||||||
@class QT_MANGLE_NAMESPACE(QMacAccessibilityElement);
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ namespace QCocoaAccessible {
|
|||||||
NSString *macRole(QAccessibleInterface *interface);
|
NSString *macRole(QAccessibleInterface *interface);
|
||||||
NSString *macSubrole(QAccessibleInterface *interface);
|
NSString *macSubrole(QAccessibleInterface *interface);
|
||||||
bool shouldBeIgnored(QAccessibleInterface *interface);
|
bool shouldBeIgnored(QAccessibleInterface *interface);
|
||||||
NSArray<QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *> *unignoredChildren(QAccessibleInterface *interface);
|
NSArray<QMacAccessibilityElement *> *unignoredChildren(QAccessibleInterface *interface);
|
||||||
NSString *getTranslatedAction(const QString &qtAction);
|
NSString *getTranslatedAction(const QString &qtAction);
|
||||||
QString translateAction(NSString *nsAction, QAccessibleInterface *interface);
|
QString translateAction(NSString *nsAction, QAccessibleInterface *interface);
|
||||||
bool hasValueAttribute(QAccessibleInterface *interface);
|
bool hasValueAttribute(QAccessibleInterface *interface);
|
||||||
|
@ -50,8 +50,6 @@
|
|||||||
|
|
||||||
#import <qaccessible.h>
|
#import <qaccessible.h>
|
||||||
|
|
||||||
@class QT_MANGLE_NAMESPACE(QMacAccessibilityElement);
|
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QMacAccessibilityElement) : NSObject <NSAccessibilityElement>
|
@interface QT_MANGLE_NAMESPACE(QMacAccessibilityElement) : NSObject <NSAccessibilityElement>
|
||||||
|
|
||||||
- (instancetype)initWithId:(QAccessible::Id)anId;
|
- (instancetype)initWithId:(QAccessible::Id)anId;
|
||||||
|
@ -144,7 +144,7 @@ static void qt_maybeSendKeyEquivalentUpEvent(NSEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSApplication)
|
@implementation QNSApplication
|
||||||
|
|
||||||
- (void)QT_MANGLE_NAMESPACE(qt_sendEvent_original):(NSEvent *)event
|
- (void)QT_MANGLE_NAMESPACE(qt_sendEvent_original):(NSEvent *)event
|
||||||
{
|
{
|
||||||
@ -188,7 +188,7 @@ void qt_redirectNSApplicationSendEvent()
|
|||||||
// can be unloaded.
|
// can be unloaded.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ([NSApp isMemberOfClass:[QT_MANGLE_NAMESPACE(QNSApplication) class]]) {
|
if ([NSApp isMemberOfClass:[QNSApplication class]]) {
|
||||||
// No need to change implementation since Qt
|
// No need to change implementation since Qt
|
||||||
// already controls a subclass of NSApplication
|
// already controls a subclass of NSApplication
|
||||||
return;
|
return;
|
||||||
@ -201,7 +201,7 @@ void qt_redirectNSApplicationSendEvent()
|
|||||||
qt_cocoa_change_implementation(
|
qt_cocoa_change_implementation(
|
||||||
[NSApplication class],
|
[NSApplication class],
|
||||||
@selector(sendEvent:),
|
@selector(sendEvent:),
|
||||||
[QT_MANGLE_NAMESPACE(QNSApplication) class],
|
[QNSApplication class],
|
||||||
@selector(QT_MANGLE_NAMESPACE(qt_sendEvent_replacement):),
|
@selector(QT_MANGLE_NAMESPACE(qt_sendEvent_replacement):),
|
||||||
@selector(QT_MANGLE_NAMESPACE(qt_sendEvent_original):));
|
@selector(QT_MANGLE_NAMESPACE(qt_sendEvent_original):));
|
||||||
}
|
}
|
||||||
|
@ -89,8 +89,7 @@
|
|||||||
|
|
||||||
#include <qglobal.h>
|
#include <qglobal.h>
|
||||||
#include <private/qcore_mac_p.h>
|
#include <private/qcore_mac_p.h>
|
||||||
|
#include "qcocoansmenu.h"
|
||||||
Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QCocoaNSMenuItem));
|
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) : NSObject <NSApplicationDelegate>
|
@interface QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) : NSObject <NSApplicationDelegate>
|
||||||
@property (nonatomic, retain) NSMenu *dockMenu;
|
@property (nonatomic, retain) NSMenu *dockMenu;
|
||||||
@ -100,8 +99,9 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QCocoaNSMenuItem));
|
|||||||
- (bool)inLaunch;
|
- (bool)inLaunch;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) (MenuAPI)
|
QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaApplicationDelegate);
|
||||||
- (void)qt_itemFired:(QT_MANGLE_NAMESPACE(QCocoaNSMenuItem) *)item;
|
|
||||||
|
@interface QCocoaApplicationDelegate (MenuAPI)
|
||||||
|
- (void)qt_itemFired:(QCocoaNSMenuItem *)item;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaApplicationDelegate);
|
|
||||||
|
@ -145,7 +145,7 @@ QT_USE_NAMESPACE
|
|||||||
[[NSApp mainMenu] cancelTracking];
|
[[NSApp mainMenu] cancelTracking];
|
||||||
|
|
||||||
bool handle_quit = true;
|
bool handle_quit = true;
|
||||||
NSMenuItem *quitMenuItem = [[QT_MANGLE_NAMESPACE(QCocoaMenuLoader) sharedMenuLoader] quitMenuItem];
|
NSMenuItem *quitMenuItem = [[QCocoaMenuLoader sharedMenuLoader] quitMenuItem];
|
||||||
if (!QGuiApplicationPrivate::instance()->modalWindowList.isEmpty()
|
if (!QGuiApplicationPrivate::instance()->modalWindowList.isEmpty()
|
||||||
&& [quitMenuItem isEnabled]) {
|
&& [quitMenuItem isEnabled]) {
|
||||||
int visible = 0;
|
int visible = 0;
|
||||||
|
@ -293,7 +293,7 @@ class QCocoaColorPanel
|
|||||||
public:
|
public:
|
||||||
QCocoaColorPanel()
|
QCocoaColorPanel()
|
||||||
{
|
{
|
||||||
mDelegate = [[QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) alloc] init];
|
mDelegate = [[QNSColorPanelDelegate alloc] init];
|
||||||
}
|
}
|
||||||
|
|
||||||
~QCocoaColorPanel()
|
~QCocoaColorPanel()
|
||||||
@ -366,7 +366,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *mDelegate;
|
QNSColorPanelDelegate *mDelegate;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(QCocoaColorPanel, sharedColorPanel)
|
Q_GLOBAL_STATIC(QCocoaColorPanel, sharedColorPanel)
|
||||||
|
@ -43,10 +43,16 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QtWidgets/qtwidgetsglobal.h>
|
#include <QtWidgets/qtwidgetsglobal.h>
|
||||||
#include <qpa/qplatformdialoghelper.h>
|
#include <qpa/qplatformdialoghelper.h>
|
||||||
|
#include <QtCore/private/qcore_mac_p.h>
|
||||||
|
|
||||||
|
#import <AppKit/NSSavePanel.h>
|
||||||
|
|
||||||
QT_REQUIRE_CONFIG(filedialog);
|
QT_REQUIRE_CONFIG(filedialog);
|
||||||
|
|
||||||
Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate));
|
@interface QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) : NSObject<NSOpenSavePanelDelegate>
|
||||||
|
@end
|
||||||
|
|
||||||
|
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate);
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -84,7 +90,7 @@ public:
|
|||||||
void QNSOpenSavePanelDelegate_filterSelected(int menuIndex);
|
void QNSOpenSavePanelDelegate_filterSelected(int menuIndex);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *mDelegate;
|
QNSOpenSavePanelDelegate *mDelegate;
|
||||||
QUrl mDir;
|
QUrl mDir;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -76,27 +76,6 @@ QT_USE_NAMESPACE
|
|||||||
|
|
||||||
typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
|
typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate)
|
|
||||||
: NSObject<NSOpenSavePanelDelegate>
|
|
||||||
|
|
||||||
- (NSString *)strip:(const QString &)label;
|
|
||||||
- (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url;
|
|
||||||
- (void)filterChanged:(id)sender;
|
|
||||||
- (void)showModelessPanel;
|
|
||||||
- (BOOL)runApplicationModalPanel;
|
|
||||||
- (void)showWindowModalSheet:(QWindow *)docWidget;
|
|
||||||
- (void)updateProperties;
|
|
||||||
- (QStringList)acceptableExtensionsForSave;
|
|
||||||
- (QString)removeExtensions:(const QString &)filter;
|
|
||||||
- (void)createTextField;
|
|
||||||
- (void)createPopUpButton:(const QString &)selectedFilter hideDetails:(BOOL)hideDetails;
|
|
||||||
- (QStringList)findStrippedFilterWithVisualFilterName:(QString)name;
|
|
||||||
- (void)createAccessory;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate);
|
|
||||||
|
|
||||||
@implementation QNSOpenSavePanelDelegate {
|
@implementation QNSOpenSavePanelDelegate {
|
||||||
@public
|
@public
|
||||||
NSOpenPanel *mOpenPanel;
|
NSOpenPanel *mOpenPanel;
|
||||||
|
@ -283,7 +283,7 @@ class QCocoaFontPanel
|
|||||||
public:
|
public:
|
||||||
QCocoaFontPanel()
|
QCocoaFontPanel()
|
||||||
{
|
{
|
||||||
mDelegate = [[QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) alloc] init];
|
mDelegate = [[QNSFontPanelDelegate alloc] init];
|
||||||
}
|
}
|
||||||
|
|
||||||
~QCocoaFontPanel()
|
~QCocoaFontPanel()
|
||||||
@ -356,7 +356,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) *mDelegate;
|
QNSFontPanelDelegate *mDelegate;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(QCocoaFontPanel, sharedFontPanel)
|
Q_GLOBAL_STATIC(QCocoaFontPanel, sharedFontPanel)
|
||||||
|
@ -44,8 +44,7 @@
|
|||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
#include <qpa/qplatformmenu.h>
|
#include <qpa/qplatformmenu.h>
|
||||||
#include "qcocoamenuitem.h"
|
#include "qcocoamenuitem.h"
|
||||||
|
#include "qcocoansmenu.h"
|
||||||
Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QCocoaNSMenu));
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -107,7 +106,7 @@ private:
|
|||||||
void scheduleUpdate();
|
void scheduleUpdate();
|
||||||
|
|
||||||
QList<QCocoaMenuItem *> m_menuItems;
|
QList<QCocoaMenuItem *> m_menuItems;
|
||||||
QT_MANGLE_NAMESPACE(QCocoaNSMenu) *m_nativeMenu;
|
QCocoaNSMenu *m_nativeMenu;
|
||||||
NSMenuItem *m_attachedItem;
|
NSMenuItem *m_attachedItem;
|
||||||
int m_updateTimer;
|
int m_updateTimer;
|
||||||
bool m_enabled:1;
|
bool m_enabled:1;
|
||||||
|
@ -278,12 +278,11 @@ void QCocoaMenuBar::updateMenuBarImmediately()
|
|||||||
// we still have to update the menubar.
|
// we still have to update the menubar.
|
||||||
if ((win->flags() & Qt::WindowType_Mask) != Qt::Tool)
|
if ((win->flags() & Qt::WindowType_Mask) != Qt::Tool)
|
||||||
return;
|
return;
|
||||||
typedef QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) AppDelegate;
|
|
||||||
NSApplication *app = [NSApplication sharedApplication];
|
NSApplication *app = [NSApplication sharedApplication];
|
||||||
if (![app.delegate isKindOfClass:[AppDelegate class]])
|
if (![app.delegate isKindOfClass:[QCocoaApplicationDelegate class]])
|
||||||
return;
|
return;
|
||||||
// We apply this logic _only_ during the startup.
|
// We apply this logic _only_ during the startup.
|
||||||
AppDelegate *appDelegate = app.delegate;
|
QCocoaApplicationDelegate *appDelegate = app.delegate;
|
||||||
if (!appDelegate.inLaunch)
|
if (!appDelegate.inLaunch)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -403,3 +402,4 @@ QCocoaWindow *QCocoaMenuBar::cocoaWindow() const
|
|||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#include "moc_qcocoamenubar.cpp"
|
||||||
|
@ -59,31 +59,20 @@ QT_FORWARD_DECLARE_CLASS(QCocoaMenu);
|
|||||||
QT_FORWARD_DECLARE_CLASS(QCocoaMenuItem);
|
QT_FORWARD_DECLARE_CLASS(QCocoaMenuItem);
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QCocoaNSMenuDelegate) : NSObject <NSMenuDelegate>
|
@interface QT_MANGLE_NAMESPACE(QCocoaNSMenuDelegate) : NSObject <NSMenuDelegate>
|
||||||
|
|
||||||
+ (instancetype)sharedMenuDelegate;
|
+ (instancetype)sharedMenuDelegate;
|
||||||
|
- (NSMenuItem *)findItemInMenu:(NSMenu *)menu forKey:(NSString *)key modifiers:(NSUInteger)modifiers;
|
||||||
- (NSMenuItem *)findItemInMenu:(NSMenu *)menu
|
|
||||||
forKey:(NSString *)key
|
|
||||||
modifiers:(NSUInteger)modifiers;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QCocoaNSMenu) : NSMenu
|
@interface QT_MANGLE_NAMESPACE(QCocoaNSMenu) : NSMenu
|
||||||
|
|
||||||
@property (readonly, nonatomic) QCocoaMenu *platformMenu;
|
@property (readonly, nonatomic) QCocoaMenu *platformMenu;
|
||||||
|
|
||||||
- (instancetype)initWithPlatformMenu:(QCocoaMenu *)menu;
|
- (instancetype)initWithPlatformMenu:(QCocoaMenu *)menu;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QCocoaNSMenuItem) : NSMenuItem
|
@interface QT_MANGLE_NAMESPACE(QCocoaNSMenuItem) : NSMenuItem
|
||||||
|
|
||||||
@property (nonatomic) QCocoaMenuItem *platformMenuItem;
|
@property (nonatomic) QCocoaMenuItem *platformMenuItem;
|
||||||
|
|
||||||
+ (instancetype)separatorItemWithPlatformMenuItem:(QCocoaMenuItem *)menuItem;
|
+ (instancetype)separatorItemWithPlatformMenuItem:(QCocoaMenuItem *)menuItem;
|
||||||
- (instancetype)initWithPlatformMenuItem:(QCocoaMenuItem *)menuItem;
|
- (instancetype)initWithPlatformMenuItem:(QCocoaMenuItem *)menuItem;
|
||||||
- (instancetype)init;
|
- (instancetype)init;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaNSMenu);
|
QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaNSMenu);
|
||||||
|
@ -80,6 +80,8 @@
|
|||||||
#include <qimagewriter.h>
|
#include <qimagewriter.h>
|
||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
|
|
||||||
|
#include <QtCore/private/qcore_mac_p.h>
|
||||||
|
|
||||||
#include "qcocoamenu.h"
|
#include "qcocoamenu.h"
|
||||||
|
|
||||||
#include "qt_mac_p.h"
|
#include "qt_mac_p.h"
|
||||||
@ -92,8 +94,6 @@
|
|||||||
|
|
||||||
QT_USE_NAMESPACE
|
QT_USE_NAMESPACE
|
||||||
|
|
||||||
@class QT_MANGLE_NAMESPACE(QNSImageView);
|
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject <NSUserNotificationCenterDelegate>
|
@interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject <NSUserNotificationCenterDelegate>
|
||||||
@property (nonatomic, assign) QCocoaMenu *menu;
|
@property (nonatomic, assign) QCocoaMenu *menu;
|
||||||
@property (nonatomic, assign) QIcon icon;
|
@property (nonatomic, assign) QIcon icon;
|
||||||
@ -104,12 +104,13 @@ QT_USE_NAMESPACE
|
|||||||
- (void)doubleClickSelector:(id)sender;
|
- (void)doubleClickSelector:(id)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSStatusItem);
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSImageView) : NSImageView
|
@interface QT_MANGLE_NAMESPACE(QNSImageView) : NSImageView
|
||||||
@property (nonatomic, assign) BOOL down;
|
@property (nonatomic, assign) BOOL down;
|
||||||
@property (nonatomic, assign) QT_MANGLE_NAMESPACE(QNSStatusItem) *parent;
|
@property (nonatomic, assign) QNSStatusItem *parent;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSStatusItem);
|
|
||||||
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSImageView);
|
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSImageView);
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@ -364,7 +365,7 @@ QT_END_NAMESPACE
|
|||||||
@implementation QNSStatusItem {
|
@implementation QNSStatusItem {
|
||||||
QCocoaSystemTrayIcon *systray;
|
QCocoaSystemTrayIcon *systray;
|
||||||
NSStatusItem *item;
|
NSStatusItem *item;
|
||||||
QT_MANGLE_NAMESPACE(QNSImageView) *imageCell;
|
QNSImageView *imageCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
@synthesize menu = menu;
|
@synthesize menu = menu;
|
||||||
|
@ -43,8 +43,6 @@
|
|||||||
#include <QtCore/QHash>
|
#include <QtCore/QHash>
|
||||||
#include <qpa/qplatformtheme.h>
|
#include <qpa/qplatformtheme.h>
|
||||||
|
|
||||||
Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QCocoaThemeAppAppearanceObserver));
|
|
||||||
|
|
||||||
#include <QtCore/private/qcore_mac_p.h>
|
#include <QtCore/private/qcore_mac_p.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
@ -51,37 +51,30 @@ class QCocoaGLContext;
|
|||||||
class QPointF;
|
class QPointF;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
|
|
||||||
Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QCocoaNSMenuItem));
|
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSView) : NSView
|
@interface QT_MANGLE_NAMESPACE(QNSView) : NSView
|
||||||
|
|
||||||
@property (nonatomic, retain) NSCursor *cursor;
|
@property (nonatomic, retain) NSCursor *cursor;
|
||||||
|
|
||||||
- (instancetype)initWithCocoaWindow:(QCocoaWindow *)platformWindow;
|
- (instancetype)initWithCocoaWindow:(QCocoaWindow *)platformWindow;
|
||||||
|
|
||||||
- (void)convertFromScreen:(NSPoint)mouseLocation toWindowPoint:(QPointF *)qtWindowPoint andScreenPoint:(QPointF *)qtScreenPoint;
|
- (void)convertFromScreen:(NSPoint)mouseLocation toWindowPoint:(QPointF *)qtWindowPoint andScreenPoint:(QPointF *)qtScreenPoint;
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSView) (MouseAPI)
|
|
||||||
- (void)handleFrameStrutMouseEvent:(NSEvent *)theEvent;
|
|
||||||
- (void)resetMouseButtons;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSView) (KeysAPI)
|
|
||||||
+ (Qt::KeyboardModifiers)convertKeyModifiers:(ulong)modifierFlags;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSView) (ComplexTextAPI)
|
|
||||||
- (void)unmarkText;
|
|
||||||
- (void)cancelComposingText;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSView) (QtExtras)
|
|
||||||
@property (nonatomic, readonly) QCocoaWindow *platformWindow;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSView);
|
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSView);
|
||||||
|
|
||||||
|
@interface QNSView (MouseAPI)
|
||||||
|
- (void)handleFrameStrutMouseEvent:(NSEvent *)theEvent;
|
||||||
|
- (void)resetMouseButtons;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface QNSView (KeysAPI)
|
||||||
|
+ (Qt::KeyboardModifiers)convertKeyModifiers:(ulong)modifierFlags;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface QNSView (ComplexTextAPI)
|
||||||
|
- (void)unmarkText;
|
||||||
|
- (void)cancelComposingText;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface QNSView (QtExtras)
|
||||||
|
@property (nonatomic, readonly) QCocoaWindow *platformWindow;
|
||||||
|
@end
|
||||||
|
|
||||||
#endif //QNSVIEW_H
|
#endif //QNSVIEW_H
|
||||||
|
@ -66,13 +66,13 @@
|
|||||||
#include "qcocoaintegration.h"
|
#include "qcocoaintegration.h"
|
||||||
|
|
||||||
// Private interface
|
// Private interface
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSView) ()
|
@interface QNSView ()
|
||||||
- (BOOL)isTransparentForUserInput;
|
- (BOOL)isTransparentForUserInput;
|
||||||
@property (assign) NSView* previousSuperview;
|
@property (assign) NSView* previousSuperview;
|
||||||
@property (assign) NSWindow* previousWindow;
|
@property (assign) NSWindow* previousWindow;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSView) (Drawing) <CALayerDelegate>
|
@interface QNSView (Drawing) <CALayerDelegate>
|
||||||
- (void)initDrawing;
|
- (void)initDrawing;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -84,7 +84,9 @@
|
|||||||
- (void)cursorUpdate:(NSEvent *)theEvent;
|
- (void)cursorUpdate:(NSEvent *)theEvent;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSView) (Mouse)
|
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSViewMouseMoveHelper);
|
||||||
|
|
||||||
|
@interface QNSView (Mouse)
|
||||||
- (void)initMouse;
|
- (void)initMouse;
|
||||||
- (NSPoint)screenMousePoint:(NSEvent *)theEvent;
|
- (NSPoint)screenMousePoint:(NSEvent *)theEvent;
|
||||||
- (void)mouseMovedImpl:(NSEvent *)theEvent;
|
- (void)mouseMovedImpl:(NSEvent *)theEvent;
|
||||||
@ -92,28 +94,28 @@
|
|||||||
- (void)mouseExitedImpl:(NSEvent *)theEvent;
|
- (void)mouseExitedImpl:(NSEvent *)theEvent;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSView) (Touch)
|
@interface QNSView (Touch)
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSView) (Tablet)
|
@interface QNSView (Tablet)
|
||||||
- (bool)handleTabletEvent:(NSEvent *)theEvent;
|
- (bool)handleTabletEvent:(NSEvent *)theEvent;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSView) (Gestures)
|
@interface QNSView (Gestures)
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSView) (Dragging)
|
@interface QNSView (Dragging)
|
||||||
-(void)registerDragTypes;
|
-(void)registerDragTypes;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSView) (Keys)
|
@interface QNSView (Keys)
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSView) (ComplexText) <NSTextInputClient>
|
@interface QNSView (ComplexText) <NSTextInputClient>
|
||||||
- (void)textInputContextKeyboardSelectionDidChangeNotification:(NSNotification *)textInputContextKeyboardSelectionDidChangeNotification;
|
- (void)textInputContextKeyboardSelectionDidChangeNotification:(NSNotification *)textInputContextKeyboardSelectionDidChangeNotification;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView) {
|
@implementation QNSView {
|
||||||
QPointer<QCocoaWindow> m_platformWindow;
|
QPointer<QCocoaWindow> m_platformWindow;
|
||||||
Qt::MouseButtons m_buttons;
|
Qt::MouseButtons m_buttons;
|
||||||
Qt::MouseButtons m_acceptedMouseDowns;
|
Qt::MouseButtons m_acceptedMouseDowns;
|
||||||
@ -125,7 +127,7 @@
|
|||||||
bool m_sendUpAsRightButton;
|
bool m_sendUpAsRightButton;
|
||||||
Qt::KeyboardModifiers m_currentWheelModifiers;
|
Qt::KeyboardModifiers m_currentWheelModifiers;
|
||||||
NSString *m_inputSource;
|
NSString *m_inputSource;
|
||||||
QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) *m_mouseMoveHelper;
|
QNSViewMouseMoveHelper *m_mouseMoveHelper;
|
||||||
bool m_resendKeyEvent;
|
bool m_resendKeyEvent;
|
||||||
bool m_scrolling;
|
bool m_scrolling;
|
||||||
bool m_updatingDrag;
|
bool m_updatingDrag;
|
||||||
@ -379,7 +381,7 @@
|
|||||||
|
|
||||||
// -----------------------------------------------------
|
// -----------------------------------------------------
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView) (QtExtras)
|
@implementation QNSView (QtExtras)
|
||||||
|
|
||||||
- (QCocoaWindow*)platformWindow
|
- (QCocoaWindow*)platformWindow
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
#import <AppKit/NSAccessibility.h>
|
#import <AppKit/NSAccessibility.h>
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView) (Accessibility)
|
@implementation QNSView (Accessibility)
|
||||||
|
|
||||||
- (id)childAccessibleElement
|
- (id)childAccessibleElement
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
// This file is included from qnsview.mm, and only used to organize the code
|
// This file is included from qnsview.mm, and only used to organize the code
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView) (ComplexTextAPI)
|
@implementation QNSView (ComplexTextAPI)
|
||||||
|
|
||||||
- (void)cancelComposingText
|
- (void)cancelComposingText
|
||||||
{
|
{
|
||||||
@ -80,7 +80,7 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView) (ComplexText)
|
@implementation QNSView (ComplexText)
|
||||||
|
|
||||||
- (void)insertNewline:(id)sender
|
- (void)insertNewline:(id)sender
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
// This file is included from qnsview.mm, and only used to organize the code
|
// This file is included from qnsview.mm, and only used to organize the code
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView) (Dragging)
|
@implementation QNSView (Dragging)
|
||||||
|
|
||||||
-(void)registerDragTypes
|
-(void)registerDragTypes
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
// This file is included from qnsview.mm, and only used to organize the code
|
// This file is included from qnsview.mm, and only used to organize the code
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView) (Drawing)
|
@implementation QNSView (Drawing)
|
||||||
|
|
||||||
- (void)initDrawing
|
- (void)initDrawing
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
Q_LOGGING_CATEGORY(lcQpaGestures, "qt.qpa.input.gestures")
|
Q_LOGGING_CATEGORY(lcQpaGestures, "qt.qpa.input.gestures")
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView) (Gestures)
|
@implementation QNSView (Gestures)
|
||||||
|
|
||||||
- (bool)handleGestureAsBeginEnd:(NSEvent *)event
|
- (bool)handleGestureAsBeginEnd:(NSEvent *)event
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
// This file is included from qnsview.mm, and only used to organize the code
|
// This file is included from qnsview.mm, and only used to organize the code
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView) (KeysAPI)
|
@implementation QNSView (KeysAPI)
|
||||||
|
|
||||||
+ (Qt::KeyboardModifiers)convertKeyModifiers:(ulong)modifierFlags
|
+ (Qt::KeyboardModifiers)convertKeyModifiers:(ulong)modifierFlags
|
||||||
{
|
{
|
||||||
@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView) (Keys)
|
@implementation QNSView (Keys)
|
||||||
|
|
||||||
- (int)convertKeyCode:(QChar)keyChar
|
- (int)convertKeyCode:(QChar)keyChar
|
||||||
{
|
{
|
||||||
|
@ -53,11 +53,11 @@ static bool selectorIsCutCopyPaste(SEL selector)
|
|||||||
|| selector == @selector(selectAll:));
|
|| selector == @selector(selectAll:));
|
||||||
}
|
}
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSView) (Menus)
|
@interface QNSView (Menus)
|
||||||
- (void)qt_itemFired:(QCocoaNSMenuItem *)item;
|
- (void)qt_itemFired:(QCocoaNSMenuItem *)item;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView) (Menus)
|
@implementation QNSView (Menus)
|
||||||
|
|
||||||
- (BOOL)validateMenuItem:(NSMenuItem*)item
|
- (BOOL)validateMenuItem:(NSMenuItem*)item
|
||||||
{
|
{
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
interact with the responder chain by e.g. calling super if Qt does not
|
interact with the responder chain by e.g. calling super if Qt does not
|
||||||
accept the mouse event
|
accept the mouse event
|
||||||
*/
|
*/
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) {
|
@implementation QNSViewMouseMoveHelper {
|
||||||
QNSView *view;
|
QNSView *view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView) (MouseAPI)
|
@implementation QNSView (MouseAPI)
|
||||||
|
|
||||||
- (void)resetMouseButtons
|
- (void)resetMouseButtons
|
||||||
{
|
{
|
||||||
@ -178,7 +178,7 @@
|
|||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView) (Mouse)
|
@implementation QNSView (Mouse)
|
||||||
|
|
||||||
- (void)initMouse
|
- (void)initMouse
|
||||||
{
|
{
|
||||||
@ -193,7 +193,7 @@
|
|||||||
m_dontOverrideCtrlLMB = qt_mac_resolveOption(false, m_platformWindow->window(),
|
m_dontOverrideCtrlLMB = qt_mac_resolveOption(false, m_platformWindow->window(),
|
||||||
"_q_platform_MacDontOverrideCtrlLMB", "QT_MAC_DONT_OVERRIDE_CTRL_LMB");
|
"_q_platform_MacDontOverrideCtrlLMB", "QT_MAC_DONT_OVERRIDE_CTRL_LMB");
|
||||||
|
|
||||||
m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self];
|
m_mouseMoveHelper = [[QNSViewMouseMoveHelper alloc] initWithView:self];
|
||||||
|
|
||||||
NSUInteger trackingOptions = NSTrackingActiveInActiveApp
|
NSUInteger trackingOptions = NSTrackingActiveInActiveApp
|
||||||
| NSTrackingMouseEnteredAndExited | NSTrackingCursorUpdate;
|
| NSTrackingMouseEnteredAndExited | NSTrackingCursorUpdate;
|
||||||
|
@ -54,7 +54,7 @@ struct QCocoaTabletDeviceData
|
|||||||
typedef QHash<uint, QCocoaTabletDeviceData> QCocoaTabletDeviceDataHash;
|
typedef QHash<uint, QCocoaTabletDeviceData> QCocoaTabletDeviceDataHash;
|
||||||
Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash)
|
Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash)
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView) (Tablet)
|
@implementation QNSView (Tablet)
|
||||||
|
|
||||||
- (bool)handleTabletEvent:(NSEvent *)theEvent
|
- (bool)handleTabletEvent:(NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
Q_LOGGING_CATEGORY(lcQpaTouch, "qt.qpa.input.touch")
|
Q_LOGGING_CATEGORY(lcQpaTouch, "qt.qpa.input.touch")
|
||||||
|
|
||||||
@implementation QT_MANGLE_NAMESPACE(QNSView) (Touch)
|
@implementation QNSView (Touch)
|
||||||
|
|
||||||
- (bool)shouldSendSingleTouch
|
- (bool)shouldSendSingleTouch
|
||||||
{
|
{
|
||||||
|
@ -64,11 +64,7 @@
|
|||||||
|
|
||||||
#include "qpaintengine_mac_p.h"
|
#include "qpaintengine_mac_p.h"
|
||||||
|
|
||||||
#ifdef __OBJC__
|
Q_FORWARD_DECLARE_OBJC_CLASS(NSPrintInfo);
|
||||||
@class NSPrintInfo;
|
|
||||||
#else
|
|
||||||
typedef void NSPrintInfo;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@
|
|||||||
#include <QtCore/qscopedpointer.h>
|
#include <QtCore/qscopedpointer.h>
|
||||||
#include <QtCore/quuid.h>
|
#include <QtCore/quuid.h>
|
||||||
#include <QtCore/private/qsystemlibrary_p.h>
|
#include <QtCore/private/qsystemlibrary_p.h>
|
||||||
|
#include <QtCore/private/qwinregistry_p.h>
|
||||||
|
|
||||||
#include <QtEventDispatcherSupport/private/qwindowsguieventdispatcher_p.h>
|
#include <QtEventDispatcherSupport/private/qwindowsguieventdispatcher_p.h>
|
||||||
|
|
||||||
@ -1518,28 +1519,13 @@ QTouchDevice *QWindowsContext::touchDevice() const
|
|||||||
d->m_pointerHandler.touchDevice() : d->m_mouseHandler.touchDevice();
|
d->m_pointerHandler.touchDevice() : d->m_mouseHandler.touchDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD readDwordRegistrySetting(const wchar_t *regKey, const wchar_t *subKey, DWORD defaultValue)
|
|
||||||
{
|
|
||||||
DWORD result = defaultValue;
|
|
||||||
HKEY handle;
|
|
||||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, regKey, 0, KEY_READ, &handle) == ERROR_SUCCESS) {
|
|
||||||
DWORD type;
|
|
||||||
if (RegQueryValueEx(handle, subKey, nullptr, &type, nullptr, nullptr) == ERROR_SUCCESS
|
|
||||||
&& type == REG_DWORD) {
|
|
||||||
DWORD value;
|
|
||||||
DWORD size = sizeof(result);
|
|
||||||
if (RegQueryValueEx(handle, subKey, nullptr, nullptr, reinterpret_cast<unsigned char *>(&value), &size) == ERROR_SUCCESS)
|
|
||||||
result = value;
|
|
||||||
}
|
|
||||||
RegCloseKey(handle);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD QWindowsContext::readAdvancedExplorerSettings(const wchar_t *subKey, DWORD defaultValue)
|
DWORD QWindowsContext::readAdvancedExplorerSettings(const wchar_t *subKey, DWORD defaultValue)
|
||||||
{
|
{
|
||||||
return readDwordRegistrySetting(L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
const auto value =
|
||||||
subKey, defaultValue);
|
QWinRegistryKey(HKEY_CURRENT_USER,
|
||||||
|
LR"(Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced)")
|
||||||
|
.dwordValue(subKey);
|
||||||
|
return value.second ? value.first : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool isEmptyRect(const RECT &rect)
|
static inline bool isEmptyRect(const RECT &rect)
|
||||||
|
@ -45,6 +45,8 @@
|
|||||||
#include <QtCore/qdebug.h>
|
#include <QtCore/qdebug.h>
|
||||||
#include <QtCore/qdir.h>
|
#include <QtCore/qdir.h>
|
||||||
|
|
||||||
|
#include <QtCore/private/qwinregistry_p.h>
|
||||||
|
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <intshcut.h>
|
#include <intshcut.h>
|
||||||
|
|
||||||
@ -78,35 +80,24 @@ static inline QString mailCommand()
|
|||||||
|
|
||||||
const wchar_t mailUserKey[] = L"Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\mailto\\UserChoice";
|
const wchar_t mailUserKey[] = L"Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\mailto\\UserChoice";
|
||||||
|
|
||||||
wchar_t command[MAX_PATH] = {0};
|
|
||||||
// Check if user has set preference, otherwise use default.
|
// Check if user has set preference, otherwise use default.
|
||||||
HKEY handle;
|
QString keyName = QWinRegistryKey(HKEY_CURRENT_USER, mailUserKey)
|
||||||
QString keyName;
|
.stringValue( L"Progid");
|
||||||
if (!RegOpenKeyEx(HKEY_CURRENT_USER, mailUserKey, 0, KEY_READ, &handle)) {
|
|
||||||
DWORD bufferSize = BufferSize;
|
|
||||||
if (!RegQueryValueEx(handle, L"Progid", nullptr, nullptr, reinterpret_cast<unsigned char*>(command), &bufferSize))
|
|
||||||
keyName = QString::fromWCharArray(command);
|
|
||||||
RegCloseKey(handle);
|
|
||||||
}
|
|
||||||
const QLatin1String mailto = keyName.isEmpty() ? QLatin1String("mailto") : QLatin1String();
|
const QLatin1String mailto = keyName.isEmpty() ? QLatin1String("mailto") : QLatin1String();
|
||||||
keyName += mailto + QLatin1String("\\Shell\\Open\\Command");
|
keyName += mailto + QLatin1String("\\Shell\\Open\\Command");
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << __FUNCTION__ << "keyName=" << keyName;
|
qDebug() << __FUNCTION__ << "keyName=" << keyName;
|
||||||
command[0] = 0;
|
const QString command = QWinRegistryKey(HKEY_CLASSES_ROOT, keyName).stringValue(L"");
|
||||||
if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, reinterpret_cast<const wchar_t*>(keyName.utf16()), 0, KEY_READ, &handle)) {
|
|
||||||
DWORD bufferSize = BufferSize;
|
|
||||||
RegQueryValueEx(handle, L"", nullptr, nullptr, reinterpret_cast<unsigned char*>(command), &bufferSize);
|
|
||||||
RegCloseKey(handle);
|
|
||||||
}
|
|
||||||
// QTBUG-57816: As of Windows 10, if there is no mail client installed, an entry like
|
// QTBUG-57816: As of Windows 10, if there is no mail client installed, an entry like
|
||||||
// "rundll32.exe .. url.dll,MailToProtocolHandler %l" is returned. Launching it
|
// "rundll32.exe .. url.dll,MailToProtocolHandler %l" is returned. Launching it
|
||||||
// silently fails or brings up a broken dialog after a long time, so exclude it and
|
// silently fails or brings up a broken dialog after a long time, so exclude it and
|
||||||
// fall back to ShellExecute() which brings up the URL assocation dialog.
|
// fall back to ShellExecute() which brings up the URL assocation dialog.
|
||||||
if (!command[0] || wcsstr(command, L",MailToProtocolHandler") != nullptr)
|
if (command.isEmpty() || command.contains(QLatin1String(",MailToProtocolHandler")))
|
||||||
return QString();
|
return QString();
|
||||||
wchar_t expandedCommand[MAX_PATH] = {0};
|
wchar_t expandedCommand[MAX_PATH] = {0};
|
||||||
return ExpandEnvironmentStrings(command, expandedCommand, MAX_PATH) ?
|
return ExpandEnvironmentStrings(reinterpret_cast<const wchar_t *>(command.utf16()),
|
||||||
QString::fromWCharArray(expandedCommand) : QString::fromWCharArray(command);
|
expandedCommand, MAX_PATH)
|
||||||
|
? QString::fromWCharArray(expandedCommand) : command;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool launchMail(const QUrl &url)
|
static inline bool launchMail(const QUrl &url)
|
||||||
|
@ -126,6 +126,7 @@ win32:SOURCES += ../../corelib/global/qoperatingsystemversion_win.cpp \
|
|||||||
../../corelib/kernel/qsharedmemory_win.cpp \
|
../../corelib/kernel/qsharedmemory_win.cpp \
|
||||||
../../corelib/kernel/qsystemsemaphore_win.cpp \
|
../../corelib/kernel/qsystemsemaphore_win.cpp \
|
||||||
../../corelib/plugin/qsystemlibrary.cpp \
|
../../corelib/plugin/qsystemlibrary.cpp \
|
||||||
|
../../corelib/kernel/qwinregistry.cpp \
|
||||||
|
|
||||||
mac {
|
mac {
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
@ -211,7 +211,9 @@ QDesktopWidget::QDesktopWidget()
|
|||||||
setObjectName(QLatin1String("desktop"));
|
setObjectName(QLatin1String("desktop"));
|
||||||
d->_q_updateScreens();
|
d->_q_updateScreens();
|
||||||
connect(qApp, SIGNAL(screenAdded(QScreen*)), this, SLOT(_q_updateScreens()));
|
connect(qApp, SIGNAL(screenAdded(QScreen*)), this, SLOT(_q_updateScreens()));
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 11)
|
||||||
connect(qApp, SIGNAL(primaryScreenChanged(QScreen*)), this, SIGNAL(primaryScreenChanged()));
|
connect(qApp, SIGNAL(primaryScreenChanged(QScreen*)), this, SIGNAL(primaryScreenChanged()));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QDesktopWidget::~QDesktopWidget()
|
QDesktopWidget::~QDesktopWidget()
|
||||||
|
@ -2909,6 +2909,8 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
|
|||||||
{
|
{
|
||||||
Q_D(QWidget);
|
Q_D(QWidget);
|
||||||
Qt::WindowStates oldstate = windowState();
|
Qt::WindowStates oldstate = windowState();
|
||||||
|
if (newstate.testFlag(Qt::WindowMinimized)) // QTBUG-46763
|
||||||
|
newstate.setFlag(Qt::WindowActive, false);
|
||||||
if (oldstate == newstate)
|
if (oldstate == newstate)
|
||||||
return;
|
return;
|
||||||
if (isWindow() && !testAttribute(Qt::WA_WState_Created))
|
if (isWindow() && !testAttribute(Qt::WA_WState_Created))
|
||||||
|
@ -5035,6 +5035,14 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
|
|||||||
QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection);
|
QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection);
|
||||||
if (subRule.hasGeometry() || subRule.hasBox() || !subRule.hasNativeBorder() || subRule.hasFont) {
|
if (subRule.hasGeometry() || subRule.hasBox() || !subRule.hasNativeBorder() || subRule.hasFont) {
|
||||||
sz = subRule.adjustSize(csz);
|
sz = subRule.adjustSize(csz);
|
||||||
|
if (!sz.isValid()) {
|
||||||
|
// Try to set the missing values based on the base style.
|
||||||
|
const auto baseSize = baseStyle()->sizeFromContents(ct, opt, sz, w);
|
||||||
|
if (sz.width() < 0)
|
||||||
|
sz.setWidth(baseSize.width());
|
||||||
|
if (sz.height() < 0)
|
||||||
|
sz.setHeight(baseSize.height());
|
||||||
|
}
|
||||||
if (!subRule.hasGeometry()) {
|
if (!subRule.hasGeometry()) {
|
||||||
QSize nativeContentsSize;
|
QSize nativeContentsSize;
|
||||||
bool nullIcon = hdr->icon.isNull();
|
bool nullIcon = hdr->icon.isNull();
|
||||||
|
@ -1031,7 +1031,8 @@ void QScrollerPrivate::setDpi(const QPointF &dpi)
|
|||||||
*/
|
*/
|
||||||
void QScrollerPrivate::setDpiFromWidget(QWidget *widget)
|
void QScrollerPrivate::setDpiFromWidget(QWidget *widget)
|
||||||
{
|
{
|
||||||
const QScreen *screen = QGuiApplication::screens().at(QApplication::desktop()->screenNumber(widget));
|
const QScreen *screen = widget ? widget->screen() : QGuiApplication::primaryScreen();
|
||||||
|
Q_ASSERT(screen);
|
||||||
setDpi(QPointF(screen->physicalDotsPerInchX(), screen->physicalDotsPerInchY()));
|
setDpi(QPointF(screen->physicalDotsPerInchX(), screen->physicalDotsPerInchY()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ static QAlphaWidget* q_blend = 0;
|
|||||||
Constructs a QAlphaWidget.
|
Constructs a QAlphaWidget.
|
||||||
*/
|
*/
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_DEPRECATED // QDesktopWidget::screen()
|
QT_WARNING_DISABLE_DEPRECATED // ### Qt 6: Find a replacement for QDesktopWidget::screen()
|
||||||
QAlphaWidget::QAlphaWidget(QWidget* w, Qt::WindowFlags f)
|
QAlphaWidget::QAlphaWidget(QWidget* w, Qt::WindowFlags f)
|
||||||
: QWidget(QApplication::desktop()->screen(QDesktopWidgetPrivate::screenNumber(w)), f)
|
: QWidget(QApplication::desktop()->screen(QDesktopWidgetPrivate::screenNumber(w)), f)
|
||||||
{
|
{
|
||||||
|
@ -12,3 +12,6 @@ SUBDIRS=\
|
|||||||
qtendian \
|
qtendian \
|
||||||
qglobalstatic \
|
qglobalstatic \
|
||||||
qhooks
|
qhooks
|
||||||
|
|
||||||
|
win32:!winrt: SUBDIRS += \
|
||||||
|
qwinregistry
|
||||||
|
8
tests/auto/corelib/global/qwinregistry/qwinregistry.pro
Normal file
8
tests/auto/corelib/global/qwinregistry/qwinregistry.pro
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
CONFIG += testcase
|
||||||
|
QT += testlib core-private
|
||||||
|
QT -= gui
|
||||||
|
|
||||||
|
TARGET = tst_qwinregistry
|
||||||
|
CONFIG += console
|
||||||
|
|
||||||
|
SOURCES += tst_qwinregistry.cpp
|
68
tests/auto/corelib/global/qwinregistry/tst_qwinregistry.cpp
Normal file
68
tests/auto/corelib/global/qwinregistry/tst_qwinregistry.cpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2019 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <QtTest/QtTest>
|
||||||
|
|
||||||
|
#include <QtCore/qoperatingsystemversion.h>
|
||||||
|
|
||||||
|
#include <QtCore/private/qwinregistry_p.h>
|
||||||
|
|
||||||
|
class tst_QWinRegistry : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void initTestCase();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void values();
|
||||||
|
};
|
||||||
|
|
||||||
|
void tst_QWinRegistry::initTestCase()
|
||||||
|
{
|
||||||
|
if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows10)
|
||||||
|
QSKIP("This test requires registry values present in Windows 10");
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QWinRegistry::values()
|
||||||
|
{
|
||||||
|
QWinRegistryKey key(HKEY_LOCAL_MACHINE, LR"(SOFTWARE\Microsoft\Windows NT\CurrentVersion)");
|
||||||
|
QVERIFY(key.isValid());
|
||||||
|
QVERIFY(!key.stringValue(L"ProductName").isEmpty());
|
||||||
|
QVERIFY(key.stringValue(L"NonExistingKey").isEmpty());
|
||||||
|
auto majorVersion = key.dwordValue(L"CurrentMajorVersionNumber");
|
||||||
|
QVERIFY(majorVersion.second);
|
||||||
|
QVERIFY(majorVersion.first > 0);
|
||||||
|
auto nonExistingValue = key.dwordValue(L"NonExistingKey");
|
||||||
|
QVERIFY(!nonExistingValue.second);
|
||||||
|
QCOMPARE(nonExistingValue.first, 0u);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTEST_APPLESS_MAIN(tst_QWinRegistry);
|
||||||
|
|
||||||
|
#include "tst_qwinregistry.moc"
|
@ -49,6 +49,7 @@
|
|||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include <qt_windows.h>
|
#include <qt_windows.h>
|
||||||
#if !defined(Q_OS_WINRT)
|
#if !defined(Q_OS_WINRT)
|
||||||
|
#include <private/qwinregistry_p.h>
|
||||||
#include <lm.h>
|
#include <lm.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -1243,17 +1244,12 @@ void tst_QFileInfo::fileTimes()
|
|||||||
//In Vista the last-access timestamp is not updated when the file is accessed/touched (by default).
|
//In Vista the last-access timestamp is not updated when the file is accessed/touched (by default).
|
||||||
//To enable this the HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisableLastAccessUpdate
|
//To enable this the HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisableLastAccessUpdate
|
||||||
//is set to 0, in the test machine.
|
//is set to 0, in the test machine.
|
||||||
HKEY key;
|
const auto disabledAccessTimes =
|
||||||
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\FileSystem",
|
QWinRegistryKey(HKEY_LOCAL_MACHINE,
|
||||||
0, KEY_READ, &key)) {
|
LR"(SYSTEM\CurrentControlSet\Control\FileSystem)")
|
||||||
DWORD disabledAccessTimes = 0;
|
.dwordValue(L"NtfsDisableLastAccessUpdate");
|
||||||
DWORD size = sizeof(DWORD);
|
if (disabledAccessTimes.second && disabledAccessTimes.first != 0)
|
||||||
LONG error = RegQueryValueEx(key, L"NtfsDisableLastAccessUpdate"
|
|
||||||
, NULL, NULL, (LPBYTE)&disabledAccessTimes, &size);
|
|
||||||
if (ERROR_SUCCESS == error && disabledAccessTimes)
|
|
||||||
noAccessTime = true;
|
noAccessTime = true;
|
||||||
RegCloseKey(key);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (noAccessTime)
|
if (noAccessTime)
|
||||||
|
@ -54,6 +54,9 @@
|
|||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
#include <QtCore/qt_windows.h>
|
#include <QtCore/qt_windows.h>
|
||||||
|
#ifndef Q_OS_WINRT
|
||||||
|
# include <private/qwinregistry_p.h>
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
@ -3623,16 +3626,13 @@ void tst_QSettings::recursionBug()
|
|||||||
|
|
||||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||||
|
|
||||||
static DWORD readKeyType(HKEY handle, const QString &rSubKey)
|
static DWORD readKeyType(HKEY handle, QStringView rSubKey)
|
||||||
{
|
{
|
||||||
DWORD dataType;
|
DWORD dataType;
|
||||||
DWORD dataSize;
|
DWORD dataSize;
|
||||||
LONG res = RegQueryValueEx(handle, reinterpret_cast<const wchar_t *>(rSubKey.utf16()), 0, &dataType, 0, &dataSize);
|
LONG res = RegQueryValueEx(handle, reinterpret_cast<const wchar_t *>(rSubKey.utf16()),
|
||||||
|
nullptr, &dataType, nullptr, &dataSize);
|
||||||
if (res == ERROR_SUCCESS)
|
return res == ERROR_SUCCESS ? dataType : 0;
|
||||||
return dataType;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a regression test for QTBUG-13249, where QSettings was storing
|
// This is a regression test for QTBUG-13249, where QSettings was storing
|
||||||
@ -3652,29 +3652,12 @@ void tst_QSettings::consistentRegistryStorage()
|
|||||||
QCOMPARE(settings1.value("quint64_value").toULongLong(), (quint64)1024);
|
QCOMPARE(settings1.value("quint64_value").toULongLong(), (quint64)1024);
|
||||||
settings1.sync();
|
settings1.sync();
|
||||||
|
|
||||||
HKEY handle;
|
QWinRegistryKey handle(HKEY_CURRENT_USER, LR"(Software\software.org\KillerAPP)");
|
||||||
LONG res;
|
if (handle.isValid()) {
|
||||||
QString keyName = "Software\\software.org\\KillerAPP";
|
QCOMPARE(readKeyType(handle, L"qint32_value"), DWORD(REG_DWORD));
|
||||||
res = RegOpenKeyEx(HKEY_CURRENT_USER, reinterpret_cast<const wchar_t *>(keyName.utf16()), 0, KEY_READ, &handle);
|
QCOMPARE(readKeyType(handle, L"quint32_value"), DWORD(REG_DWORD));
|
||||||
if (res == ERROR_SUCCESS)
|
QCOMPARE(readKeyType(handle, L"qint64_value"), DWORD(REG_QWORD));
|
||||||
{
|
QCOMPARE(readKeyType(handle, L"quint64_value"), DWORD(REG_QWORD));
|
||||||
DWORD dataType;
|
|
||||||
dataType = readKeyType(handle, QString("qint32_value"));
|
|
||||||
if (dataType != 0) {
|
|
||||||
QCOMPARE((int)REG_DWORD, (int)dataType);
|
|
||||||
}
|
|
||||||
dataType = readKeyType(handle, QString("quint32_value"));
|
|
||||||
if (dataType != 0) {
|
|
||||||
QCOMPARE((int)REG_DWORD, (int)dataType);
|
|
||||||
}
|
|
||||||
dataType = readKeyType(handle, QString("qint64_value"));
|
|
||||||
if (dataType != 0) {
|
|
||||||
QCOMPARE((int)REG_QWORD, (int)dataType);
|
|
||||||
}
|
|
||||||
dataType = readKeyType(handle, QString("quint64_value"));
|
|
||||||
if (dataType != 0) {
|
|
||||||
QCOMPARE((int)REG_QWORD, (int)dataType);
|
|
||||||
}
|
|
||||||
RegCloseKey(handle);
|
RegCloseKey(handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -458,6 +458,34 @@ void tst_QAbstractItemModel::match()
|
|||||||
res = model.match(start, Qt::DisplayRole, QVariant("bat"), -1,
|
res = model.match(start, Qt::DisplayRole, QVariant("bat"), -1,
|
||||||
Qt::MatchFixedString | Qt::MatchCaseSensitive);
|
Qt::MatchFixedString | Qt::MatchCaseSensitive);
|
||||||
QCOMPARE(res.count(), 1);
|
QCOMPARE(res.count(), 1);
|
||||||
|
|
||||||
|
res = model.match(start, Qt::DisplayRole, QVariant(".*O.*"), -1,
|
||||||
|
Qt::MatchRegularExpression);
|
||||||
|
QCOMPARE(res.count(), 2);
|
||||||
|
res = model.match(start, Qt::DisplayRole, QVariant(".*O.*"), -1,
|
||||||
|
Qt::MatchRegularExpression | Qt::MatchCaseSensitive);
|
||||||
|
QCOMPARE(res.count(), 0);
|
||||||
|
|
||||||
|
res = model.match(start, Qt::DisplayRole, QVariant(QRegularExpression(".*O.*")),
|
||||||
|
-1, Qt::MatchRegularExpression);
|
||||||
|
QCOMPARE(res.count(), 0);
|
||||||
|
res = model.match(start,
|
||||||
|
Qt::DisplayRole,
|
||||||
|
QVariant(QRegularExpression(".*O.*",
|
||||||
|
QRegularExpression::CaseInsensitiveOption)),
|
||||||
|
-1,
|
||||||
|
Qt::MatchRegularExpression);
|
||||||
|
QCOMPARE(res.count(), 2);
|
||||||
|
|
||||||
|
// Ensure that the case sensitivity is properly ignored when passing a
|
||||||
|
// QRegularExpression object.
|
||||||
|
res = model.match(start,
|
||||||
|
Qt::DisplayRole,
|
||||||
|
QVariant(QRegularExpression(".*O.*",
|
||||||
|
QRegularExpression::CaseInsensitiveOption)),
|
||||||
|
-1,
|
||||||
|
Qt::MatchRegularExpression | Qt::MatchCaseSensitive);
|
||||||
|
QCOMPARE(res.count(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef QPair<int, int> Position;
|
typedef QPair<int, int> Position;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QtWidgets/QDesktopWidget>
|
#include <QtGui/QScreen>
|
||||||
#include <QtWidgets/QGraphicsItem>
|
#include <QtWidgets/QGraphicsItem>
|
||||||
#include <QtWidgets/QGraphicsScene>
|
#include <QtWidgets/QGraphicsScene>
|
||||||
#include <QtWidgets/QGraphicsView>
|
#include <QtWidgets/QGraphicsView>
|
||||||
@ -617,7 +617,7 @@ void tst_QTouchEvent::basicRawEventTranslation()
|
|||||||
QPointF pos = touchWidget.rect().center();
|
QPointF pos = touchWidget.rect().center();
|
||||||
QPointF screenPos = touchWidget.mapToGlobal(pos.toPoint());
|
QPointF screenPos = touchWidget.mapToGlobal(pos.toPoint());
|
||||||
QPointF delta(10, 10);
|
QPointF delta(10, 10);
|
||||||
QRectF screenGeometry = QApplication::desktop()->screenGeometry(&touchWidget);
|
QRectF screenGeometry = touchWidget.screen()->geometry();
|
||||||
|
|
||||||
QTouchEvent::TouchPoint rawTouchPoint;
|
QTouchEvent::TouchPoint rawTouchPoint;
|
||||||
rawTouchPoint.setId(0);
|
rawTouchPoint.setId(0);
|
||||||
@ -753,7 +753,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
|
|||||||
QPointF leftScreenPos = leftWidget.mapToGlobal(leftPos.toPoint());
|
QPointF leftScreenPos = leftWidget.mapToGlobal(leftPos.toPoint());
|
||||||
QPointF rightScreenPos = rightWidget.mapToGlobal(rightPos.toPoint());
|
QPointF rightScreenPos = rightWidget.mapToGlobal(rightPos.toPoint());
|
||||||
QPointF centerScreenPos = touchWidget.mapToGlobal(centerPos.toPoint());
|
QPointF centerScreenPos = touchWidget.mapToGlobal(centerPos.toPoint());
|
||||||
QRectF screenGeometry = QApplication::desktop()->screenGeometry(&touchWidget);
|
QRectF screenGeometry = touchWidget.screen()->geometry();
|
||||||
|
|
||||||
QList<QTouchEvent::TouchPoint> rawTouchPoints;
|
QList<QTouchEvent::TouchPoint> rawTouchPoints;
|
||||||
rawTouchPoints.append(QTouchEvent::TouchPoint(0));
|
rawTouchPoints.append(QTouchEvent::TouchPoint(0));
|
||||||
@ -968,7 +968,7 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens()
|
|||||||
QPointF pos = touchWidget.rect().center();
|
QPointF pos = touchWidget.rect().center();
|
||||||
QPointF screenPos = touchWidget.mapToGlobal(pos.toPoint());
|
QPointF screenPos = touchWidget.mapToGlobal(pos.toPoint());
|
||||||
QPointF delta(10, 10);
|
QPointF delta(10, 10);
|
||||||
QRectF screenGeometry = QApplication::desktop()->screenGeometry(&touchWidget);
|
QRectF screenGeometry = touchWidget.screen()->geometry();
|
||||||
|
|
||||||
QVector<QTouchEvent::TouchPoint> rawTouchPoints(3);
|
QVector<QTouchEvent::TouchPoint> rawTouchPoints(3);
|
||||||
rawTouchPoints[0].setId(0);
|
rawTouchPoints[0].setId(0);
|
||||||
@ -1131,7 +1131,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
|
|||||||
QPointF leftScreenPos = leftWidget.mapToGlobal(leftPos.toPoint());
|
QPointF leftScreenPos = leftWidget.mapToGlobal(leftPos.toPoint());
|
||||||
QPointF rightScreenPos = rightWidget.mapToGlobal(rightPos.toPoint());
|
QPointF rightScreenPos = rightWidget.mapToGlobal(rightPos.toPoint());
|
||||||
QPointF centerScreenPos = touchWidget.mapToGlobal(centerPos.toPoint());
|
QPointF centerScreenPos = touchWidget.mapToGlobal(centerPos.toPoint());
|
||||||
QRectF screenGeometry = QApplication::desktop()->screenGeometry(&touchWidget);
|
QRectF screenGeometry = touchWidget.screen()->geometry();
|
||||||
|
|
||||||
QList<QTouchEvent::TouchPoint> rawTouchPoints;
|
QList<QTouchEvent::TouchPoint> rawTouchPoints;
|
||||||
rawTouchPoints.append(QTouchEvent::TouchPoint(0));
|
rawTouchPoints.append(QTouchEvent::TouchPoint(0));
|
||||||
@ -1348,7 +1348,7 @@ void tst_QTouchEvent::basicRawEventTranslationOfIds()
|
|||||||
screenPos << touchWidget.mapToGlobal(pos[i].toPoint());
|
screenPos << touchWidget.mapToGlobal(pos[i].toPoint());
|
||||||
}
|
}
|
||||||
QPointF delta(10, 10);
|
QPointF delta(10, 10);
|
||||||
QRectF screenGeometry = QApplication::desktop()->screenGeometry(&touchWidget);
|
QRectF screenGeometry = touchWidget.screen()->geometry();
|
||||||
|
|
||||||
QVector<QPointF> rawPosList;
|
QVector<QPointF> rawPosList;
|
||||||
rawPosList << QPointF(12, 34) << QPointF(56, 78);
|
rawPosList << QPointF(12, 34) << QPointF(56, 78);
|
||||||
@ -1629,7 +1629,7 @@ void tst_QTouchEvent::deleteInRawEventTranslation()
|
|||||||
QPointF leftScreenPos = leftWidget->mapToGlobal(leftPos.toPoint());
|
QPointF leftScreenPos = leftWidget->mapToGlobal(leftPos.toPoint());
|
||||||
QPointF centerScreenPos = centerWidget->mapToGlobal(centerPos.toPoint());
|
QPointF centerScreenPos = centerWidget->mapToGlobal(centerPos.toPoint());
|
||||||
QPointF rightScreenPos = rightWidget->mapToGlobal(rightPos.toPoint());
|
QPointF rightScreenPos = rightWidget->mapToGlobal(rightPos.toPoint());
|
||||||
QRectF screenGeometry = QApplication::desktop()->screenGeometry(&touchWidget);
|
QRectF screenGeometry = touchWidget.screen()->geometry();
|
||||||
|
|
||||||
QList<QTouchEvent::TouchPoint> rawTouchPoints;
|
QList<QTouchEvent::TouchPoint> rawTouchPoints;
|
||||||
rawTouchPoints.append(QTouchEvent::TouchPoint(0));
|
rawTouchPoints.append(QTouchEvent::TouchPoint(0));
|
||||||
|
@ -53,7 +53,10 @@
|
|||||||
#include "../../../../../src/widgets/dialogs/qfilesystemmodel_p.h"
|
#include "../../../../../src/widgets/dialogs/qfilesystemmodel_p.h"
|
||||||
#include "../../../../../src/widgets/dialogs/qfiledialog_p.h"
|
#include "../../../../../src/widgets/dialogs/qfiledialog_p.h"
|
||||||
|
|
||||||
|
#include <private/qguiapplication_p.h>
|
||||||
|
|
||||||
#include <qpa/qplatformdialoghelper.h>
|
#include <qpa/qplatformdialoghelper.h>
|
||||||
|
#include <qpa/qplatformintegration.h>
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
#include "../../../network-settings.h"
|
#include "../../../network-settings.h"
|
||||||
@ -365,7 +368,7 @@ void tst_QFileDialog2::task143519_deleteAndRenameActionBehavior()
|
|||||||
fd.selectFile(ctx.file.fileName());
|
fd.selectFile(ctx.file.fileName());
|
||||||
fd.show();
|
fd.show();
|
||||||
|
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
QVERIFY(QTest::qWaitForWindowExposed(&fd));
|
||||||
|
|
||||||
// grab some internals:
|
// grab some internals:
|
||||||
QAction *rm = fd.findChild<QAction*>("qt_delete_action");
|
QAction *rm = fd.findChild<QAction*>("qt_delete_action");
|
||||||
@ -548,7 +551,7 @@ void tst_QFileDialog2::task227304_proxyOnFileDialog()
|
|||||||
QFileDialog fd(0, "", QDir::currentPath(), 0);
|
QFileDialog fd(0, "", QDir::currentPath(), 0);
|
||||||
fd.setProxyModel(new FilterDirModel(QDir::currentPath()));
|
fd.setProxyModel(new FilterDirModel(QDir::currentPath()));
|
||||||
fd.show();
|
fd.show();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
QVERIFY(QTest::qWaitForWindowExposed(&fd));
|
||||||
QLineEdit *edit = fd.findChild<QLineEdit*>("fileNameEdit");
|
QLineEdit *edit = fd.findChild<QLineEdit*>("fileNameEdit");
|
||||||
QVERIFY(edit);
|
QVERIFY(edit);
|
||||||
QTest::keyClick(edit, Qt::Key_T);
|
QTest::keyClick(edit, Qt::Key_T);
|
||||||
@ -558,7 +561,7 @@ void tst_QFileDialog2::task227304_proxyOnFileDialog()
|
|||||||
CrashDialog *dialog = new CrashDialog(0, QString("crash dialog test"), QDir::homePath(), QString("*") );
|
CrashDialog *dialog = new CrashDialog(0, QString("crash dialog test"), QDir::homePath(), QString("*") );
|
||||||
dialog->setFileMode(QFileDialog::ExistingFile);
|
dialog->setFileMode(QFileDialog::ExistingFile);
|
||||||
dialog->show();
|
dialog->show();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(dialog));
|
QVERIFY(QTest::qWaitForWindowExposed(dialog));
|
||||||
|
|
||||||
QListView *list = dialog->findChild<QListView*>("listView");
|
QListView *list = dialog->findChild<QListView*>("listView");
|
||||||
QVERIFY(list);
|
QVERIFY(list);
|
||||||
@ -600,7 +603,7 @@ void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior()
|
|||||||
fd.setViewMode(QFileDialog::List);
|
fd.setViewMode(QFileDialog::List);
|
||||||
fd.setDirectory(current.absolutePath());
|
fd.setDirectory(current.absolutePath());
|
||||||
fd.show();
|
fd.show();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
QVERIFY(QTest::qWaitForWindowExposed(&fd));
|
||||||
|
|
||||||
// Ensure LayoutRequest event is processed so that the list view
|
// Ensure LayoutRequest event is processed so that the list view
|
||||||
// is sorted correctly to have the directory entires at the top.
|
// is sorted correctly to have the directory entires at the top.
|
||||||
@ -765,7 +768,7 @@ void tst_QFileDialog2::task235069_hideOnEscape()
|
|||||||
fd.setDirectory(current.absolutePath());
|
fd.setDirectory(current.absolutePath());
|
||||||
fd.setAcceptMode(QFileDialog::AcceptSave);
|
fd.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
fd.show();
|
fd.show();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
QVERIFY(QTest::qWaitForWindowExposed(&fd));
|
||||||
QWidget *child = fd.findChild<QWidget *>(childName);
|
QWidget *child = fd.findChild<QWidget *>(childName);
|
||||||
QVERIFY(child);
|
QVERIFY(child);
|
||||||
child->setFocus();
|
child->setFocus();
|
||||||
@ -787,7 +790,7 @@ void tst_QFileDialog2::task236402_dontWatchDeletedDir()
|
|||||||
fd.setDirectory(current.absolutePath());
|
fd.setDirectory(current.absolutePath());
|
||||||
fd.setAcceptMode( QFileDialog::AcceptSave);
|
fd.setAcceptMode( QFileDialog::AcceptSave);
|
||||||
fd.show();
|
fd.show();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
QVERIFY(QTest::qWaitForWindowExposed(&fd));
|
||||||
QListView *list = fd.findChild<QListView*>("listView");
|
QListView *list = fd.findChild<QListView*>("listView");
|
||||||
QVERIFY(list);
|
QVERIFY(list);
|
||||||
list->setFocus();
|
list->setFocus();
|
||||||
@ -808,7 +811,7 @@ void tst_QFileDialog2::task203703_returnProperSeparator()
|
|||||||
fd.setViewMode(QFileDialog::List);
|
fd.setViewMode(QFileDialog::List);
|
||||||
fd.setFileMode(QFileDialog::Directory);
|
fd.setFileMode(QFileDialog::Directory);
|
||||||
fd.show();
|
fd.show();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
QVERIFY(QTest::qWaitForWindowExposed(&fd));
|
||||||
QListView *list = fd.findChild<QListView*>("listView");
|
QListView *list = fd.findChild<QListView*>("listView");
|
||||||
QVERIFY(list);
|
QVERIFY(list);
|
||||||
list->setFocus();
|
list->setFocus();
|
||||||
@ -844,7 +847,7 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting()
|
|||||||
fd.setDirectory(current.absolutePath());
|
fd.setDirectory(current.absolutePath());
|
||||||
fd.setViewMode(QFileDialog::Detail);
|
fd.setViewMode(QFileDialog::Detail);
|
||||||
fd.show();
|
fd.show();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
QVERIFY(QTest::qWaitForWindowExposed(&fd));
|
||||||
QTreeView *tree = fd.findChild<QTreeView*>("treeView");
|
QTreeView *tree = fd.findChild<QTreeView*>("treeView");
|
||||||
QVERIFY(tree);
|
QVERIFY(tree);
|
||||||
tree->header()->setSortIndicator(3,Qt::DescendingOrder);
|
tree->header()->setSortIndicator(3,Qt::DescendingOrder);
|
||||||
@ -859,7 +862,7 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting()
|
|||||||
current.cd("aaaaaaaaaaaaaaaaaa");
|
current.cd("aaaaaaaaaaaaaaaaaa");
|
||||||
fd2.setDirectory(current.absolutePath());
|
fd2.setDirectory(current.absolutePath());
|
||||||
fd2.show();
|
fd2.show();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&fd2));
|
QVERIFY(QTest::qWaitForWindowExposed(&fd2));
|
||||||
QTreeView *tree2 = fd2.findChild<QTreeView*>("treeView");
|
QTreeView *tree2 = fd2.findChild<QTreeView*>("treeView");
|
||||||
QVERIFY(tree2);
|
QVERIFY(tree2);
|
||||||
tree2->setFocus();
|
tree2->setFocus();
|
||||||
@ -878,7 +881,7 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting()
|
|||||||
fd3.restoreState(fd.saveState());
|
fd3.restoreState(fd.saveState());
|
||||||
fd3.setFileMode(QFileDialog::Directory);
|
fd3.setFileMode(QFileDialog::Directory);
|
||||||
fd3.show();
|
fd3.show();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&fd3));
|
QVERIFY(QTest::qWaitForWindowExposed(&fd3));
|
||||||
QTreeView *tree3 = fd3.findChild<QTreeView*>("treeView");
|
QTreeView *tree3 = fd3.findChild<QTreeView*>("treeView");
|
||||||
QVERIFY(tree3);
|
QVERIFY(tree3);
|
||||||
tree3->setFocus();
|
tree3->setFocus();
|
||||||
@ -912,7 +915,7 @@ void tst_QFileDialog2::task239706_editableFilterCombo()
|
|||||||
QFileDialog d;
|
QFileDialog d;
|
||||||
d.setNameFilter("*.cpp *.h");
|
d.setNameFilter("*.cpp *.h");
|
||||||
d.show();
|
d.show();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&d));
|
QVERIFY(QTest::qWaitForWindowExposed(&d));
|
||||||
|
|
||||||
QList<QComboBox *> comboList = d.findChildren<QComboBox *>();
|
QList<QComboBox *> comboList = d.findChildren<QComboBox *>();
|
||||||
QComboBox *filterCombo = 0;
|
QComboBox *filterCombo = 0;
|
||||||
@ -963,7 +966,7 @@ void tst_QFileDialog2::task251321_sideBarHiddenEntries()
|
|||||||
urls << QUrl::fromLocalFile(hiddenSubDir.absolutePath());
|
urls << QUrl::fromLocalFile(hiddenSubDir.absolutePath());
|
||||||
fd.setSidebarUrls(urls);
|
fd.setSidebarUrls(urls);
|
||||||
fd.show();
|
fd.show();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
QVERIFY(QTest::qWaitForWindowExposed(&fd));
|
||||||
|
|
||||||
QSidebar *sidebar = fd.findChild<QSidebar*>("sidebar");
|
QSidebar *sidebar = fd.findChild<QSidebar*>("sidebar");
|
||||||
QVERIFY(sidebar);
|
QVERIFY(sidebar);
|
||||||
@ -1017,7 +1020,7 @@ void tst_QFileDialog2::task251341_sideBarRemoveEntries()
|
|||||||
urls << QUrl::fromLocalFile("NotFound");
|
urls << QUrl::fromLocalFile("NotFound");
|
||||||
fd.setSidebarUrls(urls);
|
fd.setSidebarUrls(urls);
|
||||||
fd.show();
|
fd.show();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
QVERIFY(QTest::qWaitForWindowExposed(&fd));
|
||||||
|
|
||||||
QSidebar *sidebar = fd.findChild<QSidebar*>("sidebar");
|
QSidebar *sidebar = fd.findChild<QSidebar*>("sidebar");
|
||||||
QVERIFY(sidebar);
|
QVERIFY(sidebar);
|
||||||
@ -1089,7 +1092,7 @@ void tst_QFileDialog2::task254490_selectFileMultipleTimes()
|
|||||||
fd.selectFile("new_file.txt");
|
fd.selectFile("new_file.txt");
|
||||||
|
|
||||||
fd.show();
|
fd.show();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
QVERIFY(QTest::qWaitForWindowExposed(&fd));
|
||||||
|
|
||||||
QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit");
|
QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit");
|
||||||
QVERIFY(lineEdit);
|
QVERIFY(lineEdit);
|
||||||
@ -1133,7 +1136,7 @@ void tst_QFileDialog2::task259105_filtersCornerCases()
|
|||||||
fd.setNameFilter(QLatin1String("All Files! (*);;Text Files (*.txt)"));
|
fd.setNameFilter(QLatin1String("All Files! (*);;Text Files (*.txt)"));
|
||||||
fd.setOption(QFileDialog::HideNameFilterDetails, true);
|
fd.setOption(QFileDialog::HideNameFilterDetails, true);
|
||||||
fd.show();
|
fd.show();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
QVERIFY(QTest::qWaitForWindowExposed(&fd));
|
||||||
|
|
||||||
//Extensions are hidden
|
//Extensions are hidden
|
||||||
QComboBox *filters = fd.findChild<QComboBox*>("fileTypeCombo");
|
QComboBox *filters = fd.findChild<QComboBox*>("fileTypeCombo");
|
||||||
@ -1170,6 +1173,9 @@ void tst_QFileDialog2::task259105_filtersCornerCases()
|
|||||||
|
|
||||||
void tst_QFileDialog2::QTBUG4419_lineEditSelectAll()
|
void tst_QFileDialog2::QTBUG4419_lineEditSelectAll()
|
||||||
{
|
{
|
||||||
|
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
|
||||||
|
QSKIP("Window activation is not supported");
|
||||||
|
|
||||||
QString tempPath = tempDir.path();
|
QString tempPath = tempDir.path();
|
||||||
QTemporaryFile temporaryFile(tempPath + "/tst_qfiledialog2_lineEditSelectAll.XXXXXX");
|
QTemporaryFile temporaryFile(tempPath + "/tst_qfiledialog2_lineEditSelectAll.XXXXXX");
|
||||||
QVERIFY2(temporaryFile.open(), qPrintable(temporaryFile.errorString()));
|
QVERIFY2(temporaryFile.open(), qPrintable(temporaryFile.errorString()));
|
||||||
@ -1195,6 +1201,9 @@ void tst_QFileDialog2::QTBUG4419_lineEditSelectAll()
|
|||||||
|
|
||||||
void tst_QFileDialog2::QTBUG6558_showDirsOnly()
|
void tst_QFileDialog2::QTBUG6558_showDirsOnly()
|
||||||
{
|
{
|
||||||
|
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
|
||||||
|
QSKIP("Window activation is not supported");
|
||||||
|
|
||||||
const QString tempPath = tempDir.path();
|
const QString tempPath = tempDir.path();
|
||||||
QDir dirTemp(tempPath);
|
QDir dirTemp(tempPath);
|
||||||
const QString tempName = QLatin1String("showDirsOnly.") + QString::number(QRandomGenerator::global()->generate());
|
const QString tempName = QLatin1String("showDirsOnly.") + QString::number(QRandomGenerator::global()->generate());
|
||||||
@ -1261,6 +1270,9 @@ void tst_QFileDialog2::QTBUG6558_showDirsOnly()
|
|||||||
|
|
||||||
void tst_QFileDialog2::QTBUG4842_selectFilterWithHideNameFilterDetails()
|
void tst_QFileDialog2::QTBUG4842_selectFilterWithHideNameFilterDetails()
|
||||||
{
|
{
|
||||||
|
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
|
||||||
|
QSKIP("Window activation is not supported");
|
||||||
|
|
||||||
QStringList filtersStr;
|
QStringList filtersStr;
|
||||||
filtersStr << "Images (*.png *.xpm *.jpg)" << "Text files (*.txt)" << "XML files (*.xml)";
|
filtersStr << "Images (*.png *.xpm *.jpg)" << "Text files (*.txt)" << "XML files (*.xml)";
|
||||||
QString chosenFilterString("Text files (*.txt)");
|
QString chosenFilterString("Text files (*.txt)");
|
||||||
@ -1301,6 +1313,9 @@ void tst_QFileDialog2::QTBUG4842_selectFilterWithHideNameFilterDetails()
|
|||||||
|
|
||||||
void tst_QFileDialog2::dontShowCompleterOnRoot()
|
void tst_QFileDialog2::dontShowCompleterOnRoot()
|
||||||
{
|
{
|
||||||
|
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
|
||||||
|
QSKIP("Window activation is not supported");
|
||||||
|
|
||||||
QFileDialog fd(0, "TestFileDialog");
|
QFileDialog fd(0, "TestFileDialog");
|
||||||
fd.setAcceptMode(QFileDialog::AcceptSave);
|
fd.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
fd.show();
|
fd.show();
|
||||||
|
@ -11084,7 +11084,7 @@ static QList<QTouchEvent::TouchPoint>
|
|||||||
tp.setStartScreenPos(screenPos);
|
tp.setStartScreenPos(screenPos);
|
||||||
tp.setLastScreenPos(screenPos);
|
tp.setLastScreenPos(screenPos);
|
||||||
tp.setEllipseDiameters(ellipseDiameters);
|
tp.setEllipseDiameters(ellipseDiameters);
|
||||||
const QSizeF screenSize = QApplication::desktop()->screenGeometry(&view).size();
|
const QSizeF screenSize = view.screen()->geometry().size();
|
||||||
tp.setNormalizedPos(QPointF(screenPos.x() / screenSize.width(), screenPos.y() / screenSize.height()));
|
tp.setNormalizedPos(QPointF(screenPos.x() / screenSize.width(), screenPos.y() / screenSize.height()));
|
||||||
return QList<QTouchEvent::TouchPoint>() << tp;
|
return QList<QTouchEvent::TouchPoint>() << tp;
|
||||||
}
|
}
|
||||||
|
@ -215,6 +215,7 @@ private slots:
|
|||||||
void QTBUG14242_hideSectionAutoSize();
|
void QTBUG14242_hideSectionAutoSize();
|
||||||
void QTBUG50171_visualRegionForSwappedItems();
|
void QTBUG50171_visualRegionForSwappedItems();
|
||||||
void QTBUG53221_assertShiftHiddenRow();
|
void QTBUG53221_assertShiftHiddenRow();
|
||||||
|
void QTBUG75615_sizeHintWithStylesheet();
|
||||||
void ensureNoIndexAtLength();
|
void ensureNoIndexAtLength();
|
||||||
void offsetConsistent();
|
void offsetConsistent();
|
||||||
|
|
||||||
@ -2557,6 +2558,26 @@ void tst_QHeaderView::QTBUG53221_assertShiftHiddenRow()
|
|||||||
QCOMPARE(tableView.verticalHeader()->isSectionHidden(2), true);
|
QCOMPARE(tableView.verticalHeader()->isSectionHidden(2), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QHeaderView::QTBUG75615_sizeHintWithStylesheet()
|
||||||
|
{
|
||||||
|
QTableView tableView;
|
||||||
|
QStandardItemModel model(1, 1);
|
||||||
|
tableView.setModel(&model);
|
||||||
|
tableView.show();
|
||||||
|
|
||||||
|
const auto headerView = tableView.horizontalHeader();
|
||||||
|
const auto oldSizeHint = headerView->sizeHint();
|
||||||
|
QVERIFY(oldSizeHint.isValid());
|
||||||
|
|
||||||
|
tableView.setStyleSheet("QTableView QHeaderView::section { height: 100px;}");
|
||||||
|
QCOMPARE(headerView->sizeHint().width(), oldSizeHint.width());
|
||||||
|
QCOMPARE(headerView->sizeHint().height(), 100);
|
||||||
|
|
||||||
|
tableView.setStyleSheet("QTableView QHeaderView::section { width: 100px;}");
|
||||||
|
QCOMPARE(headerView->sizeHint().height(), oldSizeHint.height());
|
||||||
|
QCOMPARE(headerView->sizeHint().width(), 100);
|
||||||
|
}
|
||||||
|
|
||||||
void protected_QHeaderView::testVisualRegionForSelection()
|
void protected_QHeaderView::testVisualRegionForSelection()
|
||||||
{
|
{
|
||||||
QRegion r = visualRegionForSelection(QItemSelection(model()->index(1, 0), model()->index(1, 2)));
|
QRegion r = visualRegionForSelection(QItemSelection(model()->index(1, 0), model()->index(1, 2)));
|
||||||
|
@ -42,10 +42,12 @@ class tst_QDesktopWidget : public QObject
|
|||||||
private slots:
|
private slots:
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 11)
|
||||||
void numScreens();
|
void numScreens();
|
||||||
void primaryScreen();
|
void primaryScreen();
|
||||||
void screenNumberForQWidget();
|
|
||||||
void screenNumberForQPoint();
|
void screenNumberForQPoint();
|
||||||
|
#endif
|
||||||
|
void screenNumberForQWidget();
|
||||||
void availableGeometry();
|
void availableGeometry();
|
||||||
void screenGeometry();
|
void screenGeometry();
|
||||||
void topLevels();
|
void topLevels();
|
||||||
@ -56,6 +58,7 @@ void tst_QDesktopWidget::cleanup()
|
|||||||
QVERIFY(QApplication::topLevelWidgets().isEmpty());
|
QVERIFY(QApplication::topLevelWidgets().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 11)
|
||||||
void tst_QDesktopWidget::numScreens()
|
void tst_QDesktopWidget::numScreens()
|
||||||
{
|
{
|
||||||
QDesktopWidget desktop;
|
QDesktopWidget desktop;
|
||||||
@ -68,14 +71,17 @@ void tst_QDesktopWidget::primaryScreen()
|
|||||||
QVERIFY(desktop.primaryScreen() >= 0);
|
QVERIFY(desktop.primaryScreen() >= 0);
|
||||||
QVERIFY(desktop.primaryScreen() < desktop.numScreens());
|
QVERIFY(desktop.primaryScreen() < desktop.numScreens());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void tst_QDesktopWidget::availableGeometry()
|
void tst_QDesktopWidget::availableGeometry()
|
||||||
{
|
{
|
||||||
QDesktopWidget desktop;
|
QDesktopWidget desktop;
|
||||||
QTest::ignoreMessage(QtWarningMsg, "QDesktopWidget::availableGeometry(): Attempt "
|
QTest::ignoreMessage(QtWarningMsg, "QDesktopWidget::availableGeometry(): Attempt "
|
||||||
"to get the available geometry of a null widget");
|
"to get the available geometry of a null widget");
|
||||||
desktop.availableGeometry((QWidget *)0);
|
QRect r = desktop.availableGeometry(nullptr);
|
||||||
|
QVERIFY(r.isNull());
|
||||||
|
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 11)
|
||||||
QRect total;
|
QRect total;
|
||||||
QRect available;
|
QRect available;
|
||||||
|
|
||||||
@ -90,13 +96,14 @@ void tst_QDesktopWidget::availableGeometry()
|
|||||||
QVERIFY(total.contains(available));
|
QVERIFY(total.contains(available));
|
||||||
QCOMPARE(desktop.availableGeometry(desktop.primaryScreen()), available);
|
QCOMPARE(desktop.availableGeometry(desktop.primaryScreen()), available);
|
||||||
QCOMPARE(desktop.screenGeometry(desktop.primaryScreen()), total);
|
QCOMPARE(desktop.screenGeometry(desktop.primaryScreen()), total);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QDesktopWidget::screenNumberForQWidget()
|
void tst_QDesktopWidget::screenNumberForQWidget()
|
||||||
{
|
{
|
||||||
QDesktopWidget desktop;
|
QDesktopWidget desktop;
|
||||||
|
|
||||||
QCOMPARE(desktop.screenNumber(0), 0);
|
QCOMPARE(desktop.screenNumber(nullptr), 0);
|
||||||
|
|
||||||
QWidget widget;
|
QWidget widget;
|
||||||
widget.show();
|
widget.show();
|
||||||
@ -105,9 +112,10 @@ void tst_QDesktopWidget::screenNumberForQWidget()
|
|||||||
|
|
||||||
int widgetScreen = desktop.screenNumber(&widget);
|
int widgetScreen = desktop.screenNumber(&widget);
|
||||||
QVERIFY(widgetScreen > -1);
|
QVERIFY(widgetScreen > -1);
|
||||||
QVERIFY(widgetScreen < desktop.numScreens());
|
QVERIFY(widgetScreen < QGuiApplication::screens().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 11)
|
||||||
void tst_QDesktopWidget::screenNumberForQPoint()
|
void tst_QDesktopWidget::screenNumberForQPoint()
|
||||||
{
|
{
|
||||||
// make sure QDesktopWidget::screenNumber(QPoint) returns the correct screen
|
// make sure QDesktopWidget::screenNumber(QPoint) returns the correct screen
|
||||||
@ -131,25 +139,28 @@ void tst_QDesktopWidget::screenNumberForQPoint()
|
|||||||
screen = desktopWidget->screenNumber(allScreens.bottomRight() + QPoint(1, 1));
|
screen = desktopWidget->screenNumber(allScreens.bottomRight() + QPoint(1, 1));
|
||||||
QVERIFY(screen >= 0 && screen < desktopWidget->numScreens());
|
QVERIFY(screen >= 0 && screen < desktopWidget->numScreens());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void tst_QDesktopWidget::screenGeometry()
|
void tst_QDesktopWidget::screenGeometry()
|
||||||
{
|
{
|
||||||
QDesktopWidget *desktopWidget = QApplication::desktop();
|
QDesktopWidget *desktopWidget = QApplication::desktop();
|
||||||
QTest::ignoreMessage(QtWarningMsg, "QDesktopWidget::screenGeometry(): Attempt "
|
QTest::ignoreMessage(QtWarningMsg, "QDesktopWidget::screenGeometry(): Attempt "
|
||||||
"to get the screen geometry of a null widget");
|
"to get the screen geometry of a null widget");
|
||||||
QRect r = desktopWidget->screenGeometry((QWidget *)0);
|
QRect r = desktopWidget->screenGeometry(nullptr);
|
||||||
QVERIFY(r.isNull());
|
QVERIFY(r.isNull());
|
||||||
QWidget widget;
|
QWidget widget;
|
||||||
widget.show();
|
widget.show();
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||||
r = desktopWidget->screenGeometry(&widget);
|
r = desktopWidget->screenGeometry(&widget);
|
||||||
|
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 11)
|
||||||
QRect total;
|
QRect total;
|
||||||
QRect available;
|
QRect available;
|
||||||
for (int i = 0; i < desktopWidget->screenCount(); ++i) {
|
for (int i = 0; i < desktopWidget->screenCount(); ++i) {
|
||||||
total = desktopWidget->screenGeometry(i);
|
total = desktopWidget->screenGeometry(i);
|
||||||
available = desktopWidget->availableGeometry(i);
|
available = desktopWidget->availableGeometry(i);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QDesktopWidget::topLevels()
|
void tst_QDesktopWidget::topLevels()
|
||||||
|
@ -5383,7 +5383,7 @@ void tst_QWidget::moveChild()
|
|||||||
parent.setStyle(style.data());
|
parent.setStyle(style.data());
|
||||||
ColorWidget child(&parent, Qt::Widget, Qt::blue);
|
ColorWidget child(&parent, Qt::Widget, Qt::blue);
|
||||||
|
|
||||||
parent.setGeometry(QRect(QPoint(QApplication::desktop()->availableGeometry(&parent).topLeft()) + QPoint(50, 50),
|
parent.setGeometry(QRect(parent.screen()->availableGeometry().topLeft() + QPoint(50, 50),
|
||||||
QSize(200, 200)));
|
QSize(200, 200)));
|
||||||
child.setGeometry(25, 25, 50, 50);
|
child.setGeometry(25, 25, 50, 50);
|
||||||
#ifndef QT_NO_CURSOR // Try to make sure the cursor is not in a taskbar area to prevent tooltips or window highlighting
|
#ifndef QT_NO_CURSOR // Try to make sure the cursor is not in a taskbar area to prevent tooltips or window highlighting
|
||||||
@ -5430,8 +5430,7 @@ void tst_QWidget::showAndMoveChild()
|
|||||||
const QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Windows")));
|
const QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Windows")));
|
||||||
parent.setStyle(style.data());
|
parent.setStyle(style.data());
|
||||||
|
|
||||||
QDesktopWidget desktop;
|
QRect desktopDimensions = parent.screen()->availableGeometry();
|
||||||
QRect desktopDimensions = desktop.availableGeometry(&parent);
|
|
||||||
desktopDimensions = desktopDimensions.adjusted(64, 64, -64, -64);
|
desktopDimensions = desktopDimensions.adjusted(64, 64, -64, -64);
|
||||||
|
|
||||||
#ifndef QT_NO_CURSOR // Try to make sure the cursor is not in a taskbar area to prevent tooltips or window highlighting
|
#ifndef QT_NO_CURSOR // Try to make sure the cursor is not in a taskbar area to prevent tooltips or window highlighting
|
||||||
@ -7708,7 +7707,7 @@ void tst_QWidget::repaintWhenChildDeleted()
|
|||||||
#endif
|
#endif
|
||||||
ColorWidget w(nullptr, Qt::FramelessWindowHint, Qt::red);
|
ColorWidget w(nullptr, Qt::FramelessWindowHint, Qt::red);
|
||||||
w.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
|
w.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
|
||||||
QPoint startPoint = QApplication::desktop()->availableGeometry(&w).topLeft();
|
QPoint startPoint = w.screen()->availableGeometry().topLeft();
|
||||||
startPoint.rx() += 50;
|
startPoint.rx() += 50;
|
||||||
startPoint.ry() += 50;
|
startPoint.ry() += 50;
|
||||||
w.setGeometry(QRect(startPoint, QSize(100, 100)));
|
w.setGeometry(QRect(startPoint, QSize(100, 100)));
|
||||||
@ -7733,7 +7732,7 @@ void tst_QWidget::hideOpaqueChildWhileHidden()
|
|||||||
{
|
{
|
||||||
ColorWidget w(nullptr, Qt::FramelessWindowHint, Qt::red);
|
ColorWidget w(nullptr, Qt::FramelessWindowHint, Qt::red);
|
||||||
w.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
|
w.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
|
||||||
QPoint startPoint = QApplication::desktop()->availableGeometry(&w).topLeft();
|
QPoint startPoint = w.screen()->availableGeometry().topLeft();
|
||||||
startPoint.rx() += 50;
|
startPoint.rx() += 50;
|
||||||
startPoint.ry() += 50;
|
startPoint.ry() += 50;
|
||||||
w.setGeometry(QRect(startPoint, QSize(100, 100)));
|
w.setGeometry(QRect(startPoint, QSize(100, 100)));
|
||||||
@ -9601,8 +9600,7 @@ void tst_QWidget::rectOutsideCoordinatesLimit_task144779()
|
|||||||
palette.setColor(QPalette::Window, Qt::red);
|
palette.setColor(QPalette::Window, Qt::red);
|
||||||
main.setPalette(palette);
|
main.setPalette(palette);
|
||||||
|
|
||||||
QDesktopWidget desktop;
|
QRect desktopDimensions = main.screen()->availableGeometry();
|
||||||
QRect desktopDimensions = desktop.availableGeometry(&main);
|
|
||||||
QSize mainSize(400, 400);
|
QSize mainSize(400, 400);
|
||||||
mainSize = mainSize.boundedTo(desktopDimensions.size());
|
mainSize = mainSize.boundedTo(desktopDimensions.size());
|
||||||
main.resize(mainSize);
|
main.resize(mainSize);
|
||||||
|
@ -1774,7 +1774,7 @@ void tst_QCompleter::QTBUG_52028_tabAutoCompletes()
|
|||||||
auto le = new QLineEdit;
|
auto le = new QLineEdit;
|
||||||
w.layout()->addWidget(le);
|
w.layout()->addWidget(le);
|
||||||
|
|
||||||
const auto pos = QApplication::desktop()->availableGeometry(&w).topLeft() + QPoint(200,200);
|
const auto pos = w.screen()->availableGeometry().topLeft() + QPoint(200,200);
|
||||||
w.move(pos);
|
w.move(pos);
|
||||||
w.show();
|
w.show();
|
||||||
QApplication::setActiveWindow(&w);
|
QApplication::setActiveWindow(&w);
|
||||||
@ -1815,7 +1815,7 @@ void tst_QCompleter::QTBUG_51889_activatedSentTwice()
|
|||||||
|
|
||||||
w.layout()->addWidget(new QLineEdit);
|
w.layout()->addWidget(new QLineEdit);
|
||||||
|
|
||||||
const auto pos = QApplication::desktop()->availableGeometry(&w).topLeft() + QPoint(200,200);
|
const auto pos = w.screen()->availableGeometry().topLeft() + QPoint(200,200);
|
||||||
w.move(pos);
|
w.move(pos);
|
||||||
w.show();
|
w.show();
|
||||||
QApplication::setActiveWindow(&w);
|
QApplication::setActiveWindow(&w);
|
||||||
|
@ -356,7 +356,7 @@ void tst_QAbstractScrollArea::patternBackground()
|
|||||||
widget.resize(600, 600);
|
widget.resize(600, 600);
|
||||||
scrollArea.setWidget(&widget);
|
scrollArea.setWidget(&widget);
|
||||||
topLevel.show();
|
topLevel.show();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&topLevel));
|
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
|
||||||
|
|
||||||
QLinearGradient linearGrad(QPointF(250, 250), QPointF(300, 300));
|
QLinearGradient linearGrad(QPointF(250, 250), QPointF(300, 300));
|
||||||
linearGrad.setColorAt(0, Qt::yellow);
|
linearGrad.setColorAt(0, Qt::yellow);
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include <qpa/qplatformtheme.h>
|
#include <qpa/qplatformtheme.h>
|
||||||
|
|
||||||
#include <qfontcombobox.h>
|
#include <qfontcombobox.h>
|
||||||
#include <qdesktopwidget.h>
|
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
#include <qdialog.h>
|
#include <qdialog.h>
|
||||||
@ -2212,15 +2211,13 @@ void tst_QComboBox::itemListPosition()
|
|||||||
QFontComboBox combo(&topLevel);
|
QFontComboBox combo(&topLevel);
|
||||||
|
|
||||||
layout->addWidget(&combo);
|
layout->addWidget(&combo);
|
||||||
//the code to get the available screen space is copied from QComboBox code
|
|
||||||
const int scrNumber = QApplication::desktop()->screenNumber(&combo);
|
|
||||||
|
|
||||||
bool useFullScreenForPopupMenu = false;
|
bool useFullScreenForPopupMenu = false;
|
||||||
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
|
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
|
||||||
useFullScreenForPopupMenu = theme->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool();
|
useFullScreenForPopupMenu = theme->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool();
|
||||||
const QRect screen = useFullScreenForPopupMenu ?
|
const QRect screen = useFullScreenForPopupMenu ?
|
||||||
QApplication::screens().at(scrNumber)->geometry() :
|
combo.screen()->geometry() :
|
||||||
QApplication::screens().at(scrNumber)->availableGeometry();
|
combo.screen()->availableGeometry();
|
||||||
|
|
||||||
topLevel.move(screen.width() - topLevel.sizeHint().width() - 10, 0); //puts the combo to the top-right corner
|
topLevel.move(screen.width() - topLevel.sizeHint().width() - 10, 0); //puts the combo to the top-right corner
|
||||||
|
|
||||||
@ -2440,8 +2437,7 @@ void tst_QComboBox::task248169_popupWithMinimalSize()
|
|||||||
#if defined QT_BUILD_INTERNAL
|
#if defined QT_BUILD_INTERNAL
|
||||||
QFrame *container = comboBox.findChild<QComboBoxPrivateContainer *>();
|
QFrame *container = comboBox.findChild<QComboBoxPrivateContainer *>();
|
||||||
QVERIFY(container);
|
QVERIFY(container);
|
||||||
QDesktopWidget desktop;
|
QTRY_VERIFY(container->screen()->geometry().contains(container->geometry()));
|
||||||
QTRY_VERIFY(desktop.screenGeometry(container).contains(container->geometry()));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include <qstyle.h>
|
#include <qstyle.h>
|
||||||
#include <qproxystyle.h>
|
#include <qproxystyle.h>
|
||||||
#include <qstylefactory.h>
|
#include <qstylefactory.h>
|
||||||
#include <qdesktopwidget.h>
|
|
||||||
#include <qaction.h>
|
#include <qaction.h>
|
||||||
#include <qstyleoption.h>
|
#include <qstyleoption.h>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
@ -1149,8 +1148,8 @@ void tst_QMenuBar::check_menuPosition()
|
|||||||
|
|
||||||
Menu menu;
|
Menu menu;
|
||||||
menu.setTitle("&menu");
|
menu.setTitle("&menu");
|
||||||
QRect availRect = QApplication::desktop()->availableGeometry(&w);
|
QRect availRect = w.screen()->availableGeometry();
|
||||||
QRect screenRect = QApplication::desktop()->screenGeometry(&w);
|
QRect screenRect = w.screen()->geometry();
|
||||||
|
|
||||||
while(menu.sizeHint().height() < (screenRect.height()*2/3)) {
|
while(menu.sizeHint().height() < (screenRect.height()*2/3)) {
|
||||||
menu.addAction("item");
|
menu.addAction("item");
|
||||||
|
@ -710,8 +710,7 @@ void PrintDialogPanel::showPreviewDialog()
|
|||||||
applySettings(m_printer.data());
|
applySettings(m_printer.data());
|
||||||
PrintPreviewDialog dialog(m_printer.data(), this);
|
PrintPreviewDialog dialog(m_printer.data(), this);
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
const int screenNumber = QApplication::desktop()->screenNumber(this);
|
const QSize availableSize = screen()->availableSize();
|
||||||
const QSize availableSize = QGuiApplication::screens().at(screenNumber)->availableSize();
|
|
||||||
#else
|
#else
|
||||||
const QSize availableSize = QApplication::desktop()->availableGeometry().size();
|
const QSize availableSize = QApplication::desktop()->availableGeometry().size();
|
||||||
#endif
|
#endif
|
||||||
|
@ -218,7 +218,7 @@ protected:
|
|||||||
|
|
||||||
VerticalRuler::VerticalRuler(QWidget *parent) : QWidget(parent)
|
VerticalRuler::VerticalRuler(QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
const int screenWidth = QApplication::desktop()->screenGeometry(this).width();
|
const int screenWidth = screen()->geometry().width();
|
||||||
setFixedWidth(screenWidth / 48); // 1920 pixel monitor ->40
|
setFixedWidth(screenWidth / 48); // 1920 pixel monitor ->40
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,15 +356,12 @@ int main(int argc, char *argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
MainWindowPtrList windows;
|
MainWindowPtrList windows;
|
||||||
|
|
||||||
QDesktopWidget *desktopWidget = app.desktop();
|
|
||||||
|
|
||||||
const int lastScreen = arguments.contains("-p")
|
const int lastScreen = arguments.contains("-p")
|
||||||
? 0 // Primary screen only
|
? 0 // Primary screen only
|
||||||
: desktopWidget->screenCount() - 1; // All screens
|
: QGuiApplication::screens().size() - 1; // All screens
|
||||||
for (int s = lastScreen; s >= 0; --s) {
|
for (int s = lastScreen; s >= 0; --s) {
|
||||||
MainWindowPtr window(new MainWindow(desktopWidget->screen(s)));
|
MainWindowPtr window(new MainWindow());
|
||||||
const QPoint pos = desktopWidget->screenGeometry(s).center() - QPoint(200, 100);
|
const QPoint pos = QGuiApplication::screens().at(s)->geometry().center() - QPoint(200, 100);
|
||||||
window->move(pos);
|
window->move(pos);
|
||||||
windows.append(window);
|
windows.append(window);
|
||||||
window->show();
|
window->show();
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
class DesktopView : public QGraphicsView
|
class DesktopView : public QGraphicsView
|
||||||
{
|
{
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 11)
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DesktopView()
|
DesktopView()
|
||||||
@ -195,6 +196,7 @@ private:
|
|||||||
QGraphicsScene *scene;
|
QGraphicsScene *scene;
|
||||||
QGraphicsRectItem *that;
|
QGraphicsRectItem *that;
|
||||||
QPoint thatRoot;
|
QPoint thatRoot;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "main.moc"
|
#include "main.moc"
|
||||||
|
@ -61,8 +61,10 @@ public:
|
|||||||
QLatin1String("Left-click to test QGuiApplication::topLevelAt(click pos)\nRight-click to ungrab\n") :
|
QLatin1String("Left-click to test QGuiApplication::topLevelAt(click pos)\nRight-click to ungrab\n") :
|
||||||
QLatin1String("Left-click to grab mouse\n");
|
QLatin1String("Left-click to grab mouse\n");
|
||||||
if (!m_cursorPos.isNull()) {
|
if (!m_cursorPos.isNull()) {
|
||||||
|
const auto screen = QGuiApplication::screenAt(m_cursorPos);
|
||||||
|
const auto screenNum = screen ? QGuiApplication::screens().indexOf(screen) : 0;
|
||||||
txt += QString(QLatin1String("Current mouse position: %1, %2 on screen %3\n"))
|
txt += QString(QLatin1String("Current mouse position: %1, %2 on screen %3\n"))
|
||||||
.arg(m_cursorPos.x()).arg(m_cursorPos.y()).arg(QApplication::desktop()->screenNumber(m_cursorPos));
|
.arg(m_cursorPos.x()).arg(m_cursorPos.y()).arg(screenNum);
|
||||||
if (QGuiApplication::mouseButtons() & Qt::LeftButton) {
|
if (QGuiApplication::mouseButtons() & Qt::LeftButton) {
|
||||||
QWindow *win = QGuiApplication::topLevelAt(m_cursorPos);
|
QWindow *win = QGuiApplication::topLevelAt(m_cursorPos);
|
||||||
txt += QString(QLatin1String("Top-level window found? %1\n"))
|
txt += QString(QLatin1String("Top-level window found? %1\n"))
|
||||||
@ -234,6 +236,7 @@ void screenAdded(QScreen* screen)
|
|||||||
QList<QScreen *> screens = QGuiApplication::screens();
|
QList<QScreen *> screens = QGuiApplication::screens();
|
||||||
int screenNumber = screens.indexOf(screen);
|
int screenNumber = screens.indexOf(screen);
|
||||||
Q_ASSERT(screenNumber >= 0);
|
Q_ASSERT(screenNumber >= 0);
|
||||||
|
// ### Qt 6: Find a replacement for QDesktopWidget::screen()
|
||||||
w->setParent(qApp->desktop()->screen(screenNumber));
|
w->setParent(qApp->desktop()->screen(screenNumber));
|
||||||
|
|
||||||
w->show();
|
w->show();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user