Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: src/plugins/styles/mac/qmacstyle_mac.mm src/widgets/util/qcompleter.cpp src/widgets/widgets/qmainwindowlayout.cpp src/widgets/widgets/qmdisubwindow.cpp Change-Id: If0e96981af07ce36ac68f2e69211bc2120f93973
This commit is contained in:
commit
01bc69f99f
@ -85,9 +85,9 @@ TableEditor::TableEditor(const QString &tableName, QWidget *parent)
|
||||
//! [2]
|
||||
|
||||
//! [3]
|
||||
connect(submitButton, SIGNAL(clicked()), this, SLOT(submit()));
|
||||
connect(revertButton, SIGNAL(clicked()), model, SLOT(revertAll()));
|
||||
connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(submitButton, &QPushButton::clicked, this, &TableEditor::submit);
|
||||
connect(revertButton, &QPushButton::clicked, model, &QSqlTableModel::revertAll);
|
||||
connect(quitButton, &QPushButton::clicked, this, &TableEditor::close);
|
||||
//! [3]
|
||||
|
||||
//! [4]
|
||||
|
@ -65,7 +65,7 @@ class TableEditor : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TableEditor(const QString &tableName, QWidget *parent = 0);
|
||||
explicit TableEditor(const QString &tableName, QWidget *parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void submit();
|
||||
|
@ -70,12 +70,12 @@ static bool createConnection()
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
db.setDatabaseName(":memory:");
|
||||
if (!db.open()) {
|
||||
QMessageBox::critical(0, qApp->tr("Cannot open database"),
|
||||
qApp->tr("Unable to establish a database connection.\n"
|
||||
"This example needs SQLite support. Please read "
|
||||
"the Qt SQL driver documentation for information how "
|
||||
"to build it.\n\n"
|
||||
"Click Cancel to exit."), QMessageBox::Cancel);
|
||||
QMessageBox::critical(nullptr, QObject::tr("Cannot open database"),
|
||||
QObject::tr("Unable to establish a database connection.\n"
|
||||
"This example needs SQLite support. Please read "
|
||||
"the Qt SQL driver documentation for information how "
|
||||
"to build it.\n\n"
|
||||
"Click Cancel to exit."), QMessageBox::Cancel);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -172,11 +172,20 @@
|
||||
\snippet drilldown/informationwindow.cpp 4
|
||||
|
||||
Finally, we connect the "something's changed" signals in the
|
||||
editors to our custom \c enableButtons() slot, enabling the users
|
||||
to either submit or revert their changes. We add all the widgets
|
||||
into a layout, store the item ID and the name of the displayed
|
||||
image file for future reference, and set the window title and
|
||||
initial size.
|
||||
editors to our custom \c enableButtons slot, enabling the users
|
||||
to either submit or revert their changes.
|
||||
We need to use lambdas for connecting the \c enableButtons slot
|
||||
because its signature does not match \c QTextEdit::textChanged
|
||||
and \c QComboBox::currentIndexChanged.
|
||||
Since the latter has another overload with the signature
|
||||
\c {const QString &} and the selected signal would be ambiguous,
|
||||
we need to use \c QOverload<int>::of to select a specific overload
|
||||
for \c currentIndexChanged.
|
||||
|
||||
We add all the widgets into a layout, store the item ID and the
|
||||
name of the displayed image file for future reference, and set
|
||||
the window title and initial size.
|
||||
|
||||
|
||||
Note that we also set the Qt::Window window flag to indicate that
|
||||
our widget is in fact a window, with a window system frame and a
|
||||
@ -389,19 +398,21 @@
|
||||
\snippet drilldown/view.cpp 6
|
||||
|
||||
The \c showInformation() function is given an \c ImageItem object
|
||||
as argument, and starts off by extracting the item's item
|
||||
ID. Then it determines if there already is created an information
|
||||
window for this location. If it is, and the window is visible, it
|
||||
ensures that the window is raised to the top of the widget stack
|
||||
and activated. If the window exists but is hidden, calling its \l
|
||||
{QWidget::}{show()} slot gives the same result.
|
||||
as argument, and starts off by extracting the item's item ID.
|
||||
|
||||
Then it determines if there already is created an information
|
||||
window for this location.
|
||||
If no window for the given location exists, we create one by
|
||||
passing the item ID, a pointer to the model, and our view as a
|
||||
parent, to the \c InformationWindow constructor. Note that we
|
||||
connect the information window's \c imageChanged() signal to \e
|
||||
this widget's \c updateImage() slot, before we give it a suitable
|
||||
position and add it to the list of existing windows.
|
||||
If there is a window for the given location, and that window is
|
||||
visible, it ensures that the window is raised to the top of the
|
||||
widget stack and activated. If it is hidden, calling its \l
|
||||
{QWidget::}{show()} slot gives the same result.
|
||||
|
||||
|
||||
\snippet drilldown/view.cpp 7
|
||||
|
||||
|
@ -60,8 +60,8 @@ ImageItem::ImageItem(int id, const QPixmap &pixmap, QGraphicsItem *parent)
|
||||
timeLine.setDuration(150);
|
||||
timeLine.setFrameRange(0, 150);
|
||||
|
||||
connect(&timeLine, SIGNAL(frameChanged(int)), this, SLOT(setFrame(int)));
|
||||
connect(&timeLine, SIGNAL(finished()), this, SLOT(updateItemPosition()));
|
||||
connect(&timeLine, &QTimeLine::frameChanged, this, &ImageItem::setFrame);
|
||||
connect(&timeLine, &QTimeLine::finished, this, &ImageItem::updateItemPosition);
|
||||
|
||||
adjust();
|
||||
}
|
||||
@ -116,7 +116,7 @@ void ImageItem::adjust()
|
||||
//! [4]
|
||||
|
||||
//! [5]
|
||||
int ImageItem::id()
|
||||
int ImageItem::id() const
|
||||
{
|
||||
return recordId;
|
||||
}
|
||||
|
@ -60,10 +60,10 @@ class ImageItem : public QObject, public QGraphicsPixmapItem
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ImageItem(int id, const QPixmap &pixmap, QGraphicsItem *parent = 0);
|
||||
ImageItem(int id, const QPixmap &pixmap, QGraphicsItem *parent = nullptr);
|
||||
|
||||
void adjust();
|
||||
int id();
|
||||
int id() const;
|
||||
|
||||
protected:
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
||||
|
@ -84,10 +84,12 @@ InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *items,
|
||||
//! [3]
|
||||
|
||||
//! [4]
|
||||
connect(descriptionEditor, SIGNAL(textChanged()),
|
||||
this, SLOT(enableButtons()));
|
||||
connect(imageFileEditor, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(enableButtons()));
|
||||
connect(descriptionEditor, &QTextEdit::textChanged, [=]() {
|
||||
enableButtons();
|
||||
});
|
||||
connect(imageFileEditor, QOverload<int>::of(&QComboBox::currentIndexChanged), [=]() {
|
||||
enableButtons();
|
||||
});
|
||||
|
||||
QFormLayout *formLayout = new QFormLayout;
|
||||
formLayout->addRow(itemLabel, itemText);
|
||||
@ -109,7 +111,7 @@ InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *items,
|
||||
//! [4]
|
||||
|
||||
//! [5]
|
||||
int InformationWindow::id()
|
||||
int InformationWindow::id() const
|
||||
{
|
||||
return itemId;
|
||||
}
|
||||
@ -149,9 +151,9 @@ void InformationWindow::createButtons()
|
||||
|
||||
closeButton->setDefault(true);
|
||||
|
||||
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(revertButton, SIGNAL(clicked()), this, SLOT(revert()));
|
||||
connect(submitButton, SIGNAL(clicked()), this, SLOT(submit()));
|
||||
connect(closeButton, &QPushButton::clicked, this, &InformationWindow::close);
|
||||
connect(revertButton, &QPushButton::clicked, this, &InformationWindow::revert);
|
||||
connect(submitButton, &QPushButton::clicked, this, &InformationWindow::submit);
|
||||
//! [8]
|
||||
|
||||
//! [9]
|
||||
|
@ -61,9 +61,9 @@ class InformationWindow : public QDialog
|
||||
|
||||
public:
|
||||
InformationWindow(int id, QSqlRelationalTableModel *items,
|
||||
QWidget *parent = 0);
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
int id();
|
||||
int id() const;
|
||||
|
||||
signals:
|
||||
void imageChanged(int id, const QString &fileName);
|
||||
@ -83,16 +83,16 @@ private:
|
||||
int itemId;
|
||||
QString displayedImage;
|
||||
|
||||
QComboBox *imageFileEditor;
|
||||
QLabel *itemText;
|
||||
QTextEdit *descriptionEditor;
|
||||
QComboBox *imageFileEditor = nullptr;
|
||||
QLabel *itemText = nullptr;
|
||||
QTextEdit *descriptionEditor = nullptr;
|
||||
|
||||
QPushButton *closeButton;
|
||||
QPushButton *submitButton;
|
||||
QPushButton *revertButton;
|
||||
QDialogButtonBox *buttonBox;
|
||||
QPushButton *closeButton = nullptr;
|
||||
QPushButton *submitButton = nullptr;
|
||||
QPushButton *revertButton = nullptr;
|
||||
QDialogButtonBox *buttonBox = nullptr;
|
||||
|
||||
QDataWidgetMapper *mapper;
|
||||
QDataWidgetMapper *mapper = nullptr;
|
||||
};
|
||||
//! [2]
|
||||
|
||||
|
@ -48,10 +48,13 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "../connection.h"
|
||||
#include "view.h"
|
||||
#include "../connection.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -60,7 +63,7 @@ int main(int argc, char *argv[])
|
||||
QApplication app(argc, argv);
|
||||
|
||||
if (!createConnection())
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
|
||||
View view("items", "images");
|
||||
view.show();
|
||||
|
@ -89,8 +89,6 @@ void View::addItems()
|
||||
int topMargin = 40;
|
||||
|
||||
for (int i = 0; i < itemCount; i++) {
|
||||
ImageItem *image;
|
||||
QGraphicsTextItem *label;
|
||||
QSqlRecord record = itemTable->record(i);
|
||||
|
||||
int id = record.value("id").toInt();
|
||||
@ -101,12 +99,12 @@ void View::addItems()
|
||||
int x = ((i % 2) * imageOffset) + leftMargin + columnOffset;
|
||||
int y = ((i / 2) * imageOffset) + topMargin;
|
||||
|
||||
image = new ImageItem(id, QPixmap(":/" + file));
|
||||
ImageItem *image = new ImageItem(id, QPixmap(":/" + file));
|
||||
image->setData(0, i);
|
||||
image->setPos(x, y);
|
||||
scene->addItem(image);
|
||||
|
||||
label = scene->addText(item);
|
||||
QGraphicsTextItem *label = scene->addText(item);
|
||||
label->setDefaultTextColor(QColor("#d7d6d5"));
|
||||
QPointF labelOffset((120 - label->boundingRect().width()) / 2, 120.0);
|
||||
label->setPos(QPointF(x, y) + labelOffset);
|
||||
@ -133,22 +131,22 @@ void View::showInformation(ImageItem *image)
|
||||
return;
|
||||
|
||||
InformationWindow *window = findWindow(id);
|
||||
if (window && window->isVisible()) {
|
||||
window->raise();
|
||||
window->activateWindow();
|
||||
} else if (window && !window->isVisible()) {
|
||||
window->show();
|
||||
} else {
|
||||
InformationWindow *window;
|
||||
if (!window) {
|
||||
window = new InformationWindow(id, itemTable, this);
|
||||
|
||||
connect(window, SIGNAL(imageChanged(int,QString)),
|
||||
this, SLOT(updateImage(int,QString)));
|
||||
connect(window, QOverload<int,const QString &>::of(&InformationWindow::imageChanged),
|
||||
this, QOverload<int,const QString &>::of(&View::updateImage));
|
||||
|
||||
window->move(pos() + QPoint(20, 40));
|
||||
window->show();
|
||||
informationWindows.append(window);
|
||||
}
|
||||
|
||||
if (window->isVisible()) {
|
||||
window->raise();
|
||||
window->activateWindow();
|
||||
} else
|
||||
window->show();
|
||||
}
|
||||
//! [6]
|
||||
|
||||
@ -172,19 +170,13 @@ void View::updateImage(int id, const QString &fileName)
|
||||
//! [7]
|
||||
|
||||
//! [8]
|
||||
InformationWindow* View::findWindow(int id)
|
||||
InformationWindow *View::findWindow(int id) const
|
||||
{
|
||||
QList<InformationWindow*>::iterator i, beginning, end;
|
||||
|
||||
beginning = informationWindows.begin();
|
||||
end = informationWindows.end();
|
||||
|
||||
for (i = beginning; i != end; ++i) {
|
||||
InformationWindow *window = (*i);
|
||||
for (auto window : informationWindows) {
|
||||
if (window && (window->id() == id))
|
||||
return window;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
//! [8]
|
||||
|
||||
|
@ -63,7 +63,7 @@ class View : public QGraphicsView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
View(const QString &items, const QString &images, QWidget *parent = 0);
|
||||
View(const QString &items, const QString &images, QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
@ -77,7 +77,7 @@ private slots:
|
||||
//! [2]
|
||||
private:
|
||||
void addItems();
|
||||
InformationWindow* findWindow(int id);
|
||||
InformationWindow *findWindow(int id) const;
|
||||
void showInformation(ImageItem *image);
|
||||
|
||||
QGraphicsScene *scene;
|
||||
|
@ -61,12 +61,12 @@ static bool createConnection()
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
db.setDatabaseName(":memory:");
|
||||
if (!db.open()) {
|
||||
QMessageBox::critical(0, qApp->tr("Cannot open database"),
|
||||
qApp->tr("Unable to establish a database connection.\n"
|
||||
"This example needs SQLite support. Please read "
|
||||
"the Qt SQL driver documentation for information how "
|
||||
"to build it.\n\n"
|
||||
"Click Cancel to exit."), QMessageBox::Cancel);
|
||||
QMessageBox::critical(nullptr, QObject::tr("Cannot open database"),
|
||||
QObject::tr("Unable to establish a database connection.\n"
|
||||
"This example needs SQLite support. Please read "
|
||||
"the Qt SQL driver documentation for information how "
|
||||
"to build it.\n\n"
|
||||
"Click Cancel to exit."), QMessageBox::Cancel);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -155,12 +155,12 @@ int Dialog::addNewAlbum(const QString &title, int artistId)
|
||||
return id;
|
||||
}
|
||||
|
||||
void Dialog::addTracks(int albumId, QStringList tracks)
|
||||
void Dialog::addTracks(int albumId, const QStringList &tracks)
|
||||
{
|
||||
QDomElement albumNode = albumDetails.createElement("album");
|
||||
albumNode.setAttribute("id", albumId);
|
||||
|
||||
for (int i = 0; i < tracks.count(); i++) {
|
||||
for (int i = 0; i < tracks.count(); ++i) {
|
||||
QString trackNumber = QString::number(i);
|
||||
if (i < 10)
|
||||
trackNumber.prepend('0');
|
||||
@ -254,9 +254,9 @@ QDialogButtonBox *Dialog::createButtons()
|
||||
|
||||
closeButton->setDefault(true);
|
||||
|
||||
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(revertButton, SIGNAL(clicked()), this, SLOT(revert()));
|
||||
connect(submitButton, SIGNAL(clicked()), this, SLOT(submit()));
|
||||
connect(closeButton, &QPushButton::clicked, this, &Dialog::close);
|
||||
connect(revertButton, &QPushButton::clicked, this, &Dialog::revert);
|
||||
connect(submitButton, &QPushButton::clicked, this, &Dialog::submit);
|
||||
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox;
|
||||
buttonBox->addButton(submitButton, QDialogButtonBox::ResetRole);
|
||||
@ -270,7 +270,7 @@ QModelIndex Dialog::indexOfArtist(const QString &artist)
|
||||
{
|
||||
QSqlTableModel *artistModel = model->relationModel(2);
|
||||
|
||||
for (int i = 0; i < artistModel->rowCount(); i++) {
|
||||
for (int i = 0; i < artistModel->rowCount(); ++i) {
|
||||
QSqlRecord record = artistModel->record(i);
|
||||
if (record.value("artist") == artist)
|
||||
return artistModel->index(i, 1);
|
||||
|
@ -61,7 +61,7 @@ class Dialog : public QDialog
|
||||
|
||||
public:
|
||||
Dialog(QSqlRelationalTableModel *albums, QDomDocument details,
|
||||
QFile *output, QWidget *parent = 0);
|
||||
QFile *output, QWidget *parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void revert();
|
||||
@ -70,12 +70,12 @@ private slots:
|
||||
private:
|
||||
int addNewAlbum(const QString &title, int artistId);
|
||||
int addNewArtist(const QString &name);
|
||||
void addTracks(int albumId, QStringList tracks);
|
||||
void addTracks(int albumId, const QStringList &tracks);
|
||||
QDialogButtonBox *createButtons();
|
||||
QGroupBox *createInputWidgets();
|
||||
int findArtistId(const QString &artist);
|
||||
int generateAlbumId();
|
||||
int generateArtistId();
|
||||
static int generateAlbumId();
|
||||
static int generateArtistId();
|
||||
void increaseAlbumCount(QModelIndex artistIndex);
|
||||
QModelIndex indexOfArtist(const QString &artist);
|
||||
|
||||
|
@ -48,11 +48,14 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "database.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Q_INIT_RESOURCE(masterdetail);
|
||||
@ -60,10 +63,10 @@ int main(int argc, char *argv[])
|
||||
QApplication app(argc, argv);
|
||||
|
||||
if (!createConnection())
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
|
||||
QFile *albumDetails = new QFile("albumdetails.xml");
|
||||
MainWindow window("artists", "albums", albumDetails);
|
||||
QFile albumDetails("albumdetails.xml");
|
||||
MainWindow window("artists", "albums", &albumDetails);
|
||||
window.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
@ -78,10 +78,10 @@ MainWindow::MainWindow(const QString &artistTable, const QString &albumTable,
|
||||
uniqueAlbumId = model->rowCount();
|
||||
uniqueArtistId = artistView->count();
|
||||
|
||||
connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
|
||||
this, SLOT(updateHeader(QModelIndex,int,int)));
|
||||
connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
|
||||
this, SLOT(updateHeader(QModelIndex,int,int)));
|
||||
connect(model, &QSqlRelationalTableModel::rowsInserted,
|
||||
this, &MainWindow::updateHeader);
|
||||
connect(model, &QSqlRelationalTableModel::rowsRemoved,
|
||||
this, &MainWindow::updateHeader);
|
||||
|
||||
QGridLayout *layout = new QGridLayout;
|
||||
layout->addWidget(artists, 0, 0);
|
||||
@ -145,7 +145,7 @@ void MainWindow::showAlbumDetails(QModelIndex index)
|
||||
titleLabel->show();
|
||||
|
||||
QDomNodeList albums = albumData.elementsByTagName("album");
|
||||
for (int i = 0; i < albums.count(); i++) {
|
||||
for (int i = 0; i < albums.count(); ++i) {
|
||||
QDomNode album = albums.item(i);
|
||||
if (album.toElement().attribute("id") == albumId) {
|
||||
getTrackList(album.toElement());
|
||||
@ -164,9 +164,9 @@ void MainWindow::getTrackList(QDomNode album)
|
||||
QDomNode track;
|
||||
QString trackNumber;
|
||||
|
||||
for (int j = 0; j < tracks.count(); j++) {
|
||||
for (int i = 0; i < tracks.count(); ++i) {
|
||||
|
||||
track = tracks.item(j);
|
||||
track = tracks.item(i);
|
||||
trackNumber = track.toElement().attribute("number");
|
||||
|
||||
QListWidgetItem *item = new QListWidgetItem(trackList);
|
||||
@ -222,7 +222,7 @@ void MainWindow::removeAlbumFromFile(int id)
|
||||
|
||||
QDomNodeList albums = albumData.elementsByTagName("album");
|
||||
|
||||
for (int i = 0; i < albums.count(); i++) {
|
||||
for (int i = 0; i < albums.count(); ++i) {
|
||||
QDomNode node = albums.item(i);
|
||||
if (node.toElement().attribute("id").toInt() == id) {
|
||||
albumData.elementsByTagName("archive").item(0).removeChild(node);
|
||||
@ -283,8 +283,8 @@ QGroupBox* MainWindow::createArtistGroupBox()
|
||||
artistView->setModel(model->relationModel(2));
|
||||
artistView->setModelColumn(1);
|
||||
|
||||
connect(artistView, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(changeArtist(int)));
|
||||
connect(artistView, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &MainWindow::changeArtist);
|
||||
|
||||
QGroupBox *box = new QGroupBox(tr("Artist"));
|
||||
|
||||
@ -314,10 +314,10 @@ QGroupBox* MainWindow::createAlbumGroupBox()
|
||||
locale.setNumberOptions(QLocale::OmitGroupSeparator);
|
||||
albumView->setLocale(locale);
|
||||
|
||||
connect(albumView, SIGNAL(clicked(QModelIndex)),
|
||||
this, SLOT(showAlbumDetails(QModelIndex)));
|
||||
connect(albumView, SIGNAL(activated(QModelIndex)),
|
||||
this, SLOT(showAlbumDetails(QModelIndex)));
|
||||
connect(albumView, &QTableView::clicked,
|
||||
this, &MainWindow::showAlbumDetails);
|
||||
connect(albumView, &QTableView::activated,
|
||||
this, &MainWindow::showAlbumDetails);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->addWidget(albumView, 0, 0);
|
||||
@ -383,11 +383,16 @@ void MainWindow::createMenuBar()
|
||||
helpMenu->addAction(aboutAction);
|
||||
helpMenu->addAction(aboutQtAction);
|
||||
|
||||
connect(addAction, SIGNAL(triggered(bool)), this, SLOT(addAlbum()));
|
||||
connect(deleteAction, SIGNAL(triggered(bool)), this, SLOT(deleteAlbum()));
|
||||
connect(quitAction, SIGNAL(triggered(bool)), this, SLOT(close()));
|
||||
connect(aboutAction, SIGNAL(triggered(bool)), this, SLOT(about()));
|
||||
connect(aboutQtAction, SIGNAL(triggered(bool)), qApp, SLOT(aboutQt()));
|
||||
connect(addAction, &QAction::triggered,
|
||||
this, &MainWindow::addAlbum);
|
||||
connect(deleteAction, &QAction::triggered,
|
||||
this, &MainWindow::deleteAlbum);
|
||||
connect(quitAction, &QAction::triggered,
|
||||
this, &MainWindow::close);
|
||||
connect(aboutAction, &QAction::triggered,
|
||||
this, &MainWindow::about);
|
||||
connect(aboutQtAction, &QAction::triggered,
|
||||
qApp, &QApplication::aboutQt);
|
||||
}
|
||||
|
||||
void MainWindow::showImageLabel()
|
||||
|
@ -71,7 +71,7 @@ class MainWindow : public QMainWindow
|
||||
|
||||
public:
|
||||
MainWindow(const QString &artistTable, const QString &albumTable,
|
||||
QFile *albumDetails, QWidget *parent = 0);
|
||||
QFile *albumDetails, QWidget *parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void about();
|
||||
|
@ -59,7 +59,7 @@ class CustomSqlModel : public QSqlQueryModel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CustomSqlModel(QObject *parent = 0);
|
||||
CustomSqlModel(QObject *parent = nullptr);
|
||||
|
||||
QVariant data(const QModelIndex &item, int role) const override;
|
||||
};
|
||||
|
@ -58,7 +58,7 @@ class EditableSqlModel : public QSqlQueryModel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EditableSqlModel(QObject *parent = 0);
|
||||
EditableSqlModel(QObject *parent = nullptr);
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
||||
|
@ -48,12 +48,15 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "../connection.h"
|
||||
#include "customsqlmodel.h"
|
||||
#include "editablesqlmodel.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTableView>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
void initializeModel(QSqlQueryModel *model)
|
||||
{
|
||||
model->setQuery("select * from person");
|
||||
@ -80,7 +83,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
if (!createConnection())
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
|
||||
QSqlQueryModel plainModel;
|
||||
EditableSqlModel editableModel;
|
||||
|
@ -110,7 +110,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
if (!createConnection())
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
|
||||
createRelationalTables();
|
||||
|
||||
QSqlRelationalTableModel model;
|
||||
|
@ -165,11 +165,12 @@ void Browser::showTable(const QString &t)
|
||||
model->select();
|
||||
if (model->lastError().type() != QSqlError::NoError)
|
||||
emit statusMessage(model->lastError().text());
|
||||
|
||||
table->setModel(model);
|
||||
table->setEditTriggers(QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed);
|
||||
connect(table->selectionModel(), &QItemSelectionModel::currentRowChanged,
|
||||
this, &Browser::currentChanged);
|
||||
|
||||
connect(table->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
|
||||
this, SLOT(currentChanged()));
|
||||
updateActions();
|
||||
}
|
||||
|
||||
@ -189,7 +190,6 @@ void Browser::showMetaData(const QString &t)
|
||||
model->setHeaderData(5, Qt::Horizontal, "AutoValue");
|
||||
model->setHeaderData(6, Qt::Horizontal, "DefaultValue");
|
||||
|
||||
|
||||
for (int i = 0; i < rec.count(); ++i) {
|
||||
QSqlField fld = rec.field(i);
|
||||
model->setData(model->index(i, 0), fld.name());
|
||||
|
@ -65,7 +65,7 @@ class Browser: public QWidget, private Ui::Browser
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Browser(QWidget *parent = 0);
|
||||
Browser(QWidget *parent = nullptr);
|
||||
virtual ~Browser();
|
||||
|
||||
QSqlError addConnection(const QString &driver, const QString &dbName, const QString &host,
|
||||
@ -116,7 +116,9 @@ class CustomModel: public QSqlTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CustomModel(QObject *parent = 0, QSqlDatabase db = QSqlDatabase()):QSqlTableModel(parent, db) {}
|
||||
explicit CustomModel(QObject *parent = nullptr, QSqlDatabase db = QSqlDatabase())
|
||||
: QSqlTableModel(parent, db) {}
|
||||
|
||||
QVariant data(const QModelIndex &idx, int role) const override
|
||||
{
|
||||
if (role == Qt::BackgroundRole && isDirty(idx))
|
||||
|
@ -63,8 +63,8 @@ ConnectionWidget::ConnectionWidget(QWidget *parent)
|
||||
tree->header()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
QAction *refreshAction = new QAction(tr("Refresh"), tree);
|
||||
metaDataAction = new QAction(tr("Show Schema"), tree);
|
||||
connect(refreshAction, SIGNAL(triggered()), SLOT(refresh()));
|
||||
connect(metaDataAction, SIGNAL(triggered()), SLOT(showMetaData()));
|
||||
connect(refreshAction, &QAction::triggered, this, &ConnectionWidget::refresh);
|
||||
connect(metaDataAction, &QAction::triggered, this, &ConnectionWidget::showMetaData);
|
||||
tree->addAction(refreshAction);
|
||||
tree->addAction(metaDataAction);
|
||||
tree->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
@ -146,7 +146,6 @@ void ConnectionWidget::setActive(QTreeWidgetItem *item)
|
||||
|
||||
void ConnectionWidget::on_tree_itemActivated(QTreeWidgetItem *item, int /* column */)
|
||||
{
|
||||
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
|
@ -62,7 +62,7 @@ class ConnectionWidget: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConnectionWidget(QWidget *parent = 0);
|
||||
ConnectionWidget(QWidget *parent = nullptr);
|
||||
virtual ~ConnectionWidget();
|
||||
|
||||
QSqlDatabase currentDatabase() const;
|
||||
|
@ -80,16 +80,18 @@ int main(int argc, char *argv[])
|
||||
mainWin.setCentralWidget(&browser);
|
||||
|
||||
QMenu *fileMenu = mainWin.menuBar()->addMenu(QObject::tr("&File"));
|
||||
fileMenu->addAction(QObject::tr("Add &Connection..."), &browser, SLOT(addConnection()));
|
||||
fileMenu->addAction(QObject::tr("Add &Connection..."),
|
||||
[&]() { browser.addConnection(); });
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(QObject::tr("&Quit"), &app, SLOT(quit()));
|
||||
fileMenu->addAction(QObject::tr("&Quit"), []() { qApp->quit(); });
|
||||
|
||||
QMenu *helpMenu = mainWin.menuBar()->addMenu(QObject::tr("&Help"));
|
||||
helpMenu->addAction(QObject::tr("About"), &browser, SLOT(about()));
|
||||
helpMenu->addAction(QObject::tr("About Qt"), qApp, SLOT(aboutQt()));
|
||||
helpMenu->addAction(QObject::tr("About"), [&]() { browser.about(); });
|
||||
helpMenu->addAction(QObject::tr("About Qt"), []() { qApp->aboutQt(); });
|
||||
|
||||
QObject::connect(&browser, SIGNAL(statusMessage(QString)),
|
||||
mainWin.statusBar(), SLOT(showMessage(QString)));
|
||||
QObject::connect(&browser, &Browser::statusMessage, [&mainWin](const QString &text) {
|
||||
mainWin.statusBar()->showMessage(text);
|
||||
});
|
||||
|
||||
addConnectionsFromCommandline(app.arguments(), &browser);
|
||||
mainWin.show();
|
||||
|
@ -60,7 +60,7 @@ class QSqlConnectionDialog: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QSqlConnectionDialog(QWidget *parent = 0);
|
||||
QSqlConnectionDialog(QWidget *parent = nullptr);
|
||||
~QSqlConnectionDialog();
|
||||
|
||||
QString driverName() const;
|
||||
|
@ -87,12 +87,12 @@ Window::Window(QWidget *parent)
|
||||
//! [Set up the mapper]
|
||||
|
||||
//! [Set up connections and layouts]
|
||||
connect(previousButton, SIGNAL(clicked()),
|
||||
mapper, SLOT(toPrevious()));
|
||||
connect(nextButton, SIGNAL(clicked()),
|
||||
mapper, SLOT(toNext()));
|
||||
connect(mapper, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(updateButtons(int)));
|
||||
connect(previousButton, &QPushButton::clicked,
|
||||
mapper, &QDataWidgetMapper::toPrevious);
|
||||
connect(nextButton, &QPushButton::clicked,
|
||||
mapper, &QDataWidgetMapper::toNext);
|
||||
connect(mapper, &QDataWidgetMapper::currentIndexChanged,
|
||||
this, &Window::updateButtons);
|
||||
|
||||
QGridLayout *layout = new QGridLayout();
|
||||
layout->addWidget(nameLabel, 0, 0, 1, 1);
|
||||
|
@ -72,7 +72,7 @@ class Window : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Window(QWidget *parent = 0);
|
||||
Window(QWidget *parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void updateButtons(int row);
|
||||
|
@ -47,12 +47,14 @@
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtWidgets>
|
||||
#include <QtSql>
|
||||
|
||||
#include "../connection.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QSqlTableModel>
|
||||
#include <QTableView>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
void initializeModel(QSqlTableModel *model)
|
||||
{
|
||||
model->setTable("person");
|
||||
@ -76,7 +78,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
if (!createConnection())
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
|
||||
QSqlTableModel model;
|
||||
|
||||
|
@ -9,16 +9,20 @@ include(../common/linux.conf)
|
||||
include(../common/gcc-base-unix.conf)
|
||||
include(../common/android-base-head.conf)
|
||||
|
||||
QMAKE_CC = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-gcc
|
||||
QMAKE_CXX = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-g++
|
||||
QMAKE_CC = $${CROSS_COMPILE}gcc
|
||||
QMAKE_CXX = $${CROSS_COMPILE}g++
|
||||
QMAKE_LINK = $$QMAKE_CXX
|
||||
|
||||
ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/libs/$$ANDROID_TARGET_ARCH
|
||||
ANDROID_STDCPP_PATH = $$ANDROID_SOURCES_CXX_STL_LIBDIR/libgnustl_shared.so
|
||||
ANDROID_CXX_STL_LIBS = -lgnustl_shared -lgcc
|
||||
|
||||
QMAKE_CFLAGS += --sysroot=$$ANDROID_PLATFORM_ROOT_PATH \
|
||||
-isystem $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/include \
|
||||
exists($$NDK_ROOT/sysroot/usr/include): \
|
||||
QMAKE_CFLAGS += --sysroot=$$NDK_ROOT/sysroot \
|
||||
-isystem $$NDK_ROOT/sysroot/usr/include/$$NDK_TOOLS_PREFIX
|
||||
else: QMAKE_CFLAGS += --sysroot=$$ANDROID_PLATFORM_ROOT_PATH
|
||||
|
||||
QMAKE_CFLAGS += -isystem $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/include \
|
||||
-isystem $$ANDROID_SOURCES_CXX_STL_LIBDIR/include
|
||||
|
||||
equals(ANDROID_TARGET_ARCH, armeabi)|equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
|
||||
|
@ -74,3 +74,4 @@ ANDROID_PLATFORM_PATH = $$ANDROID_PLATFORM_ROOT_PATH/usr
|
||||
equals(ANDROID_TARGET_ARCH, x86_64)|equals(ANDROID_TARGET_ARCH, mips64): \
|
||||
QMAKE_ANDROID_PLATFORM_LIBDIR = $${QMAKE_ANDROID_PLATFORM_LIBDIR}64
|
||||
|
||||
CROSS_COMPILE = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-
|
||||
|
@ -57,14 +57,14 @@ QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
|
||||
QMAKE_CXXFLAGS_HIDESYMS = $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden
|
||||
|
||||
# modifications to linux.conf
|
||||
QMAKE_AR = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-ar cqs
|
||||
QMAKE_OBJCOPY = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-objcopy
|
||||
QMAKE_NM = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-nm -P
|
||||
QMAKE_AR = $${CROSS_COMPILE}ar cqs
|
||||
QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy
|
||||
QMAKE_NM = $${CROSS_COMPILE}nm -P
|
||||
|
||||
QMAKE_STRIP =
|
||||
#$$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-strip
|
||||
#$${CROSS_COMPILE}strip
|
||||
|
||||
QMAKE_RANLIB = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-ranlib
|
||||
QMAKE_RANLIB = $${CROSS_COMPILE}ranlib
|
||||
|
||||
QMAKE_INCDIR_POST =
|
||||
QMAKE_LIBDIR_POST = $$ANDROID_SOURCES_CXX_STL_LIBDIR
|
||||
|
@ -45,7 +45,7 @@ if(gcc|intel_icl|msvc):!rim_qcc:!uikit:!no_moc_predefs:if(!macos|count(QMAKE_APP
|
||||
|
||||
defineReplace(mocCmdBase) {
|
||||
!isEmpty(WIN_INCLUDETEMP) {
|
||||
incvar = @$$WIN_INCLUDETEMP
|
||||
incvar = @$$shell_quote($$WIN_INCLUDETEMP)
|
||||
} else {
|
||||
incvar =
|
||||
for (inc, MOC_INCLUDEPATH): \
|
||||
|
@ -74,10 +74,10 @@ warnings_are_errors:warning_clean {
|
||||
# compiler.
|
||||
clang {
|
||||
# Apple clang 4.0-4.2,5.0-5.1,6.0-6.4,7.0-7.3
|
||||
# Regular clang 3.3-3.9, 4.0
|
||||
# Regular clang 3.x-5.0
|
||||
apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION}
|
||||
reg_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION}
|
||||
contains(apple_ver, "4\\.[012]|5\\.[01]|6\\.[01234]|7\\.[0123]")|contains(reg_ver, "3\\.[3-9]|4\\.0") {
|
||||
contains(apple_ver, "4\\.[012]|5\\.[01]|6\\.[01234]|7\\.[0123]")|contains(reg_ver, "[34]\\.|5\\.0") {
|
||||
QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=\\$${LITERAL_HASH}warnings -Wno-error=deprecated-declarations $$WERROR
|
||||
}
|
||||
} else:intel_icc:linux {
|
||||
|
@ -232,17 +232,17 @@ QMAKE_COMPILER_DEFINES += __cplusplus=$$QT_COMPILER_STDCXX
|
||||
QMAKE_COMPILER_DEFINES += __INTEL_COMPILER=$$QMAKE_ICC_VER __INTEL_COMPILER_UPDATE=$$QMAKE_ICC_UPDATE_VER
|
||||
!isEmpty(QMAKE_APPLE_CC): \
|
||||
QMAKE_COMPILER_DEFINES += __APPLE_CC__=$$QMAKE_APPLE_CC
|
||||
!isEmpty(QT_APPLE_CLANG_MAJOR_VERSION): \
|
||||
!isEmpty(QMAKE_APPLE_CLANG_MAJOR_VERSION): \
|
||||
QMAKE_COMPILER_DEFINES += __clang__ \
|
||||
__clang_major__=$$QMAKE_APPLE_CLANG_MAJOR_VERSION \
|
||||
__clang_minor__=$$QMAKE_APPLE_CLANG_MINOR_VERSION \
|
||||
__clang_patchlevel__=$$QMAKE_APPLE_CLANG_PATCH_VERSION
|
||||
!isEmpty(QT_CLANG_MAJOR_VERSION): \
|
||||
!isEmpty(QMAKE_CLANG_MAJOR_VERSION): \
|
||||
QMAKE_COMPILER_DEFINES += __clang__ \
|
||||
__clang_major__=$$QMAKE_CLANG_MAJOR_VERSION \
|
||||
__clang_minor__=$$QMAKE_CLANG_MINOR_VERSION \
|
||||
__clang_patchlevel__=$$QMAKE_CLANG_PATCH_VERSION
|
||||
!isEmpty(QT_GCC_MAJOR_VERSION): \
|
||||
!isEmpty(QMAKE_GCC_MAJOR_VERSION): \
|
||||
QMAKE_COMPILER_DEFINES += \
|
||||
__GNUC__=$$QMAKE_GCC_MAJOR_VERSION \
|
||||
__GNUC_MINOR__=$$QMAKE_GCC_MINOR_VERSION \
|
||||
|
@ -245,9 +245,15 @@ static int doLink(int argc, char **argv)
|
||||
static int installFile(const QString &source, const QString &target, bool exe = false)
|
||||
{
|
||||
QFile sourceFile(source);
|
||||
|
||||
QFile::remove(target);
|
||||
QDir::root().mkpath(QFileInfo(target).absolutePath());
|
||||
QFile targetFile(target);
|
||||
if (targetFile.exists()) {
|
||||
#ifdef Q_OS_WIN
|
||||
targetFile.setPermissions(targetFile.permissions() | QFile::WriteUser);
|
||||
#endif
|
||||
QFile::remove(target);
|
||||
} else {
|
||||
QDir::root().mkpath(QFileInfo(target).absolutePath());
|
||||
}
|
||||
|
||||
if (!sourceFile.copy(target)) {
|
||||
fprintf(stderr, "Error copying %s to %s: %s\n", source.toLatin1().constData(), qPrintable(target), qPrintable(sourceFile.errorString()));
|
||||
@ -255,7 +261,6 @@ static int installFile(const QString &source, const QString &target, bool exe =
|
||||
}
|
||||
|
||||
if (exe) {
|
||||
QFile targetFile(target);
|
||||
if (!targetFile.setPermissions(sourceFile.permissions() | QFileDevice::ExeOwner | QFileDevice::ExeUser |
|
||||
QFileDevice::ExeGroup | QFileDevice::ExeOther)) {
|
||||
fprintf(stderr, "Error setting execute permissions on %s: %s\n",
|
||||
@ -266,10 +271,20 @@ static int installFile(const QString &source, const QString &target, bool exe =
|
||||
|
||||
// Copy file times
|
||||
QString error;
|
||||
#ifdef Q_OS_WIN
|
||||
const QFile::Permissions permissions = targetFile.permissions();
|
||||
const bool readOnly = !(permissions & QFile::WriteUser);
|
||||
if (readOnly)
|
||||
targetFile.setPermissions(permissions | QFile::WriteUser);
|
||||
#endif
|
||||
if (!IoUtils::touchFile(target, sourceFile.fileName(), &error)) {
|
||||
fprintf(stderr, "%s", qPrintable(error));
|
||||
return 3;
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
if (readOnly)
|
||||
targetFile.setPermissions(permissions);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <QtCore/private/qcore_unix_p.h>
|
||||
#include <QtCore/qvarlengtharray.h>
|
||||
|
||||
#include <pwd.h>
|
||||
#include <stdlib.h> // for realpath()
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -3173,6 +3173,9 @@ static bool canConvertMetaObject(int fromId, int toId, QObject *fromObject)
|
||||
*/
|
||||
bool QVariant::canConvert(int targetTypeId) const
|
||||
{
|
||||
if (d.type == targetTypeId)
|
||||
return true;
|
||||
|
||||
if ((targetTypeId == QMetaType::QModelIndex && d.type == QMetaType::QPersistentModelIndex)
|
||||
|| (targetTypeId == QMetaType::QPersistentModelIndex && d.type == QMetaType::QModelIndex))
|
||||
return true;
|
||||
@ -3639,29 +3642,36 @@ static int numericCompare(const QVariant::Private *d1, const QVariant::Private *
|
||||
*/
|
||||
bool QVariant::cmp(const QVariant &v) const
|
||||
{
|
||||
auto cmp_helper = [] (const QVariant::Private &d1, const QVariant::Private &d2)
|
||||
{
|
||||
Q_ASSERT(d1.type == d2.type);
|
||||
if (d1.type >= QMetaType::User) {
|
||||
int result;
|
||||
if (QMetaType::equals(QT_PREPEND_NAMESPACE(constData(d1)), QT_PREPEND_NAMESPACE(constData(d2)), d1.type, &result))
|
||||
return result == 0;
|
||||
}
|
||||
return handlerManager[d1.type]->compare(&d1, &d2);
|
||||
};
|
||||
|
||||
// try numerics first, with C++ type promotion rules (no conversion)
|
||||
if (qIsNumericType(d.type) && qIsNumericType(v.d.type))
|
||||
return numericCompare(&d, &v.d) == 0;
|
||||
|
||||
if (d.type == v.d.type)
|
||||
return cmp_helper(d, v.d);
|
||||
|
||||
QVariant v1 = *this;
|
||||
QVariant v2 = v;
|
||||
if (d.type != v2.d.type) {
|
||||
if (v2.canConvert(v1.d.type)) {
|
||||
if (!v2.convert(v1.d.type))
|
||||
return false;
|
||||
} else {
|
||||
// try the opposite conversion, it might work
|
||||
qSwap(v1, v2);
|
||||
if (!v2.convert(v1.d.type))
|
||||
return false;
|
||||
}
|
||||
if (v2.canConvert(v1.d.type)) {
|
||||
if (!v2.convert(v1.d.type))
|
||||
return false;
|
||||
} else {
|
||||
// try the opposite conversion, it might work
|
||||
qSwap(v1, v2);
|
||||
if (!v2.convert(v1.d.type))
|
||||
return false;
|
||||
}
|
||||
if (v1.d.type >= QMetaType::User) {
|
||||
int result;
|
||||
if (QMetaType::equals(QT_PREPEND_NAMESPACE(constData(v1.d)), QT_PREPEND_NAMESPACE(constData(v2.d)), v1.d.type, &result))
|
||||
return result == 0;
|
||||
}
|
||||
return handlerManager[v1.d.type]->compare(&v1.d, &v2.d);
|
||||
return cmp_helper(v1.d, v2.d);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -3677,51 +3687,53 @@ int QVariant::compare(const QVariant &v) const
|
||||
if (cmp(v))
|
||||
return 0;
|
||||
|
||||
QVariant v1 = *this;
|
||||
QVariant v2 = v;
|
||||
const QVariant *v1 = this;
|
||||
const QVariant *v2 = &v;
|
||||
QVariant converted1;
|
||||
QVariant converted2;
|
||||
|
||||
if (v1.d.type != v2.d.type) {
|
||||
if (d.type != v.d.type) {
|
||||
// if both types differ, try to convert
|
||||
if (v2.canConvert(v1.d.type)) {
|
||||
QVariant temp = v2;
|
||||
if (temp.convert(v1.d.type))
|
||||
v2 = temp;
|
||||
if (v2->canConvert(v1->d.type)) {
|
||||
converted2 = *v2;
|
||||
if (converted2.convert(v1->d.type))
|
||||
v2 = &converted2;
|
||||
}
|
||||
if (v1.d.type != v2.d.type && v1.canConvert(v2.d.type)) {
|
||||
QVariant temp = v1;
|
||||
if (temp.convert(v2.d.type))
|
||||
v1 = temp;
|
||||
if (v1->d.type != v2->d.type && v1->canConvert(v2->d.type)) {
|
||||
converted1 = *v1;
|
||||
if (converted1.convert(v2->d.type))
|
||||
v1 = &converted1;
|
||||
}
|
||||
if (v1.d.type != v2.d.type) {
|
||||
if (v1->d.type != v2->d.type) {
|
||||
// if conversion fails, default to toString
|
||||
int r = v1.toString().compare(v2.toString(), Qt::CaseInsensitive);
|
||||
int r = v1->toString().compare(v2->toString(), Qt::CaseInsensitive);
|
||||
if (r == 0) {
|
||||
// cmp(v) returned false, so we should try to agree with it.
|
||||
return (v1.d.type < v2.d.type) ? -1 : 1;
|
||||
return (v1->d.type < v2->d.type) ? -1 : 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
// did we end up with two numerics? If so, restart
|
||||
if (qIsNumericType(v1.d.type) && qIsNumericType(v2.d.type))
|
||||
return v1.compare(v2);
|
||||
if (qIsNumericType(v1->d.type) && qIsNumericType(v2->d.type))
|
||||
return v1->compare(*v2);
|
||||
}
|
||||
if (v1.d.type >= QMetaType::User) {
|
||||
if (v1->d.type >= QMetaType::User) {
|
||||
int result;
|
||||
if (QMetaType::compare(QT_PREPEND_NAMESPACE(constData(d)), QT_PREPEND_NAMESPACE(constData(v2.d)), d.type, &result))
|
||||
if (QMetaType::compare(QT_PREPEND_NAMESPACE(constData(d)), QT_PREPEND_NAMESPACE(constData(v2->d)), d.type, &result))
|
||||
return result;
|
||||
}
|
||||
switch (v1.d.type) {
|
||||
switch (v1->d.type) {
|
||||
case QVariant::Date:
|
||||
return v1.toDate() < v2.toDate() ? -1 : 1;
|
||||
return v1->toDate() < v2->toDate() ? -1 : 1;
|
||||
case QVariant::Time:
|
||||
return v1.toTime() < v2.toTime() ? -1 : 1;
|
||||
return v1->toTime() < v2->toTime() ? -1 : 1;
|
||||
case QVariant::DateTime:
|
||||
return v1.toDateTime() < v2.toDateTime() ? -1 : 1;
|
||||
return v1->toDateTime() < v2->toDateTime() ? -1 : 1;
|
||||
case QVariant::StringList:
|
||||
return v1.toStringList() < v2.toStringList() ? -1 : 1;
|
||||
return v1->toStringList() < v2->toStringList() ? -1 : 1;
|
||||
}
|
||||
int r = v1.toString().compare(v2.toString(), Qt::CaseInsensitive);
|
||||
int r = v1->toString().compare(v2->toString(), Qt::CaseInsensitive);
|
||||
if (r == 0) {
|
||||
// cmp(v) returned false, so we should try to agree with it.
|
||||
return (d.type < v.d.type) ? -1 : 1;
|
||||
|
@ -850,17 +850,20 @@ Q_INLINE_TEMPLATE typename QSharedPointer<X>::difference_type operator-(T *ptr1,
|
||||
template <class T, class X>
|
||||
Q_INLINE_TEMPLATE bool operator<(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2)
|
||||
{
|
||||
return ptr1.data() < ptr2.data();
|
||||
using CT = typename std::common_type<T *, X *>::type;
|
||||
return std::less<CT>()(ptr1.data(), ptr2.data());
|
||||
}
|
||||
template <class T, class X>
|
||||
Q_INLINE_TEMPLATE bool operator<(const QSharedPointer<T> &ptr1, X *ptr2)
|
||||
{
|
||||
return ptr1.data() < ptr2;
|
||||
using CT = typename std::common_type<T *, X *>::type;
|
||||
return std::less<CT>()(ptr1.data(), ptr2);
|
||||
}
|
||||
template <class T, class X>
|
||||
Q_INLINE_TEMPLATE bool operator<(T *ptr1, const QSharedPointer<X> &ptr2)
|
||||
{
|
||||
return ptr1 < ptr2.data();
|
||||
using CT = typename std::common_type<T *, X *>::type;
|
||||
return std::less<CT>()(ptr1, ptr2.data());
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -2113,8 +2113,8 @@ static QImage convertWithPalette(const QImage &src, QImage::Format format,
|
||||
Returns a copy of the image converted to the given \a format,
|
||||
using the specified \a colorTable.
|
||||
|
||||
Conversion from 32 bit to 8 bit indexed is a slow operation and
|
||||
will use a straightforward nearest color approach, with no
|
||||
Conversion from RGB formats to indexed formats is a slow operation
|
||||
and will use a straightforward nearest color approach, with no
|
||||
dithering.
|
||||
*/
|
||||
QImage QImage::convertToFormat(Format format, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags) const
|
||||
@ -2122,23 +2122,12 @@ QImage QImage::convertToFormat(Format format, const QVector<QRgb> &colorTable, Q
|
||||
if (!d || d->format == format)
|
||||
return *this;
|
||||
|
||||
if (format <= QImage::Format_Indexed8 && depth() == 32) {
|
||||
return convertWithPalette(*this, format, colorTable);
|
||||
}
|
||||
|
||||
const Image_Converter *converterPtr = &qimage_converter_map[d->format][format];
|
||||
Image_Converter converter = *converterPtr;
|
||||
if (!converter)
|
||||
if (format == QImage::Format_Invalid)
|
||||
return QImage();
|
||||
if (format <= QImage::Format_Indexed8)
|
||||
return convertWithPalette(convertToFormat(QImage::Format_ARGB32, flags), format, colorTable);
|
||||
|
||||
QImage image(d->width, d->height, format);
|
||||
QIMAGE_SANITYCHECK_MEMORY(image);
|
||||
|
||||
image.d->offset = offset();
|
||||
copyMetadata(image.d, d);
|
||||
|
||||
converter(image.d, d, flags);
|
||||
return image;
|
||||
return convertToFormat(format, flags);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -136,6 +136,17 @@ bool QIBusPlatformInputContext::isValid() const
|
||||
return d->valid && d->busConnected;
|
||||
}
|
||||
|
||||
bool QIBusPlatformInputContext::hasCapability(Capability capability) const
|
||||
{
|
||||
switch (capability) {
|
||||
case QPlatformInputContext::HiddenTextCapability:
|
||||
return false; // QTBUG-40691, do not show IME on desktop for password entry fields.
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void QIBusPlatformInputContext::invokeAction(QInputMethod::Action a, int)
|
||||
{
|
||||
if (!d->busConnected)
|
||||
|
@ -95,6 +95,7 @@ public:
|
||||
void update(Qt::InputMethodQueries) Q_DECL_OVERRIDE;
|
||||
bool filterEvent(const QEvent *event) Q_DECL_OVERRIDE;
|
||||
QLocale locale() const Q_DECL_OVERRIDE;
|
||||
bool hasCapability(Capability capability) const Q_DECL_OVERRIDE;
|
||||
|
||||
public Q_SLOTS:
|
||||
void commitText(const QDBusVariant &text);
|
||||
|
@ -86,6 +86,7 @@ QCocoaMenuBar::~QCocoaMenuBar()
|
||||
// the menu bar was updated
|
||||
qDeleteAll(children());
|
||||
updateMenuBarImmediately();
|
||||
resetKnownMenuItemsToQt();
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,16 +307,9 @@ void QCocoaMenuBar::resetKnownMenuItemsToQt()
|
||||
foreach (QCocoaMenuBar *mb, static_menubars) {
|
||||
foreach (QCocoaMenu *m, mb->m_menus) {
|
||||
foreach (QCocoaMenuItem *i, m->items()) {
|
||||
switch (i->effectiveRole()) {
|
||||
case QPlatformMenuItem::CutRole:
|
||||
case QPlatformMenuItem::CopyRole:
|
||||
case QPlatformMenuItem::PasteRole:
|
||||
case QPlatformMenuItem::SelectAllRole:
|
||||
if (i->effectiveRole() >= QPlatformMenuItem::ApplicationSpecificRole) {
|
||||
[i->nsItem() setTarget:m->nsMenu().delegate];
|
||||
[i->nsItem() setAction:@selector(itemFired:)];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1348,10 +1348,16 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
|
||||
|
||||
QChar ch = QChar::ReplacementCharacter;
|
||||
int keyCode = Qt::Key_unknown;
|
||||
if ([characters length] != 0) {
|
||||
|
||||
// If a dead key occurs as a result of pressing a key combination then
|
||||
// characters will have 0 length, but charactersIgnoringModifiers will
|
||||
// have a valid character in it. This enables key combinations such as
|
||||
// ALT+E to be used as a shortcut with an English keyboard even though
|
||||
// pressing ALT+E will give a dead key while doing normal text input.
|
||||
if ([characters length] != 0 || [charactersIgnoringModifiers length] != 0) {
|
||||
if (((modifiers & Qt::MetaModifier) || (modifiers & Qt::AltModifier)) && ([charactersIgnoringModifiers length] != 0))
|
||||
ch = QChar([charactersIgnoringModifiers characterAtIndex:0]);
|
||||
else
|
||||
else if ([characters length] != 0)
|
||||
ch = QChar([characters characterAtIndex:0]);
|
||||
keyCode = [self convertKeyCode:ch];
|
||||
}
|
||||
|
@ -126,6 +126,21 @@
|
||||
"features": [
|
||||
"disable_desktopgl"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"description": "Intel driver version 8.15.10.1749 causes GPU process hangs (QTBUG-56360)",
|
||||
"vendor_id": "0x8086",
|
||||
"os": {
|
||||
"type": "win"
|
||||
},
|
||||
"driver_version": {
|
||||
"op": "=",
|
||||
"value": "8.15.10.1749"
|
||||
},
|
||||
"features": [
|
||||
"disable_desktopgl", "disable_d3d11", "disable_d3d9"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -74,9 +74,15 @@
|
||||
#include <qgroupbox.h>
|
||||
#include <qhash.h>
|
||||
#include <qheaderview.h>
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include <qlineedit.h>
|
||||
#endif
|
||||
#if QT_CONFIG(mainwindow)
|
||||
#include <qmainwindow.h>
|
||||
#endif
|
||||
#if QT_CONFIG(mdiarea)
|
||||
#include <qmdisubwindow.h>
|
||||
#endif
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <qmenubar.h>
|
||||
#endif
|
||||
@ -97,7 +103,9 @@
|
||||
#if QT_CONFIG(scrollbar)
|
||||
#include <qscrollbar.h>
|
||||
#endif
|
||||
#if QT_CONFIG(sizegrip)
|
||||
#include <qsizegrip.h>
|
||||
#endif
|
||||
#include <qstyleoption.h>
|
||||
#include <qtoolbar.h>
|
||||
#if QT_CONFIG(toolbutton)
|
||||
@ -834,7 +842,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
|
||||
else if (qobject_cast<const QProgressBar *>(widg))
|
||||
ct = QStyle::CT_ProgressBar;
|
||||
#endif
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
else if (qobject_cast<const QLineEdit *>(widg))
|
||||
ct = QStyle::CT_LineEdit;
|
||||
#endif
|
||||
@ -844,7 +852,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
|
||||
else if (qobject_cast<const QMenuBar *>(widg))
|
||||
ct = QStyle::CT_MenuBar;
|
||||
#endif
|
||||
#ifndef QT_NO_SIZEGRIP
|
||||
#if QT_CONFIG(sizegrip)
|
||||
else if (qobject_cast<const QSizeGrip *>(widg))
|
||||
ct = QStyle::CT_SizeGrip;
|
||||
#endif
|
||||
@ -932,7 +940,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
|
||||
gbi.size = sz == QStyleHelper::SizeSmall ? kHIThemeGrowBoxSizeSmall : kHIThemeGrowBoxSizeNormal;
|
||||
if (HIThemeGetGrowBoxBounds(&p, &gbi, &r) == noErr) {
|
||||
int width = 0;
|
||||
#ifndef QT_NO_MDIAREA
|
||||
#if QT_CONFIG(mdiarea)
|
||||
if (widg && qobject_cast<QMdiSubWindow *>(widg->parentWidget()))
|
||||
width = r.size.width;
|
||||
#endif
|
||||
@ -1120,7 +1128,7 @@ static QStyleHelper::WidgetSizePolicy qt_aqua_guess_size(const QWidget *widg, QS
|
||||
return QStyleHelper::SizeLarge;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MAINWINDOW
|
||||
#if QT_CONFIG(mainwindow)
|
||||
if (qEnvironmentVariableIsSet("QWIDGET_ALL_SMALL")) {
|
||||
//if (small.width() != -1 || small.height() != -1)
|
||||
return QStyleHelper::SizeSmall;
|
||||
@ -2277,7 +2285,7 @@ void QMacStyle::unpolish(QApplication *)
|
||||
|
||||
void QMacStyle::polish(QWidget* w)
|
||||
{
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (qobject_cast<QMenu*>(w)
|
||||
#if QT_CONFIG(combobox)
|
||||
|| qobject_cast<QComboBoxPrivateContainer *>(w)
|
||||
@ -2336,7 +2344,7 @@ void QMacStyle::polish(QWidget* w)
|
||||
void QMacStyle::unpolish(QWidget* w)
|
||||
{
|
||||
if (
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
qobject_cast<QMenu*>(w) &&
|
||||
#endif
|
||||
!w->testAttribute(Qt::WA_SetPalette)) {
|
||||
@ -2444,7 +2452,7 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
|
||||
ret = 15; // I hate having magic numbers in here...
|
||||
break;
|
||||
case PM_DefaultFrameWidth:
|
||||
#ifndef QT_NO_MAINWINDOW
|
||||
#if QT_CONFIG(mainwindow)
|
||||
if (widget && (widget->isWindow() || !widget->parentWidget()
|
||||
|| (qobject_cast<const QMainWindow*>(widget->parentWidget())
|
||||
&& static_cast<QMainWindow *>(widget->parentWidget())->centralWidget() == widget))
|
||||
@ -3057,7 +3065,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
|
||||
opt->rect.width(), opt->rect.height() - 8);
|
||||
HIThemeMenuDrawInfo mdi;
|
||||
mdi.version = 0;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (w && qobject_cast<QMenu *>(w->parentWidget()))
|
||||
mdi.menuType = kThemeMenuTypeHierarchical;
|
||||
else
|
||||
@ -3508,7 +3516,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
|
||||
// Draw the focus frame for widgets other than QLineEdit (e.g. for line edits in Webkit).
|
||||
// Focus frame is drawn outside the rectangle passed in the option-rect.
|
||||
if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
if ((opt->state & State_HasFocus) && !qobject_cast<const QLineEdit*>(w)) {
|
||||
int vmargin = pixelMetric(QStyle::PM_FocusFrameVMargin);
|
||||
int hmargin = pixelMetric(QStyle::PM_FocusFrameHMargin);
|
||||
@ -4586,7 +4594,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
|
||||
// the title bar. The following code fills the toolBar area with transparent pixels
|
||||
// to make that gradient visible.
|
||||
if (w) {
|
||||
#ifndef QT_NO_MAINWINDOW
|
||||
#if QT_CONFIG(mainwindow)
|
||||
if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(w->window())) {
|
||||
if (toolBar && toolBar->toolBarArea == Qt::TopToolBarArea && mainWindow->unifiedTitleAndToolBarOnMac()) {
|
||||
|
||||
@ -5468,7 +5476,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
|
||||
[slider.cell stopTracking:pressPoint at:pressPoint inView:slider mouseIsUp:NO];
|
||||
}
|
||||
break;
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case CC_SpinBox:
|
||||
if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
|
||||
if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) {
|
||||
@ -6192,7 +6200,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case CC_SpinBox:
|
||||
if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
|
||||
QStyleHelper::WidgetSizePolicy aquaSize = d->effectiveAquaSizeConstrain(spin, widget);
|
||||
@ -6303,7 +6311,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
|
||||
bool useAquaGuideline = true;
|
||||
|
||||
switch (ct) {
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case CT_SpinBox:
|
||||
if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
|
||||
// Add button + frame widths
|
||||
@ -6667,7 +6675,7 @@ bool QMacStyle::event(QEvent *e)
|
||||
QWidget *top = f->parentWidget();
|
||||
while (top && !top->isWindow() && !(top->windowType() == Qt::SubWindow))
|
||||
top = top->parentWidget();
|
||||
#ifndef QT_NO_MAINWINDOW
|
||||
#if QT_CONFIG(mainwindow)
|
||||
if (qobject_cast<QMainWindow *>(top)) {
|
||||
QWidget *central = static_cast<QMainWindow *>(top)->centralWidget();
|
||||
for (const QWidget *par = f; par; par = par->parentWidget()) {
|
||||
|
@ -74,11 +74,15 @@
|
||||
#include <qhash.h>
|
||||
#include <qheaderview.h>
|
||||
#include <qlayout.h>
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include <qlineedit.h>
|
||||
#endif
|
||||
#if QT_CONFIG(listview)
|
||||
#include <qlistview.h>
|
||||
#endif
|
||||
#if QT_CONFIG(mainwindow)
|
||||
#include <qmainwindow.h>
|
||||
#endif
|
||||
#include <qmap.h>
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <qmenubar.h>
|
||||
@ -97,8 +101,12 @@
|
||||
#if QT_CONFIG(rubberband)
|
||||
#include <qrubberband.h>
|
||||
#endif
|
||||
#if QT_CONFIG(sizegrip)
|
||||
#include <qsizegrip.h>
|
||||
#endif
|
||||
#if QT_CONFIG(spinbox)
|
||||
#include <qspinbox.h>
|
||||
#endif
|
||||
#if QT_CONFIG(splitter)
|
||||
#include <qsplitter.h>
|
||||
#endif
|
||||
|
@ -1173,7 +1173,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
case CE_MenuItem:
|
||||
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
|
||||
// windows always has a check column, regardless whether we have an icon or not
|
||||
@ -1331,7 +1331,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
case CE_HeaderSection:
|
||||
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
|
||||
partId = HP_HEADERITEM;
|
||||
@ -1772,7 +1772,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case CC_SpinBox:
|
||||
if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(option))
|
||||
{
|
||||
@ -1830,7 +1830,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
default:
|
||||
QWindowsXPStyle::drawComplexControl(control, option, painter, widget);
|
||||
break;
|
||||
@ -2290,11 +2290,11 @@ void QWindowsVistaStyle::polish(QApplication *app)
|
||||
void QWindowsVistaStyle::polish(QWidget *widget)
|
||||
{
|
||||
QWindowsXPStyle::polish(widget);
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
if (qobject_cast<QLineEdit*>(widget))
|
||||
widget->setAttribute(Qt::WA_Hover);
|
||||
else
|
||||
#endif // QT_NO_LINEEDIT
|
||||
#endif // QT_CONFIG(lineedit)
|
||||
if (qobject_cast<QGroupBox*>(widget))
|
||||
widget->setAttribute(Qt::WA_Hover);
|
||||
else if (qobject_cast<QCommandLinkButton*>(widget)) {
|
||||
@ -2351,11 +2351,11 @@ void QWindowsVistaStyle::unpolish(QWidget *widget)
|
||||
|
||||
d->stopAnimation(widget);
|
||||
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
if (qobject_cast<QLineEdit*>(widget))
|
||||
widget->setAttribute(Qt::WA_Hover, false);
|
||||
else
|
||||
#endif // QT_NO_LINEEDIT
|
||||
#endif // QT_CONFIG(lineedit)
|
||||
if (qobject_cast<QGroupBox*>(widget))
|
||||
widget->setAttribute(Qt::WA_Hover, false);
|
||||
else if (qobject_cast<QMessageBox *> (widget)) {
|
||||
|
@ -65,12 +65,16 @@
|
||||
#include <qpushbutton.h>
|
||||
#endif
|
||||
#include <qradiobutton.h>
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include <qlineedit.h>
|
||||
#endif
|
||||
#include <qgroupbox.h>
|
||||
#if QT_CONFIG(toolbutton)
|
||||
#include <qtoolbutton.h>
|
||||
#endif
|
||||
#if QT_CONFIG(spinbox)
|
||||
#include <qspinbox.h>
|
||||
#endif
|
||||
#include <qtoolbar.h>
|
||||
#if QT_CONFIG(combobox)
|
||||
#include <qcombobox.h>
|
||||
|
@ -68,7 +68,9 @@
|
||||
#include <qscrollbar.h>
|
||||
#endif
|
||||
#include <qheaderview.h>
|
||||
#if QT_CONFIG(spinbox)
|
||||
#include <qspinbox.h>
|
||||
#endif
|
||||
#if QT_CONFIG(listview)
|
||||
#include <qlistview.h>
|
||||
#endif
|
||||
@ -381,10 +383,10 @@ bool QWindowsXPStylePrivate::isLineEditBaseColorSet(const QStyleOption *option,
|
||||
// Since spin box includes a line edit we need to resolve the palette mask also from
|
||||
// the parent, as while the color is always correct on the palette supplied by panel,
|
||||
// the mask can still be empty. If either mask specifies custom base color, use that.
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
if (const QAbstractSpinBox *spinbox = qobject_cast<QAbstractSpinBox*>(widget->parentWidget()))
|
||||
resolveMask |= spinbox->palette().resolve();
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
}
|
||||
return (resolveMask & (1 << QPalette::Base)) != 0;
|
||||
}
|
||||
@ -1169,10 +1171,10 @@ void QWindowsXPStyle::polish(QWidget *widget)
|
||||
|| qobject_cast<QScrollBar*>(widget)
|
||||
|| qobject_cast<QSlider*>(widget)
|
||||
|| qobject_cast<QHeaderView*>(widget)
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
|| qobject_cast<QAbstractSpinBox*>(widget)
|
||||
|| qobject_cast<QSpinBox*>(widget)
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
) {
|
||||
widget->setAttribute(Qt::WA_Hover);
|
||||
}
|
||||
@ -1244,10 +1246,10 @@ void QWindowsXPStyle::unpolish(QWidget *widget)
|
||||
|| qobject_cast<QScrollBar*>(widget)
|
||||
|| qobject_cast<QSlider*>(widget)
|
||||
|| qobject_cast<QHeaderView*>(widget)
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
|| qobject_cast<QAbstractSpinBox*>(widget)
|
||||
|| qobject_cast<QSpinBox*>(widget)
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
) {
|
||||
widget->setAttribute(Qt::WA_Hover, false);
|
||||
}
|
||||
@ -2513,7 +2515,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
|
||||
flags |= State_MouseOver;
|
||||
|
||||
switch (cc) {
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case CC_SpinBox:
|
||||
if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(option))
|
||||
{
|
||||
@ -2565,7 +2567,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
#if QT_CONFIG(combobox)
|
||||
case CC_ComboBox:
|
||||
if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option))
|
||||
@ -2728,7 +2730,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
|
||||
}
|
||||
break;
|
||||
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
case CC_Slider:
|
||||
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option))
|
||||
{
|
||||
@ -3180,7 +3182,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
|
||||
}
|
||||
break;
|
||||
|
||||
#ifndef QT_NO_MDIAREA
|
||||
#if QT_CONFIG(mdiarea)
|
||||
case CC_MdiControls:
|
||||
{
|
||||
QRect buttonRect;
|
||||
@ -3236,7 +3238,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif //QT_NO_MDIAREA
|
||||
#endif // QT_CONFIG(mdiarea)
|
||||
#if QT_CONFIG(dial)
|
||||
case CC_Dial:
|
||||
if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
|
||||
@ -3576,7 +3578,7 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifndef QT_NO_MDIAREA
|
||||
#if QT_CONFIG(mdiarea)
|
||||
case CC_MdiControls:
|
||||
{
|
||||
int numSubControls = 0;
|
||||
@ -3613,7 +3615,7 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
|
||||
rect = QRect(offset, 0, buttonWidth, option->rect.height());
|
||||
break;
|
||||
}
|
||||
#endif // QT_NO_MDIAREA
|
||||
#endif // QT_CONFIG(mdiarea)
|
||||
|
||||
default:
|
||||
rect = visualRect(option->direction, option->rect,
|
||||
|
@ -365,6 +365,14 @@ void QSqlDatabasePrivate::disable()
|
||||
cloneDatabase() to create an independent database connection based
|
||||
on an existing one.
|
||||
|
||||
\warning It is highly recommended that you do not keep a copy of the
|
||||
QSqlDatabase around as a member of a class, as this will prevent the
|
||||
instance from being correctly cleaned up on shutdown. If you need to
|
||||
access an existing QSqlDatabase, it should be accessed with database().
|
||||
If you chose to have a QSqlDatabase member variable, this needs to be
|
||||
deleted before the QCoreApplication instance is deleted, otherwise it
|
||||
may lead to undefined behavior.
|
||||
|
||||
If you create multiple database connections, specify a unique
|
||||
connection name for each one, when you call addDatabase(). Use
|
||||
database() with a connection name to get that connection. Use
|
||||
|
@ -582,7 +582,6 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
|
||||
" -import dir : Specify an import directory.\n"
|
||||
" -plugins dir : Specify a directory where to search for plugins.\n"
|
||||
" -input dir/file : Specify the root directory for test cases or a single test case file.\n"
|
||||
" -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n"
|
||||
" -translation file : Specify the translation file.\n"
|
||||
);
|
||||
}
|
||||
@ -779,7 +778,6 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
|
||||
" -import : Specify an import directory.\n"
|
||||
" -plugins : Specify a directory where to search for plugins.\n"
|
||||
" -input : Specify the root directory for test cases.\n"
|
||||
" -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,9 @@
|
||||
#if QT_CONFIG(combobox)
|
||||
#include <qcombobox.h>
|
||||
#endif
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include <qlineedit.h>
|
||||
#endif
|
||||
#include <qstyle.h>
|
||||
#include <qstyleoption.h>
|
||||
#include <qtooltip.h>
|
||||
|
@ -39,7 +39,9 @@
|
||||
|
||||
#include "qaccessiblemenu_p.h"
|
||||
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <qmenubar.h>
|
||||
#endif
|
||||
@ -50,7 +52,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
|
||||
QString qt_accStripAmp(const QString &text);
|
||||
QString qt_accHotKey(const QString &text);
|
||||
@ -389,7 +391,7 @@ QWidget *QAccessibleMenuItem::owner() const
|
||||
return m_owner;
|
||||
}
|
||||
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
class QMenu;
|
||||
class QMenuBar;
|
||||
class QAction;
|
||||
@ -136,7 +136,7 @@ private:
|
||||
QPointer<QWidget> m_owner; // can hold either QMenu or the QMenuBar that contains the action
|
||||
};
|
||||
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#endif // QT_NO_ACCESSIBILITY
|
||||
|
@ -60,7 +60,9 @@
|
||||
#include <QRubberBand>
|
||||
#endif
|
||||
#include <QFocusFrame>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <QMenu>
|
||||
#endif
|
||||
#include <QtWidgets/private/qwidget_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -72,7 +74,7 @@ static QList<QWidget*> childWidgets(const QWidget *widget)
|
||||
QWidget *w = qobject_cast<QWidget *>(o);
|
||||
if (w && !w->isWindow()
|
||||
&& !qobject_cast<QFocusFrame*>(w)
|
||||
#if !defined(QT_NO_MENU)
|
||||
#if QT_CONFIG(menu)
|
||||
&& !qobject_cast<QMenu*>(w)
|
||||
#endif
|
||||
&& w->objectName() != QLatin1String("qt_rubberband")
|
||||
|
@ -76,7 +76,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
|
||||
return iface;
|
||||
|
||||
if (false) {
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
} else if (classname == QLatin1String("QLineEdit")) {
|
||||
if (widget->objectName() == QLatin1String("qt_spinbox_lineedit"))
|
||||
iface = 0;
|
||||
@ -87,7 +87,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
|
||||
} else if (classname == QLatin1String("QComboBox")) {
|
||||
iface = new QAccessibleComboBox(widget);
|
||||
#endif
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
} else if (classname == QLatin1String("QAbstractSpinBox")) {
|
||||
iface = new QAccessibleAbstractSpinBox(widget);
|
||||
} else if (classname == QLatin1String("QSpinBox")) {
|
||||
@ -99,7 +99,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
|
||||
} else if (classname == QLatin1String("QScrollBar")) {
|
||||
iface = new QAccessibleScrollBar(widget);
|
||||
#endif
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
} else if (classname == QLatin1String("QAbstractSlider")) {
|
||||
iface = new QAccessibleAbstractSlider(widget);
|
||||
} else if (classname == QLatin1String("QSlider")) {
|
||||
@ -120,7 +120,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
|
||||
iface = new QAccessibleWidget(widget, QAccessible::Dialog);
|
||||
} else if (classname == QLatin1String("QMessageBox")) {
|
||||
iface = new QAccessibleWidget(widget, QAccessible::AlertMessage);
|
||||
#ifndef QT_NO_MAINWINDOW
|
||||
#if QT_CONFIG(mainwindow)
|
||||
} else if (classname == QLatin1String("QMainWindow")) {
|
||||
iface = new QAccessibleMainWindow(widget);
|
||||
#endif
|
||||
@ -142,7 +142,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
|
||||
} else if (classname == QLatin1String("QMenuBar")) {
|
||||
iface = new QAccessibleMenuBar(widget);
|
||||
#endif
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
} else if (classname == QLatin1String("QMenu")) {
|
||||
iface = new QAccessibleMenu(widget);
|
||||
#endif
|
||||
@ -167,7 +167,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
|
||||
} else if (classname == QLatin1String("QSplitterHandle")) {
|
||||
iface = new QAccessibleWidget(widget, QAccessible::Grip);
|
||||
#endif
|
||||
#if !defined(QT_NO_TEXTEDIT) && !defined(QT_NO_CURSOR)
|
||||
#if QT_CONFIG(textedit) && !defined(QT_NO_CURSOR)
|
||||
} else if (classname == QLatin1String("QTextEdit")) {
|
||||
iface = new QAccessibleTextEdit(widget);
|
||||
} else if (classname == QLatin1String("QPlainTextEdit")) {
|
||||
@ -185,7 +185,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
|
||||
} else if (classname == QLatin1String("QToolBox")) {
|
||||
iface = new QAccessibleToolBox(widget);
|
||||
#endif
|
||||
#ifndef QT_NO_MDIAREA
|
||||
#if QT_CONFIG(mdiarea)
|
||||
} else if (classname == QLatin1String("QMdiArea")) {
|
||||
iface = new QAccessibleMdiArea(widget);
|
||||
} else if (classname == QLatin1String("QMdiSubWindow")) {
|
||||
|
@ -41,11 +41,13 @@
|
||||
#include "qabstracttextdocumentlayout.h"
|
||||
#include "qapplication.h"
|
||||
#include "qclipboard.h"
|
||||
#include "qtextedit.h"
|
||||
#include "private/qtextedit_p.h"
|
||||
#include "qtextdocument.h"
|
||||
#include "qtextobject.h"
|
||||
#if QT_CONFIG(textedit)
|
||||
#include "qplaintextedit.h"
|
||||
#include "qtextedit.h"
|
||||
#include "private/qtextedit_p.h"
|
||||
#endif
|
||||
#include "qtextboundaryfinder.h"
|
||||
#if QT_CONFIG(scrollbar)
|
||||
#include "qscrollbar.h"
|
||||
@ -58,8 +60,10 @@
|
||||
#if QT_CONFIG(toolbox)
|
||||
#include <QToolBox>
|
||||
#endif
|
||||
#if QT_CONFIG(mdiarea)
|
||||
#include <QMdiArea>
|
||||
#include <QMdiSubWindow>
|
||||
#endif
|
||||
#if QT_CONFIG(dialogbuttonbox)
|
||||
#include <QDialogButtonBox>
|
||||
#endif
|
||||
@ -80,8 +84,13 @@
|
||||
#include <QDockWidget>
|
||||
#include <private/qdockwidget_p.h>
|
||||
#endif
|
||||
#if QT_CONFIG(mainwindow)
|
||||
#include <QMainWindow>
|
||||
#endif
|
||||
#include <QFocusFrame>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <QMenu>
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
|
||||
@ -113,7 +122,7 @@ QList<QWidget*> childWidgets(const QWidget *widget)
|
||||
return widgets;
|
||||
}
|
||||
|
||||
#if !defined(QT_NO_TEXTEDIT) && !defined(QT_NO_CURSOR)
|
||||
#if QT_CONFIG(textedit) && !defined(QT_NO_CURSOR)
|
||||
|
||||
QAccessiblePlainTextEdit::QAccessiblePlainTextEdit(QWidget* o)
|
||||
:QAccessibleTextWidget(o)
|
||||
@ -310,7 +319,7 @@ void QAccessibleTextEdit::scrollToSubstring(int startIndex, int endIndex)
|
||||
qWarning("AccessibleTextEdit::scrollToSubstring failed!");
|
||||
}
|
||||
|
||||
#endif // QT_NO_TEXTEDIT && QT_NO_CURSOR
|
||||
#endif // QT_CONFIG(textedit) && QT_NO_CURSOR
|
||||
|
||||
#if QT_CONFIG(stackedwidget)
|
||||
// ======================= QAccessibleStackedWidget ======================
|
||||
@ -375,7 +384,7 @@ QToolBox * QAccessibleToolBox::toolBox() const
|
||||
#endif // QT_CONFIG(toolbox)
|
||||
|
||||
// ======================= QAccessibleMdiArea ======================
|
||||
#ifndef QT_NO_MDIAREA
|
||||
#if QT_CONFIG(mdiarea)
|
||||
QAccessibleMdiArea::QAccessibleMdiArea(QWidget *widget)
|
||||
: QAccessibleWidget(widget, QAccessible::LayeredPane)
|
||||
{
|
||||
@ -495,7 +504,7 @@ QMdiSubWindow *QAccessibleMdiSubWindow::mdiSubWindow() const
|
||||
{
|
||||
return static_cast<QMdiSubWindow *>(object());
|
||||
}
|
||||
#endif // QT_NO_MDIAREA
|
||||
#endif // QT_CONFIG(mdiarea)
|
||||
|
||||
#if QT_CONFIG(dialogbuttonbox)
|
||||
// ======================= QAccessibleDialogButtonBox ======================
|
||||
@ -1090,7 +1099,7 @@ void QAccessibleTextWidget::replaceText(int startOffset, int endOffset, const QS
|
||||
#endif // QT_NO_CURSOR
|
||||
|
||||
|
||||
#ifndef QT_NO_MAINWINDOW
|
||||
#if QT_CONFIG(mainwindow)
|
||||
QAccessibleMainWindow::QAccessibleMainWindow(QWidget *widget)
|
||||
: QAccessibleWidget(widget, QAccessible::Window) { }
|
||||
|
||||
@ -1139,7 +1148,7 @@ QMainWindow *QAccessibleMainWindow::mainWindow() const
|
||||
return qobject_cast<QMainWindow *>(object());
|
||||
}
|
||||
|
||||
#endif //QT_NO_MAINWINDOW
|
||||
#endif // QT_CONFIG(mainwindow)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -132,7 +132,7 @@ protected:
|
||||
virtual QWidget *viewport() const = 0;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_TEXTEDIT
|
||||
#if QT_CONFIG(textedit)
|
||||
class QAccessiblePlainTextEdit : public QAccessibleTextWidget
|
||||
{
|
||||
public:
|
||||
@ -184,7 +184,7 @@ protected:
|
||||
QTextDocument *textDocument() const Q_DECL_OVERRIDE;
|
||||
QWidget *viewport() const Q_DECL_OVERRIDE;
|
||||
};
|
||||
#endif // QT_NO_TEXTEDIT
|
||||
#endif // QT_CONFIG(textedit)
|
||||
#endif //QT_NO_CURSOR
|
||||
|
||||
class QAccessibleStackedWidget : public QAccessibleWidget
|
||||
@ -216,7 +216,7 @@ protected:
|
||||
QToolBox *toolBox() const;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_MDIAREA
|
||||
#if QT_CONFIG(mdiarea)
|
||||
class QAccessibleMdiArea : public QAccessibleWidget
|
||||
{
|
||||
public:
|
||||
@ -246,7 +246,7 @@ public:
|
||||
protected:
|
||||
QMdiSubWindow *mdiSubWindow() const;
|
||||
};
|
||||
#endif // QT_NO_MDIAREA
|
||||
#endif // QT_CONFIG(mdiarea)
|
||||
|
||||
#if QT_CONFIG(dialogbuttonbox)
|
||||
class QAccessibleDialogButtonBox : public QAccessibleWidget
|
||||
@ -304,7 +304,7 @@ protected:
|
||||
|
||||
#endif // QT_CONFIG(dockwidget)
|
||||
|
||||
#ifndef QT_NO_MAINWINDOW
|
||||
#if QT_CONFIG(mainwindow)
|
||||
class QAccessibleMainWindow : public QAccessibleWidget
|
||||
{
|
||||
public:
|
||||
@ -317,7 +317,7 @@ public:
|
||||
QMainWindow *mainWindow() const;
|
||||
|
||||
};
|
||||
#endif //QT_NO_MAINWINDOW
|
||||
#endif // QT_CONFIG(mainwindow)
|
||||
|
||||
#endif // QT_NO_ACCESSIBILITY
|
||||
|
||||
|
@ -39,11 +39,15 @@
|
||||
|
||||
#include "rangecontrols_p.h"
|
||||
|
||||
#if QT_CONFIG(slider)
|
||||
#include <qslider.h>
|
||||
#endif
|
||||
#if QT_CONFIG(dial)
|
||||
#include <qdial.h>
|
||||
#endif
|
||||
#if QT_CONFIG(spinbox)
|
||||
#include <qspinbox.h>
|
||||
#endif
|
||||
#if QT_CONFIG(scrollbar)
|
||||
#include <qscrollbar.h>
|
||||
#endif
|
||||
@ -51,8 +55,9 @@
|
||||
#include <qstyleoption.h>
|
||||
#include <qdebug.h>
|
||||
#include <qglobal.h>
|
||||
#include <QDoubleSpinBox>
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include <QtWidgets/qlineedit.h>
|
||||
#endif
|
||||
#include <qmath.h>
|
||||
#include <private/qmath_p.h>
|
||||
|
||||
@ -62,7 +67,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
QAccessibleAbstractSpinBox::QAccessibleAbstractSpinBox(QWidget *w)
|
||||
: QAccessibleWidget(w, QAccessible::SpinBox), lineEdit(Q_NULLPTR)
|
||||
{
|
||||
@ -285,7 +290,7 @@ QString QAccessibleDoubleSpinBox::text(QAccessible::Text textType) const
|
||||
return QAccessibleWidget::text(textType);
|
||||
}
|
||||
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
|
||||
#if QT_CONFIG(scrollbar)
|
||||
/*!
|
||||
@ -322,7 +327,7 @@ QString QAccessibleScrollBar::text(QAccessible::Text t) const
|
||||
|
||||
#endif // QT_CONFIG(scrollbar)
|
||||
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
/*!
|
||||
\class QAccessibleSlider
|
||||
\brief The QAccessibleSlider class implements the QAccessibleInterface for sliders.
|
||||
@ -399,7 +404,7 @@ QAbstractSlider *QAccessibleAbstractSlider::abstractSlider() const
|
||||
return static_cast<QAbstractSlider *>(object());
|
||||
}
|
||||
|
||||
#endif // QT_NO_SLIDER
|
||||
#endif // QT_CONFIG(slider)
|
||||
|
||||
#if QT_CONFIG(dial)
|
||||
// ======================================= QAccessibleDial ======================================
|
||||
|
@ -67,7 +67,7 @@ class QDoubleSpinBox;
|
||||
class QDial;
|
||||
class QAccessibleLineEdit;
|
||||
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
class QAccessibleAbstractSpinBox:
|
||||
public QAccessibleWidget,
|
||||
public QAccessibleValueInterface,
|
||||
@ -141,7 +141,7 @@ public:
|
||||
protected:
|
||||
QDoubleSpinBox *doubleSpinBox() const;
|
||||
};
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
|
||||
#if QT_CONFIG(slider)
|
||||
class QAccessibleAbstractSlider: public QAccessibleWidget, public QAccessibleValueInterface
|
||||
@ -174,7 +174,7 @@ protected:
|
||||
};
|
||||
#endif // QT_CONFIG(scrollbar)
|
||||
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
class QAccessibleSlider : public QAccessibleAbstractSlider
|
||||
{
|
||||
public:
|
||||
@ -184,7 +184,7 @@ public:
|
||||
protected:
|
||||
QSlider *slider() const;
|
||||
};
|
||||
#endif // QT_NO_SLIDER
|
||||
#endif // QT_CONFIG(slider)
|
||||
|
||||
#if QT_CONFIG(dial)
|
||||
class QAccessibleDial : public QAccessibleAbstractSlider
|
||||
|
@ -60,7 +60,9 @@
|
||||
#if QT_CONFIG(toolbutton)
|
||||
#include <qtoolbutton.h>
|
||||
#endif
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#if QT_CONFIG(label)
|
||||
#include <qlabel.h>
|
||||
#endif
|
||||
@ -70,14 +72,17 @@
|
||||
#if QT_CONFIG(lcdnumber)
|
||||
#include <qlcdnumber.h>
|
||||
#endif
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include <qlineedit.h>
|
||||
#include <private/qlineedit_p.h>
|
||||
#endif
|
||||
#include <qstyle.h>
|
||||
#include <qstyleoption.h>
|
||||
#include <qtextdocument.h>
|
||||
#include <qwindow.h>
|
||||
#include <private/qwindowcontainer_p.h>
|
||||
#include <QtCore/qvarlengtharray.h>
|
||||
#include <QtGui/qvalidator.h>
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#include <qfocusframe.h>
|
||||
@ -175,7 +180,7 @@ QAccessible::State QAccessibleButton::state() const
|
||||
if (pb) {
|
||||
if (pb->isDefault())
|
||||
state.defaultButton = true;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (pb->menu())
|
||||
state.hasPopup = true;
|
||||
#endif
|
||||
@ -214,7 +219,7 @@ QAccessible::Role QAccessibleButton::role() const
|
||||
{
|
||||
QAbstractButton *ab = button();
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (QPushButton *pb = qobject_cast<QPushButton*>(ab)) {
|
||||
if (pb->menu())
|
||||
return QAccessible::ButtonMenu;
|
||||
@ -257,7 +262,7 @@ void QAccessibleButton::doAction(const QString &actionName)
|
||||
return;
|
||||
if (actionName == pressAction() ||
|
||||
actionName == showMenuAction()) {
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
QPushButton *pb = qobject_cast<QPushButton*>(object());
|
||||
if (pb && pb->menu())
|
||||
pb->showMenu();
|
||||
@ -311,7 +316,7 @@ QToolButton *QAccessibleToolButton::toolButton() const
|
||||
*/
|
||||
bool QAccessibleToolButton::isSplitButton() const
|
||||
{
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
return toolButton()->menu() && toolButton()->popupMode() == QToolButton::MenuButtonPopup;
|
||||
#else
|
||||
return false;
|
||||
@ -323,7 +328,7 @@ QAccessible::State QAccessibleToolButton::state() const
|
||||
QAccessible::State st = QAccessibleButton::state();
|
||||
if (toolButton()->autoRaise())
|
||||
st.hotTracked = true;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (toolButton()->menu())
|
||||
st.hasPopup = true;
|
||||
#endif
|
||||
@ -337,7 +342,7 @@ int QAccessibleToolButton::childCount() const
|
||||
|
||||
QAccessible::Role QAccessibleToolButton::role() const
|
||||
{
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
QAbstractButton *ab = button();
|
||||
QToolButton *tb = qobject_cast<QToolButton*>(ab);
|
||||
if (!tb->menu())
|
||||
@ -351,7 +356,7 @@ QAccessible::Role QAccessibleToolButton::role() const
|
||||
|
||||
QAccessibleInterface *QAccessibleToolButton::child(int index) const
|
||||
{
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (index == 0 && toolButton()->menu())
|
||||
{
|
||||
return QAccessible::queryAccessibleInterface(toolButton()->menu());
|
||||
@ -658,7 +663,7 @@ QStringList QAccessibleGroupBox::keyBindingsForAction(const QString &) const
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
/*!
|
||||
\class QAccessibleLineEdit
|
||||
\brief The QAccessibleLineEdit class implements the QAccessibleInterface for widgets with editable text
|
||||
@ -895,7 +900,7 @@ void QAccessibleLineEdit::replaceText(int startOffset, int endOffset, const QStr
|
||||
lineEdit()->setText(lineEdit()->text().replace(startOffset, endOffset - startOffset, text));
|
||||
}
|
||||
|
||||
#endif // QT_NO_LINEEDIT
|
||||
#endif // QT_CONFIG(lineedit)
|
||||
|
||||
#if QT_CONFIG(progressbar)
|
||||
QAccessibleProgressBar::QAccessibleProgressBar(QWidget *o)
|
||||
|
@ -148,7 +148,7 @@ private:
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
class QAccessibleLineEdit : public QAccessibleWidget, public QAccessibleTextInterface, public QAccessibleEditableTextInterface
|
||||
{
|
||||
public:
|
||||
@ -188,7 +188,7 @@ protected:
|
||||
QLineEdit *lineEdit() const;
|
||||
friend class QAccessibleAbstractSpinBox;
|
||||
};
|
||||
#endif // QT_NO_LINEEDIT
|
||||
#endif // QT_CONFIG(lineedit)
|
||||
|
||||
#if QT_CONFIG(progressbar)
|
||||
class QAccessibleProgressBar : public QAccessibleDisplay, public QAccessibleValueInterface
|
||||
|
@ -49,7 +49,9 @@
|
||||
#include "qlabel.h"
|
||||
#include "qlayout.h"
|
||||
#include "qlineedit.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#endif
|
||||
#include "qpainter.h"
|
||||
#include "qpixmap.h"
|
||||
#include "qpushbutton.h"
|
||||
@ -428,7 +430,7 @@ void QWellArray::setSelected(int row, int col)
|
||||
if (row >= 0)
|
||||
emit selected(row, col);
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (isVisible() && qobject_cast<QMenu*>(parentWidget()))
|
||||
parentWidget()->close();
|
||||
#endif
|
||||
|
@ -53,11 +53,15 @@
|
||||
#include <private/qdesktopwidget_p.h>
|
||||
#include "qapplication.h"
|
||||
#include "qlayout.h"
|
||||
#if QT_CONFIG(sizegrip)
|
||||
#include "qsizegrip.h"
|
||||
#endif
|
||||
#if QT_CONFIG(whatsthis)
|
||||
#include "qwhatsthis.h"
|
||||
#endif
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#endif
|
||||
#include "qcursor.h"
|
||||
#if QT_CONFIG(messagebox)
|
||||
#include "qmessagebox.h"
|
||||
@ -621,7 +625,7 @@ bool QDialog::eventFilter(QObject *o, QEvent *e)
|
||||
/*! \reimp */
|
||||
void QDialog::contextMenuEvent(QContextMenuEvent *e)
|
||||
{
|
||||
#if !QT_CONFIG(whatsthis) || defined(QT_NO_MENU)
|
||||
#if !QT_CONFIG(whatsthis) || !QT_CONFIG(menu)
|
||||
Q_UNUSED(e);
|
||||
#else
|
||||
QWidget *w = childAt(e->pos());
|
||||
@ -1006,7 +1010,7 @@ void QDialog::showExtension(bool showIt)
|
||||
setFixedSize(w, height() + s.height());
|
||||
}
|
||||
d->extension->show();
|
||||
#ifndef QT_NO_SIZEGRIP
|
||||
#if QT_CONFIG(sizegrip)
|
||||
const bool sizeGripEnabled = isSizeGripEnabled();
|
||||
setSizeGripEnabled(false);
|
||||
d->sizeGripEnabled = sizeGripEnabled;
|
||||
@ -1019,7 +1023,7 @@ void QDialog::showExtension(bool showIt)
|
||||
resize(d->size);
|
||||
if (layout())
|
||||
layout()->setEnabled(true);
|
||||
#ifndef QT_NO_SIZEGRIP
|
||||
#if QT_CONFIG(sizegrip)
|
||||
setSizeGripEnabled(d->sizeGripEnabled);
|
||||
#endif
|
||||
}
|
||||
@ -1080,7 +1084,7 @@ void QDialog::setModal(bool modal)
|
||||
|
||||
bool QDialog::isSizeGripEnabled() const
|
||||
{
|
||||
#ifndef QT_NO_SIZEGRIP
|
||||
#if QT_CONFIG(sizegrip)
|
||||
Q_D(const QDialog);
|
||||
return !!d->resizer;
|
||||
#else
|
||||
@ -1091,11 +1095,11 @@ bool QDialog::isSizeGripEnabled() const
|
||||
|
||||
void QDialog::setSizeGripEnabled(bool enabled)
|
||||
{
|
||||
#ifdef QT_NO_SIZEGRIP
|
||||
#if !QT_CONFIG(sizegrip)
|
||||
Q_UNUSED(enabled);
|
||||
#else
|
||||
Q_D(QDialog);
|
||||
#ifndef QT_NO_SIZEGRIP
|
||||
#if QT_CONFIG(sizegrip)
|
||||
d->sizeGripEnabled = enabled;
|
||||
if (enabled && d->doShowExtension)
|
||||
return;
|
||||
@ -1116,7 +1120,7 @@ void QDialog::setSizeGripEnabled(bool enabled)
|
||||
d->resizer = 0;
|
||||
}
|
||||
}
|
||||
#endif //QT_NO_SIZEGRIP
|
||||
#endif // QT_CONFIG(sizegrip)
|
||||
}
|
||||
|
||||
|
||||
@ -1124,7 +1128,7 @@ void QDialog::setSizeGripEnabled(bool enabled)
|
||||
/*! \reimp */
|
||||
void QDialog::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
#ifndef QT_NO_SIZEGRIP
|
||||
#if QT_CONFIG(sizegrip)
|
||||
Q_D(QDialog);
|
||||
if (d->resizer) {
|
||||
if (isRightToLeft())
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
mainDef(0),
|
||||
#endif
|
||||
orientation(Qt::Horizontal),extension(0), doShowExtension(false),
|
||||
#ifndef QT_NO_SIZEGRIP
|
||||
#if QT_CONFIG(sizegrip)
|
||||
resizer(0),
|
||||
sizeGripEnabled(false),
|
||||
#endif
|
||||
@ -99,7 +99,7 @@ public:
|
||||
QWidget *extension;
|
||||
bool doShowExtension;
|
||||
QSize size, min, max;
|
||||
#ifndef QT_NO_SIZEGRIP
|
||||
#if QT_CONFIG(sizegrip)
|
||||
QSizeGrip *resizer;
|
||||
bool sizeGripEnabled;
|
||||
#endif
|
||||
|
@ -50,7 +50,9 @@
|
||||
#include <qheaderview.h>
|
||||
#include <qshortcut.h>
|
||||
#include <qgridlayout.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#if QT_CONFIG(messagebox)
|
||||
#include <qmessagebox.h>
|
||||
#endif
|
||||
@ -3353,7 +3355,7 @@ void QFileDialogPrivate::_q_showDetailsView()
|
||||
*/
|
||||
void QFileDialogPrivate::_q_showContextMenu(const QPoint &position)
|
||||
{
|
||||
#ifdef QT_NO_MENU
|
||||
#if !QT_CONFIG(menu)
|
||||
Q_UNUSED(position);
|
||||
#else
|
||||
Q_Q(QFileDialog);
|
||||
@ -3382,7 +3384,7 @@ void QFileDialogPrivate::_q_showContextMenu(const QPoint &position)
|
||||
menu.addAction(newFolderAction);
|
||||
}
|
||||
menu.exec(view->viewport()->mapToGlobal(position));
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -54,8 +54,12 @@
|
||||
#include <QtGui/qicon.h>
|
||||
#include <QtGui/qtextdocument.h>
|
||||
#include <QtWidgets/qapplication.h>
|
||||
#if QT_CONFIG(textedit)
|
||||
#include <QtWidgets/qtextedit.h>
|
||||
#endif
|
||||
#if QT_CONFIG(menu)
|
||||
#include <QtWidgets/qmenu.h>
|
||||
#endif
|
||||
#include "qdialog_p.h"
|
||||
#include <QtGui/qfont.h>
|
||||
#include <QtGui/qfontmetrics.h>
|
||||
@ -84,7 +88,7 @@ enum Button { Old_Ok = 1, Old_Cancel = 2, Old_Yes = 3, Old_No = 4, Old_Abort = 5
|
||||
NewButtonMask = 0xFFFFFC00 };
|
||||
|
||||
enum DetailButtonLabel { ShowLabel = 0, HideLabel = 1 };
|
||||
#ifndef QT_NO_TEXTEDIT
|
||||
#if QT_CONFIG(textedit)
|
||||
class QMessageBoxDetailsText : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -153,7 +157,7 @@ private:
|
||||
bool copyAvailable;
|
||||
TextEdit *textEdit;
|
||||
};
|
||||
#endif // QT_NO_TEXTEDIT
|
||||
#endif // QT_CONFIG(textedit)
|
||||
|
||||
class DetailButton : public QPushButton
|
||||
{
|
||||
@ -193,7 +197,7 @@ class QMessageBoxPrivate : public QDialogPrivate
|
||||
|
||||
public:
|
||||
QMessageBoxPrivate() : escapeButton(0), defaultButton(0), checkbox(0), clickedButton(0), detailsButton(0),
|
||||
#ifndef QT_NO_TEXTEDIT
|
||||
#if QT_CONFIG(textedit)
|
||||
detailsText(0),
|
||||
#endif
|
||||
compatMode(false), autoAddOkButton(true),
|
||||
@ -243,7 +247,7 @@ public:
|
||||
QCheckBox *checkbox;
|
||||
QAbstractButton *clickedButton;
|
||||
DetailButton *detailsButton;
|
||||
#ifndef QT_NO_TEXTEDIT
|
||||
#if QT_CONFIG(textedit)
|
||||
QMessageBoxDetailsText *detailsText;
|
||||
#endif
|
||||
bool compatMode;
|
||||
@ -464,7 +468,7 @@ int QMessageBoxPrivate::execReturnCode(QAbstractButton *button)
|
||||
void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button)
|
||||
{
|
||||
Q_Q(QMessageBox);
|
||||
#ifndef QT_NO_TEXTEDIT
|
||||
#if QT_CONFIG(textedit)
|
||||
if (detailsButton && detailsText && button == detailsButton) {
|
||||
detailsButton->setLabel(detailsText->isHidden() ? HideLabel : ShowLabel);
|
||||
detailsText->setHidden(!detailsText->isHidden());
|
||||
@ -1418,7 +1422,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
|
||||
|
||||
#if !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT)
|
||||
|
||||
#if !defined(QT_NO_TEXTEDIT)
|
||||
#if QT_CONFIG(textedit)
|
||||
if (e == QKeySequence::Copy) {
|
||||
if (d->detailsText && d->detailsText->isVisible() && d->detailsText->copy()) {
|
||||
e->setAccepted(true);
|
||||
@ -1429,7 +1433,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
|
||||
e->setAccepted(true);
|
||||
return;
|
||||
}
|
||||
#endif // !QT_NO_TEXTEDIT
|
||||
#endif // QT_CONFIG(textedit)
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
if (e == QKeySequence::Copy) {
|
||||
@ -1445,7 +1449,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
|
||||
for (const auto *button : buttons)
|
||||
textToCopy += button->text() + QLatin1String(" ");
|
||||
textToCopy += QLatin1Char('\n') + separator;
|
||||
#ifndef QT_NO_TEXTEDIT
|
||||
#if QT_CONFIG(textedit)
|
||||
if (d->detailsText)
|
||||
textToCopy += d->detailsText->text() + QLatin1Char('\n') + separator;
|
||||
#endif
|
||||
@ -1983,7 +1987,7 @@ int QMessageBoxPrivate::showOldMessageBox(QWidget *parent, QMessageBox::Icon ico
|
||||
|
||||
void QMessageBoxPrivate::retranslateStrings()
|
||||
{
|
||||
#ifndef QT_NO_TEXTEDIT
|
||||
#if QT_CONFIG(textedit)
|
||||
if (detailsButton)
|
||||
detailsButton->setLabel(detailsText->isHidden() ? ShowLabel : HideLabel);
|
||||
#endif
|
||||
@ -2438,7 +2442,7 @@ void QMessageBox::setButtonText(int button, const QString &text)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef QT_NO_TEXTEDIT
|
||||
#if QT_CONFIG(textedit)
|
||||
/*!
|
||||
\property QMessageBox::detailedText
|
||||
\brief the text to be displayed in the details area.
|
||||
@ -2486,7 +2490,7 @@ void QMessageBox::setDetailedText(const QString &text)
|
||||
}
|
||||
d->setupLayout();
|
||||
}
|
||||
#endif // QT_NO_TEXTEDIT
|
||||
#endif // QT_CONFIG(textedit)
|
||||
|
||||
/*!
|
||||
\property QMessageBox::informativeText
|
||||
|
@ -61,7 +61,7 @@ class Q_WIDGETS_EXPORT QMessageBox : public QDialog
|
||||
Q_PROPERTY(QPixmap iconPixmap READ iconPixmap WRITE setIconPixmap)
|
||||
Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat)
|
||||
Q_PROPERTY(StandardButtons standardButtons READ standardButtons WRITE setStandardButtons)
|
||||
#ifndef QT_NO_TEXTEDIT
|
||||
#if QT_CONFIG(textedit)
|
||||
Q_PROPERTY(QString detailedText READ detailedText WRITE setDetailedText)
|
||||
#endif
|
||||
Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText)
|
||||
@ -270,7 +270,7 @@ public:
|
||||
QString informativeText() const;
|
||||
void setInformativeText(const QString &text);
|
||||
|
||||
#ifndef QT_NO_TEXTEDIT
|
||||
#if QT_CONFIG(textedit)
|
||||
QString detailedText() const;
|
||||
void setDetailedText(const QString &text);
|
||||
#endif
|
||||
|
@ -42,7 +42,9 @@
|
||||
|
||||
#include <qaction.h>
|
||||
#include <qurl.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#include <qmimedata.h>
|
||||
#include <qevent.h>
|
||||
#include <qdebug.h>
|
||||
@ -435,7 +437,7 @@ void QSidebar::selectUrl(const QUrl &url)
|
||||
this, SLOT(clicked(QModelIndex)));
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
/*!
|
||||
\internal
|
||||
|
||||
@ -454,7 +456,7 @@ void QSidebar::showContextMenu(const QPoint &position)
|
||||
if (actions.count() > 0)
|
||||
QMenu::exec(actions, mapToGlobal(position));
|
||||
}
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
@ -148,7 +148,7 @@ protected:
|
||||
|
||||
private Q_SLOTS:
|
||||
void clicked(const QModelIndex &index);
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
void showContextMenu(const QPoint &position);
|
||||
#endif
|
||||
void removeEntry();
|
||||
|
@ -40,7 +40,9 @@
|
||||
#include "qwizard.h"
|
||||
#include <QtWidgets/private/qtwidgetsglobal_p.h>
|
||||
|
||||
#if QT_CONFIG(spinbox)
|
||||
#include "qabstractspinbox.h"
|
||||
#endif
|
||||
#include "qalgorithms.h"
|
||||
#include "qapplication.h"
|
||||
#include "qboxlayout.h"
|
||||
@ -50,7 +52,9 @@
|
||||
#include "qevent.h"
|
||||
#include "qframe.h"
|
||||
#include "qlabel.h"
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include "qlineedit.h"
|
||||
#endif
|
||||
#include "qpainter.h"
|
||||
#include "qwindow.h"
|
||||
#include "qpushbutton.h"
|
||||
@ -3680,13 +3684,13 @@ bool QWizardPage::isComplete() const
|
||||
if (value == field.initialValue)
|
||||
return false;
|
||||
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(field.object)) {
|
||||
if (!lineEdit->hasAcceptableInput())
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(field.object)) {
|
||||
if (!spinBox->hasAcceptableInput())
|
||||
return false;
|
||||
|
@ -53,8 +53,12 @@
|
||||
#include <QtGui/qpainter.h>
|
||||
#include <QtWidgets/qstyleoption.h>
|
||||
#include <QtWidgets/qgraphicsview.h>
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include <QtWidgets/qlineedit.h>
|
||||
#endif
|
||||
#if QT_CONFIG(textedit)
|
||||
#include <QtWidgets/qtextedit.h>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -49,10 +49,15 @@
|
||||
#include <qevent.h>
|
||||
#include <qstring.h>
|
||||
#include <qdebug.h>
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include <qlineedit.h>
|
||||
#endif
|
||||
#if QT_CONFIG(textedit)
|
||||
#include <qtextedit.h>
|
||||
#include <qplaintextedit.h>
|
||||
#endif
|
||||
#include <qapplication.h>
|
||||
#include <qvalidator.h>
|
||||
#include <private/qtextengine_p.h>
|
||||
#include <private/qabstractitemdelegate_p.h>
|
||||
|
||||
@ -432,7 +437,7 @@ QAbstractItemDelegatePrivate::QAbstractItemDelegatePrivate()
|
||||
|
||||
static bool editorHandlesKeyEvent(QWidget *editor, const QKeyEvent *event)
|
||||
{
|
||||
#ifndef QT_NO_TEXTEDIT
|
||||
#if QT_CONFIG(textedit)
|
||||
// do not filter enter / return / tab / backtab for QTextEdit or QPlainTextEdit
|
||||
if (qobject_cast<QTextEdit *>(editor) || qobject_cast<QPlainTextEdit *>(editor)) {
|
||||
switch (event->key()) {
|
||||
@ -446,7 +451,7 @@ static bool editorHandlesKeyEvent(QWidget *editor, const QKeyEvent *event)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif // QT_NO_TEXTEDIT
|
||||
#endif // QT_CONFIG(textedit)
|
||||
|
||||
Q_UNUSED(editor);
|
||||
Q_UNUSED(event);
|
||||
@ -535,7 +540,7 @@ bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *ev
|
||||
|
||||
bool QAbstractItemDelegatePrivate::tryFixup(QWidget *editor)
|
||||
{
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
if (QLineEdit *e = qobject_cast<QLineEdit*>(editor)) {
|
||||
if (!e->hasAcceptableInput()) {
|
||||
#if QT_CONFIG(validator)
|
||||
@ -550,7 +555,7 @@ bool QAbstractItemDelegatePrivate::tryFixup(QWidget *editor)
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(editor)
|
||||
#endif // QT_NO_LINEEDIT
|
||||
#endif // QT_CONFIG(lineedit)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -49,8 +49,12 @@
|
||||
#include <qscrollbar.h>
|
||||
#include <qtooltip.h>
|
||||
#include <qdatetime.h>
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include <qlineedit.h>
|
||||
#endif
|
||||
#if QT_CONFIG(spinbox)
|
||||
#include <qspinbox.h>
|
||||
#endif
|
||||
#include <qheaderview.h>
|
||||
#include <qstyleditemdelegate.h>
|
||||
#include <private/qabstractitemview_p.h>
|
||||
@ -4228,11 +4232,11 @@ QWidget *QAbstractItemViewPrivate::editor(const QModelIndex &index,
|
||||
QWidget *focusWidget = w;
|
||||
while (QWidget *fp = focusWidget->focusProxy())
|
||||
focusWidget = fp;
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
if (QLineEdit *le = qobject_cast<QLineEdit*>(focusWidget))
|
||||
le->selectAll();
|
||||
#endif
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
if (QSpinBox *sb = qobject_cast<QSpinBox*>(focusWidget))
|
||||
sb->selectAll();
|
||||
else if (QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox*>(focusWidget))
|
||||
|
@ -50,8 +50,12 @@
|
||||
#if QT_CONFIG(label)
|
||||
#include <qlabel.h>
|
||||
#endif
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include <qlineedit.h>
|
||||
#endif
|
||||
#if QT_CONFIG(spinbox)
|
||||
#include <qspinbox.h>
|
||||
#endif
|
||||
#include <qstyle.h>
|
||||
#include <qstyleoption.h>
|
||||
#include <limits.h>
|
||||
@ -80,7 +84,7 @@ public:
|
||||
#endif // QT_CONFIG(combobox)
|
||||
|
||||
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
|
||||
class QUIntSpinBox : public QSpinBox
|
||||
{
|
||||
@ -107,7 +111,7 @@ Q_SIGNALS:
|
||||
void uintValueChanged();
|
||||
};
|
||||
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
|
||||
/*!
|
||||
\class QItemEditorFactory
|
||||
@ -242,7 +246,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
|
||||
cb->setFrame(false);
|
||||
return cb; }
|
||||
#endif
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case QVariant::UInt: {
|
||||
QSpinBox *sb = new QUIntSpinBox(parent);
|
||||
sb->setFrame(false);
|
||||
@ -274,7 +278,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
|
||||
case QVariant::Pixmap:
|
||||
return new QLabel(parent);
|
||||
#endif
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case QVariant::Double: {
|
||||
QDoubleSpinBox *sb = new QDoubleSpinBox(parent);
|
||||
sb->setFrame(false);
|
||||
@ -282,7 +286,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
|
||||
sb->setMaximum(DBL_MAX);
|
||||
return sb; }
|
||||
#endif
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
case QVariant::String:
|
||||
default: {
|
||||
// the default editor is a lineedit
|
||||
@ -306,7 +310,7 @@ QByteArray QDefaultItemEditorFactory::valuePropertyName(int userType) const
|
||||
case QVariant::Bool:
|
||||
return "currentIndex";
|
||||
#endif
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case QVariant::UInt:
|
||||
case QVariant::Int:
|
||||
case QVariant::Double:
|
||||
@ -535,7 +539,7 @@ QItemEditorCreatorBase::~QItemEditorCreatorBase()
|
||||
\reimp
|
||||
*/
|
||||
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
|
||||
QExpandingLineEdit::QExpandingLineEdit(QWidget *parent)
|
||||
: QLineEdit(parent), originalWidth(-1), widgetOwnsGeometry(false)
|
||||
@ -595,7 +599,7 @@ void QExpandingLineEdit::resizeToContents()
|
||||
}
|
||||
}
|
||||
|
||||
#endif // QT_NO_LINEEDIT
|
||||
#endif // QT_CONFIG(lineedit)
|
||||
|
||||
#if QT_CONFIG(combobox)
|
||||
|
||||
@ -620,7 +624,7 @@ bool QBooleanComboBox::value() const
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#if !defined(QT_NO_LINEEDIT) || QT_CONFIG(combobox)
|
||||
#if QT_CONFIG(lineedit) || QT_CONFIG(combobox)
|
||||
#include "qitemeditorfactory.moc"
|
||||
#endif
|
||||
|
||||
|
@ -53,9 +53,9 @@
|
||||
|
||||
|
||||
#include <QtWidgets/private/qtwidgetsglobal_p.h>
|
||||
#include <qlineedit.h>
|
||||
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include <qlineedit.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(itemviews);
|
||||
|
||||
@ -89,6 +89,6 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_LINEEDIT
|
||||
#endif // QT_CONFIG(lineedit)
|
||||
|
||||
#endif //QITEMEDITORFACTORY_P_H
|
||||
|
@ -42,9 +42,13 @@
|
||||
#include <qabstractitemmodel.h>
|
||||
#include <qapplication.h>
|
||||
#include <qbrush.h>
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include <qlineedit.h>
|
||||
#endif
|
||||
#if QT_CONFIG(textedit)
|
||||
#include <qtextedit.h>
|
||||
#include <qplaintextedit.h>
|
||||
#endif
|
||||
#include <qpainter.h>
|
||||
#include <qpalette.h>
|
||||
#include <qpoint.h>
|
||||
@ -501,7 +505,7 @@ void QStyledItemDelegate::updateEditorGeometry(QWidget *editor,
|
||||
// let the editor take up all available space
|
||||
//if the editor is not a QLineEdit
|
||||
//or it is in a QTableView
|
||||
#if QT_CONFIG(tableview) && !defined(QT_NO_LINEEDIT)
|
||||
#if QT_CONFIG(tableview) && QT_CONFIG(lineedit)
|
||||
if (qobject_cast<QExpandingLineEdit*>(editor) && !qobject_cast<const QTableView*>(widget))
|
||||
opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, editor);
|
||||
else
|
||||
|
@ -48,7 +48,9 @@
|
||||
#include "qstylehints.h"
|
||||
#include <private/qshortcutmap_p.h>
|
||||
#include <private/qapplication_p.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <private/qmenu_p.h>
|
||||
#endif
|
||||
#include <private/qdebug_p.h>
|
||||
|
||||
#define QAPP_CHECK(functionName) \
|
||||
@ -645,7 +647,7 @@ QIcon QAction::icon() const
|
||||
return d->icon;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
/*!
|
||||
Returns the menu contained by this action. Actions that contain
|
||||
menus can be used to create menu items with submenus, or inserted
|
||||
@ -672,7 +674,7 @@ void QAction::setMenu(QMenu *menu)
|
||||
menu->d_func()->setOverrideMenuAction(this);
|
||||
d->sendDataChanged();
|
||||
}
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
|
||||
/*!
|
||||
If \a b is true then this action will be considered a separator.
|
||||
|
@ -121,7 +121,7 @@ public:
|
||||
void setPriority(Priority priority);
|
||||
Priority priority() const;
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
QMenu *menu() const;
|
||||
void setMenu(QMenu *menu);
|
||||
#endif
|
||||
|
@ -53,7 +53,9 @@
|
||||
|
||||
#include <QtWidgets/private/qtwidgetsglobal_p.h>
|
||||
#include "QtWidgets/qaction.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "QtWidgets/qmenu.h"
|
||||
#endif
|
||||
#if QT_CONFIG(graphicsview)
|
||||
#include "private/qgraphicswidget_p.h"
|
||||
#endif
|
||||
|
@ -45,7 +45,9 @@
|
||||
#include "qmenubar.h"
|
||||
#endif
|
||||
#include "qtoolbar.h"
|
||||
#if QT_CONFIG(sizegrip)
|
||||
#include "qsizegrip.h"
|
||||
#endif
|
||||
#include "qevent.h"
|
||||
#include "qstyle.h"
|
||||
#include "qvariant.h"
|
||||
|
@ -45,7 +45,9 @@
|
||||
#if QT_CONFIG(whatsthis)
|
||||
#include <qwhatsthis.h>
|
||||
#endif
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <qmenubar.h>
|
||||
#endif
|
||||
@ -276,7 +278,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
|
||||
#endif
|
||||
for (int i = 0; i < widgets.size(); ++i) {
|
||||
QWidget *w = widgets.at(i);
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (QMenu *menu = qobject_cast<QMenu *>(w)) {
|
||||
#ifdef Q_OS_DARWIN
|
||||
// On Mac, menu item shortcuts are processed before reaching any window.
|
||||
|
@ -45,7 +45,9 @@
|
||||
#include "qdesktopwidget_p.h"
|
||||
#include "qevent.h"
|
||||
#include "qlayout.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#endif
|
||||
#include "qmetaobject.h"
|
||||
#include "qpixmap.h"
|
||||
#include "qpointer.h"
|
||||
@ -8983,7 +8985,7 @@ bool QWidget::event(QEvent *event)
|
||||
case Qt::CustomContextMenu:
|
||||
emit customContextMenuRequested(static_cast<QContextMenuEvent *>(event)->pos());
|
||||
break;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
case Qt::ActionsContextMenu:
|
||||
if (d->actions.count()) {
|
||||
QMenu::exec(d->actions, static_cast<QContextMenuEvent *>(event)->globalPos(),
|
||||
|
@ -44,7 +44,9 @@
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <QDebug>
|
||||
|
||||
#if QT_CONFIG(mdiarea)
|
||||
#include <QMdiSubWindow>
|
||||
#endif
|
||||
#include <QAbstractScrollArea>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -98,7 +100,7 @@ public:
|
||||
QWidget *p = q->parentWidget();
|
||||
while (p) {
|
||||
if (false
|
||||
#ifndef QT_NO_MDIAREA
|
||||
#if QT_CONFIG(mdiarea)
|
||||
|| qobject_cast<QMdiSubWindow *>(p) != 0
|
||||
#endif
|
||||
#if QT_CONFIG(scrollarea)
|
||||
|
@ -65,11 +65,15 @@
|
||||
#include <qgroupbox.h>
|
||||
#endif
|
||||
#include <qmath.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#include <qpainter.h>
|
||||
#include <qpaintengine.h>
|
||||
#include <qpainterpath.h>
|
||||
#if QT_CONFIG(slider)
|
||||
#include <qslider.h>
|
||||
#endif
|
||||
#include <qstyleoption.h>
|
||||
#if QT_CONFIG(tabbar)
|
||||
#include <qtabbar.h>
|
||||
@ -512,7 +516,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
|
||||
break;
|
||||
}
|
||||
#endif // QT_NO_TOOLBAR
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case PE_IndicatorSpinPlus:
|
||||
case PE_IndicatorSpinMinus: {
|
||||
QRect r = opt->rect;
|
||||
@ -570,7 +574,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
|
||||
}
|
||||
p->restore();
|
||||
break; }
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
case PE_PanelTipLabel: {
|
||||
const QBrush brush(opt->palette.toolTipBase());
|
||||
qDrawPlainRect(p, opt->rect, opt->palette.toolTipText().color(), 1, &brush);
|
||||
@ -611,7 +615,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
|
||||
}
|
||||
break;
|
||||
#endif // QT_CONFIG(tabbar)
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
case PE_PanelLineEdit:
|
||||
if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
|
||||
p->fillRect(panel->rect.adjusted(panel->lineWidth, panel->lineWidth, -panel->lineWidth, -panel->lineWidth),
|
||||
@ -621,7 +625,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
|
||||
proxy()->drawPrimitive(PE_FrameLineEdit, panel, p, widget);
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_LINEEDIT
|
||||
#endif // QT_CONFIG(lineedit)
|
||||
#if QT_CONFIG(columnview)
|
||||
case PE_IndicatorColumnViewArrow: {
|
||||
if (const QStyleOptionViewItem *viewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
|
||||
@ -1371,7 +1375,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
case CE_MenuScroller: {
|
||||
QStyleOption arrowOpt = *opt;
|
||||
arrowOpt.state |= State_Enabled;
|
||||
@ -1391,7 +1395,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
|
||||
p->drawLine(opt->rect.x() + 2, opt->rect.y() + opt->rect.height() / 2,
|
||||
opt->rect.x() + opt->rect.width() - 4, opt->rect.y() + opt->rect.height() / 2);
|
||||
break;
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
#if QT_CONFIG(menubar)
|
||||
case CE_MenuBarItem:
|
||||
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
|
||||
@ -1940,7 +1944,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
|
||||
}
|
||||
break;
|
||||
#endif // QT_CONFIG(tabbar)
|
||||
#ifndef QT_NO_SIZEGRIP
|
||||
#if QT_CONFIG(sizegrip)
|
||||
case CE_SizeGrip: {
|
||||
p->save();
|
||||
int x, y, w, h;
|
||||
@ -2013,7 +2017,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
|
||||
}
|
||||
p->restore();
|
||||
break; }
|
||||
#endif // QT_NO_SIZEGRIP
|
||||
#endif // QT_CONFIG(sizegrip)
|
||||
#if QT_CONFIG(rubberband)
|
||||
case CE_RubberBand: {
|
||||
if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
|
||||
@ -2472,7 +2476,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
|
||||
r = visualRect(btn->direction, btn->rect, r);
|
||||
}
|
||||
break;
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
case SE_SliderFocusRect:
|
||||
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
|
||||
int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
|
||||
@ -2485,7 +2489,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
|
||||
r = visualRect(opt->direction, opt->rect, r);
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SLIDER
|
||||
#endif // QT_CONFIG(slider)
|
||||
#if QT_CONFIG(progressbar)
|
||||
case SE_ProgressBarGroove:
|
||||
case SE_ProgressBarContents:
|
||||
@ -3140,7 +3144,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
|
||||
QPainter *p, const QWidget *widget) const
|
||||
{
|
||||
switch (cc) {
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
case CC_Slider:
|
||||
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
|
||||
if (slider->subControls == SC_SliderTickmarks) {
|
||||
@ -3196,7 +3200,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SLIDER
|
||||
#endif // QT_CONFIG(slider)
|
||||
#if QT_CONFIG(scrollbar)
|
||||
case CC_ScrollBar:
|
||||
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
|
||||
@ -3285,7 +3289,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
|
||||
}
|
||||
break;
|
||||
#endif // QT_CONFIG(scrollbar)
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case CC_SpinBox:
|
||||
if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
|
||||
QStyleOptionSpinBox copy = *sb;
|
||||
@ -3349,7 +3353,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
#if QT_CONFIG(toolbutton)
|
||||
case CC_ToolButton:
|
||||
if (const QStyleOptionToolButton *toolbutton
|
||||
@ -3745,7 +3749,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
|
||||
}
|
||||
break;
|
||||
#endif // QT_CONFIG(groupbox)
|
||||
#ifndef QT_NO_MDIAREA
|
||||
#if QT_CONFIG(mdiarea)
|
||||
case CC_MdiControls:
|
||||
{
|
||||
QStyleOptionButton btnOpt;
|
||||
@ -3808,7 +3812,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_MDIAREA
|
||||
#endif // QT_CONFIG(mdiarea)
|
||||
default:
|
||||
qWarning("QCommonStyle::drawComplexControl: Control %d not handled", cc);
|
||||
}
|
||||
@ -3822,7 +3826,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
|
||||
{
|
||||
SubControl sc = SC_None;
|
||||
switch (cc) {
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
case CC_Slider:
|
||||
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
|
||||
QRect r = proxy()->subControlRect(cc, slider, SC_SliderHandle, widget);
|
||||
@ -3835,7 +3839,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SLIDER
|
||||
#endif // QT_CONFIG(slider)
|
||||
#if QT_CONFIG(scrollbar)
|
||||
case CC_ScrollBar:
|
||||
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
|
||||
@ -3868,7 +3872,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
|
||||
}
|
||||
break;
|
||||
#endif // QT_CONFIG(toolbutton)
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case CC_SpinBox:
|
||||
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
|
||||
QRect r;
|
||||
@ -3883,7 +3887,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
case CC_TitleBar:
|
||||
if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
|
||||
QRect r;
|
||||
@ -3959,7 +3963,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
|
||||
{
|
||||
QRect ret;
|
||||
switch (cc) {
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
case CC_Slider:
|
||||
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
|
||||
int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
|
||||
@ -3994,7 +3998,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
|
||||
ret = visualRect(slider->direction, slider->rect, ret);
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SLIDER
|
||||
#endif // QT_CONFIG(slider)
|
||||
#if QT_CONFIG(scrollbar)
|
||||
case CC_ScrollBar:
|
||||
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
|
||||
@ -4080,7 +4084,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
|
||||
}
|
||||
break;
|
||||
#endif // QT_CONFIG(scrollbar)
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case CC_SpinBox:
|
||||
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
|
||||
QSize bs;
|
||||
@ -4339,7 +4343,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
|
||||
break;
|
||||
}
|
||||
#endif // QT_CONFIG(groupbox)
|
||||
#ifndef QT_NO_MDIAREA
|
||||
#if QT_CONFIG(mdiarea)
|
||||
case CC_MdiControls:
|
||||
{
|
||||
int numSubControls = 0;
|
||||
@ -4382,7 +4386,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
|
||||
ret = QRect(offset, 0, buttonWidth, opt->rect.height());
|
||||
break;
|
||||
}
|
||||
#endif // QT_NO_MDIAREA
|
||||
#endif // QT_CONFIG(mdiarea)
|
||||
default:
|
||||
qWarning("QCommonStyle::subControlRect: Case %d not handled", cc);
|
||||
}
|
||||
@ -4497,7 +4501,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
|
||||
ret = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::MaximumScrollBarDragDistance).toInt();
|
||||
break;
|
||||
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
case PM_SliderThickness:
|
||||
ret = int(QStyleHelper::dpiScaled(16.));
|
||||
break;
|
||||
@ -4530,7 +4534,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SLIDER
|
||||
#endif // QT_CONFIG(slider)
|
||||
#if QT_CONFIG(dockwidget)
|
||||
case PM_DockWidgetSeparatorExtent:
|
||||
ret = int(QStyleHelper::dpiScaled(6.));
|
||||
@ -4812,7 +4816,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
|
||||
sz.setHeight(qMax(sz.height(), h));
|
||||
}
|
||||
break;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
case CT_MenuItem:
|
||||
if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
|
||||
bool checkable = mi->menuHasCheckableItems;
|
||||
@ -4840,7 +4844,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
|
||||
sz = QSize(w, h);
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
#if QT_CONFIG(toolbutton)
|
||||
case CT_ToolButton:
|
||||
sz = QSize(sz.width() + 6, sz.height() + 5);
|
||||
@ -4917,7 +4921,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
|
||||
#else
|
||||
Q_UNUSED(d);
|
||||
#endif // QT_CONFIG(itemviews)
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case CT_SpinBox:
|
||||
if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
|
||||
// Add button + frame widths
|
||||
|
@ -55,7 +55,9 @@
|
||||
#include <qdir.h>
|
||||
#include <qstyleoption.h>
|
||||
#include <qapplication.h>
|
||||
#if QT_CONFIG(mainwindow)
|
||||
#include <qmainwindow.h>
|
||||
#endif
|
||||
#include <qfont.h>
|
||||
#if QT_CONFIG(groupbox)
|
||||
#include <qgroupbox.h>
|
||||
@ -64,11 +66,15 @@
|
||||
#if QT_CONFIG(scrollbar)
|
||||
#include <qscrollbar.h>
|
||||
#endif
|
||||
#if QT_CONFIG(spinbox)
|
||||
#include <qspinbox.h>
|
||||
#endif
|
||||
#if QT_CONFIG(abstractslider)
|
||||
#include <qabstractslider.h>
|
||||
#endif
|
||||
#if QT_CONFIG(slider)
|
||||
#include <qslider.h>
|
||||
#endif
|
||||
#if QT_CONFIG(splitter)
|
||||
#include <qsplitter.h>
|
||||
#endif
|
||||
|
@ -43,7 +43,9 @@
|
||||
#include "qpixmapstyle_p_p.h"
|
||||
|
||||
#include <QDebug>
|
||||
#if QT_CONFIG(textedit)
|
||||
#include <QTextEdit>
|
||||
#endif
|
||||
#include <QStringBuilder>
|
||||
#include <QPainter>
|
||||
#include <QPixmapCache>
|
||||
@ -52,7 +54,9 @@
|
||||
#if QT_CONFIG(progressbar)
|
||||
#include <QProgressBar>
|
||||
#endif
|
||||
#if QT_CONFIG(slider)
|
||||
#include <QSlider>
|
||||
#endif
|
||||
#include <QEvent>
|
||||
#if QT_CONFIG(combobox)
|
||||
#include <QComboBox>
|
||||
|
@ -69,13 +69,13 @@ QString uniqueName(const QString &key, const QStyleOption *option, const QSize &
|
||||
% HexString<uint>(size.width())
|
||||
% HexString<uint>(size.height());
|
||||
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
|
||||
tmp = tmp % HexString<uint>(spinBox->buttonSymbols)
|
||||
% HexString<uint>(spinBox->stepEnabled)
|
||||
% QLatin1Char(spinBox->frame ? '1' : '0'); ;
|
||||
}
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
|
||||
// QTBUG-56743, try to create a palette cache key reflecting the value,
|
||||
// as leaks may occur in conjunction with QStyleSheetStyle/QRenderRule modifying
|
||||
|
@ -1949,7 +1949,7 @@ QStyleOptionComplex::QStyleOptionComplex(int version, int type)
|
||||
\sa QStyle::SubControl
|
||||
*/
|
||||
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
/*!
|
||||
\class QStyleOptionSlider
|
||||
\brief The QStyleOptionSlider class is used to describe the
|
||||
@ -2146,9 +2146,9 @@ QStyleOptionSlider::QStyleOptionSlider(int version)
|
||||
|
||||
\sa QAbstractSlider::pageStep
|
||||
*/
|
||||
#endif // QT_NO_SLIDER
|
||||
#endif // QT_CONFIG(slider)
|
||||
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
/*!
|
||||
\class QStyleOptionSpinBox
|
||||
\brief The QStyleOptionSpinBox class is used to describe the
|
||||
@ -2252,7 +2252,7 @@ QStyleOptionSpinBox::QStyleOptionSpinBox(int version)
|
||||
|
||||
The default value is false, i.e. the spin box has no frame.
|
||||
*/
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
|
||||
/*!
|
||||
\class QStyleOptionDockWidget
|
||||
@ -3554,7 +3554,7 @@ QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version)
|
||||
|
||||
#endif // QT_CONFIG(tabbar)
|
||||
|
||||
#ifndef QT_NO_SIZEGRIP
|
||||
#if QT_CONFIG(sizegrip)
|
||||
/*!
|
||||
\class QStyleOptionSizeGrip
|
||||
\brief The QStyleOptionSizeGrip class is used to describe the
|
||||
@ -3634,7 +3634,7 @@ QStyleOptionSizeGrip::QStyleOptionSizeGrip(int version)
|
||||
|
||||
\sa StyleOptionType
|
||||
*/
|
||||
#endif // QT_NO_SIZEGRIP
|
||||
#endif // QT_CONFIG(sizegrip)
|
||||
|
||||
/*!
|
||||
\class QStyleOptionGraphicsItem
|
||||
|
@ -41,11 +41,16 @@
|
||||
#define QSTYLEOPTION_H
|
||||
|
||||
#include <QtWidgets/qtwidgetsglobal.h>
|
||||
#include <QtCore/qlocale.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
#if QT_CONFIG(spinbox)
|
||||
#include <QtWidgets/qabstractspinbox.h>
|
||||
#endif
|
||||
#include <QtGui/qicon.h>
|
||||
#include <QtGui/qmatrix.h>
|
||||
#if QT_CONFIG(slider)
|
||||
#include <QtWidgets/qslider.h>
|
||||
#endif
|
||||
#include <QtWidgets/qstyle.h>
|
||||
#if QT_CONFIG(tabbar)
|
||||
#include <QtWidgets/qtabbar.h>
|
||||
@ -505,7 +510,7 @@ public:
|
||||
QStyleOptionComplex(const QStyleOptionComplex &other) : QStyleOption(Version, Type) { *this = other; }
|
||||
};
|
||||
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
class Q_WIDGETS_EXPORT QStyleOptionSlider : public QStyleOptionComplex
|
||||
{
|
||||
public:
|
||||
@ -531,9 +536,9 @@ public:
|
||||
protected:
|
||||
QStyleOptionSlider(int version);
|
||||
};
|
||||
#endif // QT_NO_SLIDER
|
||||
#endif // QT_CONFIG(slider)
|
||||
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
class Q_WIDGETS_EXPORT QStyleOptionSpinBox : public QStyleOptionComplex
|
||||
{
|
||||
public:
|
||||
@ -550,7 +555,7 @@ public:
|
||||
protected:
|
||||
QStyleOptionSpinBox(int version);
|
||||
};
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
|
||||
class Q_WIDGETS_EXPORT QStyleOptionToolButton : public QStyleOptionComplex
|
||||
{
|
||||
|
@ -45,13 +45,17 @@
|
||||
#include "private/qcssutil_p.h"
|
||||
#include <qdebug.h>
|
||||
#include <qapplication.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#if QT_CONFIG(menubar)
|
||||
#include <qmenubar.h>
|
||||
#endif
|
||||
#include <qpainter.h>
|
||||
#include <qstyleoption.h>
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include <qlineedit.h>
|
||||
#endif
|
||||
#include <private/qwindowsstyle_p.h>
|
||||
#if QT_CONFIG(combobox)
|
||||
#include <qcombobox.h>
|
||||
@ -85,16 +89,22 @@
|
||||
#include <qtabbar.h>
|
||||
#endif
|
||||
#include <QMetaProperty>
|
||||
#if QT_CONFIG(mainwindow)
|
||||
#include <qmainwindow.h>
|
||||
#endif
|
||||
#if QT_CONFIG(dockwidget)
|
||||
#include <qdockwidget.h>
|
||||
#endif
|
||||
#if QT_CONFIG(mdiarea)
|
||||
#include <qmdisubwindow.h>
|
||||
#endif
|
||||
#if QT_CONFIG(dialog)
|
||||
#include <qdialog.h>
|
||||
#endif
|
||||
#include <private/qwidget_p.h>
|
||||
#if QT_CONFIG(spinbox)
|
||||
#include <QAbstractSpinBox>
|
||||
#endif
|
||||
#if QT_CONFIG(label)
|
||||
#include <QLabel>
|
||||
#endif
|
||||
@ -1649,7 +1659,7 @@ int QStyleSheetStyle::nativeFrameWidth(const QWidget *w)
|
||||
{
|
||||
QStyle *base = baseStyle();
|
||||
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
if (qobject_cast<const QAbstractSpinBox *>(w))
|
||||
return base->pixelMetric(QStyle::PM_SpinBoxFrameWidth, 0, w);
|
||||
#endif
|
||||
@ -1659,7 +1669,7 @@ int QStyleSheetStyle::nativeFrameWidth(const QWidget *w)
|
||||
return base->pixelMetric(QStyle::PM_ComboBoxFrameWidth, 0, w);
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
if (qobject_cast<const QMenu *>(w))
|
||||
return base->pixelMetric(QStyle::PM_MenuPanelWidth, 0, w);
|
||||
#endif
|
||||
@ -1807,7 +1817,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption
|
||||
case PseudoElement_SpinBoxDownButton:
|
||||
case PseudoElement_SpinBoxUpArrow:
|
||||
case PseudoElement_SpinBoxDownArrow:
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
|
||||
bool on = false;
|
||||
bool up = pseudoElement == PseudoElement_SpinBoxUpButton
|
||||
@ -1818,7 +1828,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption
|
||||
on = true;
|
||||
state |= (on ? QStyle::State_On : QStyle::State_Off);
|
||||
}
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
break;
|
||||
case PseudoElement_GroupBoxTitle:
|
||||
state |= (complex->state & (QStyle::State_MouseOver | QStyle::State_Sunken));
|
||||
@ -1853,11 +1863,11 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption
|
||||
extraClass |= PseudoClass_ReadOnly;
|
||||
else
|
||||
extraClass |= PseudoClass_Editable;
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
} else if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
|
||||
if (!spin->frame)
|
||||
extraClass |= PseudoClass_Frameless;
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
} else if (const QStyleOptionGroupBox *gb = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
|
||||
if (gb->features & QStyleOptionFrame::Flat)
|
||||
extraClass |= PseudoClass_Flat;
|
||||
@ -2036,7 +2046,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption
|
||||
|
||||
}
|
||||
#endif
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
// LineEdit sets Sunken flag to indicate Sunken frame (argh)
|
||||
if (const QLineEdit *lineEdit = qobject_cast<const QLineEdit *>(obj)) {
|
||||
state &= ~QStyle::State_Sunken;
|
||||
@ -2362,7 +2372,7 @@ static QWidget *embeddedWidget(QWidget *w)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
if (QAbstractSpinBox *sb = qobject_cast<QAbstractSpinBox *>(w))
|
||||
return sb->findChild<QLineEdit *>();
|
||||
#endif
|
||||
@ -2384,19 +2394,19 @@ static QWidget *embeddedWidget(QWidget *w)
|
||||
*/
|
||||
static QWidget *containerWidget(const QWidget *w)
|
||||
{
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
if (qobject_cast<const QLineEdit *>(w)) {
|
||||
//if the QLineEdit is an embeddedWidget, we need the rule of the real widget
|
||||
#if QT_CONFIG(combobox)
|
||||
if (qobject_cast<const QComboBox *>(w->parentWidget()))
|
||||
return w->parentWidget();
|
||||
#endif
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
if (qobject_cast<const QAbstractSpinBox *>(w->parentWidget()))
|
||||
return w->parentWidget();
|
||||
#endif
|
||||
}
|
||||
#endif // QT_NO_LINEEDIT
|
||||
#endif // QT_CONFIG(lineedit)
|
||||
|
||||
#if QT_CONFIG(scrollarea)
|
||||
if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w->parentWidget())) {
|
||||
@ -2457,7 +2467,7 @@ static quint64 extendedPseudoClass(const QWidget *w)
|
||||
pc |= (combo->isEditable() ? PseudoClass_Editable : PseudoClass_ReadOnly);
|
||||
} else
|
||||
#endif
|
||||
#ifndef QT_NO_LINEEDIT
|
||||
#if QT_CONFIG(lineedit)
|
||||
if (const QLineEdit *edit = qobject_cast<const QLineEdit *>(w)) {
|
||||
pc |= (edit->isReadOnly() ? PseudoClass_ReadOnly : PseudoClass_Editable);
|
||||
} else
|
||||
@ -2827,10 +2837,10 @@ void QStyleSheetStyle::polish(QWidget *w)
|
||||
#ifndef QT_NO_FRAME
|
||||
|| qobject_cast<QFrame *>(w)
|
||||
#endif
|
||||
#ifndef QT_NO_MAINWINDOW
|
||||
#if QT_CONFIG(mainwindow)
|
||||
|| qobject_cast<QMainWindow *>(w)
|
||||
#endif
|
||||
#ifndef QT_NO_MDIAREA
|
||||
#if QT_CONFIG(mdiarea)
|
||||
|| qobject_cast<QMdiSubWindow *>(w)
|
||||
#endif
|
||||
#if QT_CONFIG(menubar)
|
||||
@ -2983,7 +2993,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
|
||||
}
|
||||
break;
|
||||
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case CC_SpinBox:
|
||||
if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
|
||||
QStyleOptionSpinBox spinOpt(*spin);
|
||||
@ -3046,7 +3056,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
|
||||
return;
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
|
||||
case CC_GroupBox:
|
||||
if (const QStyleOptionGroupBox *gb = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
|
||||
@ -3223,7 +3233,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
|
||||
break;
|
||||
#endif // QT_CONFIG(scrollbar)
|
||||
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
case CC_Slider:
|
||||
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
|
||||
rule.drawRule(p, opt->rect);
|
||||
@ -3277,7 +3287,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
|
||||
return;
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SLIDER
|
||||
#endif // QT_CONFIG(slider)
|
||||
|
||||
case CC_MdiControls:
|
||||
if (hasStyleRule(w, PseudoElement_MdiCloseButton)
|
||||
@ -4339,7 +4349,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
|
||||
|
||||
case PE_PanelLineEdit:
|
||||
if (const QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
if (w && qobject_cast<const QAbstractSpinBox *>(w->parentWidget())) {
|
||||
QRenderRule spinboxRule = renderRule(w->parentWidget(), opt);
|
||||
if (!spinboxRule.hasNativeBorder() || !spinboxRule.baseStyleCanDraw())
|
||||
@ -4992,7 +5002,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
|
||||
break;
|
||||
case CT_GroupBox:
|
||||
case CT_LineEdit:
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
if (qobject_cast<QAbstractSpinBox *>(w ? w->parentWidget() : 0))
|
||||
return csz; // we only care about the size hint of the line edit
|
||||
#endif
|
||||
@ -5390,7 +5400,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
|
||||
}
|
||||
break;
|
||||
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case CC_SpinBox:
|
||||
if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
|
||||
QRenderRule upRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton);
|
||||
@ -5449,7 +5459,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
|
||||
: QWindowsStyle::subControlRect(cc, &spinBox, sc, w);
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
|
||||
case CC_GroupBox:
|
||||
if (const QStyleOptionGroupBox *gb = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
|
||||
@ -5619,7 +5629,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
|
||||
break;
|
||||
#endif // QT_CONFIG(scrollbar)
|
||||
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
case CC_Slider:
|
||||
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
|
||||
QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderGroove);
|
||||
@ -5652,7 +5662,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SLIDER
|
||||
#endif // QT_CONFIG(slider)
|
||||
|
||||
case CC_MdiControls:
|
||||
if (hasStyleRule(w, PseudoElement_MdiCloseButton)
|
||||
|
@ -46,7 +46,9 @@
|
||||
#include "qbitmap.h"
|
||||
#include "qdrawutil.h" // for now
|
||||
#include "qevent.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#endif
|
||||
#if QT_CONFIG(menubar)
|
||||
#include "qmenubar.h"
|
||||
#include <private/qmenubar_p.h>
|
||||
@ -62,7 +64,9 @@
|
||||
#endif
|
||||
#include "qwidget.h"
|
||||
#include "qdebug.h"
|
||||
#if QT_CONFIG(mainwindow)
|
||||
#include "qmainwindow.h"
|
||||
#endif
|
||||
#include "qfile.h"
|
||||
#include "qtextstream.h"
|
||||
#include "qpixmapcache.h"
|
||||
@ -345,12 +349,12 @@ int QWindowsStylePrivate::fixedPixelMetric(QStyle::PixelMetric pm)
|
||||
return 2;
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
case QStyle::PM_SliderLength:
|
||||
return 11;
|
||||
#endif // QT_NO_SLIDER
|
||||
#endif // QT_CONFIG(slider)
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
case QStyle::PM_MenuBarHMargin:
|
||||
case QStyle::PM_MenuBarVMargin:
|
||||
case QStyle::PM_MenuBarPanelWidth:
|
||||
@ -365,7 +369,7 @@ int QWindowsStylePrivate::fixedPixelMetric(QStyle::PixelMetric pm)
|
||||
case QStyle::PM_DockWidgetFrameWidth:
|
||||
return 4;
|
||||
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
case QStyle::PM_ToolBarHandleExtent:
|
||||
return 10;
|
||||
default:
|
||||
@ -437,7 +441,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
|
||||
ret = 60;
|
||||
break;
|
||||
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
// Returns the number of pixels to use for the business part of the
|
||||
// slider (i.e., the non-tickmark portion). The remaining space is shared
|
||||
// equally between the tickmark regions.
|
||||
@ -465,7 +469,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
|
||||
ret = thick;
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SLIDER
|
||||
#endif // QT_CONFIG(slider)
|
||||
|
||||
case PM_IconViewIconSize:
|
||||
ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
|
||||
@ -1113,7 +1117,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
|
||||
break;
|
||||
#endif // QT_CONFIG(rubberband)
|
||||
|
||||
#if !defined(QT_NO_MENU) && !defined(QT_NO_MAINWINDOW)
|
||||
#if QT_CONFIG(menu) && QT_CONFIG(mainwindow)
|
||||
case CE_MenuBarEmptyArea:
|
||||
if (widget && qobject_cast<const QMainWindow *>(widget->parentWidget())) {
|
||||
p->fillRect(opt->rect, opt->palette.button());
|
||||
@ -1124,7 +1128,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
case CE_MenuItem:
|
||||
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
|
||||
int x, y, w, h;
|
||||
@ -1261,7 +1265,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
|
||||
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
#if QT_CONFIG(menubar)
|
||||
case CE_MenuBarItem:
|
||||
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
|
||||
@ -1924,7 +1928,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
|
||||
QPainter *p, const QWidget *widget) const
|
||||
{
|
||||
switch (cc) {
|
||||
#ifndef QT_NO_SLIDER
|
||||
#if QT_CONFIG(slider)
|
||||
case CC_Slider:
|
||||
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
|
||||
int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
|
||||
@ -2144,7 +2148,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SLIDER
|
||||
#endif // QT_CONFIG(slider)
|
||||
#if QT_CONFIG(scrollbar)
|
||||
case CC_ScrollBar:
|
||||
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
|
||||
@ -2229,7 +2233,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
|
||||
}
|
||||
break;
|
||||
#endif // QT_CONFIG(combobox)
|
||||
#ifndef QT_NO_SPINBOX
|
||||
#if QT_CONFIG(spinbox)
|
||||
case CC_SpinBox:
|
||||
if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
|
||||
QStyleOptionSpinBox copy = *sb;
|
||||
@ -2318,7 +2322,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_SPINBOX
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
|
||||
default:
|
||||
QCommonStyle::drawComplexControl(cc, opt, p, widget);
|
||||
@ -2351,7 +2355,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
|
||||
sz = QSize(w, h);
|
||||
}
|
||||
break;
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
case CT_MenuItem:
|
||||
if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
|
||||
int w = sz.width();
|
||||
@ -2393,7 +2397,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
|
||||
sz.setWidth(w);
|
||||
}
|
||||
break;
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
#if QT_CONFIG(menubar)
|
||||
case CT_MenuBarItem:
|
||||
if (!sz.isEmpty())
|
||||
|
@ -159,7 +159,9 @@
|
||||
#include "QtGui/qevent.h"
|
||||
#include "QtWidgets/qdesktopwidget.h"
|
||||
#include <private/qdesktopwidget_p.h>
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include "QtWidgets/qlineedit.h"
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -42,7 +42,9 @@
|
||||
|
||||
#ifndef QT_NO_SYSTEMTRAYICON
|
||||
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#endif
|
||||
#include "qlist.h"
|
||||
#include "qevent.h"
|
||||
#include "qpoint.h"
|
||||
@ -182,7 +184,7 @@ QSystemTrayIcon::~QSystemTrayIcon()
|
||||
d->remove_sys();
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
|
||||
/*!
|
||||
Sets the specified \a menu to be the context menu for the system tray icon.
|
||||
@ -228,7 +230,7 @@ QMenu* QSystemTrayIcon::contextMenu() const
|
||||
return d->menu;
|
||||
}
|
||||
|
||||
#endif // QT_NO_MENU
|
||||
#endif // QT_CONFIG(menu)
|
||||
|
||||
/*!
|
||||
\property QSystemTrayIcon::icon
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
MiddleClick
|
||||
};
|
||||
|
||||
#ifndef QT_NO_MENU
|
||||
#if QT_CONFIG(menu)
|
||||
void setContextMenu(QMenu *menu);
|
||||
QMenu *contextMenu() const;
|
||||
#endif
|
||||
|
@ -57,7 +57,10 @@
|
||||
|
||||
#ifndef QT_NO_SYSTEMTRAYICON
|
||||
|
||||
#if QT_CONFIG(menu)
|
||||
#include "QtWidgets/qmenu.h"
|
||||
#endif
|
||||
#include "QtWidgets/qwidget.h"
|
||||
#include "QtGui/qpixmap.h"
|
||||
#include <qpa/qplatformsystemtrayicon.h>
|
||||
#include "QtCore/qstring.h"
|
||||
|
@ -47,7 +47,9 @@
|
||||
#include "qevent.h"
|
||||
#include "qapplication.h"
|
||||
#include "qlist.h"
|
||||
#if QT_CONFIG(menu)
|
||||
#include "qmenu.h"
|
||||
#endif
|
||||
#include "qtimer.h"
|
||||
#include "qsystemtrayicon_p.h"
|
||||
#include "qpaintengine.h"
|
||||
|
@ -43,8 +43,6 @@
|
||||
#include <private/qlineedit_p.h>
|
||||
#include <qabstractspinbox.h>
|
||||
|
||||
#ifndef QT_NO_SPINBOX
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qstylehints.h>
|
||||
#include <qclipboard.h>
|
||||
@ -53,7 +51,9 @@
|
||||
#include <qdatetimeedit.h>
|
||||
#endif
|
||||
#include <qevent.h>
|
||||
#if QT_CONFIG(menu)
|
||||
#include <qmenu.h>
|
||||
#endif
|
||||
#include <qpainter.h>
|
||||
#include <qpalette.h>
|
||||
#include <qstylepainter.h>
|
||||
@ -2145,5 +2145,3 @@ QVariant QAbstractSpinBoxPrivate::variantBound(const QVariant &min,
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qabstractspinbox.cpp"
|
||||
|
||||
#endif // QT_NO_SPINBOX
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user