Merge remote-tracking branch 'origin/master' into api_changes
Change-Id: I89dc2e193bd01624c1fb50484610d516e39b1538
This commit is contained in:
commit
12f221410f
@ -1,3 +1,3 @@
|
||||
SOURCES = iconv.cpp
|
||||
CONFIG -= qt dylib app_bundle
|
||||
mac|win32-g++*|blackberry-*-qcc:LIBS += -liconv
|
||||
mac|win32-g++*|qnx-*-qcc:LIBS += -liconv
|
||||
|
@ -1,3 +1,4 @@
|
||||
SOURCES = libudev.cpp
|
||||
CONFIG -= qt
|
||||
LIBS += -ludev
|
||||
LIBS += $$QMAKE_LIBS_LIBUDEV
|
||||
INCLUDEPATH += $$QMAKE_INCDIR_LIBUDEV
|
||||
|
9
configure
vendored
9
configure
vendored
@ -5294,7 +5294,13 @@ if [ "$PLATFORM_QPA" = "yes" ]; then
|
||||
fi
|
||||
|
||||
if [ "$CFG_LIBUDEV" != "no" ]; then
|
||||
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libudev "libudev" $L_FLAGS $I_FLAGS $l_FLAGS; then
|
||||
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists libudev 2>/dev/null; then
|
||||
QMAKE_INCDIR_LIBUDEV=`$PKG_CONFIG --cflags-only-I libudev 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
|
||||
QMAKE_LIBS_LIBUDEV=`$PKG_CONFIG --libs libudev 2>/dev/null`
|
||||
QMakeVar set QMAKE_INCDIR_LIBUDEV "$QMAKE_INCDIR_LIBUDEV"
|
||||
QMakeVar set QMAKE_LIBS_LIBUDEV "$QMAKE_LIBS_LIBUDEV"
|
||||
fi
|
||||
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libudev "libudev" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_INCDIR_LIBUDEV $QMAKE_LIBS_LIBUDEV; then
|
||||
CFG_LIBUDEV=yes
|
||||
QT_CONFIG="$QT_CONFIG libudev"
|
||||
elif [ "$CFG_LIBUDEV" = "yes" ]; then
|
||||
@ -6890,6 +6896,7 @@ else
|
||||
fi
|
||||
echo "zlib support ........... $CFG_ZLIB"
|
||||
echo "Session management ..... $CFG_SM"
|
||||
echo "libudev support ........ $CFG_LIBUDEV"
|
||||
|
||||
if [ "$CFG_OPENGL" = "desktop" ]; then
|
||||
echo "OpenGL support ......... yes (Desktop OpenGL)"
|
||||
|
22
dist/changes-5.0.0
vendored
22
dist/changes-5.0.0
vendored
@ -203,6 +203,8 @@ information about a particular change.
|
||||
- qmake
|
||||
* Projects which explicitly set an empty TARGET are considered broken now.
|
||||
* The makespec and .qmake.cache do not see build pass specific variables any more.
|
||||
* load()/include() with a target namespace and infile()/$$fromfile() now start with
|
||||
an entirely pristine context.
|
||||
* Configure's -sysroot and -hostprefix are now handled slightly differently.
|
||||
The QT_INSTALL_... properties are now automatically prefixed with the sysroot;
|
||||
the raw values are available as QT_RAW_INSTALL_... and the sysroot as QT_SYSROOT.
|
||||
@ -308,9 +310,18 @@ QtCore
|
||||
libraries, creating uncertainty/bugs in using QString easily, and (to a lesser
|
||||
extent) performance issues.
|
||||
|
||||
* QTextCodec::codecForTr() and QTextCodec::setCodecForTr() have been removed,
|
||||
QCoreApplication::Encoding value CodecForTr is now obsolete, use
|
||||
DefaultCodec instead. For reasoning, see the codecForCStrings() removal above.
|
||||
|
||||
* QIntValidator and QDoubleValidator no longer fall back to using the C locale if
|
||||
the requested locale fails to validate the input.
|
||||
|
||||
* A new set of classes for doing pattern matching with Perl-compatible regular
|
||||
expressions has been added: QRegularExpression, QRegularExpressionMatch and
|
||||
QRegularExpressionMatchIterator. They aim to replace QRegExp with a more
|
||||
powerful and flexible regular expression engine.
|
||||
|
||||
QtGui
|
||||
-----
|
||||
* Accessibility has been refactored. The hierachy of accessible objects is implemented via
|
||||
@ -395,6 +406,17 @@ ignore the rest of the range.
|
||||
QSqlTableModel::indexInQuery() as example of how to implement in a
|
||||
subclass.
|
||||
|
||||
* QSqlTableModel::selectRow(): This is a new method that refreshes a single
|
||||
row in the model from the database.
|
||||
|
||||
* QSqlTableModel edit strategies OnFieldChange/OnRowChange QTBUG-2875
|
||||
Previously, after changes were submitted in these edit strategies, select()
|
||||
was called which removed and inserted all rows. This ruined navigation
|
||||
in QTableView. Now, with these edit strategies, there is no implicit select()
|
||||
done after committing. This includes deleted rows which remain in
|
||||
the model as blank rows until the application calls select(). Instead,
|
||||
selectRow() is called to refresh only the affected row.
|
||||
|
||||
****************************************************************************
|
||||
* Database Drivers *
|
||||
****************************************************************************
|
||||
|
94
doc/src/examples/widgets/mousebuttons.qdoc
Normal file
94
doc/src/examples/widgets/mousebuttons.qdoc
Normal file
@ -0,0 +1,94 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (C) 2012 Rick Stockton <rickstockton@reno-computerhelp.com>
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** GNU Free Documentation License
|
||||
** Alternatively, this file may be used under the terms of the GNU Free
|
||||
** Documentation License version 1.3 as published by the Free Software
|
||||
** Foundation and appearing in the file included in the packaging of
|
||||
** this file.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms
|
||||
** and conditions contained in a signed written agreement between you
|
||||
** and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\example widgets/mousebuttons/buttontester
|
||||
\title Mouse Button Tester
|
||||
|
||||
\brief The 'Mouse Button Tester' example demonstrates how to reimplement
|
||||
mouse events within a custom class. You can also use this program to
|
||||
verify that Qt is actually receiving mouse events from your mouse.
|
||||
|
||||
Many 'gamer' mouse devices are configured with high-numbered "buttons"
|
||||
sending text shortcuts for certain games. With such a mouse, no mouse
|
||||
button events occur: The "mouse" sends keystrokes, and the
|
||||
'Mouse Button Tester' Window will not see the event. Receving no event,
|
||||
it will not repaint the Window with new text describing a \button event.
|
||||
|
||||
And so, in addition to it's use as Qt example code, the program may be
|
||||
useful s a mouse device tester. Note that there is another example
|
||||
muouse buttons example which provides the same function, written in QML.
|
||||
|
||||
This program (the Widget-based example) consists of three classes,
|
||||
in addition to the main() parent program:
|
||||
|
||||
\list
|
||||
\o \c A QPushButton, "Quit".
|
||||
\o \c ButtonTester. This is derived from Qt's TextArea class, for
|
||||
purpose of customizing/re-implementing the mouse and wheel event
|
||||
member functions.
|
||||
\o \c A simple QVBoxLayout layout.
|
||||
\endlist
|
||||
|
||||
First we will review the main program, with it's layout and "Quit"
|
||||
QPushButton. Then we will take a look at the \c ButtonTester class.
|
||||
|
||||
\section1 The Main Program
|
||||
|
||||
Note that the QPushButton, "Quit", is defined directly within the main()
|
||||
program, rather than another class. This is a correct way of defining a
|
||||
"Quit" QPushButton: A "Quit" Button defined inside another
|
||||
class would result in the destructor of that second class being
|
||||
called twice. This "Quit" Button uses the traditional Signal/Slot
|
||||
connection to invoke termination of the QApp, which will properly destroy
|
||||
its child classes \before terminating itself.
|
||||
|
||||
The remainder of the main() program is concerned with defining the layout,
|
||||
and applying a minimum size to the customized ButtonTester.
|
||||
|
||||
\section1 ButtonTester Class Definition
|
||||
|
||||
The \c ButtonTester class inherits from QTextEdit, and listens for
|
||||
mouse events on all possible Qt::MouseButton values. It also listens for
|
||||
wheel events from the mouse, and indicates the direction of wheel motion
|
||||
("up", down", "left", or "right"). It prints short debug messages into
|
||||
the Window, and also on the console QDebug() stream, when mouse button
|
||||
and wheel events occur. Our reimplementation of mousePressEvent(),
|
||||
mouseReleaseEvent(), mouseDoubleClickEvent(), and wheelEvent() "drive"
|
||||
the program; the other functions simply convert the Qt::MouseButton
|
||||
values into text strings.
|
||||
|
||||
You should call the ignore() function on any mouse event (or other event)
|
||||
which your widget-based classes do not use and consume. This function
|
||||
assures that Qt will propagate the event through each parent widget,
|
||||
until it is used or propagated to the Window Manager. (Qt attempts to do
|
||||
this automatically, but it is better programming practice to explicitly
|
||||
invoke the function.)
|
||||
|
||||
\image widgets/mousebutton-buttontester.png
|
||||
*/
|
BIN
doc/src/images/widgets/mousebutton-buttontester.png
Normal file
BIN
doc/src/images/widgets/mousebutton-buttontester.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -298,6 +298,11 @@
|
||||
\li Regular expression syntax (quint8)
|
||||
\li Minimal matching (quint8)
|
||||
\endlist
|
||||
\row \li QRegularExpression
|
||||
\li \list
|
||||
\li The regular expression pattern (QString)
|
||||
\li The pattern options (quint32)
|
||||
\endlist
|
||||
\row \li QRegion
|
||||
\li \list
|
||||
\li The size of the data, i.e. 8 + 16 * (number of rectangles) (quint32)
|
||||
|
289
doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp
Normal file
289
doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp
Normal file
@ -0,0 +1,289 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Giuseppe D'Angelo <dangelog@gmail.com>.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//! [0]
|
||||
QRegularExpression re("a pattern");
|
||||
//! [0]
|
||||
|
||||
|
||||
//! [1]
|
||||
QRegularExpression re;
|
||||
re.setPattern("another pattern");
|
||||
//! [1]
|
||||
|
||||
|
||||
//! [2]
|
||||
// matches two digits followed by a space and a word
|
||||
QRegularExpression re("\\d\\d \\w+");
|
||||
|
||||
// matches a backslash
|
||||
QRegularExpression re2("\\\\");
|
||||
//! [2]
|
||||
|
||||
|
||||
//! [3]
|
||||
QRegularExpression re("a third pattern");
|
||||
QString pattern = re.pattern(); // pattern == "a third pattern"
|
||||
//! [3]
|
||||
|
||||
|
||||
//! [4]
|
||||
// matches "Qt rocks", but also "QT rocks", "QT ROCKS", "qT rOcKs", etc.
|
||||
QRegularExpression re("Qt rocks", QRegularExpression::CaseInsensitiveOption);
|
||||
//! [4]
|
||||
|
||||
|
||||
//! [5]
|
||||
QRegularExpression re("^\\d+$");
|
||||
re.setPatternOptions(QRegularExpression::MultilineOption);
|
||||
// re matches any line in the subject string that contains only digits (but at least one)
|
||||
//! [5]
|
||||
|
||||
|
||||
//! [6]
|
||||
QRegularExpression re = QRegularExpression("^two.*words$", QRegularExpression::MultilineOption
|
||||
| QRegularExpression::DotMatchesEverythingOption);
|
||||
|
||||
QRegularExpression::PatternOptions options = re.patternOptions();
|
||||
// options == QRegularExpression::MultilineOption | QRegularExpression::DotMatchesEverythingOption
|
||||
//! [6]
|
||||
|
||||
|
||||
//! [7]
|
||||
// match two digits followed by a space and a word
|
||||
QRegularExpression re("\\d\\d \\w+");
|
||||
QRegularExpressionMatch match = re.match("abc123 def");
|
||||
bool hasMatch = match.hasMatch(); // true
|
||||
//! [7]
|
||||
|
||||
|
||||
//! [8]
|
||||
QRegularExpression re("\\d\\d \\w+");
|
||||
QRegularExpressionMatch match = re.match("abc123 def");
|
||||
if (match.hasMatch()) {
|
||||
QString matched = match.captured(0); // matched == "23 def"
|
||||
// ...
|
||||
}
|
||||
//! [8]
|
||||
|
||||
|
||||
//! [9]
|
||||
QRegularExpression re("\\d\\d \\w+");
|
||||
QRegularExpressionMatch match = re.match("12 abc 45 def", 1);
|
||||
if (match.hasMatch()) {
|
||||
QString matched = match.captured(0); // matched == "45 def"
|
||||
// ...
|
||||
}
|
||||
//! [9]
|
||||
|
||||
|
||||
//! [10]
|
||||
QRegularExpression re("^(\\d\\d)/(\\d\\d)/(\\d\\d\\d\\d)$");
|
||||
QRegularExpressionMatch match = re.match("08/12/1985");
|
||||
if (match.hasMatch()) {
|
||||
QString day = re.captured(1); // day == "08"
|
||||
QString month = re.captured(2); // month == "12"
|
||||
QString year = re.captured(3); // year == "1985"
|
||||
// ...
|
||||
}
|
||||
//! [10]
|
||||
|
||||
|
||||
//! [11]
|
||||
QRegularExpression re("abc(\\d+)def");
|
||||
QRegularExpressionMatch match = re.match("XYZabc123defXYZ");
|
||||
if (match.hasMatch()) {
|
||||
int startOffset = re.capturedStart(1); // startOffset == 6
|
||||
int endOffset = re.capturedEnd(1); // endOffset == 9
|
||||
// ...
|
||||
}
|
||||
//! [11]
|
||||
|
||||
|
||||
//! [12]
|
||||
QRegularExpression re("^(?<date>\\d\\d)/(?<month>\\d\\d)/(?<year>\\d\\d\\d\\d)$");
|
||||
QRegularExpressionMatch match = re.match("08/12/1985");
|
||||
if (match.hasMatch()) {
|
||||
QString date = match.captured("date"); // date == "08"
|
||||
QString month = match.captured("month"); // month == "12"
|
||||
QString year = match.captured("year"); // year == 1985
|
||||
}
|
||||
//! [12]
|
||||
|
||||
|
||||
//! [13]
|
||||
QRegularExpression re("(\\w+)");
|
||||
QRegularExpressionMatchIterator i = re.globalMatch("the quick fox");
|
||||
//! [13]
|
||||
|
||||
|
||||
//! [14]
|
||||
QStringList words;
|
||||
while (i.hasNext()) {
|
||||
QRegularExpressionMatch match = i.next();
|
||||
QString word = match.captured(1);
|
||||
words << word;
|
||||
}
|
||||
// words contains "the", "quick", "fox"
|
||||
//! [14]
|
||||
|
||||
|
||||
//! [15]
|
||||
QString pattern("^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \\d\\d?, \\d\\d\\d\\d$");
|
||||
QRegularExpression re(pattern);
|
||||
|
||||
QString input("Jan 21,");
|
||||
QRegularExpressionMatch match = re.match(input, 0, QRegularExpressionMatch::PartialPreferCompleteMatch);
|
||||
bool hasMatch = match.hasMatch(); // false
|
||||
bool hasPartialMatch = match.hasPartialMatch(); // true
|
||||
//! [15]
|
||||
|
||||
|
||||
//! [16]
|
||||
QString input("Dec 8, 1985");
|
||||
QRegularExpressionMatch match = re.match(input, 0, QRegularExpressionMatch::PartialPreferCompleteMatch);
|
||||
bool hasMatch = match.hasMatch(); // true
|
||||
bool hasPartialMatch = match.hasPartialMatch(); // false
|
||||
//! [16]
|
||||
|
||||
|
||||
//! [17]
|
||||
QRegularExpression re("abc\\w+X|def");
|
||||
QRegularExpressionMatch match = re.match("abcdef", 0, QRegularExpressionMatch::PartialPreferCompleteMatch);
|
||||
bool hasMatch = match.hasMatch(); // true
|
||||
bool hasPartialMatch = match.hasPartialMatch(); // false
|
||||
QString captured = match.captured(0); // captured == "def"
|
||||
//! [17]
|
||||
|
||||
|
||||
//! [18]
|
||||
QRegularExpression re("abc\\w+X|defY");
|
||||
QRegularExpressionMatch match = re.match("abcdef", 0, QRegularExpressionMatch::PartialPreferCompleteMatch);
|
||||
bool hasMatch = match.hasMatch(); // false
|
||||
bool hasPartialMatch = match.hasPartialMatch(); // true
|
||||
QString captured = match.captured(0); // captured == "abcdef"
|
||||
//! [18]
|
||||
|
||||
|
||||
//! [19]
|
||||
QRegularExpression re("abc|ab");
|
||||
QRegularExpressionMatch match = re.match("ab", 0, QRegularExpressionMatch::PartialPreferFirstMatch);
|
||||
bool hasMatch = match.hasMatch(); // false
|
||||
bool hasPartialMatch = match.hasPartialMatch(); // true
|
||||
//! [19]
|
||||
|
||||
|
||||
//! [20]
|
||||
QRegularExpression re("abc(def)?");
|
||||
QRegularExpressionMatch match = re.match("abc", 0, QRegularExpressionMatch::PartialPreferFirstMatch);
|
||||
bool hasMatch = match.hasMatch(); // false
|
||||
bool hasPartialMatch = match.hasPartialMatch(); // true
|
||||
//! [20]
|
||||
|
||||
//! [21]
|
||||
QRegularExpression re("(abc)*");
|
||||
QRegularExpressionMatch match = re.match("abc", 0, QRegularExpressionMatch::PartialPreferFirstMatch);
|
||||
bool hasMatch = match.hasMatch(); // false
|
||||
bool hasPartialMatch = match.hasPartialMatch(); // true
|
||||
//! [21]
|
||||
|
||||
//! [22]
|
||||
QRegularExpression invalidRe("(unmatched|parenthesis");
|
||||
bool isValid = invalidRe.isValid(); // false
|
||||
//! [22]
|
||||
|
||||
//! [23]
|
||||
QRegularExpression invalidRe("(unmatched|parenthesis");
|
||||
if (!invalidRe.isValid()) {
|
||||
QString errorString = invalidRe.errorString(); // errorString == "missing )"
|
||||
int errorOffset = invalidRe.patternErrorOffset(); // errorOffset == 22
|
||||
// ...
|
||||
}
|
||||
//! [23]
|
||||
|
||||
//! [24]
|
||||
QRegularExpression re("^this pattern must match exactly$");
|
||||
//! [24]
|
||||
|
||||
//! [25]
|
||||
QString p("a .*|pattern");
|
||||
QRegularExpression re("\\A(?:" + p + ")\\z"); // re matches exactly the pattern string p
|
||||
//! [25]
|
||||
|
||||
//! [26]
|
||||
QString escaped = QRegularExpression::escape("a(x) = f(x) + g(x)");
|
||||
// escaped == "a\\(x\\)\\ \\=\\ f\\(x\\)\\ \\+\\ g\\(x\\)"
|
||||
//! [26]
|
||||
|
||||
//! [27]
|
||||
QString pattern = "(" + QRegularExpression::escape(name) +
|
||||
"|" + QRegularExpression::escape(nickname) + ")";
|
||||
QRegularExpression re(pattern);
|
||||
//! [27]
|
||||
|
||||
//! [28]
|
||||
QRegularExpressionMatch match = re.match(...);
|
||||
for (int i = 0; i <= match.lastCapturedIndex(); ++i) {
|
||||
QString captured = match.captured(i);
|
||||
// ...
|
||||
}
|
||||
//! [28]
|
||||
|
||||
//! [29]
|
||||
QRegularExpression("(\d\d) (?<name>\w+)");
|
||||
QRegularExpressionMatch match = re.match("23 Jordan");
|
||||
if (match.hasMatch()) {
|
||||
QString number = match.captured(1); // first == "23"
|
||||
QString name = match.captured("name"); // name == "Jordan"
|
||||
}
|
||||
//! [29]
|
||||
|
||||
//! [30]
|
||||
// extracts the words
|
||||
QRegularExpression re("(\w+)");
|
||||
QString subject("the quick fox");
|
||||
QRegularExpressionMatchIterator i = re.globalMatch(subject);
|
||||
while (i.hasNext()) {
|
||||
QRegularExpressionMatch match = i.next();
|
||||
// ...
|
||||
}
|
||||
//! [30]
|
||||
|
||||
|
@ -52,6 +52,12 @@ Browser::Browser(QWidget *parent)
|
||||
|
||||
table->addAction(insertRowAction);
|
||||
table->addAction(deleteRowAction);
|
||||
table->addAction(fieldStrategyAction);
|
||||
table->addAction(rowStrategyAction);
|
||||
table->addAction(manualStrategyAction);
|
||||
table->addAction(submitAction);
|
||||
table->addAction(revertAction);
|
||||
table->addAction(selectAction);
|
||||
|
||||
if (QSqlDatabase::drivers().isEmpty())
|
||||
QMessageBox::information(this, tr("No database drivers found"),
|
||||
@ -144,7 +150,7 @@ void Browser::addConnection()
|
||||
|
||||
void Browser::showTable(const QString &t)
|
||||
{
|
||||
QSqlTableModel *model = new QSqlTableModel(table, connectionWidget->currentDatabase());
|
||||
QSqlTableModel *model = new CustomModel(table, connectionWidget->currentDatabase());
|
||||
model->setEditStrategy(QSqlTableModel::OnRowChange);
|
||||
model->setTable(connectionWidget->currentDatabase().driver()->escapeIdentifier(t, QSqlDriver::TableName));
|
||||
model->select();
|
||||
@ -215,8 +221,6 @@ void Browser::deleteRow()
|
||||
if (!model)
|
||||
return;
|
||||
|
||||
model->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
||||
|
||||
QModelIndexList currentSelection = table->selectionModel()->selectedIndexes();
|
||||
for (int i = 0; i < currentSelection.count(); ++i) {
|
||||
if (currentSelection.at(i).column() != 0)
|
||||
@ -224,19 +228,31 @@ void Browser::deleteRow()
|
||||
model->removeRow(currentSelection.at(i).row());
|
||||
}
|
||||
|
||||
model->submitAll();
|
||||
model->setEditStrategy(QSqlTableModel::OnRowChange);
|
||||
|
||||
updateActions();
|
||||
}
|
||||
|
||||
void Browser::updateActions()
|
||||
{
|
||||
bool enableIns = qobject_cast<QSqlTableModel *>(table->model());
|
||||
QSqlTableModel * tm = qobject_cast<QSqlTableModel *>(table->model());
|
||||
bool enableIns = tm;
|
||||
bool enableDel = enableIns && table->currentIndex().isValid();
|
||||
|
||||
insertRowAction->setEnabled(enableIns);
|
||||
deleteRowAction->setEnabled(enableDel);
|
||||
|
||||
fieldStrategyAction->setEnabled(tm);
|
||||
rowStrategyAction->setEnabled(tm);
|
||||
manualStrategyAction->setEnabled(tm);
|
||||
submitAction->setEnabled(tm);
|
||||
revertAction->setEnabled(tm);
|
||||
selectAction->setEnabled(tm);
|
||||
|
||||
if (tm) {
|
||||
QSqlTableModel::EditStrategy es = tm->editStrategy();
|
||||
fieldStrategyAction->setChecked(es == QSqlTableModel::OnFieldChange);
|
||||
rowStrategyAction->setChecked(es == QSqlTableModel::OnRowChange);
|
||||
manualStrategyAction->setChecked(es == QSqlTableModel::OnManualSubmit);
|
||||
}
|
||||
}
|
||||
|
||||
void Browser::about()
|
||||
@ -245,3 +261,46 @@ void Browser::about()
|
||||
"shows how a data browser can be used to visualize the results of SQL"
|
||||
"statements on a live database"));
|
||||
}
|
||||
|
||||
void Browser::on_fieldStrategyAction_triggered()
|
||||
{
|
||||
QSqlTableModel * tm = qobject_cast<QSqlTableModel *>(table->model());
|
||||
if (tm)
|
||||
tm->setEditStrategy(QSqlTableModel::OnFieldChange);
|
||||
}
|
||||
|
||||
void Browser::on_rowStrategyAction_triggered()
|
||||
{
|
||||
QSqlTableModel * tm = qobject_cast<QSqlTableModel *>(table->model());
|
||||
if (tm)
|
||||
tm->setEditStrategy(QSqlTableModel::OnRowChange);
|
||||
}
|
||||
|
||||
void Browser::on_manualStrategyAction_triggered()
|
||||
{
|
||||
QSqlTableModel * tm = qobject_cast<QSqlTableModel *>(table->model());
|
||||
if (tm)
|
||||
tm->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
||||
}
|
||||
|
||||
void Browser::on_submitAction_triggered()
|
||||
{
|
||||
QSqlTableModel * tm = qobject_cast<QSqlTableModel *>(table->model());
|
||||
if (tm)
|
||||
tm->submitAll();
|
||||
}
|
||||
|
||||
void Browser::on_revertAction_triggered()
|
||||
{
|
||||
QSqlTableModel * tm = qobject_cast<QSqlTableModel *>(table->model());
|
||||
if (tm)
|
||||
tm->revertAll();
|
||||
}
|
||||
|
||||
void Browser::on_selectAction_triggered()
|
||||
{
|
||||
QSqlTableModel * tm = qobject_cast<QSqlTableModel *>(table->model());
|
||||
if (tm)
|
||||
tm->select();
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
||||
#define BROWSER_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QSqlTableModel>
|
||||
#include "ui_browserwidget.h"
|
||||
|
||||
class ConnectionWidget;
|
||||
@ -77,6 +78,12 @@ public slots:
|
||||
{ insertRow(); }
|
||||
void on_deleteRowAction_triggered()
|
||||
{ deleteRow(); }
|
||||
void on_fieldStrategyAction_triggered();
|
||||
void on_rowStrategyAction_triggered();
|
||||
void on_manualStrategyAction_triggered();
|
||||
void on_submitAction_triggered();
|
||||
void on_revertAction_triggered();
|
||||
void on_selectAction_triggered();
|
||||
void on_connectionWidget_tableActivated(const QString &table)
|
||||
{ showTable(table); }
|
||||
void on_connectionWidget_metaDataRequested(const QString &table)
|
||||
@ -96,4 +103,17 @@ signals:
|
||||
void statusMessage(const QString &message);
|
||||
};
|
||||
|
||||
class CustomModel: public QSqlTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CustomModel(QObject *parent = 0, QSqlDatabase db = QSqlDatabase()):QSqlTableModel(parent, db) {}
|
||||
QVariant data(const QModelIndex &idx, int role) const
|
||||
{
|
||||
if (role == Qt::BackgroundRole && isDirty(idx))
|
||||
return QBrush(QColor(Qt::yellow));
|
||||
return QSqlTableModel::data(idx, role);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<author></author>
|
||||
<comment></comment>
|
||||
<exportmacro></exportmacro>
|
||||
<class>Browser</class>
|
||||
<widget class="QWidget" name="Browser">
|
||||
<property name="geometry">
|
||||
@ -16,18 +14,16 @@
|
||||
<string>Qt SQL Browser</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="margin" >
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>7</vsizetype>
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -37,9 +33,7 @@
|
||||
</property>
|
||||
<widget class="ConnectionWidget" name="connectionWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>13</hsizetype>
|
||||
<vsizetype>7</vsizetype>
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -47,9 +41,7 @@
|
||||
</widget>
|
||||
<widget class="QTableView" name="table">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>7</vsizetype>
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -66,9 +58,7 @@
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>3</vsizetype>
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -83,18 +73,16 @@
|
||||
<string>SQL Query</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="sqlEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>3</vsizetype>
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -115,18 +103,18 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="margin" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
@ -176,15 +164,69 @@
|
||||
<string>Deletes the current Row</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="fieldStrategyAction">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Submit on &Field Change</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Commit on Field Change</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="rowStrategyAction">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Submit on &Row Change</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Commit on Row Change</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="manualStrategyAction">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Submit &Manually</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Commit Manually</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="submitAction">
|
||||
<property name="text">
|
||||
<string>&Submit All</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Submit Changes</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="revertAction">
|
||||
<property name="text">
|
||||
<string>&Revert All</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Revert</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="selectAction">
|
||||
<property name="text">
|
||||
<string>S&elect</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Refresh Data from Database</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ConnectionWidget</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>connectionwidget.h</header>
|
||||
<container>0</container>
|
||||
<pixmap></pixmap>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
|
172
examples/widgets/mousebuttons/buttontester.cpp
Normal file
172
examples/widgets/mousebuttons/buttontester.cpp
Normal file
@ -0,0 +1,172 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (C) 2012 Rick Stockton <rickstockton@reno-computerhelp.com>
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "buttontester.h"
|
||||
|
||||
void ButtonTester::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
int j = ButtonTester::buttonByNumber (e->button());
|
||||
QString result = "Mouse Press: raw button=" + QString::number(j) + " Qt=" + enumNameFromValue(e->button());
|
||||
qDebug() << result;
|
||||
this->setText(result);
|
||||
if (j == 2) {
|
||||
this->repaint();
|
||||
}
|
||||
}
|
||||
|
||||
void ButtonTester::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
int j = ButtonTester::buttonByNumber (e->button());
|
||||
QString result = "Mouse Release: raw button=" + QString::number(j) + " Qt=" + enumNameFromValue(e->button());
|
||||
qDebug() << result;
|
||||
this->setText(result);
|
||||
}
|
||||
|
||||
void ButtonTester::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
{
|
||||
int j = ButtonTester::buttonByNumber (e->button());
|
||||
QString result = "Mouse DoubleClick: raw button=" + QString::number(j) + " Qt=" + enumNameFromValue(e->button());
|
||||
qDebug() << result;
|
||||
this->setText(result);
|
||||
}
|
||||
|
||||
void ButtonTester::wheelEvent (QWheelEvent *e)
|
||||
{
|
||||
QString result;
|
||||
if (e->delta() > 0) {
|
||||
|
||||
if (e->orientation() == Qt::Vertical) {
|
||||
result = "Mouse Wheel Event: UP";
|
||||
} else {
|
||||
result = "Mouse Wheel Event: LEFT";
|
||||
}
|
||||
} else if (e->delta() < 0) {
|
||||
if (e->orientation() == Qt::Vertical) {
|
||||
result = "Mouse Wheel Event: DOWN";
|
||||
} else {
|
||||
result = "Mouse Wheel Event: RIGHT";
|
||||
}
|
||||
}
|
||||
qDebug() << result;
|
||||
this->setText(result);
|
||||
}
|
||||
|
||||
int ButtonTester::buttonByNumber(const Qt::MouseButton button)
|
||||
{
|
||||
if (button == Qt::NoButton) return 0;
|
||||
if (button == Qt::LeftButton) return 1;
|
||||
if (button == Qt::RightButton) return 2;
|
||||
if (button == Qt::MiddleButton) return 3;
|
||||
|
||||
/* Please note that Qt Button #4 corresponds to button #8 on all
|
||||
* platforms which EMULATE wheel events by creating button events
|
||||
* (Button #4 = Scroll Up; Button #5 = Scroll Down; Button #6 = Scroll
|
||||
* Left; and Button #7 = Scroll Right.) This includes X11, with both
|
||||
* Xlib and XCB. So, the "raw button" for "Qt::BackButton" is
|
||||
* usually described as "Button #8".
|
||||
|
||||
* If your platform supports "smooth scrolling", then, for the cases of
|
||||
* Qt::BackButton and higher, this program will show "raw button" with a
|
||||
* value which is too large. Subtract 4 to get the correct button ID for
|
||||
* your platform.
|
||||
*/
|
||||
|
||||
if (button == Qt::BackButton) return 8;
|
||||
if (button == Qt::ForwardButton) return 9;
|
||||
if (button == Qt::TaskButton) return 10;
|
||||
if (button == Qt::ExtraButton4) return 11;
|
||||
if (button == Qt::ExtraButton5) return 12;
|
||||
if (button == Qt::ExtraButton6) return 13;
|
||||
if (button == Qt::ExtraButton7) return 14;
|
||||
if (button == Qt::ExtraButton8) return 15;
|
||||
if (button == Qt::ExtraButton9) return 16;
|
||||
if (button == Qt::ExtraButton10) return 17;
|
||||
if (button == Qt::ExtraButton11) return 18;
|
||||
if (button == Qt::ExtraButton12) return 19;
|
||||
if (button == Qt::ExtraButton13) return 20;
|
||||
if (button == Qt::ExtraButton14) return 21;
|
||||
if (button == Qt::ExtraButton15) return 22;
|
||||
if (button == Qt::ExtraButton16) return 23;
|
||||
if (button == Qt::ExtraButton17) return 24;
|
||||
if (button == Qt::ExtraButton18) return 25;
|
||||
if (button == Qt::ExtraButton19) return 26;
|
||||
if (button == Qt::ExtraButton20) return 27;
|
||||
if (button == Qt::ExtraButton21) return 28;
|
||||
if (button == Qt::ExtraButton22) return 29;
|
||||
if (button == Qt::ExtraButton23) return 30;
|
||||
if (button == Qt::ExtraButton24) return 31;
|
||||
qDebug("QMouseShortcutEntry::addShortcut contained Invalid Qt::MouseButton value");
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString ButtonTester::enumNameFromValue(const Qt::MouseButton button)
|
||||
{
|
||||
if (button == Qt::NoButton) return "NoButton";
|
||||
if (button == Qt::LeftButton) return "LeftButton";
|
||||
if (button == Qt::RightButton) return "RightButton";
|
||||
if (button == Qt::MiddleButton) return "MiddleButton";
|
||||
if (button == Qt::BackButton) return "BackButton";
|
||||
if (button == Qt::ForwardButton) return "ForwardButton";
|
||||
if (button == Qt::TaskButton) return "TaskButton";
|
||||
if (button == Qt::ExtraButton4) return "ExtraButton4";
|
||||
if (button == Qt::ExtraButton5) return "ExtraButton5";
|
||||
if (button == Qt::ExtraButton6) return "ExtraButton6";
|
||||
if (button == Qt::ExtraButton7) return "ExtraButton7";
|
||||
if (button == Qt::ExtraButton8) return "ExtraButton8";
|
||||
if (button == Qt::ExtraButton9) return "ExtraButton9";
|
||||
if (button == Qt::ExtraButton10) return "ExtraButton10";
|
||||
if (button == Qt::ExtraButton11) return "ExtraButton11";
|
||||
if (button == Qt::ExtraButton12) return "ExtraButton12";
|
||||
if (button == Qt::ExtraButton13) return "ExtraButton13";
|
||||
if (button == Qt::ExtraButton14) return "ExtraButton14";
|
||||
if (button == Qt::ExtraButton15) return "ExtraButton15";
|
||||
if (button == Qt::ExtraButton16) return "ExtraButton16";
|
||||
if (button == Qt::ExtraButton17) return "ExtraButton17";
|
||||
if (button == Qt::ExtraButton18) return "ExtraButton18";
|
||||
if (button == Qt::ExtraButton19) return "ExtraButton19";
|
||||
if (button == Qt::ExtraButton20) return "ExtraButton20";
|
||||
if (button == Qt::ExtraButton21) return "ExtraButton21";
|
||||
if (button == Qt::ExtraButton22) return "ExtraButton22";
|
||||
if (button == Qt::ExtraButton23) return "ExtraButton23";
|
||||
if (button == Qt::ExtraButton24) return "ExtraButton24";
|
||||
qDebug("QMouseShortcutEntry::addShortcut contained Invalid Qt::MouseButton value");
|
||||
return "NoButton";
|
||||
}
|
64
examples/widgets/mousebuttons/buttontester.h
Normal file
64
examples/widgets/mousebuttons/buttontester.h
Normal file
@ -0,0 +1,64 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (C) 2012 Rick Stockton <rickstockton@reno-computerhelp.com>
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef BUTTONTESTER_H
|
||||
#define BUTTONTESTER_H
|
||||
|
||||
#include <QtWidgets>
|
||||
#include <QTextEdit>
|
||||
#include <QString>
|
||||
#include <QDebug>
|
||||
#include <QMouseEvent>
|
||||
#include <QWheelEvent>
|
||||
|
||||
class ButtonTester : public QTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
void wheelEvent(QWheelEvent * event);
|
||||
int buttonByNumber(const Qt::MouseButton button);
|
||||
QString enumNameFromValue(const Qt::MouseButton button);
|
||||
};
|
||||
|
||||
#endif // BUTTONTESTER_H
|
66
examples/widgets/mousebuttons/main.cpp
Normal file
66
examples/widgets/mousebuttons/main.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (C) 2012 Rick Stockton <rickstockton@reno-computerhelp.com>
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "buttontester.h"
|
||||
#include <QtGui>
|
||||
|
||||
int main(int argv, char **args)
|
||||
{
|
||||
QApplication app(argv, args);
|
||||
|
||||
ButtonTester *testArea = new ButtonTester;
|
||||
testArea->setMinimumSize(500, 350);
|
||||
testArea->setText("To test your mouse with Qt, press buttons in this area.\nYou may also scroll or tilt your mouse wheel.");
|
||||
QPushButton *quitButton = new QPushButton("Quit");
|
||||
|
||||
QObject::connect(quitButton, SIGNAL(clicked()), qApp, SLOT(quit()));
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->addWidget(testArea);
|
||||
layout->addWidget(quitButton);
|
||||
|
||||
QWidget window;
|
||||
window.setLayout(layout);
|
||||
window.setWindowTitle("Mouse Button Tester");
|
||||
window.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
18
examples/widgets/mousebuttons/mousebuttons.pro
Normal file
18
examples/widgets/mousebuttons/mousebuttons.pro
Normal file
@ -0,0 +1,18 @@
|
||||
TEMPLATE = app
|
||||
|
||||
TARGET = buttontester
|
||||
TEMPLATE = app
|
||||
|
||||
SOURCES += \
|
||||
main.cpp\
|
||||
buttontester.cpp \
|
||||
|
||||
HEADERS += \
|
||||
buttontester.h \
|
||||
|
||||
# install
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/examples/widgets/mousebuttons
|
||||
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS buttontester.pro
|
||||
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/examples/widgets/mousebuttons
|
||||
INSTALLS += target sources
|
||||
QT += core widgets
|
@ -12,6 +12,7 @@ SUBDIRS = analogclock \
|
||||
imageviewer \
|
||||
lineedits \
|
||||
movie \
|
||||
mousebuttons \
|
||||
orientation \
|
||||
scribble \
|
||||
shapedclock \
|
||||
|
@ -35,6 +35,57 @@ if (Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS)
|
||||
list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS)
|
||||
endif()
|
||||
|
||||
!!IF !isEmpty(CMAKE_STATIC_TYPE)
|
||||
# For static builds, we also list the dependencies of
|
||||
# Qt so that consumers can build.
|
||||
|
||||
!!IF isEqual(CMAKE_MODULE_NAME, Core)
|
||||
|
||||
set(Qt5Core_LIB_DEPENDENCIES)
|
||||
!!IF contains(QT_CONFIG, system-zlib)
|
||||
find_package(ZLIB REQUIRED)
|
||||
list(APPEND Qt5Core_LIB_DEPENDENCIES ${ZLIB_LIBRARIES})
|
||||
!!ENDIF
|
||||
|
||||
!!IF contains(QT_CONFIG, glib)
|
||||
find_package(GTK2 REQUIRED glib-2.0 gthread-2.0)
|
||||
list(APPEND Qt5Core_LIB_DEPENDENCIES ${GTK2_LIBRARIES})
|
||||
!!ENDIF
|
||||
|
||||
!!IF contains(QT_CONFIG, clock-monotonic)
|
||||
find_library(QT_RT_LIBRARY NAMES rt)
|
||||
mark_as_advanced(QT_RT_LIBRARY)
|
||||
list(APPEND Qt5Core_LIB_DEPENDENCIES ${QT_RT_LIBRARY})
|
||||
!!ENDIF
|
||||
|
||||
set(CMAKE_THREAD_PREFER_PTHREADS 1)
|
||||
find_package(Threads)
|
||||
if(CMAKE_USE_PTHREADS_INIT)
|
||||
list(APPEND Qt5Core_LIB_DEPENDENCIES ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
!!ENDIF # Core
|
||||
|
||||
!!IF isEqual(CMAKE_MODULE_NAME, Gui)
|
||||
|
||||
set(Qt5Gui_LIB_DEPENDENCIES)
|
||||
|
||||
!!IF contains(QT_CONFIG, system-png)
|
||||
find_package(PNG REQUIRED)
|
||||
list(APPEND Qt5Gui_LIB_DEPENDENCIES ${PNG_LIBRARIES})
|
||||
!!ENDIF
|
||||
|
||||
!!IF contains(QT_CONFIG, system-jpeg)
|
||||
find_package(JPEG REQUIRED)
|
||||
list(APPEND Qt5Gui_LIB_DEPENDENCIES ${JPEG_LIBRARIES})
|
||||
!!ENDIF
|
||||
|
||||
!!ENDIF # Gui
|
||||
|
||||
!!ENDIF # Static
|
||||
|
||||
list(APPEND Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES "$${CMAKE_QT5_MODULE_DEPS}")
|
||||
|
||||
if (NOT _Qt5$${CMAKE_MODULE_NAME}_target)
|
||||
set(_Qt5$${CMAKE_MODULE_NAME}_target 1)
|
||||
!!IF !isEmpty(CMAKE_STATIC_TYPE)
|
||||
@ -50,7 +101,7 @@ endif()
|
||||
!!IF !isEmpty(debug_type)
|
||||
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG \"$${CMAKE_QT5_MODULE_DEPS}\"
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG \"${Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
|
||||
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
|
||||
IMPORTED_LOCATION_DEBUG \"${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
|
||||
!!ELSE
|
||||
@ -67,7 +118,7 @@ set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
|
||||
!!IF !isEmpty(release_type)
|
||||
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE \"$${CMAKE_QT5_MODULE_DEPS}\"
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE \"${Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
|
||||
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
|
||||
IMPORTED_LOCATION_RELEASE \"${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
|
||||
!!ELSE
|
||||
|
@ -34,6 +34,7 @@ QMAKE_LIBS_OPENGL_ES1 = -lGLES_CM
|
||||
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
|
||||
QMAKE_LIBS_OPENVG = -lOpenVG
|
||||
QMAKE_LIBS_THREAD = -lpthread
|
||||
QMAKE_LIBS_LIBUDEV = -ludev
|
||||
|
||||
QMAKE_CFLAGS_WAYLAND =
|
||||
QMAKE_INCDIR_WAYLAND =
|
||||
|
@ -152,21 +152,22 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) {
|
||||
!isEmpty(QT_BUILD_TREE):QMAKE_LIBDIR = $$QT_BUILD_TREE/lib $$QMAKE_LIBDIR #as above, prepending prevents us from picking up "stale" libs
|
||||
QMAKE_LIBDIR += $$QMAKE_LIBDIR_QT
|
||||
|
||||
# Topological ordering of modules based on their QT.<module>.depends variable
|
||||
QT = $$sort_depends(QT, "QT.")
|
||||
|
||||
QT_DEPENDS=
|
||||
|
||||
# Figure out from which modules we're wanting to use the private headers
|
||||
unset(using_privates)
|
||||
NEWQT =
|
||||
for(QTLIB, QT) {
|
||||
# Figure out if we're wanting to use the private headers of a module
|
||||
contains(QTLIB, .*-private) {
|
||||
QTLIB ~= s/-private//
|
||||
use_private = UsePrivate
|
||||
} else {
|
||||
use_private = NoPrivate
|
||||
QTLIBRAW = $$replace(QTLIB, -private$, )
|
||||
!isEqual(QTLIBRAW, $$QTLIB) {
|
||||
want_var = QT.$${QTLIBRAW}.want_private
|
||||
$$want_var = UsePrivate
|
||||
using_privates = true
|
||||
}
|
||||
|
||||
NEWQT += $$QTLIBRAW
|
||||
}
|
||||
# Topological resolution of modules based on their QT.<module>.depends variable
|
||||
QT = $$resolve_depends(NEWQT, "QT.")
|
||||
# Finally actually add the modules
|
||||
for(QTLIB, QT) {
|
||||
isEmpty(QT.$${QTLIB}.name) {
|
||||
message("Warning: unknown QT module: $$QTLIB")
|
||||
next()
|
||||
@ -176,14 +177,9 @@ for(QTLIB, QT) {
|
||||
warning($$TARGET cannot have a QT of $$QTLIB)
|
||||
next()
|
||||
}
|
||||
qtAddModule($$QTLIB, $$use_private)
|
||||
QT_DEPENDS += $$eval(QT.$${QTLIB}.depends)
|
||||
isEqual(use_private, UsePrivate):using_privates = true
|
||||
}
|
||||
|
||||
# add include paths for all .depends, since module/application might need f.ex. template specializations etc.
|
||||
QT_DEPENDS -= $$QT
|
||||
for(QTLIB, $$list($$lower($$unique(QT_DEPENDS)))):INCLUDEPATH *= $$INCLUDEPATH $$eval(QT.$${QTLIB}.includes)
|
||||
qtAddModule($$QTLIB, $$eval(QT.$${QTLIB}.want_private))
|
||||
}
|
||||
|
||||
!isEmpty(using_privates):!no_private_qt_headers_warning:if(!debug_and_release|!build_pass) {
|
||||
message("This project is using private headers and will therefore be tied to this specific Qt module build version.")
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# qmake configuration for qnx-g++
|
||||
# qmake configuration for qnx-x11-g++
|
||||
#
|
||||
# Written for QNX RTOS v6 with X11
|
||||
#
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# qmake configuration for blackberry-qcc
|
||||
# qmake configuration for qnx-qcc armv7 targets
|
||||
#
|
||||
|
||||
MAKEFILE_GENERATOR = UNIX
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# qmake configuration for blackberry-qcc
|
||||
# qmake configuration for qnx-qcc x86 targets
|
||||
#
|
||||
|
||||
MAKEFILE_GENERATOR = UNIX
|
@ -178,7 +178,6 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
|
||||
}
|
||||
if(tmp_proj.first("TEMPLATE") == "subdirs") {
|
||||
QMakeProject *pp = new QMakeProject(&tmp_proj);
|
||||
pp->read(0);
|
||||
pb_subdirs += new ProjectBuilderSubDirs(pp, dir);
|
||||
} else if(tmp_proj.first("TEMPLATE") == "app" || tmp_proj.first("TEMPLATE") == "lib") {
|
||||
QString pbxproj = qmake_getpwd() + Option::dir_sep + tmp_proj.first("TARGET") + projectSuffix();
|
||||
|
@ -447,6 +447,8 @@ QT_END_INCLUDE_NAMESPACE
|
||||
MakefileGenerator *
|
||||
MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO)
|
||||
{
|
||||
Option::postProcessProject(proj);
|
||||
|
||||
MakefileGenerator *mkfile = NULL;
|
||||
if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) {
|
||||
mkfile = new ProjectGenerator;
|
||||
@ -492,6 +494,8 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO)
|
||||
MetaMakefileGenerator *
|
||||
MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &name, bool op, bool *success)
|
||||
{
|
||||
Option::postProcessProject(proj);
|
||||
|
||||
MetaMakefileGenerator *ret = 0;
|
||||
if ((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE ||
|
||||
Option::qmake_mode == Option::QMAKE_GENERATE_PRL)) {
|
||||
|
@ -404,14 +404,14 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t)
|
||||
QString ar_cmd = project->values("QMAKE_LIB").join(" ");
|
||||
if (ar_cmd.isEmpty())
|
||||
ar_cmd = "armar --create";
|
||||
objectsLinkLine = ar_cmd + " " + var("DEST_TARGET") + " --via " + ar_script_file;
|
||||
objectsLinkLine = ar_cmd + " " + var("DEST_TARGET") + " --via " + escapeFilePath(ar_script_file);
|
||||
} else {
|
||||
// Strip off any options since the ar commands will be read from file.
|
||||
QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0);;
|
||||
if (ar_cmd.isEmpty())
|
||||
ar_cmd = "ar";
|
||||
createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS"));
|
||||
objectsLinkLine = ar_cmd + " -M < " + ar_script_file;
|
||||
objectsLinkLine = ar_cmd + " -M < " + escapeFilePath(ar_script_file);
|
||||
}
|
||||
} else {
|
||||
QString ld_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
|
||||
@ -420,10 +420,10 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t)
|
||||
}
|
||||
if (project->isActiveConfig("rvct_linker")) {
|
||||
createRvctObjectScriptFile(ld_script_file, project->values("OBJECTS"));
|
||||
objectsLinkLine = QString::fromLatin1("--via ") + ld_script_file;
|
||||
objectsLinkLine = QString::fromLatin1("--via ") + escapeFilePath(ld_script_file);
|
||||
} else {
|
||||
createLdObjectScriptFile(ld_script_file, project->values("OBJECTS"));
|
||||
objectsLinkLine = ld_script_file;
|
||||
objectsLinkLine = escapeFilePath(ld_script_file);
|
||||
}
|
||||
}
|
||||
Win32MakefileGenerator::writeObjectsPart(t);
|
||||
|
@ -149,8 +149,11 @@ static QString detectProjectFile(const QString &path)
|
||||
static QString cleanSpec(const QString &spec)
|
||||
{
|
||||
QString ret = QDir::cleanPath(spec);
|
||||
if (ret.contains('/'))
|
||||
ret = QDir::cleanPath(QFileInfo(ret).absoluteFilePath());
|
||||
if (ret.contains('/')) {
|
||||
const QFileInfo specDirInfo(ret);
|
||||
if (specDirInfo.exists() && specDirInfo.isDir())
|
||||
ret = QDir::cleanPath(specDirInfo.absoluteFilePath());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -591,10 +594,12 @@ QStringList Option::mkspecPaths()
|
||||
for (QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it)
|
||||
ret << ((*it) + concat);
|
||||
}
|
||||
if (!Option::mkfile::project_build_root.isEmpty())
|
||||
ret << Option::mkfile::project_build_root + concat;
|
||||
if (!Option::mkfile::project_root.isEmpty())
|
||||
ret << Option::mkfile::project_root + concat;
|
||||
ret << QLibraryInfo::location(QLibraryInfo::HostDataPath) + concat;
|
||||
ret.removeDuplicates();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -593,6 +593,7 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0)
|
||||
concat_it != concat.end(); ++concat_it)
|
||||
feature_roots << (QLibraryInfo::location(QLibraryInfo::HostDataPath) +
|
||||
mkspecs_concat + (*concat_it));
|
||||
feature_roots.removeDuplicates();
|
||||
return feature_roots;
|
||||
}
|
||||
|
||||
@ -627,10 +628,11 @@ QMakeProject::init(QMakeProperty *p)
|
||||
reset();
|
||||
}
|
||||
|
||||
QMakeProject::QMakeProject(QMakeProject *p, const QHash<QString, QStringList> *vars)
|
||||
// Duplicate project. It is *not* allowed to call the complex read() functions on the copy.
|
||||
QMakeProject::QMakeProject(QMakeProject *p, const QHash<QString, QStringList> *_vars)
|
||||
{
|
||||
init(p->properties());
|
||||
base_vars = vars ? *vars : p->variables();
|
||||
vars = _vars ? *_vars : p->variables();
|
||||
for(QHash<QString, FunctionBlock*>::iterator it = p->replaceFunctions.begin(); it != p->replaceFunctions.end(); ++it) {
|
||||
it.value()->ref();
|
||||
replaceFunctions.insert(it.key(), it.value());
|
||||
@ -1256,7 +1258,7 @@ QMakeProject::read(const QString &project, uchar cmd)
|
||||
bool
|
||||
QMakeProject::read(uchar cmd)
|
||||
{
|
||||
if(cfile.isEmpty()) {
|
||||
if ((cmd & ReadSetup) && base_vars.isEmpty()) {
|
||||
// hack to get the Option stuff in there
|
||||
base_vars["QMAKE_EXT_CPP"] = Option::cpp_ext;
|
||||
base_vars["QMAKE_EXT_C"] = Option::c_ext;
|
||||
@ -1265,12 +1267,12 @@ QMakeProject::read(uchar cmd)
|
||||
if(!Option::user_template_prefix.isEmpty())
|
||||
base_vars["TEMPLATE_PREFIX"] = QStringList(Option::user_template_prefix);
|
||||
|
||||
if ((cmd & ReadSetup) && Option::mkfile::do_cache) { // parse the cache
|
||||
if (Option::mkfile::do_cache) { // parse the cache
|
||||
if (Option::output_dir.startsWith(Option::mkfile::project_build_root))
|
||||
Option::mkfile::cachefile_depth =
|
||||
Option::output_dir.mid(Option::mkfile::project_build_root.length()).count('/');
|
||||
}
|
||||
if (cmd & ReadSetup) { // parse mkspec
|
||||
{ // parse mkspec
|
||||
QString qmakespec = Option::mkfile::qmakespec;
|
||||
while(qmakespec.endsWith(QLatin1Char('/')))
|
||||
qmakespec.truncate(qmakespec.length()-1);
|
||||
@ -1306,7 +1308,6 @@ QMakeProject::read(uchar cmd)
|
||||
|
||||
//before commandline
|
||||
if (cmd & ReadSetup) {
|
||||
cfile = pfile;
|
||||
parser.file = "(internal)";
|
||||
parser.from_file = false;
|
||||
parser.line_no = 1; //really arg count now.. duh
|
||||
@ -1385,7 +1386,6 @@ QMakeProject::read(uchar cmd)
|
||||
break;
|
||||
}
|
||||
}
|
||||
Option::postProcessProject(this); // let Option post-process
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1633,12 +1633,8 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash<QString, QString
|
||||
if(flags & (IncludeFlagNewProject|IncludeFlagNewParser)) {
|
||||
// The "project's variables" are used in other places (eg. export()) so it's not
|
||||
// possible to use "place" everywhere. Instead just set variables and grab them later
|
||||
QMakeProject proj(this, &place);
|
||||
QMakeProject proj(prop);
|
||||
if(flags & IncludeFlagNewParser) {
|
||||
#if 1
|
||||
if(proj.doProjectInclude("default_pre", IncludeFlagFeature, proj.variables()) == IncludeNoExist)
|
||||
proj.doProjectInclude("default", IncludeFlagFeature, proj.variables());
|
||||
#endif
|
||||
parsed = proj.read(file, proj.variables()); // parse just that file (fromfile, infile)
|
||||
} else {
|
||||
parsed = proj.read(file); // parse all aux files (load/include into)
|
||||
|
@ -81,7 +81,7 @@ class QMakeProject
|
||||
bool recursive;
|
||||
bool own_prop;
|
||||
bool backslashWarned;
|
||||
QString pfile, cfile;
|
||||
QString pfile;
|
||||
QMakeProperty *prop;
|
||||
void reset();
|
||||
QStringList extra_configs;
|
||||
|
@ -39,9 +39,6 @@ confclean.depends += clean
|
||||
confclean.commands =
|
||||
unix {
|
||||
confclean.commands += (cd config.tests/unix/stl && $(MAKE) distclean); \
|
||||
(cd config.tests/unix/endian && $(MAKE) distclean); \
|
||||
(cd config.tests/unix/ipv6 && $(MAKE) distclean); \
|
||||
(cd config.tests/unix/largefile && $(MAKE) distclean); \
|
||||
(cd config.tests/unix/ptrsize && $(MAKE) distclean); \
|
||||
(cd config.tests/x11/notype && $(MAKE) distclean); \
|
||||
(cd config.tests/unix/getaddrinfo && $(MAKE) distclean); \
|
||||
@ -50,7 +47,6 @@ unix {
|
||||
(cd config.tests/unix/mysql && $(MAKE) distclean); \
|
||||
(cd config.tests/unix/mysql_r && $(MAKE) distclean); \
|
||||
(cd config.tests/unix/nis && $(MAKE) distclean); \
|
||||
(cd config.tests/unix/nix && $(MAKE) distclean); \
|
||||
(cd config.tests/unix/iodbc && $(MAKE) distclean); \
|
||||
(cd config.tests/unix/odbc && $(MAKE) distclean); \
|
||||
(cd config.tests/unix/oci && $(MAKE) distclean); \
|
||||
|
26
src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
vendored
26
src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
vendored
@ -995,7 +995,7 @@ static HB_Stream getTableStream(void *font, HB_GetFontTableFunc tableFunc, HB_Ta
|
||||
return stream;
|
||||
}
|
||||
|
||||
HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc)
|
||||
HB_Face HB_AllocFace(void *font, HB_GetFontTableFunc tableFunc)
|
||||
{
|
||||
HB_Face face = (HB_Face )malloc(sizeof(HB_FaceRec));
|
||||
if (!face)
|
||||
@ -1012,6 +1012,30 @@ HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc)
|
||||
face->tmpLogClusters = 0;
|
||||
face->glyphs_substituted = false;
|
||||
face->buffer = 0;
|
||||
face->font_for_init = font;
|
||||
face->get_font_table_func = tableFunc;
|
||||
|
||||
return face;
|
||||
}
|
||||
|
||||
HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc)
|
||||
{
|
||||
HB_Face face = HB_AllocFace(font, tableFunc);
|
||||
if (face)
|
||||
face = HB_LoadFace(face);
|
||||
return face;
|
||||
}
|
||||
|
||||
HB_Face HB_LoadFace(HB_Face face)
|
||||
{
|
||||
void *font = face->font_for_init;
|
||||
if (!font)
|
||||
return face;
|
||||
|
||||
HB_GetFontTableFunc tableFunc = face->get_font_table_func;
|
||||
|
||||
face->get_font_table_func = 0;
|
||||
face->font_for_init = 0;
|
||||
|
||||
HB_Error error = HB_Err_Ok;
|
||||
HB_Stream stream;
|
||||
|
8
src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
vendored
8
src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
vendored
@ -201,6 +201,8 @@ typedef struct {
|
||||
hb_bitfield combiningClass :8;
|
||||
} HB_GlyphAttributes;
|
||||
|
||||
typedef HB_Error (*HB_GetFontTableFunc)(void *font, HB_Tag tag, HB_Byte *buffer, HB_UInt *length);
|
||||
|
||||
typedef struct HB_FaceRec_ {
|
||||
HB_Bool isSymbolFont;
|
||||
|
||||
@ -217,11 +219,15 @@ typedef struct HB_FaceRec_ {
|
||||
unsigned int *tmpLogClusters;
|
||||
int length;
|
||||
int orig_nglyphs;
|
||||
void *font_for_init;
|
||||
HB_GetFontTableFunc get_font_table_func;
|
||||
} HB_FaceRec;
|
||||
|
||||
typedef HB_Error (*HB_GetFontTableFunc)(void *font, HB_Tag tag, HB_Byte *buffer, HB_UInt *length);
|
||||
|
||||
|
||||
HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc);
|
||||
HB_Face HB_AllocFace(void *font, HB_GetFontTableFunc tableFunc);
|
||||
HB_Face HB_LoadFace(HB_Face face);
|
||||
void HB_FreeFace(HB_Face face);
|
||||
|
||||
typedef struct {
|
||||
|
@ -92,7 +92,7 @@
|
||||
#include "qanimationgroup.h"
|
||||
#include "qpropertyanimation_p.h"
|
||||
|
||||
#include <private/qmutexpool_p.h>
|
||||
#include <QtCore/QMutex>
|
||||
|
||||
#ifndef QT_NO_ANIMATION
|
||||
|
||||
@ -268,7 +268,8 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State newState,
|
||||
QPropertyAnimation *animToStop = 0;
|
||||
{
|
||||
#ifndef QT_NO_THREAD
|
||||
QMutexLocker locker(QMutexPool::globalInstanceGet(&staticMetaObject));
|
||||
static QBasicMutex mutex;
|
||||
QMutexLocker locker(&mutex);
|
||||
#endif
|
||||
typedef QPair<QObject *, QByteArray> QPropertyAnimationPair;
|
||||
typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash;
|
||||
@ -280,6 +281,7 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State newState,
|
||||
d->updateMetaProperty();
|
||||
animToStop = hash.value(key, 0);
|
||||
hash.insert(key, this);
|
||||
locker.unlock();
|
||||
// update the default start value
|
||||
if (oldState == Stopped) {
|
||||
d->setDefaultStartEndValue(d->targetValue->property(d->propertyName.constData()));
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include <QtCore/qrect.h>
|
||||
#include <QtCore/qline.h>
|
||||
#include <QtCore/qmutex.h>
|
||||
#include <private/qmutexpool_p.h>
|
||||
|
||||
#ifndef QT_NO_ANIMATION
|
||||
|
||||
@ -399,6 +398,7 @@ void QVariantAnimation::setEasingCurve(const QEasingCurve &easing)
|
||||
|
||||
typedef QVector<QVariantAnimation::Interpolator> QInterpolatorVector;
|
||||
Q_GLOBAL_STATIC(QInterpolatorVector, registeredInterpolators)
|
||||
static QBasicMutex registeredInterpolatorsMutex;
|
||||
|
||||
/*!
|
||||
\fn void qRegisterAnimationInterpolator(QVariant (*func)(const T &from, const T &to, qreal progress))
|
||||
@ -435,9 +435,7 @@ void QVariantAnimation::registerInterpolator(QVariantAnimation::Interpolator fun
|
||||
// in such an order that we get here with interpolators == NULL,
|
||||
// to continue causes the app to crash on exit with a SEGV
|
||||
if (interpolators) {
|
||||
#ifndef QT_NO_THREAD
|
||||
QMutexLocker locker(QMutexPool::globalInstanceGet(interpolators));
|
||||
#endif
|
||||
QMutexLocker locker(®isteredInterpolatorsMutex);
|
||||
if (int(interpolationType) >= interpolators->count())
|
||||
interpolators->resize(int(interpolationType) + 1);
|
||||
interpolators->replace(interpolationType, func);
|
||||
@ -451,16 +449,16 @@ template<typename T> static inline QVariantAnimation::Interpolator castToInterpo
|
||||
}
|
||||
|
||||
QVariantAnimation::Interpolator QVariantAnimationPrivate::getInterpolator(int interpolationType)
|
||||
{
|
||||
{
|
||||
QInterpolatorVector *interpolators = registeredInterpolators();
|
||||
#ifndef QT_NO_THREAD
|
||||
QMutexLocker locker(QMutexPool::globalInstanceGet(interpolators));
|
||||
#endif
|
||||
QMutexLocker locker(®isteredInterpolatorsMutex);
|
||||
QVariantAnimation::Interpolator ret = 0;
|
||||
if (interpolationType < interpolators->count()) {
|
||||
ret = interpolators->at(interpolationType);
|
||||
if (ret) return ret;
|
||||
}
|
||||
}
|
||||
|
||||
switch(interpolationType)
|
||||
{
|
||||
|
@ -145,8 +145,6 @@ static bool destroying_is_ok = false;
|
||||
#endif
|
||||
|
||||
static QTextCodec *localeMapper = 0;
|
||||
QTextCodec *QTextCodec::cftr = 0;
|
||||
|
||||
|
||||
class QTextCodecCleanup
|
||||
{
|
||||
@ -1463,41 +1461,6 @@ QString QTextDecoder::toUnicode(const QByteArray &ba)
|
||||
return c->toUnicode(ba.constData(), ba.length(), &state);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\fn QTextCodec* QTextCodec::codecForTr()
|
||||
|
||||
Returns the codec used by QObject::tr() on its argument. If this
|
||||
function returns 0 (the default), tr() assumes Latin-1.
|
||||
|
||||
\sa setCodecForTr()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QTextCodec::setCodecForTr(QTextCodec *c)
|
||||
\nonreentrant
|
||||
|
||||
Sets the codec used by QObject::tr() on its argument to \a c. If
|
||||
\a c is 0 (the default), tr() assumes Latin-1.
|
||||
|
||||
If the literal quoted text in the program is not in the Latin-1
|
||||
encoding, this function can be used to set the appropriate
|
||||
encoding. For example, software developed by Korean programmers
|
||||
might use eucKR for all the text in the program, in which case the
|
||||
main() function might look like this:
|
||||
|
||||
\snippet doc/src/snippets/code/src_corelib_codecs_qtextcodec.cpp 3
|
||||
|
||||
Note that this is not the way to select the encoding that the \e
|
||||
user has chosen. For example, to convert an application containing
|
||||
literal English strings to Korean, all that is needed is for the
|
||||
English strings to be passed through tr() and for translation
|
||||
files to be loaded. For details of internationalization, see
|
||||
\l{Internationalization with Qt}.
|
||||
|
||||
\sa codecForTr()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\since 4.4
|
||||
|
||||
|
@ -72,9 +72,6 @@ public:
|
||||
static QTextCodec* codecForLocale();
|
||||
static void setCodecForLocale(QTextCodec *c);
|
||||
|
||||
static QTextCodec* codecForTr();
|
||||
static void setCodecForTr(QTextCodec *c);
|
||||
|
||||
static QTextCodec *codecForHtml(const QByteArray &ba);
|
||||
static QTextCodec *codecForHtml(const QByteArray &ba, QTextCodec *defaultCodec);
|
||||
|
||||
@ -129,14 +126,10 @@ protected:
|
||||
|
||||
private:
|
||||
friend class QTextCodecCleanup;
|
||||
static QTextCodec *cftr;
|
||||
static bool validCodecs();
|
||||
};
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QTextCodec::ConversionFlags)
|
||||
|
||||
inline QTextCodec* QTextCodec::codecForTr() { return validCodecs() ? cftr : 0; }
|
||||
inline void QTextCodec::setCodecForTr(QTextCodec *c) { cftr = c; }
|
||||
|
||||
class Q_CORE_EXPORT QTextEncoder {
|
||||
Q_DISABLE_COPY(QTextEncoder)
|
||||
public:
|
||||
|
@ -2233,9 +2233,7 @@ int qrand()
|
||||
|
||||
The macro QT_TR_NOOP_UTF8() is identical except that it tells lupdate
|
||||
that the source string is encoded in UTF-8. Corresponding variants
|
||||
exist in the QT_TRANSLATE_NOOP() family of macros, too. Note that
|
||||
using these macros is not required if \c CODECFORTR is already set to
|
||||
UTF-8 in the qmake project file.
|
||||
exist in the QT_TRANSLATE_NOOP() family of macros, too.
|
||||
|
||||
\sa QT_TRANSLATE_NOOP(), {Internationalization with Qt}
|
||||
*/
|
||||
|
@ -226,7 +226,7 @@ static const struct {
|
||||
{ "Imports", "imports" },
|
||||
{ "Data", "" },
|
||||
{ "Translations", "translations" },
|
||||
{ "Examples", "" },
|
||||
{ "Examples", "examples" },
|
||||
{ "Tests", "tests" },
|
||||
#ifdef QT_BUILD_QMAKE
|
||||
{ "Sysroot", "" },
|
||||
|
@ -93,7 +93,7 @@
|
||||
|| defined(__ARM_ARCH_7A__) \
|
||||
|| defined(__ARM_ARCH_7R__) \
|
||||
|| defined(__ARM_ARCH_7M__) \
|
||||
|| (__TARGET_ARCH_ARM-0 >= 7)
|
||||
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7)
|
||||
# define Q_PROCESSOR_ARM_V7
|
||||
# define Q_PROCESSOR_ARM_V6
|
||||
# define Q_PROCESSOR_ARM_V5
|
||||
@ -104,11 +104,11 @@
|
||||
|| defined(__ARM_ARCH_6K__) \
|
||||
|| defined(__ARM_ARCH_6ZK__) \
|
||||
|| defined(__ARM_ARCH_6M__) \
|
||||
|| (__TARGET_ARCH_ARM-0 >= 6)
|
||||
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
|
||||
# define Q_PROCESSOR_ARM_V6
|
||||
# define Q_PROCESSOR_ARM_V5
|
||||
# elif defined(__ARM_ARCH_5TEJ__) \
|
||||
|| (__TARGET_ARCH_ARM-0 >= 5)
|
||||
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5)
|
||||
# define Q_PROCESSOR_ARM_V5
|
||||
# endif
|
||||
# if defined(__ARMEL__)
|
||||
|
@ -530,8 +530,6 @@ void QProcessPrivate::startProcess()
|
||||
notifier->start(NOTIFYTIMEOUT);
|
||||
}
|
||||
|
||||
// give the process a chance to start ...
|
||||
Sleep(SLEEPMIN * 2);
|
||||
_q_startupNotification();
|
||||
}
|
||||
|
||||
|
@ -584,9 +584,9 @@ static inline bool addHexDigit(char digit, uint *result)
|
||||
if (digit >= '0' && digit <= '9')
|
||||
*result |= (digit - '0');
|
||||
else if (digit >= 'a' && digit <= 'f')
|
||||
*result |= (digit - 'a');
|
||||
*result |= (digit - 'a') + 10;
|
||||
else if (digit >= 'A' && digit <= 'F')
|
||||
*result |= (digit - 'A');
|
||||
*result |= (digit - 'A') + 10;
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
|
@ -543,10 +543,6 @@ void QCoreApplication::init()
|
||||
Q_ASSERT_X(!self, "QCoreApplication", "there should be only one application object");
|
||||
QCoreApplication::self = this;
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
QThread::initialize();
|
||||
#endif
|
||||
|
||||
// use the event dispatcher created by the app programmer (if any)
|
||||
if (!QCoreApplicationPrivate::eventDispatcher)
|
||||
QCoreApplicationPrivate::eventDispatcher = d->threadData->eventDispatcher;
|
||||
@ -602,7 +598,6 @@ QCoreApplication::~QCoreApplication()
|
||||
}
|
||||
if (globalThreadPool)
|
||||
globalThreadPool->waitForDone();
|
||||
QThread::cleanup();
|
||||
#endif
|
||||
|
||||
d_func()->threadData->eventDispatcher = 0;
|
||||
@ -1438,11 +1433,9 @@ bool QCoreApplication::event(QEvent *e)
|
||||
This enum type defines the 8-bit encoding of character string
|
||||
arguments to translate():
|
||||
|
||||
\value CodecForTr The encoding specified by
|
||||
QTextCodec::codecForTr() (Latin-1 if none has
|
||||
been set).
|
||||
\value UnicodeUTF8 UTF-8.
|
||||
\value DefaultCodec (Obsolete) Use CodecForTr instead.
|
||||
\value Latin1 Latin-1.
|
||||
\value DefaultCodec Latin-1.
|
||||
|
||||
\sa QObject::tr(), QObject::trUtf8(), QString::fromUtf8()
|
||||
*/
|
||||
@ -1617,7 +1610,7 @@ static void replacePercentN(QString *result, int n)
|
||||
If none of the translation files contain a translation for \a
|
||||
sourceText in \a context, this function returns a QString
|
||||
equivalent of \a sourceText. The encoding of \a sourceText is
|
||||
specified by \e encoding; it defaults to CodecForTr.
|
||||
specified by \e encoding; it defaults to DefaultCodec.
|
||||
|
||||
This function is not virtual. You can use alternative translation
|
||||
techniques by subclassing \l QTranslator.
|
||||
@ -1628,7 +1621,7 @@ static void replacePercentN(QString *result, int n)
|
||||
so will most likely result in crashes or other undesirable
|
||||
behavior.
|
||||
|
||||
\sa QObject::tr() installTranslator() QTextCodec::codecForTr()
|
||||
\sa QObject::tr() installTranslator()
|
||||
*/
|
||||
|
||||
|
||||
@ -1657,8 +1650,6 @@ QString QCoreApplication::translate(const char *context, const char *sourceText,
|
||||
#else
|
||||
if (encoding == UnicodeUTF8)
|
||||
result = QString::fromUtf8(sourceText);
|
||||
else if (QTextCodec::codecForTr() != 0)
|
||||
result = QTextCodec::codecForTr()->toUnicode(sourceText);
|
||||
else
|
||||
#endif
|
||||
result = QString::fromLatin1(sourceText);
|
||||
|
@ -137,11 +137,11 @@ public:
|
||||
static void installTranslator(QTranslator * messageFile);
|
||||
static void removeTranslator(QTranslator * messageFile);
|
||||
#endif
|
||||
enum Encoding { CodecForTr, UnicodeUTF8, DefaultCodec = CodecForTr };
|
||||
enum Encoding { UnicodeUTF8, Latin1, DefaultCodec = Latin1 };
|
||||
static QString translate(const char * context,
|
||||
const char * key,
|
||||
const char * disambiguation = 0,
|
||||
Encoding encoding = CodecForTr,
|
||||
Encoding encoding = DefaultCodec,
|
||||
int n = -1);
|
||||
|
||||
static void flush();
|
||||
@ -240,7 +240,7 @@ inline QString QCoreApplication::translate(const char *, const char *sourceText,
|
||||
public: \
|
||||
static inline QString tr(const char *sourceText, const char *disambiguation = 0, int n = -1) \
|
||||
{ return QCoreApplication::translate(#context, sourceText, disambiguation, \
|
||||
QCoreApplication::CodecForTr, n); } \
|
||||
QCoreApplication::DefaultCodec, n); } \
|
||||
static inline QString trUtf8(const char *sourceText, const char *disambiguation = 0, int n = -1) \
|
||||
{ return QCoreApplication::translate(#context, sourceText, disambiguation, \
|
||||
QCoreApplication::UnicodeUTF8, n); } \
|
||||
|
@ -127,7 +127,6 @@ public:
|
||||
DeactivateControl = 81, // ActiveX deactivation
|
||||
ContextMenu = 82, // context popup menu
|
||||
InputMethod = 83, // input method
|
||||
AccessibilityPrepare = 86, // accessibility information is requested
|
||||
TabletMove = 87, // Wacom tablet event
|
||||
LocaleChange = 88, // the system locale changed
|
||||
LanguageChange = 89, // the application language changed
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "qeventdispatcher_glib_p.h"
|
||||
#include "qeventdispatcher_unix_p.h"
|
||||
|
||||
#include <private/qmutexpool_p.h>
|
||||
#include <private/qthread_p.h>
|
||||
|
||||
#include "qcoreapplication.h"
|
||||
@ -295,8 +294,8 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
|
||||
: mainContext(context)
|
||||
{
|
||||
if (qgetenv("QT_NO_THREADED_GLIB").isEmpty()) {
|
||||
static int dummyValue = 0; // only used for its address
|
||||
QMutexLocker locker(QMutexPool::instance()->get(&dummyValue));
|
||||
static QBasicMutex mutex;
|
||||
QMutexLocker locker(&mutex);
|
||||
if (!g_thread_supported())
|
||||
g_thread_init(NULL);
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ const QObject *QMetaObject::cast(const QObject *obj) const
|
||||
*/
|
||||
QString QMetaObject::tr(const char *s, const char *c, int n) const
|
||||
{
|
||||
return QCoreApplication::translate(d.stringdata, s, c, QCoreApplication::CodecForTr, n);
|
||||
return QCoreApplication::translate(d.stringdata, s, c, QCoreApplication::DefaultCodec, n);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -456,7 +456,7 @@ static int qMetaTypeCustomType_unlocked(const char *typeName, int length)
|
||||
int QMetaType::registerType(const char *typeName, Deleter deleter,
|
||||
Creator creator)
|
||||
{
|
||||
return registerType(typeName, deleter, creator, 0, 0, 0, TypeFlags());
|
||||
return registerType(typeName, deleter, creator, qMetaTypeDestructHelper<void>, qMetaTypeConstructHelper<void>, 0, TypeFlags());
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
@ -474,7 +474,7 @@ int QMetaType::registerType(const char *typeName, Deleter deleter,
|
||||
int size, TypeFlags flags)
|
||||
{
|
||||
QVector<QCustomTypeInfo> *ct = customTypes();
|
||||
if (!ct || !typeName || !deleter || !creator)
|
||||
if (!ct || !typeName || !deleter || !creator || !destructor || !constructor)
|
||||
return -1;
|
||||
|
||||
#ifdef QT_NO_QOBJECT
|
||||
@ -1331,6 +1331,7 @@ private:
|
||||
return;
|
||||
deleter = ct->at(type - QMetaType::User).deleter;
|
||||
}
|
||||
Q_ASSERT_X(deleter, "void QMetaType::destroy(int type, void *data)", "The type was not properly registered");
|
||||
deleter(where);
|
||||
}
|
||||
|
||||
@ -1393,6 +1394,7 @@ private:
|
||||
return 0;
|
||||
ctor = ct->at(type - QMetaType::User).constructor;
|
||||
}
|
||||
Q_ASSERT_X(ctor, "void *QMetaType::construct(int type, void *where, const void *copy)", "The type was not properly registered");
|
||||
return ctor(where, copy);
|
||||
}
|
||||
|
||||
@ -1481,6 +1483,7 @@ private:
|
||||
return;
|
||||
dtor = ct->at(type - QMetaType::User).destructor;
|
||||
}
|
||||
Q_ASSERT_X(dtor, "void QMetaType::destruct(int type, void *where)", "The type was not properly registered");
|
||||
dtor(where);
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ public:
|
||||
static bool load(QDataStream &stream, int type, void *data);
|
||||
#endif
|
||||
|
||||
QMetaType(const int type);
|
||||
explicit QMetaType(const int type);
|
||||
inline ~QMetaType();
|
||||
|
||||
inline bool isValid() const;
|
||||
@ -494,6 +494,7 @@ inline int qMetaTypeId(
|
||||
#endif
|
||||
)
|
||||
{
|
||||
Q_STATIC_ASSERT_X(QMetaTypeId2<T>::Defined, "Type is not registered, please use Q_DECLARE_METATYPE macro to make it know to Qt's meta-object system");
|
||||
return QMetaTypeId2<T>::qt_metatype_id();
|
||||
}
|
||||
|
||||
|
@ -1859,7 +1859,7 @@ void QObject::deleteLater()
|
||||
translators while performing translations is not supported. Doing
|
||||
so will probably result in crashes or other undesirable behavior.
|
||||
|
||||
\sa trUtf8(), QApplication::translate(), QTextCodec::setCodecForTr(), {Internationalization with Qt}
|
||||
\sa trUtf8(), QApplication::translate(), {Internationalization with Qt}
|
||||
*/
|
||||
|
||||
/*!
|
||||
@ -1871,11 +1871,6 @@ void QObject::deleteLater()
|
||||
version. It is otherwise identical to tr(\a sourceText, \a
|
||||
disambiguation, \a n).
|
||||
|
||||
Note that using the Utf8 variants of the translation functions
|
||||
is not required if \c CODECFORTR is already set to UTF-8 in the
|
||||
qmake project file and QTextCodec::setCodecForTr("UTF-8") is
|
||||
used.
|
||||
|
||||
\warning This method is reentrant only if all translators are
|
||||
installed \e before calling this method. Installing or removing
|
||||
translators while performing translations is not supported. Doing
|
||||
|
@ -283,6 +283,8 @@ QMimeType QMimeBinaryProvider::mimeTypeForName(const QString &name)
|
||||
QStringList QMimeBinaryProvider::findByFileName(const QString &fileName, QString *foundSuffix)
|
||||
{
|
||||
checkCache();
|
||||
if (fileName.isEmpty())
|
||||
return QStringList();
|
||||
const QString lowerFileName = fileName.toLower();
|
||||
QMimeGlobMatchResult result;
|
||||
// TODO this parses in the order (local, global). Check that it handles "NOGLOBS" correctly.
|
||||
|
@ -128,6 +128,7 @@ void QFactoryLoader::update()
|
||||
QLibraryPrivate *library = 0;
|
||||
for (int j = 0; j < plugins.count(); ++j) {
|
||||
QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j));
|
||||
|
||||
if (qt_debug_component()) {
|
||||
qDebug() << "QFactoryLoader::QFactoryLoader() looking at" << fileName;
|
||||
}
|
||||
@ -140,7 +141,9 @@ void QFactoryLoader::update()
|
||||
library->release();
|
||||
continue;
|
||||
}
|
||||
|
||||
QStringList keys;
|
||||
bool metaDataOk = false;
|
||||
if (library->compatPlugin) {
|
||||
qWarning("Qt plugin loader: Compatibility plugin '%s', need to load for accessing meta data.",
|
||||
qPrintable(QDir::toNativeSeparators(fileName)));
|
||||
@ -164,10 +167,17 @@ void QFactoryLoader::update()
|
||||
QFactoryInterface *factory = qobject_cast<QFactoryInterface*>(instance);
|
||||
if (instance && factory && instance->qt_metacast(d->iid))
|
||||
keys = factory->keys();
|
||||
|
||||
if (!keys.isEmpty())
|
||||
metaDataOk = true;
|
||||
|
||||
} else {
|
||||
QString iid = library->metaData.value(QLatin1String("IID")).toString();
|
||||
if (iid == QLatin1String(d->iid.constData(), d->iid.size())) {
|
||||
QJsonObject object = library->metaData.value(QLatin1String("MetaData")).toObject();
|
||||
if (!object.isEmpty())
|
||||
metaDataOk = true;
|
||||
|
||||
QJsonArray k = object.value(QLatin1String("Keys")).toArray();
|
||||
for (int i = 0; i < k.size(); ++i) {
|
||||
QString s = k.at(i).toString();
|
||||
@ -178,11 +188,12 @@ void QFactoryLoader::update()
|
||||
qDebug() << "Got keys from plugin meta data" << keys;
|
||||
}
|
||||
|
||||
if (keys.isEmpty()) {
|
||||
if (!metaDataOk) {
|
||||
library->unload();
|
||||
library->release();
|
||||
continue;
|
||||
}
|
||||
|
||||
d->libraryList += library;
|
||||
for (int k = 0; k < keys.count(); ++k) {
|
||||
// first come first serve, unless the first
|
||||
|
@ -46,9 +46,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// qt_global_mutexpool is here for backwards compatibility only,
|
||||
// use QMutexpool::instance() in new clode.
|
||||
Q_CORE_EXPORT QMutexPool *qt_global_mutexpool = 0;
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QMutexPool, globalMutexPool, (QMutex::Recursive))
|
||||
|
||||
/*!
|
||||
|
@ -84,8 +84,6 @@ private:
|
||||
QMutex::RecursionMode recursionMode;
|
||||
};
|
||||
|
||||
extern Q_CORE_EXPORT QMutexPool *qt_global_mutexpool;
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "qthread.h"
|
||||
#include "qthreadstorage.h"
|
||||
#include "qmutex.h"
|
||||
#include "qmutexpool_p.h"
|
||||
#include "qreadwritelock.h"
|
||||
#include "qabstracteventdispatcher.h"
|
||||
|
||||
@ -537,33 +536,6 @@ void QThread::run()
|
||||
(void) exec();
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
Initializes the QThread system.
|
||||
*/
|
||||
#if defined (Q_OS_WIN)
|
||||
void qt_create_tls();
|
||||
#endif
|
||||
|
||||
void QThread::initialize()
|
||||
{
|
||||
if (qt_global_mutexpool)
|
||||
return;
|
||||
qt_global_mutexpool = QMutexPool::instance();
|
||||
|
||||
#if defined (Q_OS_WIN)
|
||||
qt_create_tls();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*! \internal
|
||||
Cleans up the QThread system.
|
||||
*/
|
||||
void QThread::cleanup()
|
||||
{
|
||||
qt_global_mutexpool = 0;
|
||||
}
|
||||
|
||||
/*! \fn void QThread::setPriority(Priority priority)
|
||||
\since 4.1
|
||||
|
||||
|
@ -128,9 +128,6 @@ private:
|
||||
Q_OBJECT
|
||||
Q_DECLARE_PRIVATE(QThread)
|
||||
|
||||
static void initialize();
|
||||
static void cleanup();
|
||||
|
||||
friend class QCoreApplication;
|
||||
friend class QThreadData;
|
||||
};
|
||||
|
@ -287,7 +287,7 @@ void *QThreadPrivate::start(void *arg)
|
||||
else
|
||||
createEventDispatcher(data);
|
||||
|
||||
#if !defined(QT_NO_DEBUG) && (defined(Q_OS_LINUX) || defined(Q_OS_MAC))
|
||||
#if (defined(Q_OS_LINUX) || defined(Q_OS_MAC))
|
||||
// sets the name of the current thread.
|
||||
QByteArray objectName = thr->objectName().toLocal8Bit();
|
||||
|
||||
|
@ -307,31 +307,6 @@ bool QThreadPoolPrivate::waitForDone(int msecs)
|
||||
return queue.isEmpty() && activeThreads == 0;
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
Pulls a runnable from the front queue and runs it in the current thread. Blocks
|
||||
until the runnable has completed. Returns true if a runnable was found.
|
||||
*/
|
||||
bool QThreadPoolPrivate::startFrontRunnable()
|
||||
{
|
||||
QMutexLocker locker(&mutex);
|
||||
if (queue.isEmpty())
|
||||
return false;
|
||||
|
||||
QRunnable *runnable = queue.takeFirst().first;
|
||||
const bool autoDelete = runnable->autoDelete();
|
||||
bool del = autoDelete && !--runnable->ref;
|
||||
|
||||
locker.unlock();
|
||||
runnable->run();
|
||||
locker.relock();
|
||||
|
||||
if (del) {
|
||||
delete runnable;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
Seaches for \a runnable in the queue, removes it from the queue and
|
||||
runs it if found. This functon does not return until the runnable
|
||||
|
@ -83,7 +83,6 @@ public:
|
||||
void startThread(QRunnable *runnable = 0);
|
||||
void reset();
|
||||
bool waitForDone(int msecs = -1);
|
||||
bool startFrontRunnable();
|
||||
void stealRunnable(QRunnable *);
|
||||
|
||||
mutable QMutex mutex;
|
||||
|
@ -48,23 +48,16 @@
|
||||
#include "../../3rdparty/sha1/sha1.cpp"
|
||||
|
||||
/*
|
||||
These typedefs are needed by the RFC6234 code. Normally they would come
|
||||
from from stdint.h, but since this header is not available on all platforms
|
||||
(MSVC 2008, for example), we need to define them ourselves.
|
||||
These #defines replace the typedefs needed by the RFC6234 code. Normally
|
||||
the typedefs would come from from stdint.h, but since this header is not
|
||||
available on all platforms (MSVC 2008, for example), we #define them to the
|
||||
Qt equivalents.
|
||||
*/
|
||||
#ifndef _UINT64_T_DECLARED
|
||||
typedef QT_PREPEND_NAMESPACE(quint64) uint64_t;
|
||||
#endif
|
||||
#define uint64_t QT_PREPEND_NAMESPACE(quint64)
|
||||
#define uint32_t QT_PREPEND_NAMESPACE(quint32)
|
||||
#define uint8_t QT_PREPEND_NAMESPACE(quint8)
|
||||
#define int_least16_t QT_PREPEND_NAMESPACE(qint16)
|
||||
|
||||
#ifndef _UINT32_T_DECLARED
|
||||
typedef QT_PREPEND_NAMESPACE(quint32) uint32_t;
|
||||
#endif
|
||||
|
||||
#ifndef _UINT8_T_DECLARED
|
||||
typedef QT_PREPEND_NAMESPACE(quint8) uint8_t;
|
||||
#endif
|
||||
|
||||
typedef QT_PREPEND_NAMESPACE(qint16) int_least16_t;
|
||||
// Header from rfc6234 with 1 modification:
|
||||
// sha1.h - commented out '#include <stdint.h>' on line 74
|
||||
#include "../../3rdparty/rfc6234/sha.h"
|
||||
@ -90,16 +83,21 @@ static int SHA384_512AddLength(SHA512Context *context, unsigned int length);
|
||||
// sha384-512.c - appended 'M' to the SHA224_256AddLength macro on line 304
|
||||
#include "../../3rdparty/rfc6234/sha384-512.c"
|
||||
|
||||
#undef uint64_t
|
||||
#undef uint32_t
|
||||
#undef uint68_t
|
||||
#undef int_least16_t
|
||||
|
||||
#include <qiodevice.h>
|
||||
|
||||
static inline int SHA224_256AddLength(SHA256Context *context, unsigned int length)
|
||||
{
|
||||
uint32_t addTemp;
|
||||
QT_PREPEND_NAMESPACE(quint32) addTemp;
|
||||
return SHA224_256AddLengthM(context, length);
|
||||
}
|
||||
static inline int SHA384_512AddLength(SHA512Context *context, unsigned int length)
|
||||
{
|
||||
uint64_t addTemp;
|
||||
QT_PREPEND_NAMESPACE(quint64) addTemp;
|
||||
return SHA384_512AddLengthM(context, length);
|
||||
}
|
||||
|
||||
|
@ -3511,7 +3511,10 @@ void QDateTime::detach()
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const QDate &date)
|
||||
{
|
||||
return out << (qint64)(date.jd);
|
||||
if (out.version() < QDataStream::Qt_5_0)
|
||||
return out << quint32(date.jd);
|
||||
else
|
||||
return out << qint64(date.jd);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -3524,9 +3527,16 @@ QDataStream &operator<<(QDataStream &out, const QDate &date)
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, QDate &date)
|
||||
{
|
||||
if (in.version() < QDataStream::Qt_5_0) {
|
||||
quint32 jd;
|
||||
in >> jd;
|
||||
date.jd = jd;
|
||||
} else {
|
||||
qint64 jd;
|
||||
in >> jd;
|
||||
date.jd = jd;
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,12 @@ HB_Bool qShapeItem(HB_ShaperItem *item)
|
||||
|
||||
HB_Face qHBNewFace(void *font, HB_GetFontTableFunc tableFunc)
|
||||
{
|
||||
return HB_NewFace(font, tableFunc);
|
||||
return HB_AllocFace(font, tableFunc);
|
||||
}
|
||||
|
||||
HB_Face qHBLoadFace(HB_Face face)
|
||||
{
|
||||
return HB_LoadFace(face);
|
||||
}
|
||||
|
||||
void qHBFreeFace(HB_Face face)
|
||||
|
@ -68,6 +68,7 @@ Q_CORE_EXPORT HB_Bool qShapeItem(HB_ShaperItem *item);
|
||||
// ### temporary
|
||||
Q_CORE_EXPORT HB_Face qHBNewFace(void *font, HB_GetFontTableFunc tableFunc);
|
||||
Q_CORE_EXPORT void qHBFreeFace(HB_Face);
|
||||
Q_CORE_EXPORT HB_Face qHBLoadFace(HB_Face face);
|
||||
|
||||
Q_DECLARE_TYPEINFO(HB_GlyphAttributes, Q_PRIMITIVE_TYPE);
|
||||
Q_DECLARE_TYPEINFO(HB_FixedPoint, Q_PRIMITIVE_TYPE);
|
||||
|
2134
src/corelib/tools/qregularexpression.cpp
Normal file
2134
src/corelib/tools/qregularexpression.cpp
Normal file
File diff suppressed because it is too large
Load Diff
248
src/corelib/tools/qregularexpression.h
Normal file
248
src/corelib/tools/qregularexpression.h
Normal file
@ -0,0 +1,248 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Giuseppe D'Angelo <dangelog@gmail.com>.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QREGULAREXPRESSION_H
|
||||
#define QREGULAREXPRESSION_H
|
||||
|
||||
#ifndef QT_NO_REGEXP
|
||||
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qshareddata.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QRegularExpressionMatch;
|
||||
class QRegularExpressionMatchIterator;
|
||||
struct QRegularExpressionPrivate;
|
||||
|
||||
class Q_CORE_EXPORT QRegularExpression
|
||||
{
|
||||
public:
|
||||
enum PatternOption {
|
||||
NoPatternOption = 0x0000,
|
||||
CaseInsensitiveOption = 0x0001,
|
||||
DotMatchesEverythingOption = 0x0002,
|
||||
MultilineOption = 0x0004,
|
||||
ExtendedPatternSyntaxOption = 0x0008,
|
||||
InvertedGreedinessOption = 0x0010,
|
||||
DontCaptureOption = 0x0020,
|
||||
UseUnicodePropertiesOption = 0x0040
|
||||
};
|
||||
Q_DECLARE_FLAGS(PatternOptions, PatternOption)
|
||||
|
||||
PatternOptions patternOptions() const;
|
||||
void setPatternOptions(PatternOptions options);
|
||||
|
||||
QRegularExpression();
|
||||
explicit QRegularExpression(const QString &pattern, PatternOptions options = NoPatternOption);
|
||||
QRegularExpression(const QRegularExpression &re);
|
||||
~QRegularExpression();
|
||||
QRegularExpression &operator=(const QRegularExpression &re);
|
||||
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
inline QRegularExpression &operator=(QRegularExpression &&re)
|
||||
{ d.swap(re.d); return *this; }
|
||||
#endif
|
||||
|
||||
inline void swap(QRegularExpression &re) { d.swap(re.d); }
|
||||
|
||||
QString pattern() const;
|
||||
void setPattern(const QString &pattern);
|
||||
|
||||
bool isValid() const;
|
||||
int patternErrorOffset() const;
|
||||
QString errorString() const;
|
||||
|
||||
int captureCount() const;
|
||||
|
||||
enum MatchType {
|
||||
NormalMatch = 0,
|
||||
PartialPreferCompleteMatch,
|
||||
PartialPreferFirstMatch
|
||||
};
|
||||
|
||||
enum MatchOption {
|
||||
NoMatchOption = 0x0000,
|
||||
AnchoredMatchOption = 0x0001
|
||||
};
|
||||
Q_DECLARE_FLAGS(MatchOptions, MatchOption)
|
||||
|
||||
QRegularExpressionMatch match(const QString &subject,
|
||||
int offset = 0,
|
||||
MatchType matchType = NormalMatch,
|
||||
MatchOptions matchOptions = NoMatchOption) const;
|
||||
|
||||
QRegularExpressionMatchIterator globalMatch(const QString &subject,
|
||||
int offset = 0,
|
||||
MatchType matchType = NormalMatch,
|
||||
MatchOptions matchOptions = NoMatchOption) const;
|
||||
|
||||
static QString escape(const QString &str);
|
||||
|
||||
bool operator==(const QRegularExpression &re) const;
|
||||
inline bool operator!=(const QRegularExpression &re) const { return !operator==(re); }
|
||||
|
||||
private:
|
||||
friend struct QRegularExpressionPrivate;
|
||||
friend class QRegularExpressionMatch;
|
||||
friend struct QRegularExpressionMatchPrivate;
|
||||
friend class QRegularExpressionMatchIterator;
|
||||
|
||||
QRegularExpression(QRegularExpressionPrivate &dd);
|
||||
QExplicitlySharedDataPointer<QRegularExpressionPrivate> d;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QRegularExpression::PatternOptions)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QRegularExpression::MatchOptions)
|
||||
Q_DECLARE_TYPEINFO(QRegularExpression, Q_MOVABLE_TYPE);
|
||||
|
||||
#ifndef QT_NO_DATASTREAM
|
||||
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const QRegularExpression &re);
|
||||
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, QRegularExpression &re);
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QRegularExpression &re);
|
||||
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QRegularExpression::PatternOptions patternOptions);
|
||||
#endif
|
||||
|
||||
struct QRegularExpressionMatchPrivate;
|
||||
|
||||
class Q_CORE_EXPORT QRegularExpressionMatch
|
||||
{
|
||||
public:
|
||||
~QRegularExpressionMatch();
|
||||
QRegularExpressionMatch(const QRegularExpressionMatch &match);
|
||||
QRegularExpressionMatch &operator=(const QRegularExpressionMatch &match);
|
||||
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
inline QRegularExpressionMatch &operator=(QRegularExpressionMatch &&match)
|
||||
{ d.swap(match.d); return *this; }
|
||||
#endif
|
||||
inline void swap(QRegularExpressionMatch &match) { d.swap(match.d); }
|
||||
|
||||
QRegularExpression regularExpression() const;
|
||||
QRegularExpression::MatchType matchType() const;
|
||||
QRegularExpression::MatchOptions matchOptions() const;
|
||||
|
||||
bool hasMatch() const;
|
||||
bool hasPartialMatch() const;
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
int lastCapturedIndex() const;
|
||||
|
||||
QString captured(int nth = 0) const;
|
||||
QStringRef capturedRef(int nth = 0) const;
|
||||
|
||||
QString captured(const QString &name) const;
|
||||
QStringRef capturedRef(const QString &name) const;
|
||||
|
||||
QStringList capturedTexts() const;
|
||||
|
||||
int capturedStart(int nth = 0) const;
|
||||
int capturedLength(int nth = 0) const;
|
||||
int capturedEnd(int nth = 0) const;
|
||||
|
||||
int capturedStart(const QString &name) const;
|
||||
int capturedLength(const QString &name) const;
|
||||
int capturedEnd(const QString &name) const;
|
||||
|
||||
private:
|
||||
friend class QRegularExpression;
|
||||
friend struct QRegularExpressionMatchPrivate;
|
||||
friend class QRegularExpressionMatchIterator;
|
||||
|
||||
QRegularExpressionMatch(QRegularExpressionMatchPrivate &dd);
|
||||
QSharedDataPointer<QRegularExpressionMatchPrivate> d;
|
||||
};
|
||||
|
||||
Q_DECLARE_TYPEINFO(QRegularExpressionMatch, Q_MOVABLE_TYPE);
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QRegularExpressionMatch &match);
|
||||
#endif
|
||||
|
||||
struct QRegularExpressionMatchIteratorPrivate;
|
||||
|
||||
class Q_CORE_EXPORT QRegularExpressionMatchIterator
|
||||
{
|
||||
public:
|
||||
~QRegularExpressionMatchIterator();
|
||||
QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator &iterator);
|
||||
QRegularExpressionMatchIterator &operator=(const QRegularExpressionMatchIterator &iterator);
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
inline QRegularExpressionMatchIterator &operator=(QRegularExpressionMatchIterator &&iterator)
|
||||
{ d.swap(iterator.d); return *this; }
|
||||
#endif
|
||||
void swap(QRegularExpressionMatchIterator &iterator) { d.swap(iterator.d); }
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
bool hasNext() const;
|
||||
QRegularExpressionMatch next();
|
||||
QRegularExpressionMatch peekNext() const;
|
||||
|
||||
QRegularExpression regularExpression() const;
|
||||
QRegularExpression::MatchType matchType() const;
|
||||
QRegularExpression::MatchOptions matchOptions() const;
|
||||
|
||||
private:
|
||||
friend class QRegularExpression;
|
||||
|
||||
QRegularExpressionMatchIterator(QRegularExpressionMatchIteratorPrivate &dd);
|
||||
QSharedDataPointer<QRegularExpressionMatchIteratorPrivate> d;
|
||||
};
|
||||
|
||||
Q_DECLARE_TYPEINFO(QRegularExpressionMatchIterator, Q_MOVABLE_TYPE);
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
Q_DECLARE_METATYPE(QRegularExpression)
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QT_NO_REGEXP
|
||||
|
||||
#endif // QREGULAREXPRESSION_H
|
@ -98,7 +98,9 @@ template<int N> struct QConstStringData
|
||||
|
||||
#define QT_UNICODE_LITERAL_II(str) u"" str
|
||||
|
||||
#elif defined(Q_OS_WIN) || (defined(__SIZEOF_WCHAR_T__) && __SIZEOF_WCHAR_T__ == 2) || defined(WCHAR_MAX) && (WCHAR_MAX - 0 < 65536)
|
||||
#elif defined(Q_OS_WIN) \
|
||||
|| (defined(__SIZEOF_WCHAR_T__) && __SIZEOF_WCHAR_T__ == 2) \
|
||||
|| (!defined(__SIZEOF_WCHAR_T__) && defined(WCHAR_MAX) && (WCHAR_MAX - 0 < 65536))
|
||||
// wchar_t is 2 bytes
|
||||
template<int N> struct QConstStringData
|
||||
{
|
||||
|
@ -30,6 +30,7 @@ HEADERS += \
|
||||
tools/qqueue.h \
|
||||
tools/qrect.h \
|
||||
tools/qregexp.h \
|
||||
tools/qregularexpression.h \
|
||||
tools/qringbuffer_p.h \
|
||||
tools/qrefcount.h \
|
||||
tools/qscopedpointer.h \
|
||||
@ -75,6 +76,7 @@ SOURCES += \
|
||||
tools/qcontiguouscache.cpp \
|
||||
tools/qrect.cpp \
|
||||
tools/qregexp.cpp \
|
||||
tools/qregularexpression.cpp \
|
||||
tools/qrefcount.cpp \
|
||||
tools/qshareddata.cpp \
|
||||
tools/qsharedpointer.cpp \
|
||||
@ -105,6 +107,12 @@ contains(QT_CONFIG,icu) {
|
||||
DEFINES += QT_USE_ICU
|
||||
}
|
||||
|
||||
pcre {
|
||||
include($$PWD/../../3rdparty/pcre.pri)
|
||||
} else {
|
||||
LIBS_PRIVATE += -lpcre16
|
||||
}
|
||||
|
||||
DEFINES += HB_EXPORT=Q_CORE_EXPORT
|
||||
INCLUDEPATH += ../3rdparty/harfbuzz/src
|
||||
HEADERS += ../3rdparty/harfbuzz/src/harfbuzz.h
|
||||
|
@ -571,10 +571,6 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
|
||||
if (!object)
|
||||
return 0;
|
||||
|
||||
QEvent e(QEvent::AccessibilityPrepare);
|
||||
|
||||
QCoreApplication::sendEvent(object, &e);
|
||||
|
||||
const QMetaObject *mo = object->metaObject();
|
||||
while (mo) {
|
||||
const QLatin1String cn(mo->className());
|
||||
|
@ -185,10 +185,10 @@ QT_BEGIN_NAMESPACE
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QPoint QCursor::pos()
|
||||
\fn QPoint QCursor::pos(const QScreen *screen)
|
||||
|
||||
Returns the position of the cursor (hot spot) in global screen
|
||||
coordinates.
|
||||
Returns the position of the cursor (hot spot) of the \a screen
|
||||
in global screen coordinates.
|
||||
|
||||
You can call QWidget::mapFromGlobal() to translate it to widget
|
||||
coordinates.
|
||||
@ -197,10 +197,23 @@ QT_BEGIN_NAMESPACE
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QCursor::setPos(int x, int y)
|
||||
\fn QPoint QCursor::pos()
|
||||
|
||||
Moves the cursor (hot spot) to the global screen position (\a x,
|
||||
\a y).
|
||||
Returns the position of the cursor (hot spot) of
|
||||
the primary screen in global screen coordinates.
|
||||
|
||||
You can call QWidget::mapFromGlobal() to translate it to widget
|
||||
coordinates.
|
||||
|
||||
\sa setPos(), QWidget::mapFromGlobal(), QWidget::mapToGlobal(), QGuiApplication::primaryScreen()
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void QCursor::setPos(QScreen *screen, int x, int y)
|
||||
|
||||
Moves the cursor (hot spot) of the \a screen to the global
|
||||
screen position (\a x, \a y).
|
||||
|
||||
You can call QWidget::mapToGlobal() to translate widget
|
||||
coordinates to global screen coordinates.
|
||||
@ -208,6 +221,18 @@ QT_BEGIN_NAMESPACE
|
||||
\sa pos(), QWidget::mapFromGlobal(), QWidget::mapToGlobal()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QCursor::setPos(int x, int y)
|
||||
|
||||
Moves the cursor (hot spot) of the primary screen
|
||||
to the global screen position (\a x, \a y).
|
||||
|
||||
You can call QWidget::mapToGlobal() to translate widget
|
||||
coordinates to global screen coordinates.
|
||||
|
||||
\sa pos(), QWidget::mapFromGlobal(), QWidget::mapToGlobal(), QGuiApplication::primaryScreen()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QCursor::setPos (const QPoint &p)
|
||||
|
||||
@ -217,6 +242,15 @@ QT_BEGIN_NAMESPACE
|
||||
\a p.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QCursor::setPos (QScreen *screen,const QPoint &p)
|
||||
|
||||
\overload
|
||||
|
||||
Moves the cursor (hot spot) to the global screen position of the
|
||||
\a screen at point \a p.
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
QCursor stream functions
|
||||
*****************************************************************************/
|
||||
|
@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class QVariant;
|
||||
class QScreen;
|
||||
|
||||
/*
|
||||
### The fake cursor has to go first with old qdoc.
|
||||
@ -101,8 +102,11 @@ public:
|
||||
QPoint hotSpot() const;
|
||||
|
||||
static QPoint pos();
|
||||
static QPoint pos(const QScreen *screen);
|
||||
static void setPos(int x, int y);
|
||||
static void setPos(QScreen *screen, int x, int y);
|
||||
inline static void setPos(const QPoint &p) { setPos(p.x(), p.y()); }
|
||||
inline static void setPos(QScreen *screen, const QPoint &p) { setPos(screen, p.x(), p.y()); }
|
||||
|
||||
#ifdef qdoc
|
||||
HCURSOR_or_HANDLE handle() const;
|
||||
|
@ -40,6 +40,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <qcursor.h>
|
||||
#include <qscreen.h>
|
||||
#include <private/qcursor_p.h>
|
||||
#include <qplatformcursor_qpa.h>
|
||||
#include <private/qguiapplication_p.h>
|
||||
@ -110,27 +111,34 @@ void QCursorData::update()
|
||||
|
||||
QPoint QCursor::pos()
|
||||
{
|
||||
return QCursor::pos(QGuiApplication::primaryScreen());
|
||||
}
|
||||
|
||||
QPoint QCursor::pos(const QScreen *screen)
|
||||
{
|
||||
if (screen)
|
||||
if (const QPlatformCursor *cursor = screen->handle()->cursor())
|
||||
return cursor->pos();
|
||||
return QGuiApplicationPrivate::lastCursorPosition.toPoint();
|
||||
}
|
||||
|
||||
void QCursor::setPos(QScreen *screen, int x, int y)
|
||||
{
|
||||
if (screen) {
|
||||
if (QPlatformCursor *cursor = screen->handle()->cursor()) {
|
||||
const QPoint pos = QPoint(x, y);
|
||||
// Need to check, since some X servers generate null mouse move
|
||||
// events, causing looping in applications which call setPos() on
|
||||
// every mouse move event.
|
||||
if (pos != cursor->pos())
|
||||
cursor->setPos(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QCursor::setPos(int x, int y)
|
||||
{
|
||||
QPoint target(x, y);
|
||||
|
||||
// Need to check, since some X servers generate null mouse move
|
||||
// events, causing looping in applications which call setPos() on
|
||||
// every mouse move event.
|
||||
//
|
||||
if (pos() == target)
|
||||
return;
|
||||
|
||||
QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances();
|
||||
int cursorCount = cursors.count();
|
||||
for (int i = 0; i < cursorCount; ++i) {
|
||||
const QWeakPointer<QPlatformCursor> &cursor(cursors.at(i));
|
||||
if (cursor)
|
||||
cursor.data()->setPos(target);
|
||||
}
|
||||
QCursor::setPos(QGuiApplication::primaryScreen(), x, y);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -3863,11 +3863,16 @@ QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the raw, unfiltered positions for the touch point. The positions are in screen coordinates.
|
||||
Returns the raw, unfiltered positions for the touch point. The positions are in native screen coordinates.
|
||||
To get local coordinates you can use mapFromGlobal() of the QWindow returned by QTouchEvent::window().
|
||||
|
||||
\note Returns an empty list if the touch device's capabilities do not include QTouchDevice::RawPositions.
|
||||
|
||||
\note Native screen coordinates refer to the native orientation of the screen which, in case of
|
||||
mobile devices, is typically portrait. This means that on systems capable of screen orientation
|
||||
changes the positions in this list will not reflect the current orientation (unlike pos(),
|
||||
screenPos(), etc.) and will always be reported in the native orientation.
|
||||
|
||||
\sa QTouchDevice::capabilities(), device(), window()
|
||||
*/
|
||||
QList<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const
|
||||
|
@ -172,6 +172,11 @@ static inline void clearPalette()
|
||||
|
||||
static void initFontUnlocked()
|
||||
{
|
||||
if (!QGuiApplicationPrivate::app_font) {
|
||||
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
|
||||
if (const QFont *font = theme->font(QPlatformTheme::SystemFont))
|
||||
QGuiApplicationPrivate::app_font = new QFont(*font);
|
||||
}
|
||||
if (!QGuiApplicationPrivate::app_font)
|
||||
QGuiApplicationPrivate::app_font =
|
||||
new QFont(QGuiApplicationPrivate::platformIntegration()->fontDatabase()->defaultFont());
|
||||
@ -933,6 +938,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
|
||||
QPointF globalPoint = e->globalPos;
|
||||
|
||||
Qt::MouseButton button = Qt::NoButton;
|
||||
bool doubleClick = false;
|
||||
|
||||
if (QGuiApplicationPrivate::lastCursorPosition != globalPoint) {
|
||||
type = QEvent::MouseMove;
|
||||
@ -940,8 +946,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
|
||||
if (qAbs(globalPoint.x() - mousePressX) > mouse_double_click_distance||
|
||||
qAbs(globalPoint.y() - mousePressY) > mouse_double_click_distance)
|
||||
mousePressButton = Qt::NoButton;
|
||||
}
|
||||
else { // Check to see if a new button has been pressed/released.
|
||||
} else { // Check to see if a new button has been pressed/released.
|
||||
for (int check = Qt::LeftButton;
|
||||
check <= int(Qt::MaxMouseButton);
|
||||
check = check << 1) {
|
||||
@ -956,33 +961,26 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
|
||||
}
|
||||
buttons = e->buttons;
|
||||
if (button & e->buttons) {
|
||||
if ((e->timestamp - mousePressTime) < static_cast<ulong>(qApp->styleHints()->mouseDoubleClickInterval()) &&
|
||||
button == mousePressButton) {
|
||||
type = QEvent::MouseButtonDblClick;
|
||||
mousePressButton = Qt::NoButton;
|
||||
}
|
||||
else {
|
||||
ulong doubleClickInterval = static_cast<ulong>(qApp->styleHints()->mouseDoubleClickInterval());
|
||||
doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton;
|
||||
type = QEvent::MouseButtonPress;
|
||||
mousePressTime = e->timestamp;
|
||||
mousePressButton = button;
|
||||
const QPoint point = QGuiApplicationPrivate::lastCursorPosition.toPoint();
|
||||
mousePressX = point.x();
|
||||
mousePressY = point.y();
|
||||
}
|
||||
}
|
||||
else
|
||||
} else {
|
||||
type = QEvent::MouseButtonRelease;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (window) {
|
||||
QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, buttons, e->modifiers);
|
||||
ev.setTimestamp(e->timestamp);
|
||||
#ifndef QT_NO_CURSOR
|
||||
QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances();
|
||||
for (int i = 0; i < cursors.count(); ++i)
|
||||
if (cursors.at(i))
|
||||
cursors.at(i).data()->pointerEvent(ev);
|
||||
if (const QScreen *screen = window->screen())
|
||||
if (QPlatformCursor *cursor = screen->handle()->cursor())
|
||||
cursor->pointerEvent(ev);
|
||||
#endif
|
||||
QGuiApplication::sendSpontaneousEvent(window, &ev);
|
||||
if (!e->synthetic && !ev.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeTouchForUnhandledMouseEvents)) {
|
||||
@ -1017,11 +1015,15 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
|
||||
fake.synthetic = true;
|
||||
processTouchEvent(&fake);
|
||||
}
|
||||
if (doubleClick) {
|
||||
mousePressButton = Qt::NoButton;
|
||||
QMouseEvent dblClickEvent(QEvent::MouseButtonDblClick, localPoint, localPoint, globalPoint,
|
||||
button, buttons, e->modifiers);
|
||||
dblClickEvent.setTimestamp(e->timestamp);
|
||||
QGuiApplication::sendSpontaneousEvent(window, &dblClickEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//### there's a lot of duplicated logic here -- refactoring required!
|
||||
|
||||
void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e)
|
||||
{
|
||||
@ -1041,8 +1043,6 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Remember, Qt convention is: keyboard state is state *before*
|
||||
|
||||
void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e)
|
||||
@ -1813,16 +1813,11 @@ void QGuiApplication::changeOverrideCursor(const QCursor &cursor)
|
||||
|
||||
|
||||
#ifndef QT_NO_CURSOR
|
||||
static void applyCursor(QWindow *w, const QCursor &c)
|
||||
static inline void applyCursor(QWindow *w, QCursor c)
|
||||
{
|
||||
QCursor cc = c;
|
||||
QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances();
|
||||
int cursorCount = cursors.count();
|
||||
for (int i = 0; i < cursorCount; ++i) {
|
||||
const QWeakPointer<QPlatformCursor> &cursor(cursors.at(i));
|
||||
if (cursor)
|
||||
cursor.data()->changeCursor(&cc, w);
|
||||
}
|
||||
if (const QScreen *screen = w->screen())
|
||||
if (QPlatformCursor *cursor = screen->handle()->cursor())
|
||||
cursor->changeCursor(&c, w);
|
||||
}
|
||||
|
||||
static inline void applyCursor(const QList<QWindow *> &l, const QCursor &c)
|
||||
|
@ -43,13 +43,22 @@
|
||||
#include <QPainter>
|
||||
#include <QBitmap>
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
#include <QPlatformScreen>
|
||||
#include <private/qguiapplication_p.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QList <QWeakPointer<QPlatformCursor> > QPlatformCursorPrivate::instances;
|
||||
QList<QPlatformCursor *> QPlatformCursorPrivate::getInstances()
|
||||
{
|
||||
QList<QPlatformCursor *> result;
|
||||
foreach (const QScreen *screen, QGuiApplicationPrivate::screen_list)
|
||||
if (QPlatformCursor *cursor = screen->handle()->cursor())
|
||||
result.push_back(cursor);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QPlatformCursor
|
||||
@ -93,10 +102,8 @@ QList <QWeakPointer<QPlatformCursor> > QPlatformCursorPrivate::instances;
|
||||
|
||||
Constructs a QPlatformCursor for the given \a screen.
|
||||
*/
|
||||
QPlatformCursor::QPlatformCursor(QPlatformScreen *scr )
|
||||
: screen(scr)
|
||||
QPlatformCursor::QPlatformCursor()
|
||||
{
|
||||
QPlatformCursorPrivate::instances.append(this);
|
||||
}
|
||||
|
||||
QPoint QPlatformCursor::pos() const
|
||||
|
@ -74,13 +74,12 @@ class QPlatformCursor;
|
||||
|
||||
class Q_GUI_EXPORT QPlatformCursorPrivate {
|
||||
public:
|
||||
static QList<QWeakPointer<QPlatformCursor> > getInstances() { return instances; }
|
||||
static QList<QWeakPointer<QPlatformCursor> > instances;
|
||||
static QList<QPlatformCursor *> getInstances();
|
||||
};
|
||||
|
||||
class Q_GUI_EXPORT QPlatformCursor : public QObject {
|
||||
public:
|
||||
QPlatformCursor(QPlatformScreen *);
|
||||
QPlatformCursor();
|
||||
|
||||
// input methods
|
||||
virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); }
|
||||
@ -88,11 +87,8 @@ public:
|
||||
virtual QPoint pos() const;
|
||||
virtual void setPos(const QPoint &pos);
|
||||
|
||||
protected:
|
||||
QPlatformScreen* screen; // Where to request an update
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(QPlatformCursor);
|
||||
Q_DECLARE_PRIVATE(QPlatformCursor)
|
||||
friend void qt_qpa_set_cursor(QWidget * w, bool force);
|
||||
friend class QApplicationPrivate;
|
||||
};
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
#include "qplatformscreen_qpa.h"
|
||||
#include <QtGui/qguiapplication.h>
|
||||
#include <QtGui/qplatformcursor_qpa.h>
|
||||
#include <QtGui/private/qguiapplication_p.h>
|
||||
#include <QtGui/private/qplatformscreen_qpa_p.h>
|
||||
#include <QtGui/qplatformintegration_qpa.h>
|
||||
@ -250,4 +251,14 @@ QPlatformScreenPageFlipper *QPlatformScreen::pageFlipper() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Reimplement this function in subclass to return the cursor of the screen.
|
||||
|
||||
The default implementation returns 0.
|
||||
*/
|
||||
QPlatformCursor *QPlatformScreen::cursor() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -63,6 +63,7 @@ class QPlatformBackingStore;
|
||||
class QPlatformOpenGLContext;
|
||||
class QPlatformScreenPrivate;
|
||||
class QPlatformWindow;
|
||||
class QPlatformCursor;
|
||||
class QPlatformScreenPageFlipper;
|
||||
class QScreen;
|
||||
class QSurfaceFormat;
|
||||
@ -103,6 +104,7 @@ public:
|
||||
virtual QString name() const { return QString(); }
|
||||
|
||||
virtual QPlatformScreenPageFlipper *pageFlipper() const;
|
||||
virtual QPlatformCursor *cursor() const;
|
||||
|
||||
protected:
|
||||
QScopedPointer<QPlatformScreenPrivate> d_ptr;
|
||||
|
@ -137,6 +137,12 @@ const QPalette *QPlatformTheme::palette(Palette type) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QFont *QPlatformTheme::font(Font type) const
|
||||
{
|
||||
Q_UNUSED(type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
QVariant QPlatformTheme::themeHint(ThemeHint hint) const
|
||||
{
|
||||
switch (hint) {
|
||||
|
@ -55,6 +55,7 @@ class QPlatformMenuBar;
|
||||
class QPlatformDialogHelper;
|
||||
class QVariant;
|
||||
class QPalette;
|
||||
class QFont;
|
||||
|
||||
class Q_GUI_EXPORT QPlatformTheme
|
||||
{
|
||||
@ -86,9 +87,47 @@ public:
|
||||
enum Palette {
|
||||
SystemPalette,
|
||||
ToolTipPalette,
|
||||
ToolButtonPalette,
|
||||
ButtonPalette,
|
||||
HeaderPalette,
|
||||
ComboBoxPalette,
|
||||
ItemViewPalette,
|
||||
MessageBoxLabelPelette,
|
||||
TabBarPalette,
|
||||
LabelPalette,
|
||||
GroupBoxPalette,
|
||||
MenuPalette,
|
||||
MenuBarPalette,
|
||||
TextEditPalette,
|
||||
TextLineEditPalette,
|
||||
NPalettes
|
||||
};
|
||||
|
||||
enum Font {
|
||||
SystemFont,
|
||||
MenuFont,
|
||||
MenuBarFont,
|
||||
MenuItemFont,
|
||||
MessageBoxFont,
|
||||
LabelFont,
|
||||
TipLabelFont,
|
||||
StatusBarFont,
|
||||
TitleBarFont,
|
||||
MdiSubWindowTitleFont,
|
||||
DockWidgetTitleFont,
|
||||
PushButtonFont,
|
||||
ToolButtonFont,
|
||||
ItemViewFont,
|
||||
ListViewFont,
|
||||
HeaderViewFont,
|
||||
ListBoxFont,
|
||||
ComboMenuItemFont,
|
||||
ComboLineEditFont,
|
||||
SmallFont,
|
||||
MiniFont,
|
||||
NFonts
|
||||
};
|
||||
|
||||
enum KeyboardSchemes
|
||||
{
|
||||
WindowsKeyboardScheme,
|
||||
@ -109,6 +148,8 @@ public:
|
||||
|
||||
virtual const QPalette *palette(Palette type = SystemPalette) const;
|
||||
|
||||
virtual const QFont *font(Font type = SystemFont) const;
|
||||
|
||||
virtual QVariant themeHint(ThemeHint hint) const;
|
||||
};
|
||||
|
||||
|
@ -114,6 +114,9 @@ QWindow* QPlatformBackingStore::window() const
|
||||
This function is called before painting onto the surface begins,
|
||||
with the \a region in which the painting will occur.
|
||||
|
||||
\note A platform providing a backing store with an alpha channel
|
||||
needs to properly initialize the region to be painted.
|
||||
|
||||
\sa endPaint(), paintDevice()
|
||||
*/
|
||||
|
||||
|
@ -227,6 +227,15 @@ HB_Face QFontEngine::harfbuzzFace() const
|
||||
return hbFace;
|
||||
}
|
||||
|
||||
HB_Face QFontEngine::initializedHarfbuzzFace() const
|
||||
{
|
||||
HB_Face face = harfbuzzFace();
|
||||
if (face != 0 && face->font_for_init != 0)
|
||||
face = qHBLoadFace(face);
|
||||
|
||||
return face;
|
||||
}
|
||||
|
||||
glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix)
|
||||
{
|
||||
glyph_metrics_t metrics = boundingBox(glyph);
|
||||
@ -1364,15 +1373,13 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
|
||||
if (glyphs->glyphs[glyph_pos] == 0 && str[i].category() != QChar::Separator_Line) {
|
||||
QGlyphLayoutInstance tmp = glyphs->instance(glyph_pos);
|
||||
for (int x=1; x < engines.size(); ++x) {
|
||||
if (!shouldLoadFontEngineForCharacter(x, ucs4))
|
||||
if (engines.at(x) == 0 && !shouldLoadFontEngineForCharacter(x, ucs4))
|
||||
continue;
|
||||
|
||||
QFontEngine *engine = engines.at(x);
|
||||
bool deleteThisEngine = false;
|
||||
if (!engine) {
|
||||
const_cast<QFontEngineMulti *>(this)->loadEngine(x);
|
||||
engine = engines.at(x);
|
||||
deleteThisEngine = true;
|
||||
}
|
||||
Q_ASSERT(engine != 0);
|
||||
if (engine->type() == Box)
|
||||
@ -1388,8 +1395,6 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
|
||||
// set the high byte to indicate which engine the glyph came from
|
||||
glyphs->glyphs[glyph_pos] |= (x << 24);
|
||||
break;
|
||||
} else if (deleteThisEngine) {
|
||||
const_cast<QFontEngineMulti *>(this)->unloadEngine(x);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,6 +235,7 @@ public:
|
||||
|
||||
HB_Font harfbuzzFont() const;
|
||||
HB_Face harfbuzzFace() const;
|
||||
HB_Face initializedHarfbuzzFace() const;
|
||||
|
||||
virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints);
|
||||
|
||||
|
@ -374,18 +374,6 @@ QFont QPlatformFontDatabase::defaultFont() const
|
||||
return QFont(QLatin1String("Helvetica"));
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns fonts for class names.
|
||||
|
||||
\sa QGuiApplication::font()
|
||||
\since 5.0
|
||||
*/
|
||||
|
||||
QHash<QByteArray, QFont> QPlatformFontDatabase::defaultFonts() const
|
||||
{
|
||||
return QHash<QByteArray, QFont>();
|
||||
}
|
||||
|
||||
/*!
|
||||
Resolve alias to actual font family names.
|
||||
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
virtual QString fontDir() const;
|
||||
|
||||
virtual QFont defaultFont() const;
|
||||
virtual QHash<QByteArray, QFont> defaultFonts() const;
|
||||
|
||||
virtual QString resolveFontFamilyAlias(const QString &family) const;
|
||||
|
||||
//callback
|
||||
|
@ -1112,7 +1112,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
|
||||
si.leading = qMax(actualFontEngine->leading(), si.leading);
|
||||
|
||||
shaper_item.font = actualFontEngine->harfbuzzFont();
|
||||
shaper_item.face = actualFontEngine->harfbuzzFace();
|
||||
shaper_item.face = actualFontEngine->initializedHarfbuzzFace();
|
||||
|
||||
shaper_item.glyphIndicesPresent = true;
|
||||
|
||||
|
@ -123,8 +123,8 @@ void QHttpNetworkConnectionPrivate::init()
|
||||
//push session down to channels
|
||||
channels[i].networkSession = networkSession;
|
||||
#endif
|
||||
channels[i].init();
|
||||
}
|
||||
|
||||
delayedConnectionTimer.setSingleShot(true);
|
||||
QObject::connect(&delayedConnectionTimer, SIGNAL(timeout()), q, SLOT(_q_connectDelayedChannel()));
|
||||
}
|
||||
@ -135,6 +135,7 @@ void QHttpNetworkConnectionPrivate::pauseConnection()
|
||||
|
||||
// Disable all socket notifiers
|
||||
for (int i = 0; i < channelCount; i++) {
|
||||
if (channels[i].socket) {
|
||||
#ifndef QT_NO_SSL
|
||||
if (encrypt)
|
||||
QSslSocketPrivate::pauseSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
|
||||
@ -143,12 +144,14 @@ void QHttpNetworkConnectionPrivate::pauseConnection()
|
||||
QAbstractSocketPrivate::pauseSocketNotifiers(channels[i].socket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QHttpNetworkConnectionPrivate::resumeConnection()
|
||||
{
|
||||
state = RunningState;
|
||||
// Enable all socket notifiers
|
||||
for (int i = 0; i < channelCount; i++) {
|
||||
if (channels[i].socket) {
|
||||
#ifndef QT_NO_SSL
|
||||
if (encrypt)
|
||||
QSslSocketPrivate::resumeSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
|
||||
@ -160,6 +163,7 @@ void QHttpNetworkConnectionPrivate::resumeConnection()
|
||||
if (channels[i].state == QHttpNetworkConnectionChannel::WritingState)
|
||||
QMetaObject::invokeMethod(&channels[i], "_q_uploadDataReadyRead", Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
||||
// queue _q_startNextRequest
|
||||
QMetaObject::invokeMethod(this->q_func(), "_q_startNextRequest", Qt::QueuedConnection);
|
||||
@ -346,11 +350,15 @@ void QHttpNetworkConnectionPrivate::emitReplyError(QAbstractSocket *socket,
|
||||
QNetworkReply::NetworkError errorCode)
|
||||
{
|
||||
Q_Q(QHttpNetworkConnection);
|
||||
if (socket && reply) {
|
||||
|
||||
int i = 0;
|
||||
if (socket)
|
||||
i = indexOf(socket);
|
||||
|
||||
if (reply) {
|
||||
// this error matters only to this reply
|
||||
reply->d_func()->errorString = errorDetail(errorCode, socket);
|
||||
emit reply->finishedWithError(errorCode, reply->d_func()->errorString);
|
||||
int i = indexOf(socket);
|
||||
// remove the corrupt data if any
|
||||
reply->d_func()->eraseData();
|
||||
|
||||
@ -358,6 +366,7 @@ void QHttpNetworkConnectionPrivate::emitReplyError(QAbstractSocket *socket,
|
||||
channels[i].close();
|
||||
channels[i].reply = 0;
|
||||
channels[i].request = QHttpNetworkRequest();
|
||||
if (socket)
|
||||
channels[i].requeueCurrentlyPipelinedRequests();
|
||||
|
||||
// send the next request
|
||||
@ -582,9 +591,9 @@ void QHttpNetworkConnectionPrivate::requeueRequest(const HttpMessagePair &pair)
|
||||
|
||||
bool QHttpNetworkConnectionPrivate::dequeueRequest(QAbstractSocket *socket)
|
||||
{
|
||||
Q_ASSERT(socket);
|
||||
|
||||
int i = indexOf(socket);
|
||||
int i = 0;
|
||||
if (socket)
|
||||
i = indexOf(socket);
|
||||
|
||||
if (!highPriorityQueue.isEmpty()) {
|
||||
// remove from queue before sendRequest! else we might pipeline the same request again
|
||||
@ -740,15 +749,15 @@ bool QHttpNetworkConnectionPrivate::fillPipeline(QList<HttpMessagePair> &queue,
|
||||
}
|
||||
|
||||
|
||||
QString QHttpNetworkConnectionPrivate::errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket* socket,
|
||||
const QString &extraDetail)
|
||||
QString QHttpNetworkConnectionPrivate::errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket *socket, const QString &extraDetail)
|
||||
{
|
||||
Q_ASSERT(socket);
|
||||
|
||||
QString errorString;
|
||||
switch (errorCode) {
|
||||
case QNetworkReply::HostNotFoundError:
|
||||
if (socket)
|
||||
errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(socket->peerName());
|
||||
else
|
||||
errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(hostName);
|
||||
break;
|
||||
case QNetworkReply::ConnectionRefusedError:
|
||||
errorString = QCoreApplication::translate("QHttp", "Connection refused");
|
||||
@ -891,11 +900,13 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
|
||||
return;
|
||||
// try to get a free AND connected socket
|
||||
for (int i = 0; i < channelCount; ++i) {
|
||||
if (channels[i].socket) {
|
||||
if (!channels[i].reply && !channels[i].isSocketBusy() && channels[i].socket->state() == QAbstractSocket::ConnectedState) {
|
||||
if (dequeueRequest(channels[i].socket))
|
||||
channels[i].sendRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// try to push more into all sockets
|
||||
// ### FIXME we should move this to the beginning of the function
|
||||
@ -908,7 +919,7 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
|
||||
if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
|
||||
return;
|
||||
for (int i = 0; i < channelCount; i++)
|
||||
if (channels[i].socket->state() == QAbstractSocket::ConnectedState)
|
||||
if (channels[i].socket && channels[i].socket->state() == QAbstractSocket::ConnectedState)
|
||||
fillPipeline(channels[i].socket);
|
||||
|
||||
// If there is not already any connected channels we need to connect a new one.
|
||||
@ -916,11 +927,19 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
|
||||
// connected or not. This is to reuse connected channels before we connect new once.
|
||||
int queuedRequest = highPriorityQueue.count() + lowPriorityQueue.count();
|
||||
for (int i = 0; i < channelCount; ++i) {
|
||||
bool connectChannel = false;
|
||||
if (channels[i].socket) {
|
||||
if ((channels[i].socket->state() == QAbstractSocket::ConnectingState) || (channels[i].socket->state() == QAbstractSocket::HostLookupState))
|
||||
queuedRequest--;
|
||||
if ( queuedRequest <=0 )
|
||||
break;
|
||||
if (!channels[i].reply && !channels[i].isSocketBusy() && (channels[i].socket->state() == QAbstractSocket::UnconnectedState)) {
|
||||
if (!channels[i].reply && !channels[i].isSocketBusy() && (channels[i].socket->state() == QAbstractSocket::UnconnectedState))
|
||||
connectChannel = true;
|
||||
} else { // not previously used channel
|
||||
connectChannel = true;
|
||||
}
|
||||
|
||||
if (connectChannel) {
|
||||
if (networkLayerState == IPv4)
|
||||
channels[i].networkLayerPreference = QAbstractSocket::IPv4Protocol;
|
||||
else if (networkLayerState == IPv6)
|
||||
@ -928,6 +947,9 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
|
||||
channels[i].ensureConnection();
|
||||
queuedRequest--;
|
||||
}
|
||||
|
||||
if ( queuedRequest <=0 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -958,8 +980,8 @@ void QHttpNetworkConnectionPrivate::startHostInfoLookup()
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
if (networkProxy.capabilities() & QNetworkProxy::HostNameLookupCapability) {
|
||||
lookupHost = networkProxy.hostName();
|
||||
} else if (channels[0].socket->proxy().capabilities() & QNetworkProxy::HostNameLookupCapability) {
|
||||
lookupHost = channels[0].socket->proxy().hostName();
|
||||
} else if (channels[0].proxy.capabilities() & QNetworkProxy::HostNameLookupCapability) {
|
||||
lookupHost = channels[0].proxy.hostName();
|
||||
}
|
||||
#endif
|
||||
QHostAddress temp;
|
||||
@ -1169,7 +1191,7 @@ void QHttpNetworkConnection::setTransparentProxy(const QNetworkProxy &networkPro
|
||||
{
|
||||
Q_D(QHttpNetworkConnection);
|
||||
for (int i = 0; i < d->channelCount; ++i)
|
||||
d->channels[i].socket->setProxy(networkProxy);
|
||||
d->channels[i].setProxy(networkProxy);
|
||||
}
|
||||
|
||||
QNetworkProxy QHttpNetworkConnection::transparentProxy() const
|
||||
@ -1190,7 +1212,7 @@ void QHttpNetworkConnection::setSslConfiguration(const QSslConfiguration &config
|
||||
|
||||
// set the config on all channels
|
||||
for (int i = 0; i < d->channelCount; ++i)
|
||||
static_cast<QSslSocket *>(d->channels[i].socket)->setSslConfiguration(config);
|
||||
d->channels[i].setSslConfiguration(config);
|
||||
}
|
||||
|
||||
void QHttpNetworkConnection::ignoreSslErrors(int channel)
|
||||
@ -1201,13 +1223,11 @@ void QHttpNetworkConnection::ignoreSslErrors(int channel)
|
||||
|
||||
if (channel == -1) { // ignore for all channels
|
||||
for (int i = 0; i < d->channelCount; ++i) {
|
||||
static_cast<QSslSocket *>(d->channels[i].socket)->ignoreSslErrors();
|
||||
d->channels[i].ignoreAllSslErrors = true;
|
||||
d->channels[i].ignoreSslErrors();
|
||||
}
|
||||
|
||||
} else {
|
||||
static_cast<QSslSocket *>(d->channels[channel].socket)->ignoreSslErrors();
|
||||
d->channels[channel].ignoreAllSslErrors = true;
|
||||
d->channels[channel].ignoreSslErrors();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1219,13 +1239,11 @@ void QHttpNetworkConnection::ignoreSslErrors(const QList<QSslError> &errors, int
|
||||
|
||||
if (channel == -1) { // ignore for all channels
|
||||
for (int i = 0; i < d->channelCount; ++i) {
|
||||
static_cast<QSslSocket *>(d->channels[i].socket)->ignoreSslErrors(errors);
|
||||
d->channels[i].ignoreSslErrorsList = errors;
|
||||
d->channels[i].ignoreSslErrors(errors);
|
||||
}
|
||||
|
||||
} else {
|
||||
static_cast<QSslSocket *>(d->channels[channel].socket)->ignoreSslErrors(errors);
|
||||
d->channels[channel].ignoreSslErrorsList = errors;
|
||||
d->channels[channel].ignoreSslErrors(errors);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,7 @@ QT_BEGIN_NAMESPACE
|
||||
QHttpNetworkConnectionChannel::QHttpNetworkConnectionChannel()
|
||||
: socket(0)
|
||||
, ssl(false)
|
||||
, isInitialized(false)
|
||||
, state(IdleState)
|
||||
, reply(0)
|
||||
, written(0)
|
||||
@ -152,18 +153,37 @@ void QHttpNetworkConnectionChannel::init()
|
||||
QObject::connect(sslSocket, SIGNAL(encryptedBytesWritten(qint64)),
|
||||
this, SLOT(_q_encryptedBytesWritten(qint64)),
|
||||
Qt::DirectConnection);
|
||||
|
||||
if (ignoreAllSslErrors)
|
||||
sslSocket->ignoreSslErrors();
|
||||
|
||||
if (!ignoreSslErrorsList.isEmpty())
|
||||
sslSocket->ignoreSslErrors(ignoreSslErrorsList);
|
||||
|
||||
if (!sslConfiguration.isNull())
|
||||
sslSocket->setSslConfiguration(sslConfiguration);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
if (proxy.type() != QNetworkProxy::NoProxy)
|
||||
socket->setProxy(proxy);
|
||||
#endif
|
||||
isInitialized = true;
|
||||
}
|
||||
|
||||
|
||||
void QHttpNetworkConnectionChannel::close()
|
||||
{
|
||||
if (socket->state() == QAbstractSocket::UnconnectedState)
|
||||
if (!socket)
|
||||
state = QHttpNetworkConnectionChannel::IdleState;
|
||||
else if (socket->state() == QAbstractSocket::UnconnectedState)
|
||||
state = QHttpNetworkConnectionChannel::IdleState;
|
||||
else
|
||||
state = QHttpNetworkConnectionChannel::ClosingState;
|
||||
|
||||
if (socket)
|
||||
socket->close();
|
||||
}
|
||||
|
||||
@ -527,6 +547,9 @@ void QHttpNetworkConnectionChannel::handleUnexpectedEOF()
|
||||
|
||||
bool QHttpNetworkConnectionChannel::ensureConnection()
|
||||
{
|
||||
if (!isInitialized)
|
||||
init();
|
||||
|
||||
QAbstractSocket::SocketState socketState = socket->state();
|
||||
|
||||
// resend this request after we receive the disconnected signal
|
||||
@ -835,6 +858,46 @@ bool QHttpNetworkConnectionChannel::resetUploadData()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
|
||||
void QHttpNetworkConnectionChannel::setProxy(const QNetworkProxy &networkProxy)
|
||||
{
|
||||
if (socket)
|
||||
socket->setProxy(networkProxy);
|
||||
|
||||
proxy = networkProxy;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_SSL
|
||||
|
||||
void QHttpNetworkConnectionChannel::ignoreSslErrors()
|
||||
{
|
||||
if (socket)
|
||||
static_cast<QSslSocket *>(socket)->ignoreSslErrors();
|
||||
|
||||
ignoreAllSslErrors = true;
|
||||
}
|
||||
|
||||
|
||||
void QHttpNetworkConnectionChannel::ignoreSslErrors(const QList<QSslError> &errors)
|
||||
{
|
||||
if (socket)
|
||||
static_cast<QSslSocket *>(socket)->ignoreSslErrors(errors);
|
||||
|
||||
ignoreSslErrorsList = errors;
|
||||
}
|
||||
|
||||
void QHttpNetworkConnectionChannel::setSslConfiguration(const QSslConfiguration &config)
|
||||
{
|
||||
if (socket)
|
||||
static_cast<QSslSocket *>(socket)->setSslConfiguration(config);
|
||||
|
||||
sslConfiguration = config;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void QHttpNetworkConnectionChannel::pipelineInto(HttpMessagePair &pair)
|
||||
{
|
||||
|
@ -72,6 +72,7 @@
|
||||
#ifndef QT_NO_SSL
|
||||
# include <QtNetwork/qsslsocket.h>
|
||||
# include <QtNetwork/qsslerror.h>
|
||||
# include <QtNetwork/qsslconfiguration.h>
|
||||
#else
|
||||
# include <QtNetwork/qtcpsocket.h>
|
||||
#endif
|
||||
@ -100,6 +101,7 @@ public:
|
||||
};
|
||||
QAbstractSocket *socket;
|
||||
bool ssl;
|
||||
bool isInitialized;
|
||||
ChannelState state;
|
||||
QHttpNetworkRequest request; // current request
|
||||
QHttpNetworkReply *reply; // current reply for this request
|
||||
@ -118,6 +120,10 @@ public:
|
||||
#ifndef QT_NO_SSL
|
||||
bool ignoreAllSslErrors;
|
||||
QList<QSslError> ignoreSslErrorsList;
|
||||
QSslConfiguration sslConfiguration;
|
||||
void ignoreSslErrors();
|
||||
void ignoreSslErrors(const QList<QSslError> &errors);
|
||||
void setSslConfiguration(const QSslConfiguration &config);
|
||||
#endif
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
QSharedPointer<QNetworkSession> networkSession;
|
||||
@ -144,6 +150,11 @@ public:
|
||||
void setConnection(QHttpNetworkConnection *c);
|
||||
QPointer<QHttpNetworkConnection> connection;
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
QNetworkProxy proxy;
|
||||
void setProxy(const QNetworkProxy &networkProxy);
|
||||
#endif
|
||||
|
||||
void init();
|
||||
void close();
|
||||
|
||||
|
@ -1089,15 +1089,16 @@ void QNetworkAccessManagerPrivate::authenticationRequired(QAuthenticator *authen
|
||||
QNetworkReply *reply,
|
||||
bool synchronous,
|
||||
QUrl &url,
|
||||
QUrl *urlForLastAuthentication)
|
||||
QUrl *urlForLastAuthentication,
|
||||
bool allowAuthenticationReuse)
|
||||
{
|
||||
Q_Q(QNetworkAccessManager);
|
||||
|
||||
// don't try the cache for the same URL twice in a row
|
||||
// being called twice for the same URL means the authentication failed
|
||||
// also called when last URL is empty, e.g. on first call
|
||||
if (urlForLastAuthentication->isEmpty()
|
||||
|| url != *urlForLastAuthentication) {
|
||||
if (allowAuthenticationReuse && (urlForLastAuthentication->isEmpty()
|
||||
|| url != *urlForLastAuthentication)) {
|
||||
// if credentials are included in the url, then use them
|
||||
if (!url.userName().isEmpty()
|
||||
&& !url.password().isEmpty()) {
|
||||
@ -1124,6 +1125,7 @@ void QNetworkAccessManagerPrivate::authenticationRequired(QAuthenticator *authen
|
||||
|
||||
*urlForLastAuthentication = url;
|
||||
emit q->authenticationRequired(reply, authenticator);
|
||||
if (allowAuthenticationReuse)
|
||||
authenticationManager->cacheCredentials(url, authenticator);
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,8 @@ public:
|
||||
QNetworkReply *reply,
|
||||
bool synchronous,
|
||||
QUrl &url,
|
||||
QUrl *urlForLastAuthentication);
|
||||
QUrl *urlForLastAuthentication,
|
||||
bool allowAuthenticationReuse = true);
|
||||
void cacheCredentials(const QUrl &url, const QAuthenticator *auth);
|
||||
QNetworkAuthenticationCredential *fetchCachedCredentials(const QUrl &url,
|
||||
const QAuthenticator *auth = 0);
|
||||
|
@ -1179,10 +1179,10 @@ void QNetworkReplyHttpImplPrivate::replyDownloadProgressSlot(qint64 bytesReceive
|
||||
emit q->downloadProgress(bytesDownloaded, bytesTotal);
|
||||
}
|
||||
|
||||
void QNetworkReplyHttpImplPrivate::httpAuthenticationRequired(const QHttpNetworkRequest &,
|
||||
void QNetworkReplyHttpImplPrivate::httpAuthenticationRequired(const QHttpNetworkRequest &request,
|
||||
QAuthenticator *auth)
|
||||
{
|
||||
managerPrivate->authenticationRequired(auth, q_func(), synchronous, url, &urlForLastAuthentication);
|
||||
managerPrivate->authenticationRequired(auth, q_func(), synchronous, url, &urlForLastAuthentication, request.withCredentials());
|
||||
}
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
|
@ -256,7 +256,7 @@ public:
|
||||
Q_GLOBAL_STATIC(QWindowsSystemProxy, systemProxy)
|
||||
|
||||
QWindowsSystemProxy::QWindowsSystemProxy()
|
||||
: initialized(false), functional(false), isAutoConfig(false)
|
||||
: hHttpSession(0), initialized(false), functional(false), isAutoConfig(false)
|
||||
{
|
||||
defaultResult << QNetworkProxy::NoProxy;
|
||||
}
|
||||
|
@ -123,6 +123,7 @@
|
||||
#include <QtCore/qfileinfo.h>
|
||||
#include <QtCore/qmap.h>
|
||||
#include <QtCore/qmutex.h>
|
||||
#include <QtCore/private/qmutexpool_p.h>
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qstringlist.h>
|
||||
#include <QtCore/qvarlengtharray.h>
|
||||
@ -263,6 +264,7 @@ void QSslCertificate::clear()
|
||||
*/
|
||||
QByteArray QSslCertificate::version() const
|
||||
{
|
||||
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
|
||||
if (d->versionString.isEmpty() && d->x509)
|
||||
d->versionString =
|
||||
QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->version)) + 1);
|
||||
@ -275,6 +277,7 @@ QByteArray QSslCertificate::version() const
|
||||
*/
|
||||
QByteArray QSslCertificate::serialNumber() const
|
||||
{
|
||||
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
|
||||
if (d->serialNumberString.isEmpty() && d->x509) {
|
||||
ASN1_INTEGER *serialNumber = d->x509->cert_info->serialNumber;
|
||||
QByteArray hexString;
|
||||
@ -327,6 +330,7 @@ static QByteArray _q_SubjectInfoToString(QSslCertificate::SubjectInfo info)
|
||||
*/
|
||||
QStringList QSslCertificate::issuerInfo(SubjectInfo info) const
|
||||
{
|
||||
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
|
||||
// lazy init
|
||||
if (d->issuerInfo.isEmpty() && d->x509)
|
||||
d->issuerInfo =
|
||||
@ -344,6 +348,7 @@ QStringList QSslCertificate::issuerInfo(SubjectInfo info) const
|
||||
*/
|
||||
QStringList QSslCertificate::issuerInfo(const QByteArray &attribute) const
|
||||
{
|
||||
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
|
||||
// lazy init
|
||||
if (d->issuerInfo.isEmpty() && d->x509)
|
||||
d->issuerInfo =
|
||||
@ -363,6 +368,7 @@ QStringList QSslCertificate::issuerInfo(const QByteArray &attribute) const
|
||||
*/
|
||||
QStringList QSslCertificate::subjectInfo(SubjectInfo info) const
|
||||
{
|
||||
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
|
||||
// lazy init
|
||||
if (d->subjectInfo.isEmpty() && d->x509)
|
||||
d->subjectInfo =
|
||||
@ -379,6 +385,7 @@ QStringList QSslCertificate::subjectInfo(SubjectInfo info) const
|
||||
*/
|
||||
QStringList QSslCertificate::subjectInfo(const QByteArray &attribute) const
|
||||
{
|
||||
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
|
||||
// lazy init
|
||||
if (d->subjectInfo.isEmpty() && d->x509)
|
||||
d->subjectInfo =
|
||||
@ -398,6 +405,7 @@ QStringList QSslCertificate::subjectInfo(const QByteArray &attribute) const
|
||||
*/
|
||||
QList<QByteArray> QSslCertificate::subjectInfoAttributes() const
|
||||
{
|
||||
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
|
||||
// lazy init
|
||||
if (d->subjectInfo.isEmpty() && d->x509)
|
||||
d->subjectInfo =
|
||||
@ -417,6 +425,7 @@ QList<QByteArray> QSslCertificate::subjectInfoAttributes() const
|
||||
*/
|
||||
QList<QByteArray> QSslCertificate::issuerInfoAttributes() const
|
||||
{
|
||||
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
|
||||
// lazy init
|
||||
if (d->issuerInfo.isEmpty() && d->x509)
|
||||
d->issuerInfo =
|
||||
|
@ -229,7 +229,7 @@ QFontEngine *QBasicFontDatabase::fontEngine(const QFontDef &fontDef, QUnicodeTab
|
||||
delete engine;
|
||||
engine = 0;
|
||||
} else if (scriptRequiresOpenType(script)) {
|
||||
HB_Face hbFace = engine->harfbuzzFace();
|
||||
HB_Face hbFace = engine->initializedHarfbuzzFace();
|
||||
if (!hbFace || !hbFace->supported_scripts[script]) {
|
||||
delete engine;
|
||||
engine = 0;
|
||||
|
@ -575,7 +575,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QUnicodeTables::
|
||||
delete engine;
|
||||
engine = 0;
|
||||
} else if (scriptRequiresOpenType(script)) {
|
||||
HB_Face hbFace = engine->harfbuzzFace();
|
||||
HB_Face hbFace = engine->initializedHarfbuzzFace();
|
||||
if (!hbFace || !hbFace->supported_scripts[script]) {
|
||||
delete engine;
|
||||
engine = 0;
|
||||
|
@ -55,6 +55,7 @@ QT_BEGIN_NAMESPACE
|
||||
class QRawFontPrivate;
|
||||
class QCoreTextFontEngine : public QFontEngine
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QCoreTextFontEngine(CTFontRef font, const QFontDef &def);
|
||||
QCoreTextFontEngine(CGFontRef font, const QFontDef &def);
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "../../services/genericunix/qgenericunixservices_p.h"
|
||||
|
||||
#include <QtGui/QPalette>
|
||||
#include <QtGui/QFont>
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
@ -54,6 +55,20 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
ResourceHelper::ResourceHelper()
|
||||
{
|
||||
qFill(palettes, palettes + QPlatformTheme::NPalettes, static_cast<QPalette *>(0));
|
||||
qFill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(0));
|
||||
}
|
||||
|
||||
void ResourceHelper::clear()
|
||||
{
|
||||
qDeleteAll(palettes, palettes + QPlatformTheme::NPalettes);
|
||||
qDeleteAll(fonts, fonts + QPlatformTheme::NFonts);
|
||||
qFill(palettes, palettes + QPlatformTheme::NPalettes, static_cast<QPalette *>(0));
|
||||
qFill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(0));
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QGenericX11ThemeQKdeTheme
|
||||
\brief QGenericX11Theme is a generic theme implementation for X11.
|
||||
@ -148,19 +163,40 @@ QKdeTheme::QKdeTheme(const QString &kdeHome, int kdeVersion) :
|
||||
m_kdeHome(kdeHome), m_kdeVersion(kdeVersion),
|
||||
m_toolButtonStyle(Qt::ToolButtonTextBesideIcon), m_toolBarIconSize(0)
|
||||
{
|
||||
qFill(m_palettes, m_palettes + NPalettes, static_cast<QPalette *>(0));
|
||||
refresh();
|
||||
}
|
||||
|
||||
void QKdeTheme::clearPalettes()
|
||||
static inline QFont *readKdeFontSetting(const QSettings &settings, const QString &key)
|
||||
{
|
||||
qDeleteAll(m_palettes, m_palettes + NPalettes);
|
||||
qFill(m_palettes, m_palettes + NPalettes, static_cast<QPalette *>(0));
|
||||
const QVariant fontValue = settings.value(key);
|
||||
if (fontValue.isValid()) {
|
||||
// Read font value: Might be a QStringList as KDE stores fonts without quotes.
|
||||
// Also retrieve the family for the constructor since we cannot use the
|
||||
// default constructor of QFont, which accesses QGuiApplication::systemFont()
|
||||
// causing recursion.
|
||||
QString fontDescription;
|
||||
QString fontFamily;
|
||||
if (fontValue.type() == QVariant::StringList) {
|
||||
const QStringList list = fontValue.toStringList();
|
||||
if (!list.isEmpty()) {
|
||||
fontFamily = list.first();
|
||||
fontDescription = list.join(QStringLiteral(","));
|
||||
}
|
||||
} else {
|
||||
fontDescription = fontFamily = fontValue.toString();
|
||||
}
|
||||
if (!fontDescription.isEmpty()) {
|
||||
QFont font(fontFamily);
|
||||
if (font.fromString(fontDescription))
|
||||
return new QFont(font);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QKdeTheme::refresh()
|
||||
{
|
||||
clearPalettes();
|
||||
m_resources.clear();
|
||||
|
||||
m_toolButtonStyle = Qt::ToolButtonTextBesideIcon;
|
||||
m_toolBarIconSize = 0;
|
||||
@ -177,7 +213,7 @@ void QKdeTheme::refresh()
|
||||
|
||||
QPalette systemPalette;
|
||||
if (readKdeSystemPalette(kdeSettings, &systemPalette))
|
||||
m_palettes[SystemPalette] = new QPalette(systemPalette);
|
||||
m_resources.palettes[SystemPalette] = new QPalette(systemPalette);
|
||||
//## TODO tooltip color
|
||||
|
||||
const QVariant styleValue = kdeSettings.value(QStringLiteral("widgetStyle"));
|
||||
@ -205,6 +241,9 @@ void QKdeTheme::refresh()
|
||||
else if (toolBarStyle == QStringLiteral("TextUnderIcon"))
|
||||
m_toolButtonStyle = Qt::ToolButtonTextUnderIcon;
|
||||
}
|
||||
|
||||
// Read system font, ignore 'fixed' 'smallestReadableFont'
|
||||
m_resources.fonts[SystemFont] = readKdeFontSetting(kdeSettings, QStringLiteral("font"));
|
||||
}
|
||||
|
||||
QString QKdeTheme::globalSettingsFile() const
|
||||
|
@ -50,6 +50,18 @@ QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class ResourceHelper
|
||||
{
|
||||
public:
|
||||
ResourceHelper();
|
||||
~ResourceHelper() { clear(); }
|
||||
|
||||
void clear();
|
||||
|
||||
QPalette *palettes[QPlatformTheme::NPalettes];
|
||||
QFont *fonts[QPlatformTheme::NFonts];
|
||||
};
|
||||
|
||||
class QGenericUnixTheme : public QPlatformTheme
|
||||
{
|
||||
public:
|
||||
@ -66,21 +78,24 @@ class QKdeTheme : public QPlatformTheme
|
||||
{
|
||||
QKdeTheme(const QString &kdeHome, int kdeVersion);
|
||||
public:
|
||||
~QKdeTheme() { clearPalettes(); }
|
||||
|
||||
static QPlatformTheme *createKdeTheme();
|
||||
virtual QVariant themeHint(ThemeHint hint) const;
|
||||
|
||||
virtual const QPalette *palette(Palette type = SystemPalette) const
|
||||
{ return m_palettes[type]; }
|
||||
{ return m_resources.palettes[type]; }
|
||||
|
||||
virtual const QFont *font(Font type) const
|
||||
{ return m_resources.fonts[type]; }
|
||||
|
||||
private:
|
||||
QString globalSettingsFile() const;
|
||||
void clearPalettes();
|
||||
void refresh();
|
||||
|
||||
const QString m_kdeHome;
|
||||
const int m_kdeVersion;
|
||||
QPalette *m_palettes[NPalettes];
|
||||
|
||||
ResourceHelper m_resources;
|
||||
QString m_iconThemeName;
|
||||
QString m_iconFallbackThemeName;
|
||||
QStringList m_styleNames;
|
||||
|
@ -1,4 +1,6 @@
|
||||
contains(QT_CONFIG, libudev) {
|
||||
HEADERS += $$PWD/qudevhelper_p.h $$PWD/qudevicehelper_p.h
|
||||
SOURCES += $$PWD/qudevhelper.cpp $$PWD/qudevicehelper.cpp
|
||||
|
||||
INCLUDEPATH += $$QMAKE_INCDIR_LIBUDEV
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user