From 9ae94806addcc9d736eafd01a5841fbc23f58728 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 24 Oct 2013 12:37:10 +0300 Subject: ANGLE: Fix fxc path setting for MSVC 2013. Change-Id: I7be4dbd948052d069bb1b97d759d6fc5099236f9 Reviewed-by: Oliver Wolff Reviewed-by: Joerg Bornemann --- src/angle/src/common/common.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/angle/src/common/common.pri b/src/angle/src/common/common.pri index a94b9a6fc3..e5b01d5051 100644 --- a/src/angle/src/common/common.pri +++ b/src/angle/src/common/common.pri @@ -7,7 +7,7 @@ INCLUDEPATH += \ LIBS = $$QMAKE_LIBS_CORE $$QMAKE_LIBS_GUI # DirectX is included in the Windows 8 Kit, but everything else requires the DX SDK. -win32-msvc2012 { +win32-msvc2012|win32-msvc2013 { FXC = fxc.exe } else { DX_DIR = $$(DXSDK_DIR) -- cgit v1.2.3 From b66a217a1c0517376a730c391c2c1bb45c7eb271 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 24 Oct 2013 12:49:59 +0300 Subject: ANGLE: Fix compilation with MSVC2013. Add missing include for std::min(), std::max(). Change-Id: I740e5db94f9f958ac65de8dd7baab7e203482637 Reviewed-by: Joerg Bornemann Reviewed-by: Oliver Wolff --- src/3rdparty/angle/src/libEGL/Surface.cpp | 2 ++ .../0001-ANGLE-Fix-compilation-with-MSVC2013.patch | 28 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/angle/patches/0001-ANGLE-Fix-compilation-with-MSVC2013.patch (limited to 'src') diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp index b47a7bcc20..83fbbf5b07 100644 --- a/src/3rdparty/angle/src/libEGL/Surface.cpp +++ b/src/3rdparty/angle/src/libEGL/Surface.cpp @@ -20,6 +20,8 @@ #include "libEGL/main.h" #include "libEGL/Display.h" +#include + namespace egl { diff --git a/src/angle/patches/0001-ANGLE-Fix-compilation-with-MSVC2013.patch b/src/angle/patches/0001-ANGLE-Fix-compilation-with-MSVC2013.patch new file mode 100644 index 0000000000..cf32a20d46 --- /dev/null +++ b/src/angle/patches/0001-ANGLE-Fix-compilation-with-MSVC2013.patch @@ -0,0 +1,28 @@ +From 4863cf64cd332a5fcefe453634c3c5ef62cb758c Mon Sep 17 00:00:00 2001 +From: Friedemann Kleint +Date: Thu, 24 Oct 2013 12:49:59 +0300 +Subject: [PATCH] ANGLE: Fix compilation with MSVC2013. + +Add missing include for std::min(), std::max(). + +Change-Id: I740e5db94f9f958ac65de8dd7baab7e203482637 +--- + src/3rdparty/angle/src/libEGL/Surface.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp +index b47a7bc..83fbbf5 100644 +--- a/src/3rdparty/angle/src/libEGL/Surface.cpp ++++ b/src/3rdparty/angle/src/libEGL/Surface.cpp +@@ -20,6 +20,8 @@ + #include "libEGL/main.h" + #include "libEGL/Display.h" + ++#include ++ + namespace egl + { + +-- +1.8.3.msysgit.0 + -- cgit v1.2.3 From c9ae85641775b5fd93648e95f13e982d5f9ca73f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 23 Oct 2013 13:59:39 +0200 Subject: document format of entries Change-Id: I94c169b03844a7091ab98a9689a19ef27e665509 Reviewed-by: Joerg Bornemann Reviewed-by: Tasuku Suzuki --- src/corelib/global/qfeatures.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index ec54c7bdbf..44a4f8a33b 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -1,3 +1,11 @@ +# Generic entry format +#Feature: UPPERCASENAME (for the #define) +#Description: One sentence description of what this does. +#Section: Categorization +#Requires: UPPERCASENAME... +#Name: CamelCaseName (often a class name) +#SeeAlso: UPPERCASENAME... (currently unused) + # Kernel Feature: PROPERTIES -- cgit v1.2.3 From 75454e84eabbf8ace89abe22fc19ff981f2ef07b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 23 Oct 2013 14:00:43 +0200 Subject: remove pointless "SeeAlso: ???" entries Change-Id: Iaca0a4f81720b3c20291e91a08fbb617b104330e Reviewed-by: Joerg Bornemann Reviewed-by: Tasuku Suzuki --- src/corelib/global/qfeatures.txt | 153 --------------------------------------- 1 file changed, 153 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 44a4f8a33b..4d07c798c8 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -13,147 +13,126 @@ Description: Supports scripting Qt-based applications. Section: Kernel Requires: Name: Properties -SeeAlso: ??? Feature: TEXTHTMLPARSER Description: Parser for HTML Section: Kernel Requires: Name: HtmlParser -SeeAlso: ??? Feature: TEXTODFWRITER Description: Provides an ODF writer Section: Kernel Requires: XMLSTREAMWRITER Name: OdfWriter -SeeAlso: ??? Feature: CSSPARSER Description: Parser for Style Sheets Section: Kernel Requires: Name: CssParser -SeeAlso: ??? Feature: REGULAREXPRESSION Description: Perl-compatible regular expression APIs Section: Kernel Requires: Name: QRegularExpression -SeeAlso: ??? Feature: CONCURRENT Description: Provides a high-level multi-threaded APIs Section: Kernel Requires: Name: QtConcurrent -SeeAlso: ??? Feature: DRAGANDDROP Description: Supports the drag and drop mechansim. Section: Kernel Requires: IMAGEFORMAT_XPM Name: Drag and drop -SeeAlso: ??? Feature: SESSIONMANAGER Description: Supports session management. Section: Kernel Requires: Name: Session Manager -SeeAlso: ??? Feature: SHORTCUT Description: Supports keyboard accelerators and shortcuts. Section: Kernel Requires: Name: QShortcut -SeeAlso: ??? Feature: ACTION Description: Supports widget actions. Section: Kernel Requires: Name: QAction -SeeAlso: ??? Feature: CURSOR Description: Supports mouse cursors. Section: Kernel Requires: Name: QCursor -SeeAlso: ??? Feature: CLIPBOARD Description: Supports cut and paste operations. Section: Kernel Requires: Name: QClipboard -SeeAlso: ??? Feature: WHEELEVENT Description: Supports wheel events. Section: Kernel Requires: Name: QWheelEvent -SeeAlso: ??? Feature: TABLETEVENT Description: Supports tablet events. Section: Kernel Requires: Name: QTabletEvent -SeeAlso: ??? Feature: EFFECTS Description: Supports special widget effects (e.g. fading and scrolling). Section: Kernel Requires: Name: Effects -SeeAlso: ??? Feature: SHAREDMEMORY Description: Provides access to a shared memory segment. Section: Kernel Requires: Name: QSharedMemory -SeeAlso: ??? Feature: SYSTEMSEMAPHORE Description: Provides a general counting system semaphore. Section: Kernel Requires: Name: QSystemSemaphore -SeeAlso: ??? Feature: XMLSTREAM Description: Provides a simple streaming API for XML. Section: Kernel Requires: Name: -SeeAlso: ??? Feature: XMLSTREAMREADER Description: Provides a well-formed XML parser with a simple streaming API. Section: Kernel Requires: XMLSTREAM Name: QXmlStreamReader -SeeAlso: ??? Feature: XMLSTREAMWRITER Description: Provides a XML writer with a simple streaming API. Section: Kernel Requires: XMLSTREAM Name: QXmlStreamWriter -SeeAlso: ??? Feature: IM Description: Inputmethods with QInputContext Section: Kernel Requires: LIBRARY Name: QInputContext -SeeAlso: ??? # Data structures Feature: TEXTDATE @@ -161,14 +140,12 @@ Description: Supports month and day names in dates. Section: Data structures Requires: Name: Text Date -SeeAlso: ??? Feature: DATESTRING Description: Supports convertion between dates and strings. Section: Data structures Requires: TEXTDATE Name: QDate/QTime/QDateTime -SeeAlso: ??? # File I/O @@ -177,42 +154,36 @@ Description: Supports external process invocation. Section: File I/O Requires: Name: QProcess -SeeAlso: ??? Feature: TEMPORARYFILE Description: Provides an I/O device that operates on temporary files. Section: File I/O Requires: Name: QTemporaryFile -SeeAlso: ??? Feature: LIBRARY Description: Supports a shared library wrapper. Section: File I/O Requires: Name: QLibrary -SeeAlso: ??? Feature: SETTINGS Description: Supports persistent application settings. Section: File I/O Requires: Name: QSettings -SeeAlso: ??? Feature: DOM Description: Supports the Document Object Model. Section: File I/O Requires: Name: Document Object Model -SeeAlso: ??? Feature: FILESYSTEMMODEL Description: Provides a data model for the local filesystem. Section: File I/O Requires: Name: QFileSystemModel -SeeAlso: ??? Feature: FILESYSTEMWATCHER Description: Provides an interface for monitoring files and directories @@ -220,7 +191,6 @@ for modications. Section: File I/O Requires: Name: QFileSystemWatcher -SeeAlso: ??? Feature: FILESYSTEMITERATOR Description: Provides fast file-system iteration. @@ -228,7 +198,6 @@ for modications. Section: File I/O Requires: Name: QFileSystemIterator -SeeAlso: ??? # Widgets @@ -237,154 +206,132 @@ Description: Supports views using tree models. Section: Widgets Requires: TREEVIEW Name: QTreeWidget -SeeAlso: ??? Feature: LISTWIDGET Description: Supports item-based list widgets. Section: Widgets Requires: LISTVIEW Name: QListWidget -SeeAlso: ??? Feature: TABLEWIDGET Description: Supports item-based table views. Section: Widgets Requires: TABLEVIEW Name: QTableWidget -SeeAlso: ??? Feature: DATETIMEEDIT Description: Supports editing dates and times. Section: Widgets Requires: CALENDARWIDGET DATESTRING Name: QDateTimeEdit -SeeAlso: ??? Feature: STACKEDWIDGET Description: Supports stacked widgets. Section: Widgets Requires: Name: QStackedWidget -SeeAlso: ??? Feature: TEXTBROWSER Description: Supports HTML document browsing. Section: Widgets Requires: TEXTEDIT Name: QTextBrowser -SeeAlso: ??? Feature: SPLASHSCREEN Description: Supports splash screens that can be shown during application startup. Section: Widgets Requires: Name: Splash screen widget -SeeAlso: ??? Feature: SPLITTER Description: Supports user controlled splitter widgets. Section: Widgets Requires: RUBBERBAND Name: QSplitter -SeeAlso: ??? Feature: LCDNUMBER Description: Supports LCD-like digits. Section: Widgets Requires: Name: QLCDNumber -SeeAlso: ??? Feature: MENU Description: Supports popup-menus. Section: Widgets Requires: ACTION Name: QMenu -SeeAlso: ??? Feature: LINEEDIT Description: Supports single-line edits. Section: Widgets Requires: Name: QLineEdit -SeeAlso: ??? Feature: SPINBOX Description: Supports spin boxes handling integers and discrete sets of values. Section: Widgets Requires: SPINWIDGET LINEEDIT VALIDATOR Name: QSpinBox -SeeAlso: ??? Feature: TABBAR Description: Supports tab bars, e.g. for use in tabbed dialogs. Section: Widgets Requires: TOOLBUTTON Name: QTabBar -SeeAlso: ??? Feature: TABWIDGET Description: Supports stacking tabbed widgets. Section: Widgets Requires: TABBAR STACKEDWIDGET Name: QTabWidget -SeeAlso: ??? Feature: COMBOBOX Description: Supports comboboxes presenting a list of options to the user. Section: Widgets Requires: LINEEDIT STANDARDITEMMODEL LISTVIEW Name: QComboBox -SeeAlso: ??? Feature: FONTCOMBOBOX Description: Supports a combobox that lets the user select a font family. Section: Widgets Requires: COMBOBOX STRINGLISTMODEL Name: QFontComboBox -SeeAlso: ??? Feature: TOOLBUTTON Description: Supports quick-access buttons to commands and options. Section: Widgets Requires: ACTION Name: QToolButton -SeeAlso: ??? Feature: TOOLBAR Description: Supports movable panels containing a set of controls. Section: Widgets Requires: MAINWINDOW Name: QToolBar -SeeAlso: ??? Feature: TOOLBOX Description: Supports columns of tabbed widget items. Section: Widgets Requires: TOOLBUTTON SCROLLAREA Name: QToolBox -SeeAlso: ??? Feature: GROUPBOX Description: Supports group box frames. Section: Widgets Requires: Name: QGroupBox -SeeAlso: ??? Feature: BUTTONGROUP Description: Supports organizing groups of button widgets. Section: Widgets Requires: GROUPBOX Name: QButtonGroup -SeeAlso: ??? Feature: MAINWINDOW Description: Supports main application windows. Section: Widgets Requires: MENU RESIZEHANDLER TOOLBUTTON Name: QMainWindow -SeeAlso: ??? Feature: DOCKWIDGET Description: Supports docking widgets inside a QMainWindow or floated as @@ -392,56 +339,48 @@ a top-level window on the desktop. Section: Widgets Requires: RUBBERBAND MAINWINDOW Name: QDockwidget -SeeAlso: ??? Feature: MDIAREA Description: Provides an area in which MDI windows are displayed. Section: Widgets Requires: SCROLLAREA Name: QMdiArea -SeeAlso: ??? Feature: RESIZEHANDLER Description: Supports an internal resize handler. Section: Widgets Requires: Name: Resize Handler -SeeAlso: ??? Feature: STATUSBAR Description: Supports presentation of status information. Section: Widgets Requires: Name: QStatusBar -SeeAlso: ??? Feature: MENUBAR Description: Supports pull-down menu items. Section: Widgets Requires: MENU TOOLBUTTON Name: QMenuBar -SeeAlso: ??? Feature: CONTEXTMENU Description: Supports pop-up menus on right mouse click Section: Widgets Requires: MENU Name: Context menu -SeeeAlso: ??? Feature: PROGRESSBAR Description: Supports presentation of operation progress. Section: Widgets Requires: Name: QProgressBar -SeeAlso: ??? Feature: SLIDER Description: Supports sliders controlling a bounded value. Section: Widgets Requires: Name: QSlider -SeeAlso: ??? Feature: SCROLLBAR Description: Supports scrollbars allowing the user access parts of a @@ -449,98 +388,84 @@ document that is larger than the widget used to display it. Section: Widgets Requires: SLIDER Name: QScrollBar -SeeAlso: ??? Feature: DIAL Description: Supports rounded range control, e.g. like a speedometer. Section: Widgets Requires: SLIDER Name: QDial -SeeAlso: ??? Feature: SCROLLAREA Description: Supports scrolling views onto widgets. Section: Widgets Requires: SCROLLBAR Name: QScrollArea -SeeAlso: ??? Feature: GRAPHICSVIEW Description: Supports the graphicsview classes. Section: Widgets Requires: SCROLLAREA Name: QGraphicsView -SeeAlso: ??? Feature: GRAPHICSEFFECT Description: Supports the graphicseffect classes. Section: Widgets Requires: GRAPHICSVIEW Name: QGraphicsEffect -SeeAlso: ??? Feature: SPINWIDGET Description: Supports spinbox control widgets. Section: Widgets Requires: Name: Spin Widget -SeeAlso: ??? Feature: TEXTEDIT Description: Supports rich text editing. Section: Widgets Requires: SCROLLAREA PROPERTIES Name: QTextEdit -SeeAlso: ??? Feature: SYNTAXHIGHLIGHTER Description: Supports custom syntax highlighting. Section: Widgets Requires: TEXTEDIT Name: QSyntaxHighlighter -SeeAlso: ??? Feature: RUBBERBAND Description: Supports using rubberbands to indicate selections and boundaries. Section: Widgets Requires: Name: QRubberBand -SeeAlso: ??? Feature: TOOLTIP Description: Supports presentation of tooltips. Section: Widgets Requires: Name: QToolTip -SeeAlso: ??? Feature: STATUSTIP Description: Supports status tip functionality and events. Section: Widgets Requires: Name: Status Tip -SeeAlso: ??? Feature: WHATSTHIS Description: Supports displaying "What's this" help. Section: Widgets Requires: TOOLBUTTON Name: QWhatsThis -SeeAlso: ??? Feature: VALIDATOR Description: Supports validation of input text. Section: Widgets Requires: Name: QValidator -SeeAlso: ??? Feature: SIZEGRIP Description: Supports corner-grips for resizing a top-level windows. Section: Widgets Requires: Name: QSizeGrip -SeeAlso: ??? Feature: CALENDARWIDGET Description: Provides a monthly based calendar widget allowing the user to select @@ -548,7 +473,6 @@ a date. Section: Widgets Requires: TABLEVIEW MENU TEXTDATE SPINBOX TOOLBUTTON Name: QCalendarWidget -SeeAlso: ??? Feature: PRINTPREVIEWWIDGET Description: Provides a widget for previewing page layouts for printer output. @@ -556,7 +480,6 @@ a date. Section: Widgets Requires: GRAPHICSVIEW PRINTER MAINWINDOW Name: QPrintPreviewWidget -SeeAlso: ??? # Dialogs @@ -566,70 +489,60 @@ informative messages and simple questions. Section: Dialogs Requires: Name: QMessageBox -SeeAlso: ??? Feature: COLORDIALOG Description: Supports a dialog widget for specifying colors. Section: Dialogs Requires: SPINBOX Name: QColorDialog -SeeAlso: ??? Feature: FILEDIALOG Description: Supports a dialog widget for selecting files or directories. Section: Dialogs Requires: DIRMODEL TREEVIEW COMBOBOX TOOLBUTTON BUTTONGROUP TOOLTIP SPLITTER STACKEDWIDGET PROXYMODEL Name: QFileDialog -SeeAlso: ??? Feature: FONTDIALOG Description: Supports a dialog widget for selecting fonts. Section: Dialogs Requires: STRINGLISTMODEL COMBOBOX VALIDATOR GROUPBOX Name: QFontDialog -SeeAlso: ??? Feature: PRINTDIALOG Description: Supports a dialog widget for specifying printer configuration. Section: Dialogs Requires: PRINTER COMBOBOX BUTTONGROUP SPINBOX TREEVIEW TABWIDGET Name: QPrintDialog -SeeAlso: ??? Feature: PRINTPREVIEWDIALOG Description: Provides a dialog for previewing and configuring page layouts for printer output. Section: Dialogs Requires: PRINTPREVIEWWIDGET PRINTDIALOG TOOLBAR Name: QPrintPreviewDialog -SeeAlso: ??? Feature: PROGRESSDIALOG Description: Supports feedback on the progress of a slow operation. Section: Dialogs Requires: PROGRESSBAR Name: QProgressDialog -SeeAlso: ??? Feature: INPUTDIALOG Description: Supports a simple convenience dialog to get a single value from the user. Section: Dialogs Requires: COMBOBOX SPINBOX STACKEDWIDGET Name: QInputDialog -SeeAlso: ??? Feature: ERRORMESSAGE Description: Supports an error message display dialog. Section: Dialogs Requires: TEXTEDIT Name: QErrorMessage -SeeAlso: ??? Feature: WIZARD Description: Provides a framework for wizards. Section: Dialogs Requires: PROPERTIES Name: QWizard -SeeAlso: ??? # ItemViews @@ -639,28 +552,24 @@ between data and the way it is presented to the user. Section: ItemViews Requires: RUBBERBAND SCROLLAREA Name: The Model/View Framework -SeeAlso: ??? Feature: DIRMODEL Description: Supports a data model for the local filesystem. Section: ItemViews Requires: ITEMVIEWS FILESYSTEMMODEL Name: QDirModel -SeeAlso: ??? Feature: STANDARDITEMMODEL Description: Supports a generic model for storing custom data. Section: ItemViews Requires: ITEMVIEWS Name: QStandardItemModel -SeeAlso: ??? Feature: PROXYMODEL Description: Supports processing of data passed between another model and a view. Section: ItemViews Requires: ITEMVIEWS Name: QAbstractProxyModel -SeeAlso: ??? Feature: SORTFILTERPROXYMODEL Description: Supports sorting and filtering of data passed between @@ -668,56 +577,48 @@ another model and a view. Section: ItemViews Requires: PROXYMODEL Name: QSortFilterProxyModel -SeeAlso: ??? Feature: IDENTITYPROXYMODEL Description: Supports proxying a source model unmodified. Section: ItemViews Requires: PROXYMODEL Name: QIdentityProxyModel -SeeAlso: ??? Feature: STRINGLISTMODEL Description: Supports a model that supplies strings to views. Section: ItemViews Requires: ITEMVIEWS Name: QStringListModel -SeeAlso: ??? Feature: LISTVIEW Description: Supports a list or icon view onto a model. Section: ItemViews Requires: ITEMVIEWS Name: QListView -SeeAlso: ??? Feature: TABLEVIEW Description: Supports a default model/view implementation of a table view. Section: ItemViews Requires: ITEMVIEWS Name: QTableView -SeeAlso: ??? Feature: TREEVIEW Description: Supports a default model/view implementation of a tree view. Section: ItemViews Requires: ITEMVIEWS Name: QTreeView -SeeAlso: ??? Feature: DATAWIDGETMAPPER Description: Provides mapping between a section of a data model to widgets. Section: ItemViews Requires: ITEMVIEWS PROPERTIES Name: QDataWidgetMapper -SeeAlso: ??? Feature: COLUMNVIEW Description: Provides a model/view implementation of a column view. Section: ItemViews Requires: LISTVIEW Name: QColumnView -SeeAlso: ??? # Styles @@ -726,49 +627,42 @@ Description: Supports a Microsoft Windows-like look and feel. Section: Styles Requires: Name: QWindowsStyle -SeeAlso: ??? Feature: STYLE_FUSION Description: Supports a modern platform independent widget style. Section: Styles Requires: IMAGEFORMAT_XPM Name: QFusionStyle -SeeAlso: ??? Feature: STYLE_WINDOWSXP Description: Supports a Microsoft WindowsXP-like look and feel. Section: Styles Requires: STYLE_WINDOWS Name: QWindowsXPStyle -SeeAlso: ??? Feature: STYLE_WINDOWSVISTA Description: Supports a Microsoft WindowsVista-like look and feel. Section: Styles Requires: STYLE_WINDOWSXP Name: QWindowsVistaStyle -SeeAlso: ??? Feature: STYLE_WINDOWSCE Description: WindowsCE look and feel Section: Styles Requires: STYLE_WINDOWS IMAGEFORMAT_XPM Name: QWindowsCEStyle -SeeAlso: ??? Feature: STYLE_WINDOWSMOBILE Description: WindowsMobile look and feel Section: Styles Requires: STYLE_WINDOWS IMAGEFORMAT_XPM Name: QWindowsMobileStyle -SeeAlso: ??? Feature: STYLE_STYLESHEET Description: Section: Styles Requires: STYLE_WINDOWS PROPERTIES CSSPARSER Name: QStyleSheetStyle -SeeAlso: ??? # Images @@ -777,70 +671,60 @@ Description: Supports writing an image format plugin. Section: Images Requires: LIBRARY Name: QImageIOPlugin -SeeAlso: ??? Feature: MOVIE Description: Supports animated images. Section: Images Requires: Name: QMovie -SeeAlso: ??? Feature: IMAGEFORMAT_BMP Description: Supports Microsoft's Bitmap image file format. Section: Images Requires: Name: BMP Image Format -SeeAlso: ??? Feature: IMAGEFORMAT_PPM Description: Supports the Portable Pixmap image file format. Section: Images Requires: Name: PPM Image Format -SeeAlso: ??? Feature: IMAGEFORMAT_XBM Description: Supports the X11 Bitmap image file format. Section: Images Requires: Name: XBM Image Format -SeeAlso: ??? Feature: IMAGEFORMAT_XPM Description: Supports the X11 Pixmap image file format. Section: Images Requires: Name: XPM Image Format -SeeAlso: ??? Feature: IMAGEFORMAT_PNG Description: Supports the Portable Network Graphics image file format. Section: Images Requires: Name: PNG Image Format -SeeAlso: ??? Feature: IMAGEFORMAT_JPEG Description: Supports the Joint Photographic Experts Group image file format. Section: Images Requires: Name: JPEG Image Format -SeeAlso: ??? Feature: IMAGE_HEURISTIC_MASK Description: Supports creating a 1-bpp heuristic mask for images. Section: Images Requires: Name: QImage::createHeuristicMask() -SeeAlso: ??? Feature: IMAGE_TEXT Description: Supports image file text strings. Section: Images Requires: Name: Image Text -SeeAlso: ??? # Painting @@ -849,7 +733,6 @@ Description: Supports recording and replaying QPainter commands. Section: Painting Requires: Name: QPicture -SeeAlso: ??? Feature: COLORNAMES Description: Supports color names such as "red", used by QColor @@ -857,42 +740,36 @@ and by some HTML documents. Section: Painting Requires: Name: Color Names -SeeAlso: ??? Feature: PDF Description: Supports pdf format Section: Painting Requires: TEMPORARYFILE Name: QPdf -SeeAlso: ??? Feature: PRINTER Description: Supports printing Section: Painting Requires: PICTURE TEMPORARYFILE Name: QPrinter -SeeAlso: ??? Feature: CUPS Description Supports the Common UNIX Printing System Section: Painting Requires: PRINTER LIBRARY Name: Common UNIX Printing System -SeeAlso: ??? Feature: PAINTONSCREEN Description: Supports the Qt::WA_PaintOnScreen widget attribute. Section: Painting Requires: Name: Qt::WA_PaintOnScreen -SeeAlso: ??? Feature: PAINT_DEBUG Description: Debug painting with the environment variables QT_FLUSH_UPDATE and QT_FLUSH_PAINT Section: Painting Requires: Name: Painting Debug Utilities -SeeAlso: ??? # Fonts @@ -901,7 +778,6 @@ Description: Supports the FreeType 2 font engine (and its supported font formats Section: Fonts Requires: Name: Freetype Font Engine -SeeAlso: ??? # Internationalization @@ -910,42 +786,36 @@ Description: Supports translations using QObject::tr(). Section: Internationalization Requires: Name: Translation -SeeAlso: ??? Feature: TRANSLATION_UTF8 Description: Supports translations using QObject::trUtf8(). Section: Internationalization Requires: TRANSLATION TEXTCODEC Name: Translation (UTF-8 representation) -SeeAlso: ??? Feature: TEXTCODEC Description: Supports conversions between text encodings. Section: Internationalization Requires: Name: QTextCodec -SeeAlso: ??? Feature: CODECS Description: Supports non-unicode text conversions. Section: Internationalization Requires: TEXTCODEC Name: Codecs -SeeAlso: ??? Feature: BIG_CODECS Description: Supports big codecs, e.g. CJK. Section: Internationalization Requires: TEXTCODEC Name: Big Codecs -SeeAlso: ??? Feature: ICONV Description: Supports conversions between text encodings using iconv. Section: Internationalization Requires: TEXTCODEC Name: iconv -SeeAlso: ??? # Networking @@ -954,70 +824,60 @@ Description: Supports host name lookups. Section: Networking Requires: Name: QHostInfo -SeeAlso: ??? Feature: FTP Description: Supports FTP file access. Section: Networking Requires: TEXTDATE Name: File Transfer Protocol -SeeAlso: ??? Feature: HTTP Description: Supports HTTP file access. Section: Networking Requires: HOSTINFO Name: Hyper Text Transfer Protocol -SeeAlso: ??? Feature: UDPSOCKET Description: Supports User Datagram Protocol sockets. Section: Networking Requires: Name: QUdpSocket -SeeAlso: ??? Feature: NETWORKPROXY Description: Supports configuring network layer proxy support to the Qt network classes. Section: Networking Requires: Name: QNetworkProxy -SeeAlso: ??? Feature: SOCKS5 Description: Supports SOCKS v5 network proxy. Section: Networking Requires: NETWORKPROXY Name: SOCKS5 -SeeAlso: ??? Feature: NETWORKINTERFACE Description: Supports listing the host's IP addresses and network interfaces Section: Networking Requires: Name: QNetworkInterface -SeeAlso: ??? Feature: NETWORKDISKCACHE Description: Supports a disk cache for network resources Section: Networking Requires: TEMPORARYFILE Name: QNetworkDiskCache -SeeAlso: ??? Feature: BEARERMANAGEMENT Description: Provides bearer management support Section: Networking Requires: LIBRARY NETWORKINTERFACE PROPERTIES Name: Bearer Management -SeeAlso: ??? Feature: LOCALSERVER Description: Supports a local socket based server Section: Networking Requires: TEMPORARYFILE Name: QLocalServer -SeeAlso: ??? # Utilities @@ -1026,84 +886,72 @@ Description: Provides completions based on an item model. Section: Utilities Requires: PROXYMODEL Name: QCompleter -SeeAlso: ??? Feature: FSCOMPLETER Description: Provides completions based on an item model. Section: Utilities Requires: FILESYSTEMMODEL COMPLETER Name: QCompleter -SeeAlso: ??? Feature: DESKTOPSERVICES Description: Provides methods for accessing common desktop services. Section: Utilities Requires: Name: QDesktopServices -SeeAlso: ??? Feature: SYSTEMTRAYICON Description: Provides an icon for an application in the system tray. Section: Utilities Requires: Name: QSystemTrayIcon -SeeAlso: ??? Feature: UNDOCOMMAND Description: Applies (redo or) undo of a single change in a document. Section: Utilities Requires: Name: QUndoCommand -SeeAlso: ??? Feature: UNDOSTACK Description: Provides the ability to (redo or) undo a list of changes in a document. Section: Utilities Requires: UNDOCOMMAND Name: QUndoStack -SeeAlso: ??? Feature: UNDOGROUP Description: Section: Utilities Requires: UNDOSTACK Name: QUndoGroup -SeeAlso: ??? Feature: UNDOVIEW Description: A widget which shows the contents of an undo stack. Section: Utilities Requires: UNDOSTACK LISTVIEW Name: QUndoView -SeeAlso: ??? Feature: ACCESSIBILITY Description: Provides accessibility support. Section: Utilities Requires: PROPERTIES MENUBAR Name: Accessibility -SeeAlso: ??? Feature: ANIMATION Description: Provides a framework for animations. Section: Utilities Requires: PROPERTIES Name: Animation -SeeAlso: ??? Feature: STATEMACHINE Description: Provides hierarchical finite state machines. Section: Utilities Requires: PROPERTIES Name: State machine -SeeAlso: ??? Feature: GESTURES Description: Provides a framework for gestures. Section: Utilities Requires: Name: Gesture -SeeAlso: ??? # D-Bus @@ -1112,5 +960,4 @@ Description: Provides classes for D-Bus. Section: D-Bus Requires: PROPERTIES XMLSTREAMREADER Name: Qt D-Bus module -SeeAlso: ??? -- cgit v1.2.3 From e658f70b852c4c618e330a06a45670d0d342ff6b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 23 Oct 2013 15:08:26 +0200 Subject: don't explicitly exclude qconfig.h when building moc it excludes itself for bootstrapped builds. Change-Id: I22fa969c47ff69eab8c96bf0917b0859c65b2fd9 Reviewed-by: Joerg Bornemann --- src/corelib/global/qglobal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index d7253c39c6..1d19a6cf6f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -55,7 +55,7 @@ */ #define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) -#if !defined(QT_BUILD_MOC) && !defined(QT_BUILD_QMAKE) && !defined(QT_BUILD_CONFIGURE) +#if !defined(QT_BUILD_QMAKE) && !defined(QT_BUILD_CONFIGURE) #include #endif -- cgit v1.2.3 From dff6d73d6c37c40790d90bfdf3cb2f6e75c5bfa4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 24 Oct 2013 15:05:34 +0200 Subject: Introduce Windows version 8.1 and detect by checking the version. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I04012218c34f7a95a87fcf2dc7fc095f0e743e67 Reviewed-by: Joerg Bornemann Reviewed-by: Oliver Wolff Reviewed-by: Andrew Knight Reviewed-by: Björn Breitmeyer --- src/corelib/global/qglobal.cpp | 40 +++++++++++++++++++++++++++++++++++++--- src/corelib/global/qsysinfo.h | 2 ++ 2 files changed, 39 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 1dd77c5859..51cf91a77d 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1018,6 +1018,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \value WV_VISTA Windows Vista, Windows Server 2008 (operating system version 6.0) \value WV_WINDOWS7 Windows 7, Windows Server 2008 R2 (operating system version 6.1) \value WV_WINDOWS8 Windows 8 (operating system version 6.2) + \value WV_WINDOWS8_1 Windows 8.1 (operating system version 6.3), introduced in Qt 5.2 Alternatively, you may use the following macros which correspond directly to the Windows operating system version number: @@ -1028,6 +1029,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \value WV_6_0 Operating system version 6.0, corresponds to Windows Vista and Windows Server 2008 \value WV_6_1 Operating system version 6.1, corresponds to Windows 7 and Windows Server 2008 R2 \value WV_6_2 Operating system version 6.2, corresponds to Windows 8 + \value WV_6_3 Operating system version 6.3, corresponds to Windows 8.1, introduced in Qt 5.2 CE-based versions: @@ -1744,6 +1746,38 @@ QT_BEGIN_INCLUDE_NAMESPACE #include "qt_windows.h" QT_END_INCLUDE_NAMESPACE +#ifndef Q_OS_WINRT +static inline OSVERSIONINFO winOsVersion() +{ + OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0, {'\0'}}; + // GetVersionEx() has been deprecated in Windows 8.1 and will return + // only Windows 8 from that version on. +# if defined(_MSC_VER) && _MSC_VER >= 1800 +# pragma warning( push ) +# pragma warning( disable : 4996 ) +# endif + GetVersionEx(&result); +# if defined(_MSC_VER) && _MSC_VER >= 1800 +# pragma warning( pop ) +# endif +# ifndef Q_OS_WINCE + if (result.dwMajorVersion == 6 && result.dwMinorVersion == 2) { + // This could be Windows 8.1 or higher. Note that as of Windows 9, + // the major version needs to be checked as well. + DWORDLONG conditionMask = 0; + VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL); + VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL); + VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL); + OSVERSIONINFOEX checkVersion = { sizeof(OSVERSIONINFOEX), result.dwMajorVersion, result.dwMinorVersion, + result.dwBuildNumber, result.dwPlatformId, {'\0'}, 0, 0, 0, 0, 0 }; + for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMinorVersion) + result.dwMinorVersion = checkVersion.dwMinorVersion; + } +# endif // !Q_OS_WINCE + return result; +} +#endif // !Q_OS_WINRT + QSysInfo::WinVersion QSysInfo::windowsVersion() { #ifndef VER_PLATFORM_WIN32s @@ -1766,9 +1800,7 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() winver = QSysInfo::WV_WINDOWS8; #else winver = QSysInfo::WV_NT; - OSVERSIONINFO osver; - osver.dwOSVersionInfoSize = sizeof(osver); - GetVersionEx(&osver); + const OSVERSIONINFO osver = winOsVersion(); #ifdef Q_OS_WINCE DWORD qt_cever = 0; qt_cever = osver.dwMajorVersion * 100; @@ -1814,6 +1846,8 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() winver = QSysInfo::WV_WINDOWS7; } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 2) { winver = QSysInfo::WV_WINDOWS8; + } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 3) { + winver = QSysInfo::WV_WINDOWS8_1; } else { qWarning("Qt: Untested Windows version %d.%d detected!", int(osver.dwMajorVersion), int(osver.dwMinorVersion)); diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h index a6accdfebc..bd76f908e7 100644 --- a/src/corelib/global/qsysinfo.h +++ b/src/corelib/global/qsysinfo.h @@ -96,6 +96,7 @@ public: WV_VISTA = 0x0080, WV_WINDOWS7 = 0x0090, WV_WINDOWS8 = 0x00a0, + WV_WINDOWS8_1 = 0x00b0, WV_NT_based = 0x00f0, /* version numbers */ @@ -106,6 +107,7 @@ public: WV_6_0 = WV_VISTA, WV_6_1 = WV_WINDOWS7, WV_6_2 = WV_WINDOWS8, + WV_6_3 = WV_WINDOWS8_1, WV_CE = 0x0100, WV_CENET = 0x0200, -- cgit v1.2.3 From f609e65a911efad7472a18fcbed983936af116b8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 13 Oct 2013 23:24:43 +0200 Subject: QImageWriter: add a forgotten #ifndef QT_NO_IMAGEFORMAT_BPM The equivalent code in qimagereader.cpp has this, so add here, too. Change-Id: I0313727f009db5cb00ee9ce0540ba2674da49ccd Reviewed-by: Friedemann Kleint --- src/gui/image/qimagewriter.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index e4065724be..900093b51b 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -772,7 +772,9 @@ QList QImageWriter::supportedImageFormats() QList QImageWriter::supportedMimeTypes() { QSet mimeTypes; +#ifndef QT_NO_IMAGEFORMAT_BMP mimeTypes << "image/bmp"; +#endif #ifndef QT_NO_IMAGEFORMAT_PPM mimeTypes << "image/x-portable-bitmap"; mimeTypes << "image/x-portable-graymap"; -- cgit v1.2.3 From 8fd9fe209934ac92210ed3b81723ad5e21a98a30 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 18 Oct 2013 12:42:42 +0200 Subject: Android: Fix repaint on rotation After f89f099c55576992b39a8021aace64ff32747624, we no longer post a geometry-change and expose event when calling setGeometry, which the Android plugin depended on. This caused the window to stay the same size when it was resized by orientation changes. We put back the events in the code that calls setGeometry() instead. Task-number: QTBUG-32878 Change-Id: I449515dda07c839e0991c5a7031a972ca9c74dff Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/src/androidjnimain.cpp | 15 +++------------ src/plugins/platforms/android/src/androidjnimain.h | 1 - .../android/src/opengl/qandroidopenglcontext.cpp | 2 ++ .../android/src/opengl/qandroidopenglplatformwindow.cpp | 5 ++++- .../platforms/android/src/opengl/qeglfshooks_android.cpp | 2 +- 5 files changed, 10 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp index 5c9ca798a8..34413ae509 100644 --- a/src/plugins/platforms/android/src/androidjnimain.cpp +++ b/src/plugins/platforms/android/src/androidjnimain.cpp @@ -247,17 +247,6 @@ namespace QtAndroid m_surfaceMutex.unlock(); return m_nativeWindow; } - - QSize nativeWindowSize() - { - if (m_nativeWindow == 0) - return QAndroidPlatformIntegration::defaultDesktopSize(); - - int width = ANativeWindow_getWidth(m_nativeWindow); - int height = ANativeWindow_getHeight(m_nativeWindow); - - return QSize(width, height); - } #endif void setAndroidPlatformIntegration(QAndroidPlatformIntegration *androidPlatformIntegration) @@ -564,7 +553,9 @@ static void setSurface(JNIEnv *env, jobject /*thiz*/, jobject jSurface) m_waitForWindowSemaphore.release(); if (m_androidPlatformIntegration) { - QSize size = QtAndroid::nativeWindowSize(); + // Use the desktop size. + // On some devices, the getters for the native window size gives wrong values + QSize size = QAndroidPlatformIntegration::defaultDesktopSize(); QPlatformScreen *screen = m_androidPlatformIntegration->screen(); QRect geometry(QPoint(0, 0), size); diff --git a/src/plugins/platforms/android/src/androidjnimain.h b/src/plugins/platforms/android/src/androidjnimain.h index 9a3d8a9607..b530aac884 100644 --- a/src/plugins/platforms/android/src/androidjnimain.h +++ b/src/plugins/platforms/android/src/androidjnimain.h @@ -75,7 +75,6 @@ namespace QtAndroid void flushImage(const QPoint &pos, const QImage &image, const QRect &rect); #else EGLNativeWindowType nativeWindow(bool waitToCreate = true); - QSize nativeWindowSize(); #endif QWindow *topLevelWindowAt(const QPoint &globalPos); diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp index 9d6d4003f7..6431914812 100644 --- a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp @@ -71,6 +71,8 @@ void QAndroidOpenGLContext::swapBuffers(QPlatformSurface *surface) if (size.isValid()) { QRect geometry(QPoint(0, 0), size); window->setGeometry(geometry); + QWindowSystemInterface::handleGeometryChange(window->window(), geometry); + QWindowSystemInterface::handleExposeEvent(window->window(), QRegion(geometry)); window->scheduleResize(QSize()); } window->unlock(); diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp index 4934047af9..258a0968e8 100644 --- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp @@ -41,6 +41,7 @@ #include "qandroidopenglplatformwindow.h" #include "androidjnimain.h" +#include "qandroidplatformintegration.h" #include QT_BEGIN_NAMESPACE @@ -110,7 +111,9 @@ void QAndroidOpenGLPlatformWindow::resetSurface() { lock(); - scheduleResize(QtAndroid::nativeWindowSize()); + // Use the desktop size. + // On some devices, the getters for the native window size gives wrong values + scheduleResize(QAndroidPlatformIntegration::defaultDesktopSize()); QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event unlock(); } diff --git a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp b/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp index 338966eb40..e7e53e72a2 100644 --- a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp +++ b/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp @@ -82,7 +82,7 @@ EGLNativeDisplayType QEglFSAndroidHooks::platformDisplay() const QSize QEglFSAndroidHooks::screenSize() const { - return QtAndroid::nativeWindowSize(); + return QAndroidPlatformIntegration::defaultDesktopSize(); } QSizeF QEglFSAndroidHooks::physicalScreenSize() const -- cgit v1.2.3 From 9a369a25ddfac9352cabde65c8476c7433dc6c3a Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 21 Oct 2013 14:53:16 +0200 Subject: Accessibility: Make it possible to send events with no QObject MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Icbb9d15ec52ff5f7718eaf3600cab140971274aa Reviewed-by: Jan Arve Sæther --- src/gui/accessible/qaccessible.cpp | 41 ++++++++++-- src/gui/accessible/qaccessible.h | 72 +++++++++++++++++++++- src/plugins/platforms/cocoa/qcocoaaccessibility.mm | 10 +-- 3 files changed, 110 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index b8771ec583..5d28512697 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -1270,8 +1270,16 @@ QAccessibleInterface::~QAccessibleInterface() /*! \fn QAccessibleEvent::QAccessibleEvent(QObject *object, QAccessible::Event type) Constructs a QAccessibleEvent to notify that \a object has changed. - The event \a type explains what changed. - */ + The event \a type describes what changed. +*/ + +/*! \fn QAccessibleEvent::QAccessibleEvent(QAccessibleInterface *interface, QAccessible::Event type) + + Constructs a QAccessibleEvent to notify that \a interface has changed. + The event \a type describes what changed. + Use this function if you already have a QAccessibleInterface or no QObject, otherwise consider + the overload taking a \l QObject parameter as it might be cheaper. +*/ /*! \fn QAccessibleEvent::~QAccessibleEvent() Destroys the event. @@ -1293,6 +1301,22 @@ QAccessibleInterface::~QAccessibleInterface() Returns the child index. */ +/*! + \internal + Returns the uniqueId of the QAccessibleInterface represented by this event. + + In case the object() function returns 0 this is the only way to access the + interface. +*/ +QAccessible::Id QAccessibleEvent::uniqueId() const +{ + if (!m_object) + return m_uniqueId; + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object); + if (m_child != -1) + iface = iface->child(m_child); + return QAccessible::uniqueId(iface); +} /*! \class QAccessibleValueChangeEvent @@ -1530,6 +1554,9 @@ QAccessibleInterface::~QAccessibleInterface() */ QAccessibleInterface *QAccessibleEvent::accessibleInterface() const { + if (m_object == 0) + return QAccessible::accessibleInterface(m_uniqueId); + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object); if (!iface || !iface->isValid()) { static bool hasWarned = false; @@ -1681,9 +1708,13 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev) d << "QAccessibleEvent(null)"; return d; } - d.nospace() << "QAccessibleEvent(object=" << hex << ev.object(); - d.nospace() << dec; - d.nospace() << "child=" << ev.child(); + d.nospace() << "QAccessibleEvent("; + if (ev.object()) { + d.nospace() << "object=" << hex << ev.object() << dec; + d.nospace() << "child=" << ev.child(); + } else { + d.nospace() << "no object, uniqueId=" << ev.uniqueId(); + } d << " event=" << qAccessibleEventString(ev.type()); if (ev.type() == QAccessible::StateChanged) { QAccessible::State changed = static_cast(&ev)->changedStates(); diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index d5b0af550e..25ce161940 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -597,6 +597,7 @@ class Q_GUI_EXPORT QAccessibleEvent { Q_DISABLE_COPY(QAccessibleEvent) public: + inline QAccessibleEvent(QObject *obj, QAccessible::Event typ) : m_type(typ), m_object(obj), m_child(-1) { @@ -613,11 +614,27 @@ public: Q_ASSERT(m_type != QAccessible::TableModelChanged); } + inline QAccessibleEvent(QAccessibleInterface *iface, QAccessible::Event typ) + : m_type(typ), m_object(0) + { + Q_ASSERT(iface); + Q_ASSERT(m_type != QAccessible::ValueChanged); + Q_ASSERT(m_type != QAccessible::StateChanged); + Q_ASSERT(m_type != QAccessible::TextCaretMoved); + Q_ASSERT(m_type != QAccessible::TextSelectionChanged); + Q_ASSERT(m_type != QAccessible::TextInserted); + Q_ASSERT(m_type != QAccessible::TextRemoved); + Q_ASSERT(m_type != QAccessible::TextUpdated); + Q_ASSERT(m_type != QAccessible::TableModelChanged); + m_uniqueId = QAccessible::uniqueId(iface); + } + virtual ~QAccessibleEvent() {} QAccessible::Event type() const { return m_type; } QObject *object() const { return m_object; } + QAccessible::Id uniqueId() const; void setChild(int chld) { m_child = chld; } int child() const { return m_child; } @@ -627,7 +644,11 @@ public: protected: QAccessible::Event m_type; QObject *m_object; - int m_child; + union { + int m_child; + QAccessible::Id m_uniqueId; + }; + }; class Q_GUI_EXPORT QAccessibleStateChangeEvent :public QAccessibleEvent @@ -638,6 +659,11 @@ public: { m_type = QAccessible::StateChanged; } + inline QAccessibleStateChangeEvent(QAccessibleInterface *iface, QAccessible::State state) + : QAccessibleEvent(iface, QAccessible::InvalidEvent), m_changedStates(state) + { + m_type = QAccessible::StateChanged; + } QAccessible::State changedStates() const { return m_changedStates; @@ -657,6 +683,12 @@ public: { m_type = QAccessible::TextCaretMoved; } + inline QAccessibleTextCursorEvent(QAccessibleInterface *iface, int cursorPos) + : QAccessibleEvent(iface, QAccessible::InvalidEvent) + , m_cursorPosition(cursorPos) + { + m_type = QAccessible::TextCaretMoved; + } void setCursorPosition(int position) { m_cursorPosition = position; } int cursorPosition() const { return m_cursorPosition; } @@ -675,6 +707,12 @@ public: { m_type = QAccessible::TextSelectionChanged; } + inline QAccessibleTextSelectionEvent(QAccessibleInterface *iface, int start, int end) + : QAccessibleTextCursorEvent(iface, (start == -1) ? 0 : end) + , m_selectionStart(start), m_selectionEnd(end) + { + m_type = QAccessible::TextSelectionChanged; + } void setSelection(int start, int end) { m_selectionStart = start; @@ -698,6 +736,12 @@ public: { m_type = QAccessible::TextInserted; } + inline QAccessibleTextInsertEvent(QAccessibleInterface *iface, int position, const QString &text) + : QAccessibleTextCursorEvent(iface, position + text.length()) + , m_position(position), m_text(text) + { + m_type = QAccessible::TextInserted; + } QString textInserted() const { return m_text; @@ -720,6 +764,12 @@ public: { m_type = QAccessible::TextRemoved; } + inline QAccessibleTextRemoveEvent(QAccessibleInterface *iface, int position, const QString &text) + : QAccessibleTextCursorEvent(iface, position) + , m_position(position), m_text(text) + { + m_type = QAccessible::TextRemoved; + } QString textRemoved() const { return m_text; @@ -742,6 +792,12 @@ public: { m_type = QAccessible::TextUpdated; } + inline QAccessibleTextUpdateEvent(QAccessibleInterface *iface, int position, const QString &oldText, const QString &text) + : QAccessibleTextCursorEvent(iface, position + text.length()) + , m_position(position), m_oldText(oldText), m_text(text) + { + m_type = QAccessible::TextUpdated; + } QString textRemoved() const { return m_oldText; } @@ -767,6 +823,12 @@ public: { m_type = QAccessible::ValueChanged; } + inline QAccessibleValueChangeEvent(QAccessibleInterface *iface, const QVariant &val) + : QAccessibleEvent(iface, QAccessible::InvalidEvent) + , m_value(val) + { + m_type = QAccessible::ValueChanged; + } void setValue(const QVariant & val) { m_value= val; } QVariant value() const { return m_value; } @@ -794,6 +856,14 @@ public: { m_type = QAccessible::TableModelChanged; } + inline QAccessibleTableModelChangeEvent(QAccessibleInterface *iface, ModelChangeType changeType) + : QAccessibleEvent(iface, QAccessible::InvalidEvent) + , m_modelChangeType(changeType) + , m_firstRow(-1), m_firstColumn(-1), m_lastRow(-1), m_lastColumn(-1) + { + m_type = QAccessible::TableModelChanged; + } + void setModelChangeType(ModelChangeType changeType) { m_modelChangeType = changeType; } ModelChangeType modelChangeType() const { return m_modelChangeType; } diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm index e135f36e78..f43beb1bb5 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm @@ -56,12 +56,8 @@ QCocoaAccessibility::~QCocoaAccessibility() void QCocoaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) { - QObject *object = event->object(); - if (!object) - return; - - QAccessibleInterface *interface = event->accessibleInterface(); - if (!interface) + QAccessible::Id interfaceId = event->uniqueId(); + if (!interfaceId) return; switch (event->type()) { @@ -69,7 +65,7 @@ void QCocoaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) case QAccessible::TextInserted : case QAccessible::TextRemoved : case QAccessible::TextUpdated : { - QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId : QAccessible::uniqueId(interface) parent : nil]; + QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId : interfaceId parent : nil]; [element autorelease]; NSAccessibilityPostNotification(element, NSAccessibilityValueChangedNotification); break; } -- cgit v1.2.3 From 27f2b971550ceafc7810a5a2d25450319ab0ccc5 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 24 Oct 2013 13:16:36 +0300 Subject: Cleanup java files. Remove unused imports Change-Id: I9752ff3593cf97153133381736ef3c8c62898bd7 Reviewed-by: Paul Olav Tvete --- src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java | 2 +- src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java | 1 - src/android/jar/src/org/qtproject/qt5/android/QtNative.java | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 11af4d4280..503b38ae79 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -362,7 +362,7 @@ public class QtActivityDelegate + "\tNECESSITAS_API_LEVEL=" + necessitasApiLevel + "\tHOME=" + m_activity.getFilesDir().getAbsolutePath() + "\tTMPDIR=" + m_activity.getFilesDir().getAbsolutePath(); - if (android.os.Build.VERSION.SDK_INT < 14) + if (Build.VERSION.SDK_INT < 14) additionalEnvironmentVariables += "\tQT_ANDROID_FONTS=Droid Sans;Droid Sans Fallback"; else additionalEnvironmentVariables += "\tQT_ANDROID_FONTS=Roboto;Droid Sans;Droid Sans Fallback"; diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java b/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java index f251369737..3aba42642a 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java @@ -43,7 +43,6 @@ package org.qtproject.qt5.android; import android.content.Context; -import android.os.Build; import android.view.View; import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.CompletionInfo; diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java index 1385c90e3e..b37f1e87fd 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -50,7 +50,6 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; -import android.os.Build; import android.text.ClipboardManager; import android.util.Log; import android.view.ContextMenu; -- cgit v1.2.3 From c1815a7b3f842041b88dafc3b3c0ffeff3e6cb10 Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Fri, 25 Oct 2013 08:41:19 +0200 Subject: Fix compile warnings on 10.6 Apple clang 3.0 complains about missing function declarations. Add them. Change-Id: Ib9c3c238c94e8649844cf3e67a659875ad549ecb Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm | 1 + src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 1 + src/plugins/platforms/cocoa/qcocoamenu.mm | 1 + 3 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index d90d77ec1d..be2bab8ce7 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -82,6 +82,7 @@ static NSButton *macCreateButton(const char *text, NSView *superview) BOOL mDialogIsExecuting; BOOL mResultSet; }; +- (void)restoreOriginalContentView; - (void)relayout; - (void)updateQtColor; - (void)finishOffWithCode:(NSInteger)code; diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index 91fb52eb6d..dc22da0983 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -121,6 +121,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) BOOL mDialogIsExecuting; BOOL mResultSet; }; +- (void)restoreOriginalContentView; - (void)relayout; - (void)relayoutToContentSize:(NSSize)frameSize; - (void)updateQtFont; diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 14b8dee101..16b02a93f5 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -84,6 +84,7 @@ static inline QCocoaMenuLoader *getMenuLoader() } - (id) initWithMenu:(QCocoaMenu*) m; +- (BOOL)hasShortcut:(NSMenu *)menu forKey:(NSString *)key forModifiers:(NSUInteger)modifier; @end -- cgit v1.2.3 From fcebbaeba37422780afd58a1a63954bdbf1a67e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Luis=20Boya=20Garc=C3=ADa?= Date: Wed, 16 Oct 2013 17:34:52 +0200 Subject: Fix virtual key mapping on MS Windows In order to map MS Windows virtual keys to Qt keys without messing with dead keys now I use the built-in keyMap structure of QWindowsKeyMapper and assert every cell in the keymap is properly updated. In order to guarantee this even when the user changes the keyboard layout, WndProc now manages the WM_INPUTLANGCHANGE message, which is handled by QWindowsKeyMapper, resetting the layout structure. I don't fully understand yet some things about QWindowsKeyMapper, i.e. how QWindowsKeyMapper::updatePossibleKeyCodes workarounds the dead key issue with ToAscii; but it seems to work fine in all the tests I've done. Any further testing is highly appreciated, though. [ChangeLog][[QtGui][Platform Specific Changes][Windows] Fixed virtual key mapping on Windows. Task-number: QTBUG-33409 Task-number: QTBUG-8764 Task-number: QTBUG-10032 Change-Id: I4f7709a90906b03f4504deea1ff5c361e9f94b3f Reviewed-by: Friedemann Kleint --- src/corelib/kernel/qcoreapplication_win.cpp | 5 +++ src/plugins/platforms/windows/qtwindowsglobal.h | 5 +++ src/plugins/platforms/windows/qwindowscontext.cpp | 1 + .../platforms/windows/qwindowskeymapper.cpp | 47 +++++++++------------- 4 files changed, 31 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 418074dc7a..65ca6b0dcb 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -831,6 +831,11 @@ QString decodeMSG(const MSG& msg) } break; #endif +#ifdef WM_INPUTLANGCHANGE + case WM_INPUTLANGCHANGE: + parameters = QStringLiteral("Keyboard layout changed"); + break; +#endif // WM_INPUTLANGCHANGE #ifdef WM_NCACTIVATE case WM_NCACTIVATE: { diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h index f6ed9447ef..7b574b0a56 100644 --- a/src/plugins/platforms/windows/qtwindowsglobal.h +++ b/src/plugins/platforms/windows/qtwindowsglobal.h @@ -93,6 +93,7 @@ enum WindowsEventType // Simplify event types NonClientHitTest = NonClientEventFlag + 2, KeyEvent = KeyEventFlag + 1, KeyDownEvent = KeyEventFlag + KeyDownEventFlag + 1, + KeyboardLayoutChangeEvent = KeyEventFlag + 2, InputMethodKeyEvent = InputMethodEventFlag + KeyEventFlag + 1, InputMethodKeyDownEvent = InputMethodEventFlag + KeyEventFlag + KeyDownEventFlag + 1, ClipboardEvent = ClipboardEventFlag + 1, @@ -165,6 +166,10 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI return QtWindows::InputMethodKeyEvent; case WM_IME_KEYDOWN: return QtWindows::InputMethodKeyDownEvent; +#ifdef WM_INPUTLANGCHANGE + case WM_INPUTLANGCHANGE: + return QtWindows::KeyboardLayoutChangeEvent; +#endif // WM_INPUTLANGCHANGE case WM_TOUCH: return QtWindows::TouchEvent; case WM_CHANGECBCHAIN: diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 85b03673ac..174b3312d2 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -842,6 +842,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::KeyEvent: case QtWindows::InputMethodKeyEvent: case QtWindows::InputMethodKeyDownEvent: + case QtWindows::KeyboardLayoutChangeEvent: #if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInterractionBlocked() ? true : d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result); #else diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 47c136991a..994128738b 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -574,7 +574,7 @@ void QWindowsKeyMapper::updateKeyMap(const MSG &msg) { unsigned char kbdBuffer[256]; // Will hold the complete keyboard state GetKeyboardState(kbdBuffer); - quint32 scancode = (msg.lParam >> 16) & 0xfff; + const quint32 scancode = (msg.lParam >> 16) & 0xff; updatePossibleKeyCodes(kbdBuffer, scancode, msg.wParam); } @@ -742,12 +742,21 @@ bool QWindowsKeyMapper::translateKeyEvent(QWindow *widget, HWND hwnd, const MSG &msg, LRESULT *result) { *result = 0; + + // Reset layout map when system keyboard layout is changed + if (msg.message == WM_INPUTLANGCHANGE) { + deleteLayouts(); + return true; + } + + // Add this key to the keymap if it is not present yet. + updateKeyMap(msg); + MSG peekedMsg; // consume dead chars?(for example, typing '`','a' resulting in a-accent). if (PeekMessage(&peekedMsg, hwnd, 0, 0, PM_NOREMOVE) && peekedMsg.message == WM_DEADCHAR) return true; - if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN) - updateKeyMap(msg); + return translateKeyEventInternal(widget, msg, false); } @@ -755,9 +764,8 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms { const int msgType = msg.message; - const quint32 scancode = (msg.lParam >> 16) & 0xfff; - const quint32 vk_key = MapVirtualKey(scancode, 1); - const bool isNumpad = (msg.wParam >= VK_NUMPAD0 && msg.wParam <= VK_NUMPAD9); + const quint32 scancode = (msg.lParam >> 16) & 0xff; + const quint32 vk_key = msg.wParam; quint32 nModifiers = 0; QWindow *receiver = m_keyGrabber ? m_keyGrabber : window; @@ -786,10 +794,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms state |= (nModifiers & AltAny ? int(Qt::AltModifier) : 0); state |= (nModifiers & MetaAny ? int(Qt::MetaModifier) : 0); - // Now we know enough to either have MapVirtualKey or our own keymap tell us if it's a deadkey - const bool isDeadKey = isADeadKey(msg.wParam, state) - || MapVirtualKey(msg.wParam, 2) & 0x80000000; - // A multi-character key or a Input method character // not found by our look-ahead if (msgType == WM_CHAR || msgType == WM_IME_CHAR) { @@ -849,23 +853,12 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms return true; // Translate VK_* (native) -> Key_* (Qt) keys - // If it's a dead key, we cannot use the toKeyOrUnicode() function, since that will change - // the internal state of the keyboard driver, resulting in that dead keys no longer works. - // ..also if we're typing numbers on the keypad, while holding down the Alt modifier. - int code = 0; - if (isNumpad && (nModifiers & AltAny)) { - code = winceKeyBend(msg.wParam); - } else if (!isDeadKey) { - // QTBUG-8764, QTBUG-10032 - // Can't call toKeyOrUnicode because that would call ToUnicode, and, if a dead key - // is pressed at the moment, Windows would NOT use it to compose a character for the next - // WM_CHAR event. - - // Instead, use MapVirtualKey, which will provide adequate values. - code = MapVirtualKey(msg.wParam, MAPVK_VK_TO_CHAR); - if (code < 0x20 || code == 0x7f) // The same logic as in toKeyOrUnicode() - code = winceKeyBend(msg.wParam); - } + int modifiersIndex = 0; + modifiersIndex |= (nModifiers & ShiftAny ? 0x1 : 0); + modifiersIndex |= (nModifiers & ControlAny ? 0x2 : 0); + modifiersIndex |= (nModifiers & AltAny ? 0x4 : 0); + + int code = keyLayout[vk_key].qtKey[modifiersIndex]; // Invert state logic: // If the key actually pressed is a modifier key, then we remove its modifier key from the -- cgit v1.2.3 From c15e8517ef877a141df7cd5d4767d19ac81e7c2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Luis=20Boya=20Garc=C3=ADa?= Date: Wed, 23 Oct 2013 12:34:02 +0200 Subject: Fix bug in updatePossibleKeyCodes() with dead keys and modifiers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As it was until now, QWindowsKeyMapper::updatePossibleKeyCodes() tested using ToUnicode for which characters produce a key with every possible combination of modifiers. Calling ToUnicode with a dead key is dangerous, because MS Windows keeps it in the driver buffer, so if you call ToUnicode with acute key and then you press a, you get an á. To prevent this, updatePossibleKeyCodes() checked if the key that was being tested was a dead key. If true, it inserted an space and then repeated the key in order to reset the system internal buffers to the same state they were before the call. The problem with this is if the dead key is really two keys (like ^ or ´ in US International keyboard layout) and you press one of those keys without the modifier to make it a dead key (i.e. 6 in US International): Since updatePossibleKeyCodes() only tests for the key that was pressed it gets 6 is not a dead key, and thus it does not execute the workaround. Thus, the next time the user presses 'a' they get 'â' instead because updatePossibleKeyCodes() set the dead key on the keyboard buffer and did not run the workaround. This patch makes updatePossibleKeyCodes() run the workaround if any possible combination of modifiers with the key being examinated makes a dead key. Task-number: QTBUG-33591 Change-Id: I8c0b27586f7c62798986258b1b84aa90e4c5d64c Reviewed-by: Oliver Wolff Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowskeymapper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 994128738b..02795283b2 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -635,8 +635,8 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 } keyLayout[vk_key].qtKey[8] = fallbackKey; - // If this vk_key a Dead Key - if (MapVirtualKey(vk_key, 2) & 0x80000000) { + // If this vk_key makes a dead key with any combination of modifiers + if (keyLayout[vk_key].deadkeys) { // Push a Space, then the original key through the low-level ToAscii functions. // We do this because these functions (ToAscii / ToUnicode) will alter the internal state of // the keyboard driver By doing the following, we set the keyboard driver state back to what -- cgit v1.2.3 From e1325cf26e146b68725cc1a0a02b274ce3dfbe5c Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 24 Oct 2013 19:50:34 +0200 Subject: Do not byteswap RGBA8888 formats The three RGBA8888 formats was introduced to make it possible to have QImages and QPixmaps in native OpenGL formats, but uploaded textures of these types are still converted to ARGB first and then swapped back. This patch detects the formats and ensures the unneeded back-and-forth conversion does not take place. It also replaces a seemingly unused private API meant for the same goal. Change-Id: Id69d6973bb9c13d1052f2a1b0c516183f63421c2 Reviewed-by: Gunnar Sletta --- src/gui/opengl/qopengltexturecache.cpp | 30 ++-------------------------- src/gui/opengl/qopengltexturecache_p.h | 3 +-- src/opengl/qgl.cpp | 36 ++++++++++++++++++++++++++++++---- 3 files changed, 35 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/gui/opengl/qopengltexturecache.cpp b/src/gui/opengl/qopengltexturecache.cpp index 94b82885ff..4238f63cd8 100644 --- a/src/gui/opengl/qopengltexturecache.cpp +++ b/src/gui/opengl/qopengltexturecache.cpp @@ -95,10 +95,9 @@ void QOpenGLTextureCacheWrapper::cleanupTexturesForPixmapData(QPlatformPixmap *p cleanupTexturesForCacheKey(pmd->cacheKey()); } -QOpenGLTextureCache::QOpenGLTextureCache(QOpenGLContext *ctx, bool useByteSwapImage) +QOpenGLTextureCache::QOpenGLTextureCache(QOpenGLContext *ctx) : QOpenGLSharedResource(ctx->shareGroup()) , m_cache(64 * 1024) // 64 MB cache - , m_useByteSwapImage(useByteSwapImage) { } @@ -152,38 +151,13 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QImage &i return id; } -static inline void qgl_byteSwapImage(QImage &img) -{ - const int width = img.width(); - const int height = img.height(); - - if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) - { - for (int i = 0; i < height; ++i) { - uint *p = (uint *) img.scanLine(i); - for (int x = 0; x < width; ++x) - p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00); - } - } else { - for (int i = 0; i < height; ++i) { - uint *p = (uint *) img.scanLine(i); - for (int x = 0; x < width; ++x) - p[x] = (p[x] << 8) | (p[x] >> 24); - } - } -} - GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, qint64 key, const QImage &image) { GLuint id; glGenTextures(1, &id); glBindTexture(GL_TEXTURE_2D, id); - QImage tx = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); - - // Performance could be improved by skipping qgl_byteSwapImage(). - if (m_useByteSwapImage) - qgl_byteSwapImage(tx); + QImage tx = image.convertToFormat(QImage::Format_RGBA8888_Premultiplied); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tx.width(), tx.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, const_cast(tx).bits()); diff --git a/src/gui/opengl/qopengltexturecache_p.h b/src/gui/opengl/qopengltexturecache_p.h index d4d3f00069..2e82d5f373 100644 --- a/src/gui/opengl/qopengltexturecache_p.h +++ b/src/gui/opengl/qopengltexturecache_p.h @@ -78,7 +78,7 @@ class Q_GUI_EXPORT QOpenGLTextureCache : public QOpenGLSharedResource public: static QOpenGLTextureCache *cacheForContext(QOpenGLContext *context); - QOpenGLTextureCache(QOpenGLContext *, bool useByteSwapImage = true); + QOpenGLTextureCache(QOpenGLContext *); ~QOpenGLTextureCache(); GLuint bindTexture(QOpenGLContext *context, const QPixmap &pixmap); @@ -94,7 +94,6 @@ private: QMutex m_mutex; QCache m_cache; - bool m_useByteSwapImage; }; QT_END_NAMESPACE diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 8ee0a8b290..16044df8b1 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2308,10 +2308,18 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G QImage::Format target_format = img.format(); bool premul = options & QGLContext::PremultipliedAlphaBindOption; + bool needsbyteswap = true; GLenum externalFormat; GLuint pixel_type; - if (qgl_extensions()->hasOpenGLExtension(QOpenGLExtensions::BGRATextureFormat)) { + if (target_format == QImage::Format_RGBA8888 + || target_format == QImage::Format_RGBA8888_Premultiplied + || target_format == QImage::Format_RGBX8888) { + externalFormat = GL_RGBA; + pixel_type = GL_UNSIGNED_BYTE; + needsbyteswap = false; + } else if (qgl_extensions()->hasOpenGLExtension(QOpenGLExtensions::BGRATextureFormat)) { externalFormat = GL_BGRA; + needsbyteswap = false; if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2) pixel_type = GL_UNSIGNED_INT_8_8_8_8_REV; else @@ -2335,6 +2343,22 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G img = img.convertToFormat(target_format = QImage::Format_ARGB32); #ifdef QGL_BIND_TEXTURE_DEBUG printf(" - converted ARGB32_Premultiplied -> ARGB32 (%d ms)\n", time.elapsed()); +#endif + } + break; + case QImage::Format_RGBA8888: + if (premul) { + img = img.convertToFormat(target_format = QImage::Format_RGBA8888_Premultiplied); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - converted RGBA8888 -> RGBA8888_Premultiplied (%d ms) \n", time.elapsed()); +#endif + } + break; + case QImage::Format_RGBA8888_Premultiplied: + if (!premul) { + img = img.convertToFormat(target_format = QImage::Format_RGBA8888); +#ifdef QGL_BIND_TEXTURE_DEBUG + printf(" - converted RGBA8888_Premultiplied -> RGBA8888 (%d ms) \n", time.elapsed()); #endif } break; @@ -2342,10 +2366,14 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G pixel_type = GL_UNSIGNED_SHORT_5_6_5; externalFormat = GL_RGB; internalFormat = GL_RGB; + needsbyteswap = false; break; case QImage::Format_RGB32: + case QImage::Format_RGBX8888: break; default: + // Ideally more formats would be converted directly to an RGBA8888 format, + // but we are only guaranteed to have a fast conversion to an ARGB format. if (img.hasAlphaChannel()) { img = img.convertToFormat(premul ? QImage::Format_ARGB32_Premultiplied @@ -2383,10 +2411,10 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G #endif } - if (externalFormat == GL_RGBA) { + if (needsbyteswap) { // The only case where we end up with a depth different from - // 32 in the switch above is for the RGB16 case, where we set - // the format to GL_RGB + // 32 in the switch above is for the RGB16 case, where we do + // not need a byteswap. Q_ASSERT(img.depth() == 32); qgl_byteSwapImage(img, pixel_type); #ifdef QGL_BIND_TEXTURE_DEBUG -- cgit v1.2.3 From 746f7a5b28d92d962ae261c52da4d750ea3b50f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Thu, 24 Oct 2013 16:24:48 +0200 Subject: QJNI: Don't detach from the thread as long as the thread is alive. Attaching and detaching the current thread to/from the VM on each jni call, causes a new thread object to be created and triggers GC when detaching (GC alone takes anything between 10-30 ms to finish on the test device). Instead of detaching when the environment object goes out of scope, we now detach when the thread exits. Task-number: QTBUG-34279 Change-Id: Ia613934e61f914d4be63bfa1be8fdecf849928b0 Reviewed-by: Yoann Lopes --- src/corelib/kernel/qjni.cpp | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qjni.cpp b/src/corelib/kernel/qjni.cpp index 54cd2b5a75..cf839cfaef 100644 --- a/src/corelib/kernel/qjni.cpp +++ b/src/corelib/kernel/qjni.cpp @@ -162,24 +162,31 @@ static jfieldID getCachedFieldID(JNIEnv *env, return id; } -Q_GLOBAL_STATIC(QThreadStorage, refCount) +class QJNIEnvironmentPrivateTLS +{ +public: + inline ~QJNIEnvironmentPrivateTLS() + { + QtAndroidPrivate::javaVM()->DetachCurrentThread(); + } +}; + +Q_GLOBAL_STATIC(QThreadStorage, jniEnvTLS) QJNIEnvironmentPrivate::QJNIEnvironmentPrivate() : jniEnv(0) { JavaVM *vm = QtAndroidPrivate::javaVM(); if (vm->GetEnv((void**)&jniEnv, JNI_VERSION_1_6) == JNI_EDETACHED) { - if (vm->AttachCurrentThread(&jniEnv, 0) < 0) + if (vm->AttachCurrentThread(&jniEnv, 0) != JNI_OK) return; } if (!jniEnv) return; - if (!refCount->hasLocalData()) - refCount->setLocalData(1); - else - refCount->setLocalData(refCount->localData() + 1); + if (!jniEnvTLS->hasLocalData()) + jniEnvTLS->setLocalData(new QJNIEnvironmentPrivateTLS); } JNIEnv *QJNIEnvironmentPrivate::operator->() @@ -194,16 +201,6 @@ QJNIEnvironmentPrivate::operator JNIEnv* () const QJNIEnvironmentPrivate::~QJNIEnvironmentPrivate() { - if (!jniEnv) - return; - - const int newRef = refCount->localData() - 1; - refCount->setLocalData(newRef); - - if (newRef == 0) - QtAndroidPrivate::javaVM()->DetachCurrentThread(); - - jniEnv = 0; } QJNIObjectData::QJNIObjectData() -- cgit v1.2.3 From 9b9c63c27d6f9945d0b662a4a931750d775e1955 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 25 Oct 2013 16:34:33 +0300 Subject: Android: Fix the QSlider handler position. Change-Id: I300f187a94d6c2b6b385c5a129150344f6b805ea Reviewed-by: Paul Olav Tvete --- src/widgets/styles/qandroidstyle.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/widgets/styles/qandroidstyle.cpp b/src/widgets/styles/qandroidstyle.cpp index afd6c3024c..9595e49f40 100644 --- a/src/widgets/styles/qandroidstyle.cpp +++ b/src/widgets/styles/qandroidstyle.cpp @@ -696,7 +696,10 @@ int QAndroidStyle::styleHint(QStyle::StyleHint hint, const QStyleOption *option, { switch (hint) { case SH_Slider_AbsoluteSetButtons: - return 1; + return Qt::LeftButton; + + case SH_Slider_PageSetButtons: + return 0; case SH_RequestSoftwareInputPanel: return RSIP_OnMouseClick; @@ -1776,9 +1779,9 @@ QRect QAndroidStyle::AndroidSeekBarControl::subControlRect(const QStyleOptionCom drawable = static_cast(m_seekBarThumb)->bestAndroidStateMatch(option); QRect r(option->rect); - double factor = double(styleOption->sliderPosition/(styleOption->maximum-styleOption->minimum)); - int pos=(double(option->rect.width()*factor - drawable->size().width()) / 2); - r.setX(r.x()+pos); + double factor = double(styleOption->sliderPosition) / (styleOption->maximum - styleOption->minimum); + int pos = option->rect.width() * factor - double(drawable->size().width() / 2); + r.setX(r.x() + pos); r.setSize(drawable->size()); return r; } -- cgit v1.2.3 From b01ec07a061f53776a0a178f7fe24f5321122f06 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 17 Oct 2013 16:52:29 +0300 Subject: Remove sunken state for Android. Only QLineEdit always sets the sunken state and on some Android devices (e.g HTC) the line edit is painted as it is pressed. Task-number: QTBUG-29565 Change-Id: I25031ffaadba85cae6b6ff17c0847cb706e23503 Reviewed-by: Paul Olav Tvete --- src/widgets/styles/qandroidstyle.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/styles/qandroidstyle.cpp b/src/widgets/styles/qandroidstyle.cpp index 9595e49f40..ceb95aa125 100644 --- a/src/widgets/styles/qandroidstyle.cpp +++ b/src/widgets/styles/qandroidstyle.cpp @@ -515,8 +515,15 @@ void QAndroidStyle::drawPrimitive(PrimitiveElement pe, AndroidControlsHash::const_iterator it = itemType != QC_UnknownType ? m_androidControlsHash.find(itemType) : m_androidControlsHash.end(); - if (it != m_androidControlsHash.end()) - it.value()->drawControl(opt, p, w); + if (it != m_androidControlsHash.end()) { + if (itemType != QC_EditText) + it.value()->drawControl(opt, p, w); + else { + QStyleOption copy(*opt); + copy.state &= ~QStyle::State_Sunken; + it.value()->drawControl(©, p, w); + } + } else QFusionStyle::drawPrimitive(pe, opt, p, w); } -- cgit v1.2.3 From 054f357b695cfb2ef4a3c20e2bb617f23a00172a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 25 Oct 2013 13:26:00 +0200 Subject: CMake: Fix quoting issue with quoted paths in strings. Create a local CMake variable instead and use that in the search paths argument and in the message string. Resolves a warning that can appear with CMake 2.8.12. Task-number: QTBUG-34115 Change-Id: I04c67668586a9ad6584b7f6e91ee65351c86389c Reviewed-by: James Turner Reviewed-by: Stephen Kelly --- src/gui/Qt5GuiConfigExtras.cmake.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in index 77e456df53..f2f75d0ea0 100644 --- a/src/gui/Qt5GuiConfigExtras.cmake.in +++ b/src/gui/Qt5GuiConfigExtras.cmake.in @@ -54,12 +54,14 @@ set(Qt5Gui_OPENGL_LIBRARIES Qt5::Gui_GLESv2) !!IF !isEmpty(CMAKE_GL_INCDIRS) +set(_GL_INCDIRS $$CMAKE_GL_INCDIRS) find_path(_qt5gui_OPENGL_INCLUDE_DIR $$CMAKE_GL_HEADER_NAME - PATHS $$CMAKE_GL_INCDIRS + PATHS ${_GL_INCDIRS} NO_DEFAULT_PATH) if (NOT _qt5gui_OPENGL_INCLUDE_DIR) - message(FATAL_ERROR \"Failed to find \\\"$$CMAKE_GL_HEADER_NAME\\\" in \\\"$$CMAKE_GL_INCDIRS\\\".\") + message(FATAL_ERROR \"Failed to find \\\"$$CMAKE_GL_HEADER_NAME\\\" in \\\"${_GL_INCDIRS}\\\".\") endif() +unset(_GL_INCDIRS) _qt5_Gui_check_file_exists(${_qt5gui_OPENGL_INCLUDE_DIR}) -- cgit v1.2.3 From a0da5290ff1898c456e34e03cc7a994984172880 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Fri, 25 Oct 2013 14:43:42 +0100 Subject: QWindowsKeyMapper: Added some comments about functionality + cleanup Change-Id: Ieabdea7601ea0eba08eac701b2fdf27b4cd2ff45 Reviewed-by: Friedemann Kleint --- .../platforms/windows/qwindowskeymapper.cpp | 38 ++++++++-------------- src/plugins/platforms/windows/qwindowskeymapper.h | 2 -- 2 files changed, 14 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 02795283b2..e2594207fe 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -97,6 +97,8 @@ struct KeyRecord { QString text; }; +// We need to record the pressed keys in order to decide, whether the key event is an autorepeat +// event. As soon as its state changes, the chain of autorepeat events will be broken. static const int QT_MAX_KEY_RECORDINGS = 64; // User has LOTS of fingers... struct KeyRecorder { @@ -503,12 +505,6 @@ static inline int toKeyOrUnicode(int vk, int scancode, unsigned char *kbdBuffer, return code == Qt::Key_unknown ? 0 : code; } -int qt_translateKeyCode(int vk) -{ - int code = winceKeyBend((vk < 0 || vk > 255) ? 0 : vk); - return code == Qt::Key_unknown ? 0 : code; -} - static inline int asciiToKeycode(char a, int state) { if (a >= 'a' && a <= 'z') @@ -554,12 +550,8 @@ void QWindowsKeyMapper::changeKeyboard() keyboardInputDirection = bidi ? Qt::RightToLeft : Qt::LeftToRight; } -void QWindowsKeyMapper::clearRecordedKeys() -{ - key_recorder.clearKeys(); -} - - +// Helper function that is used when obtaining the list of characters that can be produced by one key and +// every possible combination of modifiers inline void setKbdState(unsigned char *kbd, bool shift, bool ctrl, bool alt) { kbd[VK_LSHIFT ] = (shift ? 0x80 : 0); @@ -570,6 +562,7 @@ inline void setKbdState(unsigned char *kbd, bool shift, bool ctrl, bool alt) kbd[VK_MENU ] = (alt ? 0x80 : 0); } +// Adds the msg's key to keyLayout if it is not yet present there void QWindowsKeyMapper::updateKeyMap(const MSG &msg) { unsigned char kbdBuffer[256]; // Will hold the complete keyboard state @@ -578,6 +571,9 @@ void QWindowsKeyMapper::updateKeyMap(const MSG &msg) updatePossibleKeyCodes(kbdBuffer, scancode, msg.wParam); } +// Fills keyLayout for that vk_key. Values are all characters one can type using that key +// (in connection with every combination of modifiers) and whether these "characters" are +// dead keys. void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 scancode, quint32 vk_key) { @@ -598,6 +594,10 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 buffer[VK_RCONTROL] = 0; buffer[VK_LMENU ] = 0; // Use right Alt, since left Ctrl + right Alt is considered AltGraph + // keyLayout contains the actual characters which can be written using the vk_key together with the + // different modifiers. '2' together with shift will for example cause the character + // to be @ for a US key layout (thus keyLayout[vk_key].qtKey[1] will be @). In addition to that + // it stores whether the resulting key is a dead key as these keys have to be handled later. bool isDeadKey = false; keyLayout[vk_key].deadkeys = 0; keyLayout[vk_key].dirty = false; @@ -635,7 +635,8 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 } keyLayout[vk_key].qtKey[8] = fallbackKey; - // If this vk_key makes a dead key with any combination of modifiers + // If one of the values inserted into the keyLayout above, can be considered a dead key, we have + // to run the workaround below. if (keyLayout[vk_key].deadkeys) { // Push a Space, then the original key through the low-level ToAscii functions. // We do this because these functions (ToAscii / ToUnicode) will alter the internal state of @@ -661,17 +662,6 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 } } -bool QWindowsKeyMapper::isADeadKey(unsigned int vk_key, unsigned int modifiers) -{ - if ((vk_key < NumKeyboardLayoutItems) && keyLayout[vk_key].exists) { - for (size_t i = 0; i < NumMods; ++i) { - if (uint(ModsTbl[i]) == modifiers) - return bool(keyLayout[vk_key].deadkeys & 1< Date: Thu, 24 Oct 2013 11:32:15 +0200 Subject: eglfs: Perform initialization in initialize() instead of the constructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move (almost) everything to initialize(). Doing so allows the QEglFSScreen constructor, the hooks' platformInit() and others to perform tasks that need the event dispatcher. Task-number: QTBUG-34208 Change-Id: If64e3d1691c41752c53968f8d4fb063b45345680 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 47 ++++++++++++----------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 67f0c35ed7..8a526dbff5 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -79,30 +79,9 @@ QT_BEGIN_NAMESPACE QEglFSIntegration::QEglFSIntegration() : mFontDb(new QGenericUnixFontDatabase) , mServices(new QGenericUnixServices) + , mScreen(0) , mInputContext(0) { - QEglFSHooks::hooks()->platformInit(); - - EGLint major, minor; - - if (!eglBindAPI(EGL_OPENGL_ES_API)) { - qWarning("Could not bind GL_ES API\n"); - qFatal("EGL error"); - } - - mDisplay = eglGetDisplay(QEglFSHooks::hooks() ? QEglFSHooks::hooks()->platformDisplay() : EGL_DEFAULT_DISPLAY); - if (mDisplay == EGL_NO_DISPLAY) { - qWarning("Could not open egl display\n"); - qFatal("EGL error"); - } - - if (!eglInitialize(mDisplay, &major, &minor)) { - qWarning("Could not initialize egl display\n"); - qFatal("EGL error"); - } - - mScreen = new QEglFSScreen(mDisplay); - screenAdded(mScreen); } QEglFSIntegration::~QEglFSIntegration() @@ -166,7 +145,31 @@ QAbstractEventDispatcher *QEglFSIntegration::createEventDispatcher() const void QEglFSIntegration::initialize() { + QEglFSHooks::hooks()->platformInit(); + + EGLint major, minor; + + if (!eglBindAPI(EGL_OPENGL_ES_API)) { + qWarning("Could not bind GL_ES API\n"); + qFatal("EGL error"); + } + + mDisplay = eglGetDisplay(QEglFSHooks::hooks() ? QEglFSHooks::hooks()->platformDisplay() : EGL_DEFAULT_DISPLAY); + if (mDisplay == EGL_NO_DISPLAY) { + qWarning("Could not open egl display\n"); + qFatal("EGL error"); + } + + if (!eglInitialize(mDisplay, &major, &minor)) { + qWarning("Could not initialize egl display\n"); + qFatal("EGL error"); + } + + mScreen = new QEglFSScreen(mDisplay); + screenAdded(mScreen); + mInputContext = QPlatformInputContextFactory::create(); + createInputHandlers(); } -- cgit v1.2.3 From 1d039184543c3c1079a56e98ca22d9774166ed3f Mon Sep 17 00:00:00 2001 From: Cristian Tarsoaga Date: Sun, 13 Oct 2013 23:33:15 +0300 Subject: Fix - psql driver must format qdatetime using iso QDateTime must be formatted as ISO8601 specifies, date/month must pe padded with 0 until width is 2 Task-number:QTBUG-33389 Change-Id: If07bcaa976ea3583369da3fd21ce442ee30e8c1f Reviewed-by: Lars Knoll --- src/sql/drivers/psql/qsql_psql.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 9331f5c371..fd5990f3ee 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -1253,8 +1253,8 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const QTime tm = field.value().toDateTime().time(); // msecs need to be right aligned otherwise psql interprets them wrong r = QLatin1Char('\'') + QString::number(dt.year()) + QLatin1Char('-') - + QString::number(dt.month()) + QLatin1Char('-') - + QString::number(dt.day()) + QLatin1Char(' ') + + QString::number(dt.month()).rightJustified(2, QLatin1Char('0')) + QLatin1Char('-') + + QString::number(dt.day()).rightJustified(2, QLatin1Char('0')) + QLatin1Char(' ') + tm.toString() + QLatin1Char('.') + QString::number(tm.msec()).rightJustified(3, QLatin1Char('0')) + QLatin1Char('\''); -- cgit v1.2.3 From 942a59d8fbb1ab6956887f6caa3c0595798b8afc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 25 Oct 2013 14:05:16 +0200 Subject: remove some vestiges of QFontEngineQPF amends d7e424ee66. Change-Id: I9aaef14f8ecba78685ce5f7e908a0b42e554434f Reviewed-by: thiago Reviewed-by: paulot Reviewed-by: Konstantin Ritt Reviewed-by: Lars Knoll --- src/gui/painting/qpaintengine.h | 6 ---- src/gui/text/qfontengine_ft.cpp | 1 - src/gui/text/qpfutil.cpp | 66 ----------------------------------------- 3 files changed, 73 deletions(-) delete mode 100644 src/gui/text/qpfutil.cpp (limited to 'src') diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h index b4dec2929d..18b6d84146 100644 --- a/src/gui/painting/qpaintengine.h +++ b/src/gui/painting/qpaintengine.h @@ -247,12 +247,6 @@ private: friend class QFontEngineBox; friend class QFontEngineMac; friend class QFontEngineWin; -#ifndef QT_NO_QWS_QPF - friend class QFontEngineQPF1; -#endif -#ifndef QT_NO_QWS_QPF2 - friend class QFontEngineQPF; -#endif friend class QMacPrintEngine; friend class QMacPrintEnginePrivate; friend class QFontEngineQPA; diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 328931e1eb..8c266fe7b6 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -699,7 +699,6 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format, line_thickness = QFixed::fromFixed(FT_MulFix(face->underline_thickness, face->size->metrics.y_scale)); underline_position = QFixed::fromFixed(-FT_MulFix(face->underline_position, face->size->metrics.y_scale)); } else { - // copied from QFontEngineQPF // ad hoc algorithm int score = fontDef.weight * fontDef.pixelSize; line_thickness = score / 700; diff --git a/src/gui/text/qpfutil.cpp b/src/gui/text/qpfutil.cpp deleted file mode 100644 index cf955e91e5..0000000000 --- a/src/gui/text/qpfutil.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -static const QFontEngineQPF::TagType tagTypes[QFontEngineQPF::NumTags] = { - QFontEngineQPF::StringType, // FontName - QFontEngineQPF::StringType, // FileName - QFontEngineQPF::UInt32Type, // FileIndex - QFontEngineQPF::UInt32Type, // FontRevision - QFontEngineQPF::StringType, // FreeText - QFontEngineQPF::FixedType, // Ascent - QFontEngineQPF::FixedType, // Descent - QFontEngineQPF::FixedType, // Leading - QFontEngineQPF::FixedType, // XHeight - QFontEngineQPF::FixedType, // AverageCharWidth - QFontEngineQPF::FixedType, // MaxCharWidth - QFontEngineQPF::FixedType, // LineThickness - QFontEngineQPF::FixedType, // MinLeftBearing - QFontEngineQPF::FixedType, // MinRightBearing - QFontEngineQPF::FixedType, // UnderlinePosition - QFontEngineQPF::UInt8Type, // GlyphFormat - QFontEngineQPF::UInt8Type, // PixelSize - QFontEngineQPF::UInt8Type, // Weight - QFontEngineQPF::UInt8Type, // Style - QFontEngineQPF::StringType, // EndOfHeader - QFontEngineQPF::BitFieldType// WritingSystems -}; - - -- cgit v1.2.3 From 338da730e8bc23e227e26b094cba6bb6233c42de Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 25 Oct 2013 10:56:01 +0200 Subject: network: fix multi-phased NTLM authentication tested manually with internal NTLM proxy. Patch-by: Jonathan Lauvernier Change-Id: Ib3ed7aff12cb8d59ffc2b11ecc1c4fdc04acb368 Reviewed-by: Richard J. Moore --- src/network/kernel/qauthenticator.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index e1a24a226f..8c16486878 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -189,7 +189,7 @@ QAuthenticator &QAuthenticator::operator=(const QAuthenticator &other) d->realm = other.d->realm; d->method = other.d->method; d->options = other.d->options; - } else { + } else if (d->phase == QAuthenticatorPrivate::Start) { delete d; d = 0; } @@ -267,7 +267,8 @@ void QAuthenticator::detach() return; } - d->phase = QAuthenticatorPrivate::Start; + if (d->phase == QAuthenticatorPrivate::Done) + d->phase = QAuthenticatorPrivate::Start; } /*! -- cgit v1.2.3 From 1ea191276ea49ce2334d21b1f4a2c66ee8889466 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 8 Oct 2013 13:31:19 +0200 Subject: QWizard: give all buttons an objectName Only Commit, Finish and Cancel didn't have an object name, yet. Also Extract Method on the switch statement, add a test, and use QStringBuilder. Task-number: QTBUG-29924 Reported-by: Leo Arias Change-Id: I8c29606bc53e9d4caab631da2089e971a9da2d75 Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qwizard.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 02ad5a3be5..4e82167049 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -1345,6 +1345,21 @@ void QWizardPrivate::updateCurrentPage() updateButtonTexts(); } +static QString object_name_for_button(QWizard::WizardButton which) +{ + switch (which) { + case QWizard::CommitButton: + return QLatin1String("qt_wizard_") + QLatin1String("commit"); + case QWizard::FinishButton: + return QLatin1String("qt_wizard_") + QLatin1String("finish"); + case QWizard::CancelButton: + return QLatin1String("qt_wizard_") + QLatin1String("cancel"); + default: + // Make navigation buttons detectable as passive interactor in designer + return QLatin1String("__qt__passive_wizardbutton") + QString::number(which); + } +} + bool QWizardPrivate::ensureButton(QWizard::WizardButton which) const { Q_Q(const QWizard); @@ -1356,19 +1371,7 @@ bool QWizardPrivate::ensureButton(QWizard::WizardButton which) const QStyle *style = q->style(); if (style != QApplication::style()) // Propagate style pushButton->setStyle(style); - // Make navigation buttons detectable as passive interactor in designer - switch (which) { - case QWizard::CommitButton: - case QWizard::FinishButton: - case QWizard::CancelButton: - break; - default: { - QString objectName = QLatin1String("__qt__passive_wizardbutton"); - objectName += QString::number(which); - pushButton->setObjectName(objectName); - } - break; - } + pushButton->setObjectName(object_name_for_button(which)); #ifdef Q_OS_MACX pushButton->setAutoDefault(false); #endif -- cgit v1.2.3 From 269590516d89a35ea3121366f7d4bf43b0d391ca Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 25 Oct 2013 19:17:28 +0200 Subject: QWizard: provoke 'enum value not handled in switch' warnings in object_name_for_button This is strictly speaking a behavior change, since we're no longer returning something for Stretch and NoButton, but - guessing here - that shouldn't matter. Yet, better safe than sorry, thus submitted as a separate patch. Change-Id: I20cb084147f8c9257ce37d1e87ea38febabec28d Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qwizard.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 4e82167049..a667f299e8 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -1354,10 +1354,22 @@ static QString object_name_for_button(QWizard::WizardButton which) return QLatin1String("qt_wizard_") + QLatin1String("finish"); case QWizard::CancelButton: return QLatin1String("qt_wizard_") + QLatin1String("cancel"); - default: + case QWizard::BackButton: + case QWizard::NextButton: + case QWizard::HelpButton: + case QWizard::CustomButton1: + case QWizard::CustomButton2: + case QWizard::CustomButton3: // Make navigation buttons detectable as passive interactor in designer return QLatin1String("__qt__passive_wizardbutton") + QString::number(which); + case QWizard::Stretch: + case QWizard::NoButton: + //case QWizard::NStandardButtons: + //case QWizard::NButtons: + ; } + Q_UNREACHABLE(); + return QString(); } bool QWizardPrivate::ensureButton(QWizard::WizardButton which) const -- cgit v1.2.3 From eb921e6edc3906ac90e8155f063b6c71df6386be Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 28 Oct 2013 09:47:34 +0100 Subject: Remove unused static function systemtimeToMsecs() See also commit 660aed3516f91c that removed the reverse method. Change-Id: Ib20c5be863ba6644485c581e3ece47a390ce467d Reviewed-by: Friedemann Kleint --- src/corelib/tools/qtimezoneprivate_win.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qtimezoneprivate_win.cpp b/src/corelib/tools/qtimezoneprivate_win.cpp index c219a49e1e..efdd6676fb 100644 --- a/src/corelib/tools/qtimezoneprivate_win.cpp +++ b/src/corelib/tools/qtimezoneprivate_win.cpp @@ -106,14 +106,6 @@ static QDate msecsToDate(qint64 msecs) return QDate::fromJulianDay(jd); } -static qint64 systemtimeToMsecs(const SYSTEMTIME &systemtime) -{ - FILETIME utcFileTime; - SystemTimeToFileTime(&systemtime, &utcFileTime); - ULONGLONG utcNSecs = (((ULONGLONG) utcFileTime.dwHighDateTime) << 32) + utcFileTime.dwLowDateTime; - return (utcNSecs - FILETIME_UNIX_EPOCH) / 10000; -} - static bool equalSystemtime(const SYSTEMTIME &t1, const SYSTEMTIME &t2) { return (t1.wYear == t2.wYear -- cgit v1.2.3 From 3567f4c2fc9ee45898ed9a0784051d4fa64897e2 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Fri, 25 Oct 2013 22:23:30 +0800 Subject: Doc: Update boost::bind()/std::tr1::bind() to std::bind() boost::bind() became part of the C++11 standard with minor modifications. Present the standard version as the main one to use, but list the others as alternatives. Change-Id: If419d8d24c0925119d3b9f7ff76be44981351bc0 Reviewed-by: Olivier Goffart Reviewed-by: Jerome Pasion --- .../snippets/code/src_concurrent_qtconcurrentfilter.cpp | 4 ++-- .../doc/snippets/code/src_concurrent_qtconcurrentmap.cpp | 4 ++-- .../doc/snippets/code/src_concurrent_qtconcurrentrun.cpp | 2 +- src/concurrent/qtconcurrentfilter.cpp | 14 +++++--------- src/concurrent/qtconcurrentmap.cpp | 14 +++++--------- src/concurrent/qtconcurrentrun.cpp | 15 ++++++--------- 6 files changed, 21 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp index 7160f80b34..9afcdc9740 100644 --- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp +++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp @@ -136,7 +136,7 @@ bool QString::contains(const QRegExp ®exp) const; //! [10] -boost::bind(&QString::contains, QRegExp("^\\S+$")); // matches strings without whitespace +std::bind(&QString::contains, QRegExp("^\\S+$")); // matches strings without whitespace //! [10] @@ -147,7 +147,7 @@ bool contains(const QString &string) //! [12] QStringList strings = ...; -boost::bind(static_cast( &QString::contains ), QRegExp("..." )); +std::bind(static_cast( &QString::contains ), QRegExp("..." )); //! [12] //! [13] diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp index 756ca3902c..634c03e808 100644 --- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp +++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp @@ -149,7 +149,7 @@ QImage QImage::scaledToWidth(int width, Qt::TransformationMode) const; //! [11] -boost::bind(&QImage::scaledToWidth, 100, Qt::SmoothTransformation) +std::bind(&QImage::scaledToWidth, 100, Qt::SmoothTransformation) //! [11] @@ -160,7 +160,7 @@ QImage scaledToWith(const QImage &image) //! [13] QList images = ...; -QFuture thumbnails = QtConcurrent::mapped(images, boost::bind(&QImage::scaledToWidth, 100 Qt::SmoothTransformation)); +QFuture thumbnails = QtConcurrent::mapped(images, std::bind(&QImage::scaledToWidth, 100 Qt::SmoothTransformation)); //! [13] //! [14] diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp index 7288fc642b..8922e41f34 100644 --- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp +++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp @@ -93,6 +93,6 @@ future.waitForFinished(); //! [6] void someFunction(int arg1, double arg2); -QFuture future = QtConcurrent::run(boost::bind(someFunction, 1, 2.0)); +QFuture future = QtConcurrent::run(std::bind(someFunction, 1, 2.0)); ... //! [6] diff --git a/src/concurrent/qtconcurrentfilter.cpp b/src/concurrent/qtconcurrentfilter.cpp index 22a1243c18..a58c52edc1 100644 --- a/src/concurrent/qtconcurrentfilter.cpp +++ b/src/concurrent/qtconcurrentfilter.cpp @@ -155,15 +155,11 @@ \section2 Using Bound Function Arguments - Note that Qt does not provide support for bound functions. This is - provided by 3rd party libraries like - \l{http://www.boost.org/libs/bind/bind.html}{Boost} or - \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf} - {C++ TR1 Library Extensions}. - If you want to use a filter function takes more than one argument, you can - use boost::bind() or std::tr1::bind() to transform it onto a function that - takes one argument. + use std::bind() to transform it onto a function that takes one argument. If + C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html} + {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf} + {std::tr1::bind()} are suitable replacements. As an example, we use QString::contains(): @@ -177,7 +173,7 @@ \snippet code/src_concurrent_qtconcurrentfilter.cpp 10 - The return value from boost::bind() is a function object (functor) with + The return value from std::bind() is a function object (functor) with the following signature: \snippet code/src_concurrent_qtconcurrentfilter.cpp 11 diff --git a/src/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp index da2a601ae2..5233a9db45 100644 --- a/src/concurrent/qtconcurrentmap.cpp +++ b/src/concurrent/qtconcurrentmap.cpp @@ -204,15 +204,11 @@ \section2 Using Bound Function Arguments - Note that Qt does not provide support for bound functions. This is - provided by 3rd party libraries like - \l{http://www.boost.org/libs/bind/bind.html}{Boost} or - \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}{C++ - TR1 Library Extensions}. - If you want to use a map function that takes more than one argument you can - use boost::bind() or std::tr1::bind() to transform it onto a function that - takes one argument. + use std::bind() to transform it onto a function that takes one argument. If + C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html} + {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf} + {std::tr1::bind()} are suitable replacements. As an example, we'll use QImage::scaledToWidth(): @@ -226,7 +222,7 @@ \snippet code/src_concurrent_qtconcurrentmap.cpp 11 - The return value from boost::bind() is a function object (functor) with + The return value from std::bind() is a function object (functor) with the following signature: \snippet code/src_concurrent_qtconcurrentmap.cpp 12 diff --git a/src/concurrent/qtconcurrentrun.cpp b/src/concurrent/qtconcurrentrun.cpp index 4398e1a91f..c60fa14777 100644 --- a/src/concurrent/qtconcurrentrun.cpp +++ b/src/concurrent/qtconcurrentrun.cpp @@ -110,15 +110,12 @@ \section2 Using Bound Function Arguments - Note that Qt does not provide support for bound functions. This is - provided by 3rd party libraries like - \l{http://www.boost.org/libs/bind/bind.html}{Boost} or - \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf} - {C++ TR1 Library Extensions}. - - You can use boost::bind() or std::tr1::bind() to \e bind a number of - arguments to a function when called. There are number of reasons for doing - this: + You can use std::bind() to \e bind a number of arguments to a function when + called. If C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html} + {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf} + {std::tr1::bind()} are suitable replacements. + + There are number of reasons for binding: \list \li To call a function that takes more than 5 arguments. -- cgit v1.2.3 From 8d1ab25ed2864bda530aec5ca76ad3ba35b2a55f Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Sat, 26 Oct 2013 20:14:26 +0300 Subject: Android: Remove unneeded dependency Change-Id: Ie4daa618efb6fbc29656cc3d25837478d9d690f4 Reviewed-by: Paul Olav Tvete --- src/corelib/corelib.pro | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 1ed55bb0c8..bc618ed843 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -20,8 +20,7 @@ ANDROID_JAR_DEPENDENCIES = \ jar/QtAndroid.jar \ jar/QtAndroidAccessibility.jar ANDROID_LIB_DEPENDENCIES = \ - plugins/platforms/android/libqtforandroid.so \ - libs/libgnustl_shared.so + plugins/platforms/android/libqtforandroid.so ANDROID_BUNDLED_JAR_DEPENDENCIES = \ jar/QtAndroid-bundled.jar \ jar/QtAndroidAccessibility-bundled.jar -- cgit v1.2.3 From 684a952edbf5ec5bd70c7edae7c8eff8e87cf2de Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Sun, 27 Oct 2013 10:20:32 +0200 Subject: Android: Don't crash if the screen is not yet initialized. Change-Id: I4751c2dec5780f42b348a8a8ea628f65d548dcec Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/android/src/androidjnimain.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp index 34413ae509..abfc2fa19c 100644 --- a/src/plugins/platforms/android/src/androidjnimain.cpp +++ b/src/plugins/platforms/android/src/androidjnimain.cpp @@ -559,8 +559,10 @@ static void setSurface(JNIEnv *env, jobject /*thiz*/, jobject jSurface) QPlatformScreen *screen = m_androidPlatformIntegration->screen(); QRect geometry(QPoint(0, 0), size); - QWindowSystemInterface::handleScreenAvailableGeometryChange(screen->screen(), geometry); - QWindowSystemInterface::handleScreenGeometryChange(screen->screen(), geometry); + if (screen) { + QWindowSystemInterface::handleScreenAvailableGeometryChange(screen->screen(), geometry); + QWindowSystemInterface::handleScreenGeometryChange(screen->screen(), geometry); + } if (!sameNativeWindow) { m_surfaceMutex.unlock(); -- cgit v1.2.3 From 00bf148b07cb7771136ed472766400336ab4d2bf Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 28 Oct 2013 10:27:53 +0100 Subject: Fix compilation with MinGW gcc 64 bit Fix compilation of ANGLE with gcc 4.8.0 64 bit: The reinterpret_cast(void*) was causing error: cast from 'const void*' to 'long unsigned int' loses precision Task-number: QTBUG-34395 Change-Id: Ibde75dd4b5536f3827bdf0ab02a15e93a1a8a4f0 Reviewed-by: Friedemann Kleint --- .../src/third_party/trace_event/trace_event.h | 2 +- ...001-Fix-compilation-with-MinGW-gcc-64-bit.patch | 35 ++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/angle/patches/0001-Fix-compilation-with-MinGW-gcc-64-bit.patch (limited to 'src') diff --git a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h index 113b126a77..72d354dd64 100644 --- a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h +++ b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h @@ -589,7 +589,7 @@ const unsigned long long noEventId = 0; class TraceID { public: explicit TraceID(const void* id, unsigned char* flags) : - m_data(static_cast(reinterpret_cast(id))) + m_data(reinterpret_cast(id)) { *flags |= TRACE_EVENT_FLAG_MANGLE_ID; } diff --git a/src/angle/patches/0001-Fix-compilation-with-MinGW-gcc-64-bit.patch b/src/angle/patches/0001-Fix-compilation-with-MinGW-gcc-64-bit.patch new file mode 100644 index 0000000000..0420694c91 --- /dev/null +++ b/src/angle/patches/0001-Fix-compilation-with-MinGW-gcc-64-bit.patch @@ -0,0 +1,35 @@ +From 821c28d387b332bf16b6ea35ec22a77d3ba41632 Mon Sep 17 00:00:00 2001 +From: Kai Koehne +Date: Mon, 28 Oct 2013 10:27:53 +0100 +Subject: [PATCH] Fix compilation with MinGW gcc 64 bit + +Fix compilation of ANGLE with gcc 4.8.0 64 bit: The + + reinterpret_cast(void*) + +was causing + + error: cast from 'const void*' to 'long unsigned int' loses precision + +Task-number: QTBUG-34395 +Change-Id: Ibde75dd4b5536f3827bdf0ab02a15e93a1a8a4f0 +--- + src/3rdparty/angle/src/third_party/trace_event/trace_event.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h +index 113b126..72d354d 100644 +--- a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h ++++ b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h +@@ -589,7 +589,7 @@ const unsigned long long noEventId = 0; + class TraceID { + public: + explicit TraceID(const void* id, unsigned char* flags) : +- m_data(static_cast(reinterpret_cast(id))) ++ m_data(reinterpret_cast(id)) + { + *flags |= TRACE_EVENT_FLAG_MANGLE_ID; + } +-- +1.8.3.msysgit.0 + -- cgit v1.2.3 From 6ea7336e4aed916c5c9602c51d7d9646a289e83b Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 29 Oct 2013 12:16:30 +0100 Subject: eglfs: Make backingstore handle unexpected scenarios gracefully On platforms other than Android eglfs does not allow having multiple windows when one of the windows is OpenGL. On Android however this has to be handled silently, without aborting the application. The backingstore lacked the necessary checks so QGLWidget-based apps were crashing. This is now corrected. Task-number: QTBUG-34412 Change-Id: Ifb469fa9ef391b24aed3942430c0347276809ba5 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/eglfs/qeglfsbackingstore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp index 8de8268616..9de5960fdb 100644 --- a/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp +++ b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp @@ -113,7 +113,7 @@ void QEglFSBackingStore::flush(QWindow *window, const QRegion ®ion, const QPo #endif QEglFSWindow *rootWin = m_window->screen()->rootWindow(); - if (!rootWin) + if (!rootWin || !rootWin->isRaster()) return; m_window->create(); @@ -132,7 +132,7 @@ void QEglFSBackingStore::resize(const QSize &size, const QRegion &staticContents Q_UNUSED(staticContents); QEglFSWindow *rootWin = m_window->screen()->rootWindow(); - if (!rootWin) + if (!rootWin || !rootWin->isRaster()) return; m_image = QImage(size, QImage::Format_RGB32); -- cgit v1.2.3 From 0731dbcd19e4a6978f50bb6f104df49b81f5e649 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Tue, 29 Oct 2013 14:50:46 +0100 Subject: Fail when QT_POINTER_SIZE is not set Some cross compile setups don't have special treatment and don't have a configure check. To notice this early in the build fail at this state. One example is to cross compile from Windows for eg QNX or even linux embedded. If QT_POINTER_SIZE is not set, later v4 build in qtdeclarative is failing with a unmeaningful compile error. Change-Id: Iff9498d916371241b0b044b9543f9cd2946ecf42 Reviewed-by: Simon Hausmann --- src/corelib/global/qglobal.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 1d19a6cf6f..c430da80fd 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -198,6 +198,8 @@ typedef quint64 qulonglong; # define QT_POINTER_SIZE 4 # elif defined(Q_OS_ANDROID) # define QT_POINTER_SIZE 4 // ### Add auto-detection to Windows configure +# elif !defined(QT_BUILD_MOC) && !defined(QT_BUILD_QMAKE) && !defined(QT_BUILD_CONFIGURE) +# error could not determine QT_POINTER_SIZE # endif #endif -- cgit v1.2.3 From 4d5bf32c20078dc4fb186e9a7b4969f01ebdc7e5 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 28 Oct 2013 12:22:50 +0100 Subject: Re-enable NonFullScreenWindows on Android This flag was created because the eglfs plugin did not support non-fullscreen raster windows. Now that it does, we can remove it again. Turns out this also fixes several issues with positioning and sizing of dialogs due to bugs in the implementation of the flag. Task-number: QTBUG-33846, QTBUG-33499, QTBUG-32537, QTBUG-32297, QTBUG-31457 Change-Id: I3902ae57d49d77e3c1046ec57b6f6926f70ec6a4 Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/src/qandroidplatformintegration.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp index a3db421de9..e48a3c9ebe 100644 --- a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp @@ -123,7 +123,6 @@ bool QAndroidPlatformIntegration::hasCapability(Capability cap) const switch (cap) { case ThreadedPixmaps: return true; case ApplicationState: return true; - case NonFullScreenWindows: return false; case NativeWidgets: return false; default: #ifndef ANDROID_PLUGIN_OPENGL -- cgit v1.2.3 From d536713e96725a7767787b011b7454079f641f72 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 25 Oct 2013 14:47:01 +0300 Subject: Allow the user to specify a theme list. Cleanup the theme handling. Set default theme, needed by native dialogs. Needs Ministro v9.6+. Change-Id: Ia131edd8712b7737d3118d714c7772adb8f27acd Reviewed-by: Paul Olav Tvete --- .../qtproject/qt5/android/bindings/QtActivity.java | 85 +++++++++++++++------- 1 file changed, 58 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java index 9c7b57a4f5..4c5d479800 100644 --- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java +++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java @@ -56,6 +56,7 @@ import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.Canvas; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; @@ -113,13 +114,15 @@ public class QtActivity extends Activity // for more details. private static final String REPOSITORY_KEY = "repository"; // use this key to overwrite the default ministro repsitory + private static final String ANDROID_THEMES_KEY = "android.themes"; // themes that your application uses - private static final String APPLICATION_PARAMETERS = null; // use this variable to pass any parameters to your application, + + public String APPLICATION_PARAMETERS = null; // use this variable to pass any parameters to your application, // the parameters must not contain any white spaces // and must be separated with "\t" // e.g "-param1\t-param2=value2\t-param3\tvalue3" - private String ENVIRONMENT_VARIABLES = "QT_USE_ANDROID_NATIVE_STYLE=1\t"; + public String ENVIRONMENT_VARIABLES = "QT_USE_ANDROID_NATIVE_STYLE=1\t"; // use this variable to add any environment variables to your application. // the env vars must be separated with "\t" // e.g. "ENV_VAR1=1\tENV_VAR2=2\t" @@ -127,14 +130,21 @@ public class QtActivity extends Activity // * QT_USE_ANDROID_NATIVE_STYLE - 1 to use the android widget style if available, // note that the android style plugin in Qt 5.1 is not fully functional. - private static final String QT_ANDROID_THEME = "light"; // sets the default theme to light. Possible values are: - // * "" - for the device default dark theme - // * "light" - for the device default light theme - // * "holo" - for the holo dark theme - // * "holo_light" - for the holo light theme + public String[] QT_ANDROID_THEMES = null; // A list with all themes that your application want to use. + // The name of the theme must be the same with any theme from + // http://developer.android.com/reference/android/R.style.html + // The most used themes are: + // * "Theme" - (fallback) check http://developer.android.com/reference/android/R.style.html#Theme + // * "Theme_Black" - check http://developer.android.com/reference/android/R.style.html#Theme_Black + // * "Theme_Light" - (default for API <=10) check http://developer.android.com/reference/android/R.style.html#Theme_Light + // * "Theme_Holo" - check http://developer.android.com/reference/android/R.style.html#Theme_Holo + // * "Theme_Holo_Light" - (default for API 11-13) check http://developer.android.com/reference/android/R.style.html#Theme_Holo_Light + // * "Theme_DeviceDefault" - check http://developer.android.com/reference/android/R.style.html#Theme_DeviceDefault + // * "Theme_DeviceDefault_Light" - (default for API 14+) check http://developer.android.com/reference/android/R.style.html#Theme_DeviceDefault_Light + + public String QT_ANDROID_DEFAULT_THEME = null; // sets the default theme. private static final int INCOMPATIBLE_MINISTRO_VERSION = 1; // Incompatible Ministro version. Ministro needs to be upgraded. - private static final String DISPLAY_DPI_KEY = "display.dpi"; private static final int BUFFER_SIZE = 1024; private ActivityInfo m_activityInfo = null; // activity info object, used to access the libs and the strings @@ -153,6 +163,21 @@ public class QtActivity extends Activity // this repository is used to push Qt snapshots. private String[] m_qtLibs = null; // required qt libs + public QtActivity() + { + if (Build.VERSION.SDK_INT <= 10) { + QT_ANDROID_THEMES = new String[] {"Theme_Light"}; + QT_ANDROID_DEFAULT_THEME = "Theme_Light"; + } + else if (Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT <= 13) { + QT_ANDROID_THEMES = new String[] {"Theme_Holo_Light"}; + QT_ANDROID_DEFAULT_THEME = "Theme_Holo_Light"; + } else { + QT_ANDROID_THEMES = new String[] {"Theme_DeviceDefault_Light"}; + QT_ANDROID_DEFAULT_THEME = "Theme_DeviceDefault_Light"; + } + } + // this function is used to load and start the loader private void loadApplication(Bundle loaderParams) { @@ -237,23 +262,24 @@ public class QtActivity extends Activity private ServiceConnection m_ministroConnection=new ServiceConnection() { private IMinistro m_service = null; - @Override + @Override public void onServiceConnected(ComponentName name, IBinder service) { m_service = IMinistro.Stub.asInterface(service); try { - if (m_service!=null) { - Bundle parameters= new Bundle(); + if (m_service != null) { + Bundle parameters = new Bundle(); parameters.putStringArray(REQUIRED_MODULES_KEY, m_qtLibs); parameters.putString(APPLICATION_TITLE_KEY, (String)QtActivity.this.getTitle()); parameters.putInt(MINIMUM_MINISTRO_API_KEY, MINISTRO_API_LEVEL); parameters.putInt(MINIMUM_QT_VERSION_KEY, QT_VERSION); parameters.putString(ENVIRONMENT_VARIABLES_KEY, ENVIRONMENT_VARIABLES); - if (null!=APPLICATION_PARAMETERS) + if (APPLICATION_PARAMETERS != null) parameters.putString(APPLICATION_PARAMETERS_KEY, APPLICATION_PARAMETERS); parameters.putStringArray(SOURCES_KEY, m_sources); parameters.putString(REPOSITORY_KEY, m_repository); - parameters.putInt(DISPLAY_DPI_KEY, QtActivity.this.getResources().getDisplayMetrics().densityDpi); + if (QT_ANDROID_THEMES != null) + parameters.putStringArray(ANDROID_THEMES_KEY, QT_ANDROID_THEMES); m_service.requestLoader(m_ministroCallback, parameters); } } catch (RemoteException e) { @@ -261,19 +287,19 @@ public class QtActivity extends Activity } } - private IMinistroCallback m_ministroCallback = new IMinistroCallback.Stub() { - // this function is called back by Ministro. - @Override - public void loaderReady(final Bundle loaderParams) throws RemoteException { - runOnUiThread(new Runnable() { - @Override - public void run() { - unbindService(m_ministroConnection); - loadApplication(loaderParams); - } - }); - } - }; + private IMinistroCallback m_ministroCallback = new IMinistroCallback.Stub() { + // this function is called back by Ministro. + @Override + public void loaderReady(final Bundle loaderParams) throws RemoteException { + runOnUiThread(new Runnable() { + @Override + public void run() { + unbindService(m_ministroConnection); + loadApplication(loaderParams); + } + }); + } + }; @Override public void onServiceDisconnected(ComponentName name) { @@ -683,11 +709,16 @@ public class QtActivity extends Activity public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + try { + setTheme(Class.forName("android.R$style").getDeclaredField(QT_ANDROID_DEFAULT_THEME).getInt(null)); + } catch (Exception e) { + e.printStackTrace(); + } if (QtApplication.m_delegateObject != null && QtApplication.onCreate != null) { QtApplication.invokeDelegateMethod(QtApplication.onCreate, savedInstanceState); return; } - ENVIRONMENT_VARIABLES += "\tQT_ANDROID_THEME=" + QT_ANDROID_THEME + ENVIRONMENT_VARIABLES += "\tQT_ANDROID_THEME=" + QT_ANDROID_DEFAULT_THEME + "/\tQT_ANDROID_THEME_DISPLAY_DPI=" + getResources().getDisplayMetrics().densityDpi + "\t"; requestWindowFeature(Window.FEATURE_NO_TITLE); try { -- cgit v1.2.3 From 472e448d6a71f679dd022f7405564c42d8f47916 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Mon, 28 Oct 2013 17:09:59 +0200 Subject: Fix the show/hide logic. Make sure the back key event is not sent to applicaton as long as the keyboard is still visible. Task-number: QTBUG-30803 Change-Id: I8063981a96ddb8e065c1281b1bdc0fb4a2895bc2 Reviewed-by: Paul Olav Tvete --- .../qtproject/qt5/android/QtActivityDelegate.java | 52 +++++++++++++++++----- .../qtproject/qt5/android/QtInputConnection.java | 8 ++-- 2 files changed, 45 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 503b38ae79..1f99440428 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -57,6 +57,8 @@ import android.content.res.Configuration; import android.graphics.Rect; import android.os.Build; import android.os.Bundle; +import android.os.Handler; +import android.os.ResultReceiver; import android.text.method.MetaKeyKeyListener; import android.util.DisplayMetrics; import android.util.Log; @@ -110,7 +112,8 @@ public class QtActivityDelegate private Process m_debuggerProcess = null; // debugger process public boolean m_keyboardIsVisible = false; - public boolean m_keyboardIsHiding = false; + public boolean m_backKeyPressedSent = false; + public QtLayout getQtLayout() { @@ -253,9 +256,21 @@ public class QtActivityDelegate m_editText.postDelayed(new Runnable() { @Override public void run() { - m_imm.showSoftInput(m_editText, 0); - m_keyboardIsVisible = true; - m_keyboardIsHiding = false; + m_imm.showSoftInput(m_editText, 0, new ResultReceiver( new Handler()){ + @Override + protected void onReceiveResult(int resultCode, Bundle resultData) { + switch (resultCode) { + case InputMethodManager.RESULT_SHOWN: + case InputMethodManager.RESULT_UNCHANGED_SHOWN: + m_keyboardIsVisible = true; + break; + case InputMethodManager.RESULT_HIDDEN: + case InputMethodManager.RESULT_UNCHANGED_HIDDEN: + m_keyboardIsVisible = false; + break; + } + } + }) ; m_editText.postDelayed(new Runnable() { @Override public void run() { @@ -270,9 +285,21 @@ public class QtActivityDelegate { if (m_imm == null) return; - m_imm.hideSoftInputFromWindow(m_editText.getWindowToken(), 0); - m_keyboardIsVisible = false; - m_keyboardIsHiding = false; + m_imm.hideSoftInputFromWindow(m_editText.getWindowToken(), 0, new ResultReceiver( new Handler()){ + @Override + protected void onReceiveResult(int resultCode, Bundle resultData) { + switch (resultCode) { + case InputMethodManager.RESULT_SHOWN: + case InputMethodManager.RESULT_UNCHANGED_SHOWN: + m_keyboardIsVisible = true; + break; + case InputMethodManager.RESULT_HIDDEN: + case InputMethodManager.RESULT_UNCHANGED_HIDDEN: + m_keyboardIsVisible = false; + break; + } + } + }); } public boolean isSoftwareKeyboardVisible() @@ -717,8 +744,12 @@ public class QtActivityDelegate } m_lastChar = lc; - if (keyCode != KeyEvent.KEYCODE_BACK) - QtNative.keyDown(keyCode, c, event.getMetaState()); + if (keyCode == KeyEvent.KEYCODE_BACK) { + m_backKeyPressedSent = !m_keyboardIsVisible; + if (!m_backKeyPressedSent) + return true; + } + QtNative.keyDown(keyCode, c, event.getMetaState()); return true; } @@ -737,8 +768,9 @@ public class QtActivityDelegate } } - if (keyCode == KeyEvent.KEYCODE_BACK && m_keyboardIsVisible && !m_keyboardIsHiding) { + if (keyCode == KeyEvent.KEYCODE_BACK && !m_backKeyPressedSent) { hideSoftwareKeyboard(); + m_keyboardIsVisible = false; return true; } diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java b/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java index 3aba42642a..f28ea3be83 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java @@ -139,15 +139,13 @@ public class QtInputConnection extends BaseInputConnection public boolean finishComposingText() { if (m_closing) { - QtNative.activityDelegate().m_keyboardIsHiding = true; m_view.postDelayed(new Runnable() { @Override public void run() { - if (QtNative.activityDelegate().m_keyboardIsHiding) QtNative.activityDelegate().m_keyboardIsVisible=false; - } - }, 5000); // it seems finishComposingText comes musch faster than onKeyUp event, - // so we must delay hide notification + } + }, 100); // it seems finishComposingText comes much faster than onKeyUp event, + // so we must delay hide notification m_closing = false; } else { m_closing = true; -- cgit v1.2.3 From fc98d027c00aeff0dc8062492683e4952126bb1b Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 23 Apr 2013 10:47:55 +0200 Subject: Android: handle keyPress event for Key_Back Added logic so that accepting either the press or the release will keep the app running. This makes it possible to use the onBackPressed functionality in QML. This functionality is only intended for running in a complete Android environment, so make sure that we don't terminate the application in the NO_SDK case. Task-number: QTBUG-30803 Change-Id: I2546eea73bf6a6ee8b196125b7556479b9b10a9c Reviewed-by: BogDan Vatra --- src/gui/kernel/qguiapplication.cpp | 41 +++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index d254f7c9bc..2e6000625e 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1666,41 +1666,36 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE QWindow *window = e->window.data(); modifier_buttons = e->modifiers; if (e->nullWindow -#ifdef Q_OS_ANDROID - || (e->keyType == QEvent::KeyRelease && e->key == Qt::Key_Back) || e->key == Qt::Key_Menu +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + || e->key == Qt::Key_Back || e->key == Qt::Key_Menu #endif ) { window = QGuiApplication::focusWindow(); } - if (!window -#ifdef Q_OS_ANDROID - && e->keyType != QEvent::KeyRelease && e->key != Qt::Key_Back -#endif - ) { - return; - } - if (window && window->d_func()->blockedByModalWindow) { - // a modal window is blocking this window, don't allow key events through - return; - } QKeyEvent ev(e->keyType, e->key, e->modifiers, e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers, e->unicode, e->repeat, e->repeatCount); ev.setTimestamp(e->timestamp); -#ifdef Q_OS_ANDROID - if (e->keyType == QEvent::KeyRelease && e->key == Qt::Key_Back) { - if (!window) { + // only deliver key events when we have a window, and no modal window is blocking this window + + if (window && !window->d_func()->blockedByModalWindow) + QGuiApplication::sendSpontaneousEvent(window, &ev); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + else + ev.setAccepted(false); + + static bool backKeyPressAccepted = false; + if (e->keyType == QEvent::KeyPress) { + backKeyPressAccepted = e->key == Qt::Key_Back && ev.isAccepted(); + } else if (e->keyType == QEvent::KeyRelease && e->key == Qt::Key_Back && !backKeyPressAccepted && !ev.isAccepted()) { + if (!window) qApp->quit(); - } else { - QGuiApplication::sendEvent(window, &ev); - if (!ev.isAccepted() && e->key == Qt::Key_Back) - QWindowSystemInterface::handleCloseEvent(window); - } - } else + else + QWindowSystemInterface::handleCloseEvent(window); + } #endif - QGuiApplication::sendSpontaneousEvent(window, &ev); } void QGuiApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e) -- cgit v1.2.3 From 8b61ec579693b4420f62e9563c61035659de7ffe Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 26 Oct 2013 10:59:54 +0200 Subject: remove dead code this file is not built as part of the xml library for years, so the condition was never true. Change-Id: Ifdc044b6a8044c5093a3f7c268505527dd53f134 Reviewed-by: Joerg Bornemann --- src/corelib/xml/qxmlstream.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src') diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index 75ccea94e0..2a26c2ede4 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -41,13 +41,6 @@ #include "QtCore/qxmlstream.h" -#if defined(QT_BUILD_XML_LIB) && defined(Q_OS_MAC64) -// No need to define this in the 64-bit Mac libraries. -// Since Qt 4.4 and previous weren't supported in 64-bit, there are -// no QXmlStream* symbols to keep compatibility with -# define QT_NO_XMLSTREAM -#endif - #ifndef QT_NO_XMLSTREAM #include "qxmlutils_p.h" -- cgit v1.2.3 From 95156cfff75398d8e920f2aee5abef42dd07c0b3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 25 Oct 2013 14:49:16 +0200 Subject: purge vestiges of dead QT_NO_* defines Change-Id: I6be54e8ce4c2522b3907a645506b695fab3aebd9 Reviewed-by: Tasuku Suzuki Reviewed-by: Joerg Bornemann --- src/corelib/global/qconfig-large.h | 28 --------- src/corelib/global/qconfig-medium.h | 40 ------------- src/corelib/global/qconfig-minimal.h | 89 ----------------------------- src/corelib/global/qconfig-nacl.h | 106 ----------------------------------- src/corelib/global/qconfig-small.h | 26 --------- src/corelib/global/qfeatures.txt | 20 +------ 6 files changed, 1 insertion(+), 308 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qconfig-large.h b/src/corelib/global/qconfig-large.h index 584be07067..0c1fcbf7da 100644 --- a/src/corelib/global/qconfig-large.h +++ b/src/corelib/global/qconfig-large.h @@ -56,11 +56,6 @@ # define QT_NO_PROGRESSDIALOG #endif -/* Fonts */ -#ifndef QT_NO_QWS_QPF -# define QT_NO_QWS_QPF -#endif - /* Images */ #ifndef QT_NO_IMAGEFORMAT_BMP # define QT_NO_IMAGEFORMAT_BMP @@ -76,9 +71,6 @@ #ifndef QT_NO_TRANSLATION # define QT_NO_TRANSLATION #endif -#ifndef QT_NO_TRANSLATION_UTF8 -# define QT_NO_TRANSLATION_UTF8 -#endif /* ItemViews */ #ifndef QT_NO_TABLEVIEW @@ -101,23 +93,14 @@ #ifndef QT_NO_PROPERTIES # define QT_NO_PROPERTIES #endif -#ifndef QT_NO_SOUND -# define QT_NO_SOUND -#endif /* Networking */ -#ifndef QT_NO_HOSTINFO -# define QT_NO_HOSTINFO -#endif #ifndef QT_NO_HTTP # define QT_NO_HTTP #endif #ifndef QT_NO_UDPSOCKET # define QT_NO_UDPSOCKET #endif -#ifndef QT_NO_URLINFO -# define QT_NO_URLINFO -#endif #ifndef QT_NO_FTP # define QT_NO_FTP #endif @@ -136,18 +119,7 @@ # define QT_NO_CUPS #endif -/* Qt for Embedded Linux */ -#ifndef QT_NO_QWS_SOUNDSERVER -# define QT_NO_QWS_SOUNDSERVER -#endif - /* Styles */ -#ifndef QT_NO_STYLE_MOTIF -# define QT_NO_STYLE_MOTIF -#endif -#ifndef QT_NO_STYLE_CDE -# define QT_NO_STYLE_CDE -#endif #ifndef QT_NO_STYLE_STYLESHEET # define QT_NO_STYLE_STYLESHEET #endif diff --git a/src/corelib/global/qconfig-medium.h b/src/corelib/global/qconfig-medium.h index 132c8ce45c..5ad2610f68 100644 --- a/src/corelib/global/qconfig-medium.h +++ b/src/corelib/global/qconfig-medium.h @@ -58,14 +58,6 @@ #ifndef QT_NO_PROGRESSDIALOG # define QT_NO_PROGRESSDIALOG #endif -#ifndef QT_NO_TABDIALOG -# define QT_NO_TABDIALOG -#endif - -/* Fonts */ -#ifndef QT_NO_QWS_QPF -# define QT_NO_QWS_QPF -#endif /* Images */ #ifndef QT_NO_IMAGEFORMAT_BMP @@ -91,9 +83,6 @@ #ifndef QT_NO_TRANSLATION # define QT_NO_TRANSLATION #endif -#ifndef QT_NO_TRANSLATION_UTF8 -# define QT_NO_TRANSLATION_UTF8 -#endif /* ItemViews */ #ifndef QT_NO_TABLEVIEW @@ -125,20 +114,11 @@ #ifndef QT_NO_SHORTCUT # define QT_NO_SHORTCUT #endif -#ifndef QT_NO_SOUND -# define QT_NO_SOUND -#endif #ifndef QT_NO_WHEELEVENT # define QT_NO_WHEELEVENT #endif /* Networking */ -#ifndef QT_NO_COP -# define QT_NO_COP -#endif -#ifndef QT_NO_HOSTINFO -# define QT_NO_HOSTINFO -#endif #ifndef QT_NO_HTTP # define QT_NO_HTTP #endif @@ -151,9 +131,6 @@ #ifndef QT_NO_UDPSOCKET # define QT_NO_UDPSOCKET #endif -#ifndef QT_NO_URLINFO -# define QT_NO_URLINFO -#endif #ifndef QT_NO_FTP # define QT_NO_FTP #endif @@ -172,24 +149,7 @@ # define QT_NO_CUPS #endif -/* Qt for Embedded Linux */ -#ifndef QT_NO_QWSEMBEDWIDGET -# define QT_NO_QWSEMBEDWIDGET -#endif -#ifndef QT_NO_QWS_SOUNDSERVER -# define QT_NO_QWS_SOUNDSERVER -#endif -#ifndef QT_NO_QWS_PROPERTIES -# define QT_NO_QWS_PROPERTIES -#endif - /* Styles */ -#ifndef QT_NO_STYLE_MOTIF -# define QT_NO_STYLE_MOTIF -#endif -#ifndef QT_NO_STYLE_CDE -# define QT_NO_STYLE_CDE -#endif #ifndef QT_NO_STYLE_STYLESHEET # define QT_NO_STYLE_STYLESHEET #endif diff --git a/src/corelib/global/qconfig-minimal.h b/src/corelib/global/qconfig-minimal.h index cc5ac9987c..5ef8366903 100644 --- a/src/corelib/global/qconfig-minimal.h +++ b/src/corelib/global/qconfig-minimal.h @@ -75,9 +75,6 @@ #ifndef QT_NO_PROGRESSDIALOG # define QT_NO_PROGRESSDIALOG #endif -#ifndef QT_NO_TABDIALOG -# define QT_NO_TABDIALOG -#endif #ifndef QT_NO_WIZARD # define QT_NO_WIZARD #endif @@ -109,9 +106,6 @@ #ifndef QT_NO_FREETYPE # define QT_NO_FREETYPE #endif -#ifndef QT_NO_QWS_QPF2 -# define QT_NO_QWS_QPF2 -#endif /* Images */ #ifndef QT_NO_IMAGEFORMATPLUGIN @@ -146,9 +140,6 @@ #ifndef QT_NO_BIG_CODECS # define QT_NO_BIG_CODECS #endif -#ifndef QT_NO_QWS_INPUTMETHODS -# define QT_NO_QWS_INPUTMETHODS -#endif #ifndef QT_NO_TEXTCODEC # define QT_NO_TEXTCODEC #endif @@ -158,9 +149,6 @@ #ifndef QT_NO_TRANSLATION # define QT_NO_TRANSLATION #endif -#ifndef QT_NO_TRANSLATION_UTF8 -# define QT_NO_TRANSLATION_UTF8 -#endif /* ItemViews */ #ifndef QT_NO_ITEMVIEWS @@ -228,9 +216,6 @@ #ifndef QT_NO_SHORTCUT # define QT_NO_SHORTCUT #endif -#ifndef QT_NO_SOUND -# define QT_NO_SOUND -#endif #ifndef QT_NO_SYSTEMSEMAPHORE # define QT_NO_SYSTEMSEMAPHORE #endif @@ -257,12 +242,6 @@ #endif /* Networking */ -#ifndef QT_NO_COP -# define QT_NO_COP -#endif -#ifndef QT_NO_HOSTINFO -# define QT_NO_HOSTINFO -#endif #ifndef QT_NO_HTTP # define QT_NO_HTTP #endif @@ -275,9 +254,6 @@ #ifndef QT_NO_UDPSOCKET # define QT_NO_UDPSOCKET #endif -#ifndef QT_NO_URLINFO -# define QT_NO_URLINFO -#endif #ifndef QT_NO_FTP # define QT_NO_FTP #endif @@ -286,12 +262,6 @@ #ifndef QT_NO_COLORNAMES # define QT_NO_COLORNAMES #endif -#ifndef QT_NO_DIRECTPAINTER -# define QT_NO_DIRECTPAINTER -#endif -#ifndef QT_NO_PAINTONSCREEN -# define QT_NO_PAINTONSCREEN -#endif #ifndef QT_NO_PAINT_DEBUG # define QT_NO_PAINT_DEBUG #endif @@ -305,63 +275,10 @@ # define QT_NO_CUPS #endif -/* Qt for Embedded Linux */ -#ifndef QT_NO_QWSEMBEDWIDGET -# define QT_NO_QWSEMBEDWIDGET -#endif -#ifndef QT_NO_QWS_ALPHA_CURSOR -# define QT_NO_QWS_ALPHA_CURSOR -#endif -#ifndef QT_NO_QWS_CURSOR -# define QT_NO_QWS_CURSOR -#endif -#ifndef QT_NO_QWS_DECORATION_DEFAULT -# define QT_NO_QWS_DECORATION_DEFAULT -#endif -#ifndef QT_NO_QWS_DECORATION_STYLED -# define QT_NO_QWS_DECORATION_STYLED -#endif -#ifndef QT_NO_QWS_DECORATION_WINDOWS -# define QT_NO_QWS_DECORATION_WINDOWS -#endif -#ifndef QT_NO_QWS_MANAGER -# define QT_NO_QWS_MANAGER -#endif -#ifndef QT_NO_QWS_KEYBOARD -# define QT_NO_QWS_KEYBOARD -#endif -#ifndef QT_NO_QWS_MOUSE -# define QT_NO_QWS_MOUSE -#endif -#ifndef QT_NO_QWS_MOUSE_AUTO -# define QT_NO_QWS_MOUSE_AUTO -#endif -#ifndef QT_NO_QWS_MOUSE_MANUAL -# define QT_NO_QWS_MOUSE_MANUAL -#endif -#ifndef QT_NO_QWS_MULTIPROCESS -# define QT_NO_QWS_MULTIPROCESS -#endif -#ifndef QT_NO_QWS_SOUNDSERVER -# define QT_NO_QWS_SOUNDSERVER -#endif -#ifndef QT_NO_QWS_PROPERTIES -# define QT_NO_QWS_PROPERTIES -#endif -#ifndef QT_NO_QWS_PROXYSCREEN -# define QT_NO_QWS_PROXYSCREEN -#endif -#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION -# define QT_NO_QWS_DYNAMICSCREENTRANSFORMATION -#endif - /* SVG */ #ifndef QT_NO_SVG # define QT_NO_SVG #endif -#ifndef QT_NO_GRAPHICSSVGITEM -# define QT_NO_GRAPHICSSVGITEM -#endif #ifndef QT_NO_SVGGENERATOR # define QT_NO_SVGGENERATOR #endif @@ -402,9 +319,6 @@ #ifndef QT_NO_DESKTOPSERVICES # define QT_NO_DESKTOPSERVICES #endif -#ifndef QT_NO_SCRIPT -# define QT_NO_SCRIPT -#endif #ifndef QT_NO_SYSTEMTRAYICON # define QT_NO_SYSTEMTRAYICON #endif @@ -485,9 +399,6 @@ #ifndef QT_NO_SPLITTER # define QT_NO_SPLITTER #endif -#ifndef QT_NO_SIGNALMAPPER -# define QT_NO_SIGNALMAPPER -#endif #ifndef QT_NO_SIZEGRIP # define QT_NO_SIZEGRIP #endif diff --git a/src/corelib/global/qconfig-nacl.h b/src/corelib/global/qconfig-nacl.h index c2854b26c3..4773c5ec26 100644 --- a/src/corelib/global/qconfig-nacl.h +++ b/src/corelib/global/qconfig-nacl.h @@ -72,9 +72,6 @@ #ifndef QT_NO_FILESYSTEMWATCHER # define QT_NO_FILESYSTEMWATCHER #endif -#ifndef QT_NO_FSFILEENGINE -# define QT_NO_FSFILEENGINE -#endif #ifndef QT_NO_FILESYSTEMMODEL # define QT_NO_FILESYSTEMMODEL #endif @@ -94,11 +91,6 @@ # define QT_NO_LIBRARY #endif -/* Fonts */ -#ifndef QT_NO_QWS_QPF2 -# define QT_NO_QWS_QPF2 -#endif - /* Images */ #ifndef QT_NO_IMAGEFORMATPLUGIN # define QT_NO_IMAGEFORMATPLUGIN @@ -114,9 +106,6 @@ #ifndef QT_NO_BIG_CODECS # define QT_NO_BIG_CODECS #endif -#ifndef QT_NO_QWS_INPUTMETHODS -# define QT_NO_QWS_INPUTMETHODS -#endif #ifndef QT_NO_TEXTCODEC # define QT_NO_TEXTCODEC #endif @@ -126,9 +115,6 @@ #ifndef QT_NO_TRANSLATION # define QT_NO_TRANSLATION #endif -#ifndef QT_NO_TRANSLATION_UTF8 -# define QT_NO_TRANSLATION_UTF8 -#endif /* ItemViews */ @@ -158,9 +144,6 @@ #ifndef QT_NO_SHAREDMEMORY # define QT_NO_SHAREDMEMORY #endif -#ifndef QT_NO_SOUND -# define QT_NO_SOUND -#endif #ifndef QT_NO_SYSTEMLOCALE # define QT_NO_SYSTEMSEMAPHORE #endif @@ -187,12 +170,6 @@ #endif /* Networking */ -#ifndef QT_NO_COP -# define QT_NO_COP -#endif -#ifndef QT_NO_HOSTINFO -# define QT_NO_HOSTINFO -#endif #ifndef QT_NO_HTTP # define QT_NO_HTTP #endif @@ -205,9 +182,6 @@ #ifndef QT_NO_UDPSOCKET # define QT_NO_UDPSOCKET #endif -#ifndef QT_NO_URLINFO -# define QT_NO_URLINFO -#endif #ifndef QT_NO_FTP # define QT_NO_FTP #endif @@ -216,12 +190,6 @@ #ifndef QT_NO_COLORNAMES # define QT_NO_COLORNAMES #endif -#ifndef QT_NO_DIRECTPAINTER -# define QT_NO_DIRECTPAINTER -#endif -#ifndef QT_NO_PAINTONSCREEN -# define QT_NO_PAINTONSCREEN -#endif #ifndef QT_NO_PAINT_DEBUG # define QT_NO_PAINT_DEBUG #endif @@ -235,75 +203,10 @@ # define QT_NO_CUPS #endif -/* Qt for Embedded Linux */ -#ifndef QT_NO_QWSEMBEDWIDGET -# define QT_NO_QWSEMBEDWIDGET -#endif -#ifndef QT_NO_QWS_ALPHA_CURSOR -# define QT_NO_QWS_ALPHA_CURSOR -#endif -#ifndef QT_NO_QWS_CURSOR -# define QT_NO_QWS_CURSOR -#endif -#ifndef QT_NO_QWS_DECORATION_DEFAULT -# define QT_NO_QWS_DECORATION_DEFAULT -#endif -#ifndef QT_NO_QWS_DECORATION_STYLED -# define QT_NO_QWS_DECORATION_STYLED -#endif -#ifndef QT_NO_QWS_DECORATION_WINDOWS -# define QT_NO_QWS_DECORATION_WINDOWS -#endif -#ifndef QT_NO_QWS_MANAGER -# define QT_NO_QWS_MANAGER -#endif -#ifndef QT_NO_QWS_KEYBOARD -# define QT_NO_QWS_KEYBOARD -#endif -#ifndef QT_NO_QWS_MOUSE -# define QT_NO_QWS_MOUSE -#endif -#ifndef QT_NO_QWS_MOUSE_AUTO -# define QT_NO_QWS_MOUSE_AUTO -#endif -#ifndef QT_NO_QWS_MOUSE_MANUAL -# define QT_NO_QWS_MOUSE_MANUAL -#endif -#ifndef QT_NO_QWS_MULTIPROCESS -# define QT_NO_QWS_MULTIPROCESS -#endif -#ifndef QT_NO_QWS_SOUNDSERVER -# define QT_NO_QWS_SOUNDSERVER -#endif -#ifndef QT_NO_QWS_PROPERTIES -# define QT_NO_QWS_PROPERTIES -#endif -#ifndef QT_NO_QWS_PROXYSCREEN -# define QT_NO_QWS_PROXYSCREEN -#endif -#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION -# define QT_NO_QWS_DYNAMICSCREENTRANSFORMATION -#endif -#ifndef QT_NO_QWS_LINUXFB -# define QT_NO_QWS_LINUXFB -#endif -#ifndef QT_NO_QWS_MOUSE_PC -# define QT_NO_QWS_MOUSE_PC -#endif -#ifndef QT_NO_QWS_MOUSE_LINUXTP -# define QT_NO_QWS_MOUSE_LINUXTP -#endif -#ifndef QT_NO_QWS_QPF -# define QT_NO_QWS_QPF -#endif - /* SVG */ #ifndef QT_NO_SVG # define QT_NO_SVG #endif -#ifndef QT_NO_GRAPHICSSVGITEM -# define QT_NO_GRAPHICSSVGITEM -#endif #ifndef QT_NO_SVGGENERATOR # define QT_NO_SVGGENERATOR #endif @@ -315,12 +218,6 @@ #endif /* Styles */ -#ifndef QT_NO_STYLE_MOTIF -# define QT_NO_STYLE_MOTIF -#endif -#ifndef QT_NO_STYLE_CDE -# define QT_NO_STYLE_CDE -#endif #ifndef QT_NO_STYLE_STYLESHEET # define QT_NO_STYLE_STYLESHEET #endif @@ -347,9 +244,6 @@ #ifndef QT_NO_DESKTOPSERVICES # define QT_NO_DESKTOPSERVICES #endif -#ifndef QT_NO_SCRIPT -# define QT_NO_SCRIPT -#endif #ifndef QT_NO_SYSTEMTRAYICON # define QT_NO_SYSTEMTRAYICON #endif diff --git a/src/corelib/global/qconfig-small.h b/src/corelib/global/qconfig-small.h index f730b3d5d2..8a0e769383 100644 --- a/src/corelib/global/qconfig-small.h +++ b/src/corelib/global/qconfig-small.h @@ -64,9 +64,6 @@ #ifndef QT_NO_PROGRESSDIALOG # define QT_NO_PROGRESSDIALOG #endif -#ifndef QT_NO_TABDIALOG -# define QT_NO_TABDIALOG -#endif /* File I/O */ #ifndef QT_NO_SETTINGS @@ -105,9 +102,6 @@ #endif /* Internationalization */ -#ifndef QT_NO_QWS_INPUTMETHODS -# define QT_NO_QWS_INPUTMETHODS -#endif #ifndef QT_NO_TEXTCODEC # define QT_NO_TEXTCODEC #endif @@ -117,9 +111,6 @@ #ifndef QT_NO_TRANSLATION # define QT_NO_TRANSLATION #endif -#ifndef QT_NO_TRANSLATION_UTF8 -# define QT_NO_TRANSLATION_UTF8 -#endif /* ItemViews */ #ifndef QT_NO_DIRMODEL @@ -163,20 +154,11 @@ #ifndef QT_NO_SHORTCUT # define QT_NO_SHORTCUT #endif -#ifndef QT_NO_SOUND -# define QT_NO_SOUND -#endif #ifndef QT_NO_WHEELEVENT # define QT_NO_WHEELEVENT #endif /* Networking */ -#ifndef QT_NO_COP -# define QT_NO_COP -#endif -#ifndef QT_NO_HOSTINFO -# define QT_NO_HOSTINFO -#endif #ifndef QT_NO_HTTP # define QT_NO_HTTP #endif @@ -195,14 +177,6 @@ # define QT_NO_CUPS #endif -/* Qt for Embedded Linux */ -#ifndef QT_NO_QWS_SOUNDSERVER -# define QT_NO_QWS_SOUNDSERVER -#endif -#ifndef QT_NO_QWS_PROPERTIES -# define QT_NO_QWS_PROPERTIES -#endif - /* Styles */ #ifndef QT_NO_STYLE_FUSION # define QT_NO_STYLE_FUSION diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 4d07c798c8..50b803c912 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -759,12 +759,6 @@ Section: Painting Requires: PRINTER LIBRARY Name: Common UNIX Printing System -Feature: PAINTONSCREEN -Description: Supports the Qt::WA_PaintOnScreen widget attribute. -Section: Painting -Requires: -Name: Qt::WA_PaintOnScreen - Feature: PAINT_DEBUG Description: Debug painting with the environment variables QT_FLUSH_UPDATE and QT_FLUSH_PAINT Section: Painting @@ -787,12 +781,6 @@ Section: Internationalization Requires: Name: Translation -Feature: TRANSLATION_UTF8 -Description: Supports translations using QObject::trUtf8(). -Section: Internationalization -Requires: TRANSLATION TEXTCODEC -Name: Translation (UTF-8 representation) - Feature: TEXTCODEC Description: Supports conversions between text encodings. Section: Internationalization @@ -819,12 +807,6 @@ Name: iconv # Networking -Feature: HOSTINFO -Description: Supports host name lookups. -Section: Networking -Requires: -Name: QHostInfo - Feature: FTP Description: Supports FTP file access. Section: Networking @@ -834,7 +816,7 @@ Name: File Transfer Protocol Feature: HTTP Description: Supports HTTP file access. Section: Networking -Requires: HOSTINFO +Requires: Name: Hyper Text Transfer Protocol Feature: UDPSOCKET -- cgit v1.2.3 From 6f0c88f6c36030c91b1d54e00989cc9f39529951 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 25 Oct 2013 21:28:28 +0200 Subject: purge references to non-features due to modularization, svg and activeqt do not belong here any more. note that concurrent and dbus are staying for the time being, because being part of qtbase and configure lacking support to switch them off, this is the only way to disable the modules. Change-Id: Idbc0d2f7db23f7e797fc301ab1136f69f9049b27 Reviewed-by: Tasuku Suzuki Reviewed-by: Joerg Bornemann --- src/corelib/global/qconfig-medium.h | 5 ----- src/corelib/global/qconfig-minimal.h | 19 ------------------- src/corelib/global/qconfig-nacl.h | 19 ------------------- 3 files changed, 43 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qconfig-medium.h b/src/corelib/global/qconfig-medium.h index 5ad2610f68..e5ab33faed 100644 --- a/src/corelib/global/qconfig-medium.h +++ b/src/corelib/global/qconfig-medium.h @@ -241,8 +241,3 @@ #ifndef QT_NO_TREEWIDGET # define QT_NO_TREEWIDGET #endif - -/* Windows */ -#ifndef QT_NO_WIN_ACTIVEQT -# define QT_NO_WIN_ACTIVEQT -#endif diff --git a/src/corelib/global/qconfig-minimal.h b/src/corelib/global/qconfig-minimal.h index 5ef8366903..b27f3271c1 100644 --- a/src/corelib/global/qconfig-minimal.h +++ b/src/corelib/global/qconfig-minimal.h @@ -275,20 +275,6 @@ # define QT_NO_CUPS #endif -/* SVG */ -#ifndef QT_NO_SVG -# define QT_NO_SVG -#endif -#ifndef QT_NO_SVGGENERATOR -# define QT_NO_SVGGENERATOR -#endif -#ifndef QT_NO_SVGRENDERER -# define QT_NO_SVGRENDERER -#endif -#ifndef QT_NO_SVGWIDGET -# define QT_NO_SVGWIDGET -#endif - /* Styles */ #ifndef QT_NO_STYLE_FUSION # define QT_NO_STYLE_FUSION @@ -474,8 +460,3 @@ #ifndef QT_NO_VALIDATOR # define QT_NO_VALIDATOR #endif - -/* Windows */ -#ifndef QT_NO_WIN_ACTIVEQT -# define QT_NO_WIN_ACTIVEQT -#endif diff --git a/src/corelib/global/qconfig-nacl.h b/src/corelib/global/qconfig-nacl.h index 4773c5ec26..22dd56e772 100644 --- a/src/corelib/global/qconfig-nacl.h +++ b/src/corelib/global/qconfig-nacl.h @@ -203,20 +203,6 @@ # define QT_NO_CUPS #endif -/* SVG */ -#ifndef QT_NO_SVG -# define QT_NO_SVG -#endif -#ifndef QT_NO_SVGGENERATOR -# define QT_NO_SVGGENERATOR -#endif -#ifndef QT_NO_SVGRENDERER -# define QT_NO_SVGRENDERER -#endif -#ifndef QT_NO_SVGWIDGET -# define QT_NO_SVGWIDGET -#endif - /* Styles */ #ifndef QT_NO_STYLE_STYLESHEET # define QT_NO_STYLE_STYLESHEET @@ -247,8 +233,3 @@ #ifndef QT_NO_SYSTEMTRAYICON # define QT_NO_SYSTEMTRAYICON #endif - -/* Windows */ -#ifndef QT_NO_WIN_ACTIVEQT -# define QT_NO_WIN_ACTIVEQT -#endif -- cgit v1.2.3 From 192a6fb82f44c065a56a824d7726718e59d4b438 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 25 Oct 2013 21:37:03 +0200 Subject: fix "markup" Change-Id: I447175adf1c00e4e20b36747ee035e30a74a50f8 Reviewed-by: Tasuku Suzuki Reviewed-by: Joerg Bornemann --- src/corelib/global/qfeatures.txt | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 50b803c912..ed8b797213 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -133,6 +133,7 @@ Description: Inputmethods with QInputContext Section: Kernel Requires: LIBRARY Name: QInputContext + # Data structures Feature: TEXTDATE @@ -186,15 +187,13 @@ Requires: Name: QFileSystemModel Feature: FILESYSTEMWATCHER -Description: Provides an interface for monitoring files and directories -for modications. +Description: Provides an interface for monitoring files and directories for modications. Section: File I/O Requires: Name: QFileSystemWatcher Feature: FILESYSTEMITERATOR Description: Provides fast file-system iteration. -for modications. Section: File I/O Requires: Name: QFileSystemIterator @@ -310,7 +309,7 @@ Requires: MAINWINDOW Name: QToolBar Feature: TOOLBOX -Description: Supports columns of tabbed widget items. +Description: Supports columns of tabbed widget items. Section: Widgets Requires: TOOLBUTTON SCROLLAREA Name: QToolBox @@ -334,8 +333,7 @@ Requires: MENU RESIZEHANDLER TOOLBUTTON Name: QMainWindow Feature: DOCKWIDGET -Description: Supports docking widgets inside a QMainWindow or floated as -a top-level window on the desktop. +Description: Supports docking widgets inside a QMainWindow or floated as a top-level window on the desktop. Section: Widgets Requires: RUBBERBAND MAINWINDOW Name: QDockwidget @@ -383,8 +381,7 @@ Requires: Name: QSlider Feature: SCROLLBAR -Description: Supports scrollbars allowing the user access parts of a -document that is larger than the widget used to display it. +Description: Supports scrollbars allowing the user access parts of a document that is larger than the widget used to display it. Section: Widgets Requires: SLIDER Name: QScrollBar @@ -468,15 +465,13 @@ Requires: Name: QSizeGrip Feature: CALENDARWIDGET -Description: Provides a monthly based calendar widget allowing the user to select -a date. +Description: Provides a monthly based calendar widget allowing the user to select a date. Section: Widgets Requires: TABLEVIEW MENU TEXTDATE SPINBOX TOOLBUTTON Name: QCalendarWidget Feature: PRINTPREVIEWWIDGET Description: Provides a widget for previewing page layouts for printer output. -a date. Section: Widgets Requires: GRAPHICSVIEW PRINTER MAINWINDOW Name: QPrintPreviewWidget @@ -533,7 +528,7 @@ Requires: COMBOBOX SPINBOX STACKEDWIDGET Name: QInputDialog Feature: ERRORMESSAGE -Description: Supports an error message display dialog. +Description: Supports an error message display dialog. Section: Dialogs Requires: TEXTEDIT Name: QErrorMessage @@ -547,8 +542,7 @@ Name: QWizard # ItemViews Feature: ITEMVIEWS -Description: Supports the model/view architecture managing the relationship -between data and the way it is presented to the user. +Description: Supports the model/view architecture managing the relationship between data and the way it is presented to the user. Section: ItemViews Requires: RUBBERBAND SCROLLAREA Name: The Model/View Framework @@ -572,8 +566,7 @@ Requires: ITEMVIEWS Name: QAbstractProxyModel Feature: SORTFILTERPROXYMODEL -Description: Supports sorting and filtering of data passed between -another model and a view. +Description: Supports sorting and filtering of data passed between another model and a view. Section: ItemViews Requires: PROXYMODEL Name: QSortFilterProxyModel @@ -679,7 +672,7 @@ Requires: Name: QMovie Feature: IMAGEFORMAT_BMP -Description: Supports Microsoft's Bitmap image file format. +Description: Supports Microsoft's Bitmap image file format. Section: Images Requires: Name: BMP Image Format @@ -735,8 +728,7 @@ Requires: Name: QPicture Feature: COLORNAMES -Description: Supports color names such as "red", used by QColor -and by some HTML documents. +Description: Supports color names such as "red", used by QColor and by some HTML documents. Section: Painting Requires: Name: Color Names @@ -835,7 +827,7 @@ Feature: SOCKS5 Description: Supports SOCKS v5 network proxy. Section: Networking Requires: NETWORKPROXY -Name: SOCKS5 +Name: SOCKS5 Feature: NETWORKINTERFACE Description: Supports listing the host's IP addresses and network interfaces -- cgit v1.2.3 From 569ec1ab346e786e98a8e6884ed40a063a740832 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 25 Oct 2013 21:31:01 +0200 Subject: give XMLSTREAM a Name Change-Id: I4759d8d64f90db580cd15cad6edeed77411c0c33 Reviewed-by: Tasuku Suzuki Reviewed-by: Joerg Bornemann --- src/corelib/global/qfeatures.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index ed8b797213..ce0076bce5 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -114,7 +114,7 @@ Feature: XMLSTREAM Description: Provides a simple streaming API for XML. Section: Kernel Requires: -Name: +Name: XML Streaming APIs Feature: XMLSTREAMREADER Description: Provides a well-formed XML parser with a simple streaming API. -- cgit v1.2.3 From 08a737def9145a53615871bb5900f9794bf699f5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 23 Oct 2013 15:24:03 +0200 Subject: generate qfeatures.h at build time much more elegant than the checked in file. and less chance to get it wrong, as people often enough do. Change-Id: I975a62dfd83ce4f15947ce54f3c40931b1badae0 Reviewed-by: Tasuku Suzuki Reviewed-by: Joerg Bornemann --- src/corelib/global/global.pri | 1 + src/corelib/global/qfeatures.h | 686 ----------------------------------------- src/corelib/global/qglobal.h | 3 +- 3 files changed, 2 insertions(+), 688 deletions(-) delete mode 100644 src/corelib/global/qfeatures.h (limited to 'src') diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index a0842a946d..fd031469f6 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -31,6 +31,7 @@ INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global # configure creates these, not syncqt, so we need to manually inject them qconfig_h_files = \ + $$OUT_PWD/global/qfeatures.h \ $$OUT_PWD/global/qconfig.h \ $$QT_BUILD_TREE/include/QtCore/QtConfig targ_headers.files += $$qconfig_h_files diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h deleted file mode 100644 index 17dd600265..0000000000 --- a/src/corelib/global/qfeatures.h +++ /dev/null @@ -1,686 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - * All features and their dependencies. - * - * This list is generated from $QTDIR/src/corelib/global/qfeatures.txt - * by $QTSRCDIR/util/scripts/make_qfeatures_dot_h - */ - -// QAction -//#define QT_NO_ACTION - -// QClipboard -//#define QT_NO_CLIPBOARD - -// Color Names -//#define QT_NO_COLORNAMES - -// QtConcurrent -//#define QT_NO_CONCURRENT - -// CssParser -//#define QT_NO_CSSPARSER - -// QCursor -//#define QT_NO_CURSOR - -// QDesktopServices -//#define QT_NO_DESKTOPSERVICES - -// Document Object Model -//#define QT_NO_DOM - -// Effects -//#define QT_NO_EFFECTS - -// QFileSystemIterator -//#define QT_NO_FILESYSTEMITERATOR - -// QFileSystemWatcher -//#define QT_NO_FILESYSTEMWATCHER - -// Freetype Font Engine -//#define QT_NO_FREETYPE - -// Gesture -//#define QT_NO_GESTURES - -// QGroupBox -//#define QT_NO_GROUPBOX - -// QHostInfo -//#define QT_NO_HOSTINFO - -// BMP Image Format -//#define QT_NO_IMAGEFORMAT_BMP - -// JPEG Image Format -//#define QT_NO_IMAGEFORMAT_JPEG - -// PNG Image Format -//#define QT_NO_IMAGEFORMAT_PNG - -// PPM Image Format -//#define QT_NO_IMAGEFORMAT_PPM - -// XBM Image Format -//#define QT_NO_IMAGEFORMAT_XBM - -// XPM Image Format -//#define QT_NO_IMAGEFORMAT_XPM - -// QImage::createHeuristicMask() -//#define QT_NO_IMAGE_HEURISTIC_MASK - -// Image Text -//#define QT_NO_IMAGE_TEXT - -// QKeySequenceEdit -//#define QT_NO_KEYSEQUENCEEDIT - -// QLCDNumber -//#define QT_NO_LCDNUMBER - -// QLibrary -//#define QT_NO_LIBRARY - -// QLineEdit -//#define QT_NO_LINEEDIT - -// QMessageBox -//#define QT_NO_MESSAGEBOX - -// QMovie -//#define QT_NO_MOVIE - -// QNetworkInterface -//#define QT_NO_NETWORKINTERFACE - -// QNetworkProxy -//#define QT_NO_NETWORKPROXY - -// Qt::WA_PaintOnScreen -//#define QT_NO_PAINTONSCREEN - -// Painting Debug Utilities -//#define QT_NO_PAINT_DEBUG - -// QPicture -//#define QT_NO_PICTURE - -// QProcess -//#define QT_NO_PROCESS - -// QProgressBar -//#define QT_NO_PROGRESSBAR - -// Properties -//#define QT_NO_PROPERTIES - -// QRegularExpression -//#define QT_NO_REGULAREXPRESSION - -// Resize Handler -//#define QT_NO_RESIZEHANDLER - -// QRubberBand -//#define QT_NO_RUBBERBAND - -// Session Manager -//#define QT_NO_SESSIONMANAGER - -// QSettings -//#define QT_NO_SETTINGS - -// QSharedMemory -//#define QT_NO_SHAREDMEMORY - -// QShortcut -//#define QT_NO_SHORTCUT - -// QSizeGrip -//#define QT_NO_SIZEGRIP - -// QSlider -//#define QT_NO_SLIDER - -// Spin Widget -//#define QT_NO_SPINWIDGET - -// Splash screen widget -//#define QT_NO_SPLASHSCREEN - -// QStackedWidget -//#define QT_NO_STACKEDWIDGET - -// QStatusBar -//#define QT_NO_STATUSBAR - -// Status Tip -//#define QT_NO_STATUSTIP - -// QWindowsStyle -//#define QT_NO_STYLE_WINDOWS - -// QSystemSemaphore -//#define QT_NO_SYSTEMSEMAPHORE - -// QSystemTrayIcon -//#define QT_NO_SYSTEMTRAYICON - -// QTabletEvent -//#define QT_NO_TABLETEVENT - -// QTemporaryFile -//#define QT_NO_TEMPORARYFILE - -// QTextCodec -//#define QT_NO_TEXTCODEC - -// Text Date -//#define QT_NO_TEXTDATE - -// HtmlParser -//#define QT_NO_TEXTHTMLPARSER - -// QToolTip -//#define QT_NO_TOOLTIP - -// Translation -//#define QT_NO_TRANSLATION - -// QUdpSocket -//#define QT_NO_UDPSOCKET - -// QUndoCommand -//#define QT_NO_UNDOCOMMAND - -// QValidator -//#define QT_NO_VALIDATOR - -// QWheelEvent -//#define QT_NO_WHEELEVENT - -// -//#define QT_NO_XMLSTREAM - -// Animation -#if !defined(QT_NO_ANIMATION) && (defined(QT_NO_PROPERTIES)) -#define QT_NO_ANIMATION -#endif - -// Big Codecs -#if !defined(QT_NO_BIG_CODECS) && (defined(QT_NO_TEXTCODEC)) -#define QT_NO_BIG_CODECS -#endif - -// QButtonGroup -#if !defined(QT_NO_BUTTONGROUP) && (defined(QT_NO_GROUPBOX)) -#define QT_NO_BUTTONGROUP -#endif - -// Codecs -#if !defined(QT_NO_CODECS) && (defined(QT_NO_TEXTCODEC)) -#define QT_NO_CODECS -#endif - -// QDate/QTime/QDateTime -#if !defined(QT_NO_DATESTRING) && (defined(QT_NO_TEXTDATE)) -#define QT_NO_DATESTRING -#endif - -// QDial -#if !defined(QT_NO_DIAL) && (defined(QT_NO_SLIDER)) -#define QT_NO_DIAL -#endif - -// Drag and drop -#if !defined(QT_NO_DRAGANDDROP) && (defined(QT_NO_IMAGEFORMAT_XPM)) -#define QT_NO_DRAGANDDROP -#endif - -// File Transfer Protocol -#if !defined(QT_NO_FTP) && (defined(QT_NO_TEXTDATE)) -#define QT_NO_FTP -#endif - -// Hyper Text Transfer Protocol -#if !defined(QT_NO_HTTP) && (defined(QT_NO_HOSTINFO)) -#define QT_NO_HTTP -#endif - -// iconv -#if !defined(QT_NO_ICONV) && (defined(QT_NO_TEXTCODEC)) -#define QT_NO_ICONV -#endif - -// QInputContext -#if !defined(QT_NO_IM) && (defined(QT_NO_LIBRARY)) -#define QT_NO_IM -#endif - -// QImageIOPlugin -#if !defined(QT_NO_IMAGEFORMATPLUGIN) && (defined(QT_NO_LIBRARY)) -#define QT_NO_IMAGEFORMATPLUGIN -#endif - -// QKeySequenceEdit -#if !defined(QT_NO_KEYSEQUENCEEDIT) && (defined(QT_NO_SHORTCUT)) -#define QT_NO_KEYSEQUENCEEDIT -#endif - -// QLocalServer -#if !defined(QT_NO_LOCALSERVER) && (defined(QT_NO_TEMPORARYFILE)) -#define QT_NO_LOCALSERVER -#endif - -// QPdf -#if !defined(QT_NO_PDF) && (defined(QT_NO_TEMPORARYFILE)) -#define QT_NO_PDF -#endif - -// QMenu -#if !defined(QT_NO_MENU) && (defined(QT_NO_ACTION)) -#define QT_NO_MENU -#endif - -// QNetworkDiskCache -#if !defined(QT_NO_NETWORKDISKCACHE) && (defined(QT_NO_TEMPORARYFILE)) -#define QT_NO_NETWORKDISKCACHE -#endif - -// QProgressDialog -#if !defined(QT_NO_PROGRESSDIALOG) && (defined(QT_NO_PROGRESSBAR)) -#define QT_NO_PROGRESSDIALOG -#endif - -// QScrollBar -#if !defined(QT_NO_SCROLLBAR) && (defined(QT_NO_SLIDER)) -#define QT_NO_SCROLLBAR -#endif - -// SOCKS5 -#if !defined(QT_NO_SOCKS5) && (defined(QT_NO_NETWORKPROXY)) -#define QT_NO_SOCKS5 -#endif - -// QSplitter -#if !defined(QT_NO_SPLITTER) && (defined(QT_NO_RUBBERBAND)) -#define QT_NO_SPLITTER -#endif - -// State machine -#if !defined(QT_NO_STATEMACHINE) && (defined(QT_NO_PROPERTIES)) -#define QT_NO_STATEMACHINE -#endif - -// QFusionStyle -#if !defined(QT_NO_STYLE_FUSION) && (defined(QT_NO_IMAGEFORMAT_XPM)) -#define QT_NO_STYLE_FUSION -#endif - -// QWindowsXPStyle -#if !defined(QT_NO_STYLE_WINDOWSXP) && (defined(QT_NO_STYLE_WINDOWS)) -#define QT_NO_STYLE_WINDOWSXP -#endif - -// QToolButton -#if !defined(QT_NO_TOOLBUTTON) && (defined(QT_NO_ACTION)) -#define QT_NO_TOOLBUTTON -#endif - -// QUndoStack -#if !defined(QT_NO_UNDOSTACK) && (defined(QT_NO_UNDOCOMMAND)) -#define QT_NO_UNDOSTACK -#endif - -// QWizard -#if !defined(QT_NO_WIZARD) && (defined(QT_NO_PROPERTIES)) -#define QT_NO_WIZARD -#endif - -// QXmlStreamReader -#if !defined(QT_NO_XMLSTREAMREADER) && (defined(QT_NO_XMLSTREAM)) -#define QT_NO_XMLSTREAMREADER -#endif - -// QXmlStreamWriter -#if !defined(QT_NO_XMLSTREAMWRITER) && (defined(QT_NO_XMLSTREAM)) -#define QT_NO_XMLSTREAMWRITER -#endif - -// Context menu -#if !defined(QT_NO_CONTEXTMENU) && (defined(QT_NO_MENU)) -#define QT_NO_CONTEXTMENU -#endif - -// QPrinter -#if !defined(QT_NO_PRINTER) && (defined(QT_NO_PICTURE) || defined(QT_NO_TEMPORARYFILE)) -#define QT_NO_PRINTER -#endif - -// QScrollArea -#if !defined(QT_NO_SCROLLAREA) && (defined(QT_NO_SCROLLBAR)) -#define QT_NO_SCROLLAREA -#endif - -// QWindowsCEStyle -#if !defined(QT_NO_STYLE_WINDOWSCE) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_IMAGEFORMAT_XPM)) -#define QT_NO_STYLE_WINDOWSCE -#endif - -// QWindowsMobileStyle -#if !defined(QT_NO_STYLE_WINDOWSMOBILE) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_IMAGEFORMAT_XPM)) -#define QT_NO_STYLE_WINDOWSMOBILE -#endif - -// QWindowsVistaStyle -#if !defined(QT_NO_STYLE_WINDOWSVISTA) && (defined(QT_NO_STYLE_WINDOWSXP)) -#define QT_NO_STYLE_WINDOWSVISTA -#endif - -// QTabBar -#if !defined(QT_NO_TABBAR) && (defined(QT_NO_TOOLBUTTON)) -#define QT_NO_TABBAR -#endif - -// OdfWriter -#if !defined(QT_NO_TEXTODFWRITER) && (defined(QT_NO_XMLSTREAMWRITER)) -#define QT_NO_TEXTODFWRITER -#endif - -// Translation (UTF-8 representation) -#if !defined(QT_NO_TRANSLATION_UTF8) && (defined(QT_NO_TRANSLATION) || defined(QT_NO_TEXTCODEC)) -#define QT_NO_TRANSLATION_UTF8 -#endif - -// QUndoGroup -#if !defined(QT_NO_UNDOGROUP) && (defined(QT_NO_UNDOSTACK)) -#define QT_NO_UNDOGROUP -#endif - -// QWhatsThis -#if !defined(QT_NO_WHATSTHIS) && (defined(QT_NO_TOOLBUTTON)) -#define QT_NO_WHATSTHIS -#endif - -// Bearer Management -#if !defined(QT_NO_BEARERMANAGEMENT) && (defined(QT_NO_LIBRARY) || defined(QT_NO_NETWORKINTERFACE) || defined(QT_NO_PROPERTIES)) -#define QT_NO_BEARERMANAGEMENT -#endif - -// Qt D-Bus module -#if !defined(QT_NO_DBUS) && (defined(QT_NO_PROPERTIES) || defined(QT_NO_XMLSTREAMREADER)) -#define QT_NO_DBUS -#endif - -// QGraphicsView -#if !defined(QT_NO_GRAPHICSVIEW) && (defined(QT_NO_SCROLLAREA)) -#define QT_NO_GRAPHICSVIEW -#endif - -// QMdiArea -#if !defined(QT_NO_MDIAREA) && (defined(QT_NO_SCROLLAREA)) -#define QT_NO_MDIAREA -#endif - -// QSpinBox -#if !defined(QT_NO_SPINBOX) && (defined(QT_NO_SPINWIDGET) || defined(QT_NO_LINEEDIT) || defined(QT_NO_VALIDATOR)) -#define QT_NO_SPINBOX -#endif - -// QStyleSheetStyle -#if !defined(QT_NO_STYLE_STYLESHEET) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_PROPERTIES) || defined(QT_NO_CSSPARSER)) -#define QT_NO_STYLE_STYLESHEET -#endif - -// QColorDialog -#if !defined(QT_NO_COLORDIALOG) && (defined(QT_NO_SPINBOX)) -#define QT_NO_COLORDIALOG -#endif - -// Common UNIX Printing System -#if !defined(QT_NO_CUPS) && (defined(QT_NO_PRINTER) || defined(QT_NO_LIBRARY)) -#define QT_NO_CUPS -#endif - -// QGraphicsEffect -#if !defined(QT_NO_GRAPHICSEFFECT) && (defined(QT_NO_GRAPHICSVIEW)) -#define QT_NO_GRAPHICSEFFECT -#endif - -// The Model/View Framework -#if !defined(QT_NO_ITEMVIEWS) && (defined(QT_NO_RUBBERBAND) || defined(QT_NO_SCROLLAREA)) -#define QT_NO_ITEMVIEWS -#endif - -// QMenuBar -#if !defined(QT_NO_MENUBAR) && (defined(QT_NO_MENU) || defined(QT_NO_TOOLBUTTON)) -#define QT_NO_MENUBAR -#endif - -// QTabWidget -#if !defined(QT_NO_TABWIDGET) && (defined(QT_NO_TABBAR) || defined(QT_NO_STACKEDWIDGET)) -#define QT_NO_TABWIDGET -#endif - -// QTextEdit -#if !defined(QT_NO_TEXTEDIT) && (defined(QT_NO_SCROLLAREA) || defined(QT_NO_PROPERTIES)) -#define QT_NO_TEXTEDIT -#endif - -// QErrorMessage -#if !defined(QT_NO_ERRORMESSAGE) && (defined(QT_NO_TEXTEDIT)) -#define QT_NO_ERRORMESSAGE -#endif - -// QListView -#if !defined(QT_NO_LISTVIEW) && (defined(QT_NO_ITEMVIEWS)) -#define QT_NO_LISTVIEW -#endif - -// QMainWindow -#if !defined(QT_NO_MAINWINDOW) && (defined(QT_NO_MENU) || defined(QT_NO_RESIZEHANDLER) || defined(QT_NO_TOOLBUTTON)) -#define QT_NO_MAINWINDOW -#endif - -// QAbstractProxyModel -#if !defined(QT_NO_PROXYMODEL) && (defined(QT_NO_ITEMVIEWS)) -#define QT_NO_PROXYMODEL -#endif - -// QStandardItemModel -#if !defined(QT_NO_STANDARDITEMMODEL) && (defined(QT_NO_ITEMVIEWS)) -#define QT_NO_STANDARDITEMMODEL -#endif - -// QStringListModel -#if !defined(QT_NO_STRINGLISTMODEL) && (defined(QT_NO_ITEMVIEWS)) -#define QT_NO_STRINGLISTMODEL -#endif - -// QSyntaxHighlighter -#if !defined(QT_NO_SYNTAXHIGHLIGHTER) && (defined(QT_NO_TEXTEDIT)) -#define QT_NO_SYNTAXHIGHLIGHTER -#endif - -// QTableView -#if !defined(QT_NO_TABLEVIEW) && (defined(QT_NO_ITEMVIEWS)) -#define QT_NO_TABLEVIEW -#endif - -// QTextBrowser -#if !defined(QT_NO_TEXTBROWSER) && (defined(QT_NO_TEXTEDIT)) -#define QT_NO_TEXTBROWSER -#endif - -// QToolBox -#if !defined(QT_NO_TOOLBOX) && (defined(QT_NO_TOOLBUTTON) || defined(QT_NO_SCROLLAREA)) -#define QT_NO_TOOLBOX -#endif - -// QTreeView -#if !defined(QT_NO_TREEVIEW) && (defined(QT_NO_ITEMVIEWS)) -#define QT_NO_TREEVIEW -#endif - -// Accessibility -#if !defined(QT_NO_ACCESSIBILITY) && (defined(QT_NO_PROPERTIES) || defined(QT_NO_MENUBAR)) -#define QT_NO_ACCESSIBILITY -#endif - -// QColumnView -#if !defined(QT_NO_COLUMNVIEW) && (defined(QT_NO_LISTVIEW)) -#define QT_NO_COLUMNVIEW -#endif - -// QCompleter -#if !defined(QT_NO_COMPLETER) && (defined(QT_NO_PROXYMODEL)) -#define QT_NO_COMPLETER -#endif - -// QDataWidgetMapper -#if !defined(QT_NO_DATAWIDGETMAPPER) && (defined(QT_NO_ITEMVIEWS) || defined(QT_NO_PROPERTIES)) -#define QT_NO_DATAWIDGETMAPPER -#endif - -// QIdentityProxyModel -#if !defined(QT_NO_IDENTITYPROXYMODEL) && (defined(QT_NO_PROXYMODEL)) -#define QT_NO_IDENTITYPROXYMODEL -#endif - -// QListWidget -#if !defined(QT_NO_LISTWIDGET) && (defined(QT_NO_LISTVIEW)) -#define QT_NO_LISTWIDGET -#endif - -// QSortFilterProxyModel -#if !defined(QT_NO_SORTFILTERPROXYMODEL) && (defined(QT_NO_PROXYMODEL)) -#define QT_NO_SORTFILTERPROXYMODEL -#endif - -// QTableWidget -#if !defined(QT_NO_TABLEWIDGET) && (defined(QT_NO_TABLEVIEW)) -#define QT_NO_TABLEWIDGET -#endif - -// QToolBar -#if !defined(QT_NO_TOOLBAR) && (defined(QT_NO_MAINWINDOW)) -#define QT_NO_TOOLBAR -#endif - -// QTreeWidget -#if !defined(QT_NO_TREEWIDGET) && (defined(QT_NO_TREEVIEW)) -#define QT_NO_TREEWIDGET -#endif - -// QDirModel -#if !defined(QT_NO_DIRMODEL) && (defined(QT_NO_ITEMVIEWS) || defined(QT_NO_FILESYSTEMMODEL)) -#define QT_NO_DIRMODEL -#endif - -// QDockwidget -#if !defined(QT_NO_DOCKWIDGET) && (defined(QT_NO_RUBBERBAND) || defined(QT_NO_MAINWINDOW)) -#define QT_NO_DOCKWIDGET -#endif - -// QUndoView -#if !defined(QT_NO_UNDOVIEW) && (defined(QT_NO_UNDOSTACK) || defined(QT_NO_LISTVIEW)) -#define QT_NO_UNDOVIEW -#endif - -// QCompleter -#if !defined(QT_NO_FSCOMPLETER) && (defined(QT_NO_FILESYSTEMMODEL) || defined(QT_NO_COMPLETER)) -#define QT_NO_FSCOMPLETER -#endif - -// QComboBox -#if !defined(QT_NO_COMBOBOX) && (defined(QT_NO_LINEEDIT) || defined(QT_NO_STANDARDITEMMODEL) || defined(QT_NO_LISTVIEW)) -#define QT_NO_COMBOBOX -#endif - -// QPrintPreviewWidget -#if !defined(QT_NO_PRINTPREVIEWWIDGET) && (defined(QT_NO_GRAPHICSVIEW) || defined(QT_NO_PRINTER) || defined(QT_NO_MAINWINDOW)) -#define QT_NO_PRINTPREVIEWWIDGET -#endif - -// QCalendarWidget -#if !defined(QT_NO_CALENDARWIDGET) && (defined(QT_NO_TABLEVIEW) || defined(QT_NO_MENU) || defined(QT_NO_TEXTDATE) || defined(QT_NO_SPINBOX) || defined(QT_NO_TOOLBUTTON)) -#define QT_NO_CALENDARWIDGET -#endif - -// QDateTimeEdit -#if !defined(QT_NO_DATETIMEEDIT) && (defined(QT_NO_CALENDARWIDGET) || defined(QT_NO_DATESTRING)) -#define QT_NO_DATETIMEEDIT -#endif - -// QInputDialog -#if !defined(QT_NO_INPUTDIALOG) && (defined(QT_NO_COMBOBOX) || defined(QT_NO_SPINBOX) || defined(QT_NO_STACKEDWIDGET)) -#define QT_NO_INPUTDIALOG -#endif - -// QFontComboBox -#if !defined(QT_NO_FONTCOMBOBOX) && (defined(QT_NO_COMBOBOX) || defined(QT_NO_STRINGLISTMODEL)) -#define QT_NO_FONTCOMBOBOX -#endif - -// QFontDialog -#if !defined(QT_NO_FONTDIALOG) && (defined(QT_NO_STRINGLISTMODEL) || defined(QT_NO_COMBOBOX) || defined(QT_NO_VALIDATOR) || defined(QT_NO_GROUPBOX)) -#define QT_NO_FONTDIALOG -#endif - -// QPrintDialog -#if !defined(QT_NO_PRINTDIALOG) && (defined(QT_NO_PRINTER) || defined(QT_NO_COMBOBOX) || defined(QT_NO_BUTTONGROUP) || defined(QT_NO_SPINBOX) || defined(QT_NO_TREEVIEW) || defined(QT_NO_TABWIDGET)) -#define QT_NO_PRINTDIALOG -#endif - -// QFileDialog -#if !defined(QT_NO_FILEDIALOG) && (defined(QT_NO_DIRMODEL) || defined(QT_NO_TREEVIEW) || defined(QT_NO_COMBOBOX) || defined(QT_NO_TOOLBUTTON) || defined(QT_NO_BUTTONGROUP) || defined(QT_NO_TOOLTIP) || defined(QT_NO_SPLITTER) || defined(QT_NO_STACKEDWIDGET) || defined(QT_NO_PROXYMODEL)) -#define QT_NO_FILEDIALOG -#endif - -// QPrintPreviewDialog -#if !defined(QT_NO_PRINTPREVIEWDIALOG) && (defined(QT_NO_PRINTPREVIEWWIDGET) || defined(QT_NO_PRINTDIALOG) || defined(QT_NO_TOOLBAR)) -#define QT_NO_PRINTPREVIEWDIALOG -#endif - diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index c430da80fd..0fd9bab979 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -57,10 +57,9 @@ #if !defined(QT_BUILD_QMAKE) && !defined(QT_BUILD_CONFIGURE) #include -#endif - #include #define QT_SUPPORTS(FEATURE) (!defined(QT_NO_##FEATURE)) +#endif /* These two macros makes it possible to turn the builtin line expander into a * string literal. */ -- cgit v1.2.3 From a199dd133e15374552c4238b3fd1fb0e83a59988 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 29 Oct 2013 15:55:29 +0200 Subject: Fix QCommonStyle::subControlRect(SC_GroupBoxCheckBox) Make sure the groupbox check indicator doesn't get placed in negative coordinates when font height is smaller than the indicator height. Task-number: QTBUG-33610 Change-Id: Ifad0016e9311f1212cccb6d5971343beb68517c4 Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qcommonstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 7f0813c303..a9f1c3bbbc 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -4251,7 +4251,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex if (sc == SC_GroupBoxCheckBox) { int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, opt, widget); left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth); - int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2; + int top = totalRect.top() + qMax(0, fontMetrics.height() - indicatorHeight) / 2; totalRect.setRect(left, top, indicatorWidth, indicatorHeight); // Adjust for label } else { -- cgit v1.2.3 From 11e93372df2ebe8700ebb39fca3709e3a6c3d399 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 9 Oct 2013 11:40:05 -0700 Subject: Make the localHostName() copy function return QByteArray This avoids one extra memory allocation when creating the lock file. The number of memory allocations when checking the file are still the same. Change-Id: I16a2fdb7a5458bdc66f8ad1c602582b5698a5b5c Reviewed-by: Oswald Buddenhagen Reviewed-by: Kevin Ottens Reviewed-by: Thiago Macieira --- src/corelib/io/qlockfile_unix.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index dc8817706c..d1dbb51e76 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -57,13 +57,13 @@ QT_BEGIN_NAMESPACE -static QString localHostName() // from QHostInfo::localHostName() +static QByteArray localHostName() // from QHostInfo::localHostName(), modified to return a QByteArray { - char hostName[512]; - if (gethostname(hostName, sizeof(hostName)) == -1) - return QString(); - hostName[sizeof(hostName) - 1] = '\0'; - return QString::fromLocal8Bit(hostName); + QByteArray hostName(512, Qt::Uninitialized); + if (gethostname(hostName.data(), hostName.size()) == -1) + return QByteArray(); + hostName.truncate(strlen(hostName.data())); + return hostName; } // ### merge into qt_safe_write? @@ -145,7 +145,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys() // Use operator% from the fast builder to avoid multiple memory allocations. QByteArray fileData = QByteArray::number(QCoreApplication::applicationPid()) % '\n' % qAppName().toUtf8() % '\n' - % localHostName().toUtf8() % '\n'; + % localHostName() % '\n'; const QByteArray lockFileName = QFile::encodeName(fileName); const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0644); @@ -190,7 +190,7 @@ bool QLockFilePrivate::isApparentlyStale() const QString hostname, appname; if (!getLockInfo(&pid, &hostname, &appname)) return false; - if (hostname == localHostName()) { + if (hostname == QString::fromLocal8Bit(localHostName())) { if (::kill(pid, 0) == -1 && errno == ESRCH) return true; // PID doesn't exist anymore } -- cgit v1.2.3 From d7f8f7e0783a5e2d6e2324e7bb16001d23f3d7bf Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 29 Oct 2013 09:41:08 +0100 Subject: qdbusxml2cpp: Fix warnings about writing to closed devices. Unearthed by fe1cbe9ca78619b54b08e4ec1155d7e6e4e0640a while building QPlatformSupport. Change-Id: Ife56efe111dda6bcf9f11f9c144a4d1dc1651380 Reviewed-by: Laszlo Papp Reviewed-by: Thiago Macieira --- src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index f2b9441ea4..6dd88824b5 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -509,10 +509,10 @@ static QString stringify(const QString &data) return retval; } -static void openFile(const QString &fileName, QFile &file) +static bool openFile(const QString &fileName, QFile &file) { if (fileName.isEmpty()) - return; + return false; bool isOk = false; if (fileName == QLatin1String("-")) { @@ -525,6 +525,7 @@ static void openFile(const QString &fileName, QFile &file) if (!isOk) fprintf(stderr, "Unable to open '%s': %s\n", qPrintable(fileName), qPrintable(file.errorString())); + return isOk; } static void writeProxy(const QString &filename, const QDBusIntrospection::Interfaces &interfaces) @@ -821,15 +822,17 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf hs.flush(); QFile file; - openFile(headerName, file); - file.write(headerData); + const bool headerOpen = openFile(headerName, file); + if (headerOpen) + file.write(headerData); if (headerName == cppName) { - file.write(cppData); + if (headerOpen) + file.write(cppData); } else { QFile cppFile; - openFile(cppName, cppFile); - cppFile.write(cppData); + if (openFile(cppName, cppFile)) + cppFile.write(cppData); } } @@ -1125,15 +1128,17 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte hs.flush(); QFile file; - openFile(headerName, file); - file.write(headerData); + const bool headerOpen = openFile(headerName, file); + if (headerOpen) + file.write(headerData); if (headerName == cppName) { - file.write(cppData); + if (headerOpen) + file.write(cppData); } else { QFile cppFile; - openFile(cppName, cppFile); - cppFile.write(cppData); + if (openFile(cppName, cppFile)) + cppFile.write(cppData); } } -- cgit v1.2.3 From 5dfda7a556485ff07448f5bc2006ac4132e33e7d Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 11 Oct 2013 12:03:02 +0200 Subject: Cocoa: Fix mouse event coordinates transform to window space MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We pass the mouse screen coordinates that we convert to window space instead of the other way around. This makes sure the original mouse coordinates are not bound to any moving window. Task-number: QTBUG-29583 Task-number: QTBUG-32221 Change-Id: I8f9ada6e8c0d20af8e85e88ee39190d23e58977f Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qnsview.mm | 43 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index f90fc6b205..8f839384df 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -496,7 +496,7 @@ static QTouchDevice *touchDevice = 0; return YES; } -- (void)convertFromEvent:(NSEvent *)event toWindowPoint:(QPointF *)qtWindowPoint andScreenPoint:(QPointF *)qtScreenPoint +- (void)convertFromScreen:(NSPoint)mouseLocation toWindowPoint:(QPointF *)qtWindowPoint andScreenPoint:(QPointF *)qtScreenPoint { // Calculate the mouse position in the QWindow and Qt screen coordinate system, // starting from coordinates in the NSWindow coordinate system. @@ -516,23 +516,22 @@ static QTouchDevice *touchDevice = 0; // NSView and QWindow are equal coordinate systems: the QWindow covers the // entire NSView, and we've set the NSView's isFlipped property to true. - NSPoint nsWindowPoint = [event locationInWindow]; // NSWindow coordinates - - NSPoint nsViewPoint = [self convertPoint: nsWindowPoint fromView: nil]; // NSView/QWindow coordinates - *qtWindowPoint = QPointF(nsViewPoint.x, nsViewPoint.y); // NSView/QWindow coordinates - NSWindow *window = [self window]; + NSPoint nsWindowPoint; // Use convertRectToScreen if available (added in 10.7). #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 - if ([window respondsToSelector:@selector(convertRectToScreen:)]) { - NSRect screenRect = [window convertRectToScreen : NSMakeRect(nsWindowPoint.x, nsWindowPoint.y, 0, 0)]; // OS X screen coordinates - *qtScreenPoint = QPointF(screenRect.origin.x, qt_mac_flipYCoordinate(screenRect.origin.y)); // Qt screen coordinates + if ([window respondsToSelector:@selector(convertRectFromScreen:)]) { + NSRect windowRect = [window convertRectFromScreen:NSMakeRect(mouseLocation.x, mouseLocation.y, 1, 1)]; + nsWindowPoint = windowRect.origin; // NSWindow coordinates } else #endif { - NSPoint screenPoint = [window convertBaseToScreen : NSMakePoint(nsWindowPoint.x, nsWindowPoint.y)]; - *qtScreenPoint = QPointF(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y)); + nsWindowPoint = [window convertScreenToBase:mouseLocation]; // NSWindow coordinates } + NSPoint nsViewPoint = [self convertPoint: nsWindowPoint fromView: nil]; // NSView/QWindow coordinates + *qtWindowPoint = QPointF(nsViewPoint.x, nsViewPoint.y); // NSView/QWindow coordinates + + *qtScreenPoint = QPointF(mouseLocation.x, qt_mac_flipYCoordinate(mouseLocation.y)); // Qt screen coordinates } - (void)resetMouseButtons @@ -546,7 +545,7 @@ static QTouchDevice *touchDevice = 0; QPointF qtWindowPoint; QPointF qtScreenPoint; - [self convertFromEvent:theEvent toWindowPoint:&qtWindowPoint andScreenPoint:&qtScreenPoint]; + [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&qtWindowPoint andScreenPoint:&qtScreenPoint]; ulong timestamp = [theEvent timestamp] * 1000; QCocoaDrag* nativeDrag = static_cast(QGuiApplicationPrivate::platformIntegration()->drag()); @@ -688,7 +687,7 @@ static QTouchDevice *touchDevice = 0; QPointF windowPoint; QPointF screenPoint; - [self convertFromEvent:theEvent toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; + [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; QWindow *childWindow = m_platformWindow->childWindowAt(windowPoint.toPoint()); // Top-level windows generate enter-leave events for sub-windows. @@ -722,7 +721,7 @@ static QTouchDevice *touchDevice = 0; QPointF windowPoint; QPointF screenPoint; - [self convertFromEvent:theEvent toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; + [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; m_platformWindow->m_underMouseWindow = m_platformWindow->childWindowAt(windowPoint.toPoint()); QWindowSystemInterface::handleEnterEvent(m_platformWindow->m_underMouseWindow, windowPoint, screenPoint); } @@ -812,7 +811,7 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash) QPointF windowPoint; QPointF screenPoint; - [self convertFromEvent: theEvent toWindowPoint: &windowPoint andScreenPoint: &screenPoint]; + [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint: &windowPoint andScreenPoint: &screenPoint]; uint deviceId = [theEvent deviceID]; if (!tabletDeviceDataHash->contains(deviceId)) { @@ -985,7 +984,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) const NSTimeInterval timestamp = [event timestamp]; QPointF windowPoint; QPointF screenPoint; - [self convertFromEvent:event toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; + [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; QWindowSystemInterface::handleGestureEventWithRealValue(m_window, timestamp, Qt::ZoomNativeGesture, [event magnification], windowPoint, screenPoint); } @@ -1000,7 +999,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) const NSTimeInterval timestamp = [event timestamp]; QPointF windowPoint; QPointF screenPoint; - [self convertFromEvent:event toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; + [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; QWindowSystemInterface::handleGestureEventWithRealValue(m_window, timestamp, Qt::SmartZoomNativeGesture, zoomIn ? 1.0f : 0.0f, windowPoint, screenPoint); zoomIn = !zoomIn; @@ -1015,7 +1014,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) const NSTimeInterval timestamp = [event timestamp]; QPointF windowPoint; QPointF screenPoint; - [self convertFromEvent:event toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; + [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; QWindowSystemInterface::handleGestureEventWithRealValue(m_window, timestamp, Qt::RotateNativeGesture, -[event rotation], windowPoint, screenPoint); } @@ -1028,7 +1027,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) const NSTimeInterval timestamp = [event timestamp]; QPointF windowPoint; QPointF screenPoint; - [self convertFromEvent:event toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; + [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; qreal angle = 0.0f; if ([event deltaX] == 1) @@ -1052,7 +1051,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) const NSTimeInterval timestamp = [event timestamp]; QPointF windowPoint; QPointF screenPoint; - [self convertFromEvent:event toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; + [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; QWindowSystemInterface::handleGestureEvent(m_window, timestamp, Qt::BeginNativeGesture, windowPoint, screenPoint); } @@ -1065,7 +1064,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) const NSTimeInterval timestamp = [event timestamp]; QPointF windowPoint; QPointF screenPoint; - [self convertFromEvent:event toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; + [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; QWindowSystemInterface::handleGestureEvent(m_window, timestamp, Qt::EndNativeGesture, windowPoint, screenPoint); } @@ -1125,7 +1124,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) QPointF qt_windowPoint; QPointF qt_screenPoint; - [self convertFromEvent:theEvent toWindowPoint:&qt_windowPoint andScreenPoint:&qt_screenPoint]; + [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&qt_windowPoint andScreenPoint:&qt_screenPoint]; NSTimeInterval timestamp = [theEvent timestamp]; ulong qt_timestamp = timestamp * 1000; -- cgit v1.2.3 From 721ec985011489b35ec9fd4f3c3cb9d51864f003 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 23 Oct 2013 14:50:45 +0200 Subject: remove qt_windows.h include from qwineventnotifier.h We must not include qt_windows.h in public headers, otherwise we're cluttering the environment with a colorful bouquet of Windows API preprocessor macros and typedefs. Task-number: QTBUG-34058 Change-Id: I415717ea2a47f39e7f4b7ce1c1df9d49afc99278 Reviewed-by: Olivier Goffart --- src/corelib/kernel/qwineventnotifier.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/kernel/qwineventnotifier.h b/src/corelib/kernel/qwineventnotifier.h index 56605d9aaa..cddb9d73be 100644 --- a/src/corelib/kernel/qwineventnotifier.h +++ b/src/corelib/kernel/qwineventnotifier.h @@ -45,7 +45,6 @@ #include "QtCore/qobject.h" #ifdef Q_OS_WIN -#include "QtCore/qt_windows.h" QT_BEGIN_NAMESPACE @@ -54,6 +53,7 @@ class Q_CORE_EXPORT QWinEventNotifier : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QWinEventNotifier) + typedef Qt::HANDLE HANDLE; public: explicit QWinEventNotifier(QObject *parent = 0); -- cgit v1.2.3 From cf239f69e1873573da1d17d1eeed326686f7cbef Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Fri, 18 Oct 2013 18:36:23 -0300 Subject: QNX: Manage foreign mmrenderer windows Manage and correctly set the z-order of a foreign created mmrenderer window by QtMultimedia Task-number: QTBUG-33816 Change-Id: I46273b945bf10991462fa72eb1ec8d00b0648988 Reviewed-by: Thomas McGuire --- src/plugins/platforms/qnx/qqnxnativeinterface.cpp | 9 +++ src/plugins/platforms/qnx/qqnxnativeinterface.h | 1 + src/plugins/platforms/qnx/qqnxscreen.cpp | 77 +++++++++++++++++++++-- src/plugins/platforms/qnx/qqnxscreen.h | 1 + src/plugins/platforms/qnx/qqnxwindow.cpp | 37 +++++++++-- src/plugins/platforms/qnx/qqnxwindow.h | 10 +++ 6 files changed, 125 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp index 4dd3444832..8958a5c1e2 100644 --- a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp +++ b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp @@ -42,6 +42,7 @@ #include "qqnxnativeinterface.h" #include "qqnxscreen.h" +#include "qqnxwindow.h" #include #include @@ -70,4 +71,12 @@ void *QQnxNativeInterface::nativeResourceForScreen(const QByteArray &resource, Q return 0; } +void QQnxNativeInterface::setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value) +{ + if (name == QStringLiteral("mmRendererWindowName")) { + QQnxWindow *qnxWindow = static_cast(window); + qnxWindow->setMMRendererWindowName(value.toString()); + } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.h b/src/plugins/platforms/qnx/qqnxnativeinterface.h index 6692da2576..b61f6a56cc 100644 --- a/src/plugins/platforms/qnx/qqnxnativeinterface.h +++ b/src/plugins/platforms/qnx/qqnxnativeinterface.h @@ -51,6 +51,7 @@ class QQnxNativeInterface : public QPlatformNativeInterface public: void *nativeResourceForWindow(const QByteArray &resource, QWindow *window); void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen); + void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index dd8cf2131a..3dab2b3bc9 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -119,6 +119,38 @@ static QSize determineScreenSize(screen_display_t display, bool primaryScreen) { #endif } +static QQnxWindow *findMultimediaWindow(const QList windows, + const QByteArray &mmWindowId) +{ + Q_FOREACH (QQnxWindow *sibling, windows) { + if (sibling->mmRendererWindowName() == mmWindowId) + return sibling; + + QQnxWindow *mmWindow = findMultimediaWindow(sibling->children(), mmWindowId); + + if (mmWindow) + return mmWindow; + } + + return 0; +} + +static QQnxWindow *findMultimediaWindow(const QList windows, + screen_window_t mmWindowId) +{ + Q_FOREACH (QQnxWindow *sibling, windows) { + if (sibling->mmRendererWindow() == mmWindowId) + return sibling; + + QQnxWindow *mmWindow = findMultimediaWindow(sibling->children(), mmWindowId); + + if (mmWindow) + return mmWindow; + } + + return 0; +} + QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, bool primaryScreen) : m_screenContext(screenContext), m_display(display), @@ -585,6 +617,19 @@ void QQnxScreen::addUnderlayWindow(screen_window_t window) updateHierarchy(); } +void QQnxScreen::addMultimediaWindow(const QByteArray &id, screen_window_t window) +{ + // find the QnxWindow this mmrenderer window is related to + QQnxWindow *mmWindow = findMultimediaWindow(m_childWindows, id); + + if (!mmWindow) + return; + + mmWindow->setMMRendererWindow(window); + + updateHierarchy(); +} + void QQnxScreen::removeOverlayOrUnderlayWindow(screen_window_t window) { const int numRemoved = m_overlays.removeAll(window) + m_underlays.removeAll(window); @@ -610,17 +655,35 @@ void QQnxScreen::newWindowCreated(void *window) zorder = 0; } + char windowNameBuffer[256] = { 0 }; + QByteArray windowName; + + if (screen_get_window_property_cv(windowHandle, SCREEN_PROPERTY_ID_STRING, + sizeof(windowNameBuffer) - 1, windowNameBuffer) != 0) { + qWarning("QQnx: Failed to get id for window, errno=%d", errno); + } + + windowName = QByteArray(windowNameBuffer); + if (display == nativeDisplay()) { // A window was created on this screen. If we don't know about this window yet, it means // it was not created by Qt, but by some foreign library like the multimedia renderer, which // creates an overlay window when playing a video. // - // Treat all foreign windows as overlays or underlays here. + // Treat all foreign windows as overlays, underlays or as windows + // created by the BlackBerry QtMultimedia plugin. // - // Assume that if a foreign window already has a Z-Order both negative and + // In the case of the BlackBerry QtMultimedia plugin, we need to + // "attach" the foreign created mmrenderer window to the correct + // platform window (usually the one belonging to QVideoWidget) to + // ensure proper z-ordering. + // + // Otherwise, assume that if a foreign window already has a Z-Order both negative and // less than the default Z-Order installed by mmrender on windows it creates, // the windows should be treated as an underlay. Otherwise, we treat it as an overlay. - if (!findWindow(windowHandle)) { + if (!windowName.isEmpty() && windowName.startsWith("BbVideoWindowControl")) { + addMultimediaWindow(windowName, windowHandle); + } else if (!findWindow(windowHandle)) { if (zorder <= MAX_UNDERLAY_ZORDER) addUnderlayWindow(windowHandle); else @@ -634,7 +697,13 @@ void QQnxScreen::windowClosed(void *window) { Q_ASSERT(thread() == QThread::currentThread()); const screen_window_t windowHandle = reinterpret_cast(window); - removeOverlayOrUnderlayWindow(windowHandle); + + QQnxWindow *mmWindow = findMultimediaWindow(m_childWindows, windowHandle); + + if (mmWindow) + mmWindow->clearMMRendererWindow(); + else + removeOverlayOrUnderlayWindow(windowHandle); } void QQnxScreen::windowGroupStateChanged(const QByteArray &id, Qt::WindowState state) diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index e11030ea0a..014f7905f3 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -119,6 +119,7 @@ private: void resizeWindows(const QRect &previousScreenGeometry); void addOverlayWindow(screen_window_t window); void addUnderlayWindow(screen_window_t window); + void addMultimediaWindow(const QByteArray &id, screen_window_t window); void removeOverlayOrUnderlayWindow(screen_window_t window); QWindow *topMostChildWindow() const; diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 3969a09098..749a336fcc 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -77,7 +77,8 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) m_parentWindow(0), m_visible(false), m_exposed(true), - m_windowState(Qt::WindowNoState) + m_windowState(Qt::WindowNoState), + m_mmRendererWindow(0) { qWindowDebug() << Q_FUNC_INFO << "window =" << window << ", size =" << window->size(); int result; @@ -489,6 +490,22 @@ void QQnxWindow::gainedFocus() QWindowSystemInterface::handleWindowActivated(window()); } +void QQnxWindow::setMMRendererWindowName(const QString &name) +{ + m_mmRendererWindowName = name; +} + +void QQnxWindow::setMMRendererWindow(screen_window_t handle) +{ + m_mmRendererWindow = handle; +} + +void QQnxWindow::clearMMRendererWindow() +{ + m_mmRendererWindowName.clear(); + m_mmRendererWindow = 0; +} + QQnxWindow *QQnxWindow::findWindow(screen_window_t windowHandle) { if (m_window == windowHandle) @@ -583,17 +600,25 @@ void QQnxWindow::initWindow() void QQnxWindow::updateZorder(int &topZorder) { - errno = 0; - int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ZORDER, &topZorder); - topZorder++; + updateZorder(m_window, topZorder); - if (result != 0) - qFatal("QQnxWindow: failed to set window z-order=%d, errno=%d, mWindow=%p", topZorder, errno, m_window); + if (m_mmRendererWindow) + updateZorder(m_mmRendererWindow, topZorder); Q_FOREACH (QQnxWindow *childWindow, m_childWindows) childWindow->updateZorder(topZorder); } +void QQnxWindow::updateZorder(screen_window_t window, int &topZorder) +{ + errno = 0; + int result = screen_set_window_property_iv(window, SCREEN_PROPERTY_ZORDER, &topZorder); + topZorder++; + + if (result != 0) + qFatal("QQnxWindow: failed to set window z-order=%d, errno=%d, mWindow=%p", topZorder, errno, window); +} + void QQnxWindow::applyWindowState() { switch (m_windowState) { diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h index f96280848a..52d22235a2 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.h +++ b/src/plugins/platforms/qnx/qqnxwindow.h @@ -99,6 +99,9 @@ public: void propagateSizeHints(); void gainedFocus(); + void setMMRendererWindowName(const QString &name); + void setMMRendererWindow(screen_window_t handle); + void clearMMRendererWindow(); QQnxScreen *screen() const { return m_screen; } const QList& children() const { return m_childWindows; } @@ -107,6 +110,10 @@ public: void minimize(); + QString mmRendererWindowName() const { return m_mmRendererWindowName; } + + screen_window_t mmRendererWindow() const { return m_mmRendererWindow; } + virtual WindowType windowType() const = 0; protected: virtual int pixelFormat() const = 0; @@ -123,6 +130,7 @@ private: void setOffset(const QPoint &setOffset); void updateVisibility(bool parentVisible); void updateZorder(int &topZorder); + void updateZorder(screen_window_t window, int &zOrder); void applyWindowState(); screen_window_t m_window; @@ -135,6 +143,8 @@ private: bool m_exposed; QRect m_unmaximizedGeometry; Qt::WindowState m_windowState; + QString m_mmRendererWindowName; + screen_window_t m_mmRendererWindow; }; QT_END_NAMESPACE -- cgit v1.2.3 From 9087d4ed7bd81b97de90e0aa1844e9944c9d9be6 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 28 Oct 2013 10:29:02 +0100 Subject: Don't support threaded GL on chromium (virtual box GL) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I84f89450e3fce1cbbafd19dbf4509b1911e06b19 Reviewed-by: Jørgen Lind --- src/plugins/platforms/xcb/qglxintegration.cpp | 32 +++++++++++++++++++++++++++ src/plugins/platforms/xcb/qglxintegration.h | 6 +++++ src/plugins/platforms/xcb/qxcbintegration.cpp | 2 +- 3 files changed, 39 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index cbfbdf495f..2c418cbebe 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -408,6 +408,38 @@ bool QGLXContext::isValid() const return m_context != 0; } +bool QGLXContext::m_queriedDummyContext = false; +bool QGLXContext::m_supportsThreading = true; + +void QGLXContext::queryDummyContext() +{ + if (m_queriedDummyContext) + return; + m_queriedDummyContext = true; + + static bool skip = qEnvironmentVariableIsSet("QT_OPENGL_NO_SANITY_CHECK"); + if (skip) + return; + + QOffscreenSurface surface; + surface.create(); + QOpenGLContext context; + context.create(); + context.makeCurrent(&surface); + + const char *renderer = (const char *) glGetString(GL_RENDERER); + if (QByteArray(renderer).contains("Chromium")) + m_supportsThreading = false; + else + m_supportsThreading = true; +} + +bool QGLXContext::supportsThreading() +{ + if (!m_queriedDummyContext) + queryDummyContext(); + return m_supportsThreading; +} QGLXPbuffer::QGLXPbuffer(QOffscreenSurface *offscreenSurface) : QPlatformOffscreenSurface(offscreenSurface) diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h index 7116b2389d..dcc7fe8855 100644 --- a/src/plugins/platforms/xcb/qglxintegration.h +++ b/src/plugins/platforms/xcb/qglxintegration.h @@ -72,12 +72,18 @@ public: GLXContext glxContext() const { return m_context; } + static bool supportsThreading(); + static void queryDummyContext(); + private: QXcbScreen *m_screen; GLXContext m_context; GLXContext m_shareContext; QSurfaceFormat m_format; bool m_isPBufferCurrent; + + static bool m_queriedDummyContext; + static bool m_supportsThreading; }; diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 5168bd818b..6b5ea93638 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -278,7 +278,7 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const #else case OpenGL: return false; #endif - case ThreadedOpenGL: return m_connections.at(0)->supportsThreadedRendering(); + case ThreadedOpenGL: return m_connections.at(0)->supportsThreadedRendering() && QGLXContext::supportsThreading(); case WindowMasks: return true; case MultipleWindows: return true; case ForeignWindows: return true; -- cgit v1.2.3 From 89ab2671051671ecf440ba480caf0b6b6768b1a9 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 28 Oct 2013 14:41:43 +0100 Subject: Keep web fontdata alive as long as CG uses it With OS X 10.9 font decoding appears to happen lazily, this means we have to ensure the data we provide CG is kept alive until it dereferences it itself. Task-number: QTBUG-34332 Change-Id: I8fc38fafba746b062c4ad16314b0a410fd0b668d Reviewed-by: Erik Verbruggen --- .../fontdatabases/mac/qcoretextfontdatabase.mm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 72486c097d..38c44e3f35 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -305,12 +305,20 @@ QFontEngine *QCoreTextFontDatabase::fontEngine(const QFontDef &f, QChar::Script return NULL; } +static void releaseFontData(void* info, const void* data, size_t size) +{ + Q_UNUSED(data); + Q_UNUSED(size); + delete (QByteArray*)info; +} + QFontEngine *QCoreTextFontDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) { Q_UNUSED(hintingPreference); - QCFType dataProvider = CGDataProviderCreateWithData(NULL, - fontData.constData(), fontData.size(), NULL); + QByteArray* fontDataCopy = new QByteArray(fontData); + QCFType dataProvider = CGDataProviderCreateWithData(fontDataCopy, + fontDataCopy->constData(), fontDataCopy->size(), releaseFontData); CGFontRef cgFont = CGFontCreateWithDataProvider(dataProvider); @@ -474,8 +482,9 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData CTFontRef font = NULL; if (!fontData.isEmpty()) { - QCFType dataProvider = CGDataProviderCreateWithData(NULL, - fontData.constData(), fontData.size(), NULL); + QByteArray* fontDataCopy = new QByteArray(fontData); + QCFType dataProvider = CGDataProviderCreateWithData(fontDataCopy, + fontDataCopy->constData(), fontDataCopy->size(), releaseFontData); CGFontRef cgFont = CGFontCreateWithDataProvider(dataProvider); if (cgFont) { CFErrorRef error; -- cgit v1.2.3 From aceb854bbb6582cbdecb4da94b64782c76a653cb Mon Sep 17 00:00:00 2001 From: Christoph Schleifenbaum Date: Mon, 28 Oct 2013 17:11:10 +0100 Subject: Different native Cocoa menu fixes. - Fix location of NSMenu when no NSView is given. - Fix shortcut when given in text with tab. Change-Id: Iec21cf3d12084db1e70c1a8779d5482c78285796 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoamenu.mm | 26 +++++++++++++++----------- src/plugins/platforms/cocoa/qcocoamenuitem.mm | 4 ++++ 2 files changed, 19 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 16b02a93f5..329c7a264a 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -466,17 +466,21 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf nsPos.y = screen->availableVirtualSize().height() - nsPos.y; } - // Finally, we need to synthesize an event. - NSEvent *menuEvent = [NSEvent mouseEventWithType:NSRightMouseDown - location:nsPos - modifierFlags:0 - timestamp:0 - windowNumber:view ? view.window.windowNumber : 0 - context:nil - eventNumber:0 - clickCount:1 - pressure:1.0]; - [NSMenu popUpContextMenu:m_nativeMenu withEvent:menuEvent forView:view]; + if (view) { + // Finally, we need to synthesize an event. + NSEvent *menuEvent = [NSEvent mouseEventWithType:NSRightMouseDown + location:nsPos + modifierFlags:0 + timestamp:0 + windowNumber:view ? view.window.windowNumber : 0 + context:nil + eventNumber:0 + clickCount:1 + pressure:1.0]; + [NSMenu popUpContextMenu:m_nativeMenu withEvent:menuEvent forView:view]; + } else { + [m_nativeMenu popUpMenuPositioningItem:nsItem atLocation:nsPos inView:0]; + } } // The calls above block, and also swallow any mouse release event, diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index 013f9931ff..3bba1ee1d5 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -338,6 +338,8 @@ QString QCocoaMenuItem::mergeText() return qt_mac_applicationmenu_string(4); } else if (m_native == [loader quitMenuItem]) { return qt_mac_applicationmenu_string(5).arg(qt_mac_applicationName()); + } else if (m_text.contains('\t')) { + return m_text.left(m_text.indexOf('\t')); } return m_text; } @@ -349,6 +351,8 @@ QKeySequence QCocoaMenuItem::mergeAccel() return QKeySequence(QKeySequence::Preferences); else if (m_native == [loader quitMenuItem]) return QKeySequence(QKeySequence::Quit); + else if (m_text.contains('\t')) + return QKeySequence(m_text.mid(m_text.indexOf('\t') + 1), QKeySequence::NativeText); return m_shortcut; } -- cgit v1.2.3 From bec8d2e0891344f44cd2f57b40fdd286c2361b18 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Thu, 24 Oct 2013 19:50:12 +0800 Subject: Doc: Remove unofficial Qt Concurrent headers , , and are not official headers. Developers should use instead. As a side-effect, this patch also stops the function documentation from being duplicated (one copy in the QtConcurrent namespace page, one copy in the \headerfile pages) (For some reason, \brief doesn't work on standalone pages like these) Change-Id: I9482f014acf52ba734a3fa597cdcc5931fcd7ecf Reviewed-by: Jerome Pasion Reviewed-by: Stephen Kelly --- src/concurrent/qtconcurrentfilter.cpp | 14 +++----------- src/concurrent/qtconcurrentmap.cpp | 20 +++----------------- src/concurrent/qtconcurrentrun.cpp | 13 ++++--------- 3 files changed, 10 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/concurrent/qtconcurrentfilter.cpp b/src/concurrent/qtconcurrentfilter.cpp index a58c52edc1..ab0227983d 100644 --- a/src/concurrent/qtconcurrentfilter.cpp +++ b/src/concurrent/qtconcurrentfilter.cpp @@ -40,15 +40,10 @@ ****************************************************************************/ /*! - \headerfile + \page qtconcurrentfilter.html \title Concurrent Filter and Filter-Reduce \ingroup thread - \brief The header provides concurrent Filter and - Filter-Reduce. - - These functions are a part of the \l {Qt Concurrent} framework. - The QtConcurrent::filter(), QtConcurrent::filtered() and QtConcurrent::filteredReduced() functions filter items in a sequence such as a QList or a QVector in parallel. QtConcurrent::filter() modifies a @@ -56,6 +51,8 @@ containing the filtered content, and QtConcurrent::filteredReduced() returns a single result. + These functions are a part of the \l {Qt Concurrent} framework. + Each of the above functions have a blocking variant that returns the final result instead of a QFuture. You use them in the same way as the asynchronous variants. @@ -186,7 +183,6 @@ /*! \fn QFuture QtConcurrent::filter(Sequence &sequence, FilterFunction filterFunction) - \relates Calls \a filterFunction once for each item in \a sequence. If \a filterFunction returns \c true, the item is kept in \a sequence; @@ -195,7 +191,6 @@ /*! \fn QFuture QtConcurrent::filtered(const Sequence &sequence, FilterFunction filterFunction) - \relates Calls \a filterFunction once for each item in \a sequence and returns a new Sequence of kept items. If \a filterFunction returns \c true, a copy of @@ -205,7 +200,6 @@ /*! \fn QFuture QtConcurrent::filtered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction) - \relates Calls \a filterFunction once for each item from \a begin to \a end and returns a new Sequence of kept items. If \a filterFunction returns \c true, a @@ -215,7 +209,6 @@ /*! \fn QFuture QtConcurrent::filteredReduced(const Sequence &sequence, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) - \relates Calls \a filterFunction once for each item in \a sequence. If \a filterFunction returns \c true for an item, that item is then passed to @@ -232,7 +225,6 @@ /*! \fn QFuture QtConcurrent::filteredReduced(ConstIterator begin, ConstIterator end, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) - \relates Calls \a filterFunction once for each item from \a begin to \a end. If \a filterFunction returns \c true for an item, that item is then passed to diff --git a/src/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp index 5233a9db45..fc904a4d59 100644 --- a/src/concurrent/qtconcurrentmap.cpp +++ b/src/concurrent/qtconcurrentmap.cpp @@ -68,14 +68,10 @@ */ /*! - \headerfile + \page qtconcurrentmap.html \title Concurrent Map and Map-Reduce \ingroup thread - \brief The header provides concurrent Map and MapReduce. - - These functions are a part of the \l {Qt Concurrent} framework. - The QtConcurrent::map(), QtConcurrent::mapped() and QtConcurrent::mappedReduced() functions run computations in parallel on the items in a sequence such as a QList or a QVector. QtConcurrent::map() @@ -83,6 +79,8 @@ sequence containing the modified content, and QtConcurrent::mappedReduced() returns a single result. + These functions are a part of the \l {Qt Concurrent} framework. + Each of the above functions has a blocking variant that returns the final result instead of a QFuture. You use them in the same way as the asynchronous variants. @@ -235,7 +233,6 @@ /*! \fn QFuture QtConcurrent::map(Sequence &sequence, MapFunction function) - \relates Calls \a function once for each item in \a sequence. The \a function is passed a reference to the item, so that any modifications done to the item @@ -244,7 +241,6 @@ /*! \fn QFuture QtConcurrent::map(Iterator begin, Iterator end, MapFunction function) - \relates Calls \a function once for each item from \a begin to \a end. The \a function is passed a reference to the item, so that any modifications @@ -253,7 +249,6 @@ /*! \fn QFuture QtConcurrent::mapped(const Sequence &sequence, MapFunction function) - \relates Calls \a function once for each item in \a sequence and returns a future with each mapped item as a result. You can use QFuture::const_iterator or @@ -262,7 +257,6 @@ /*! \fn QFuture QtConcurrent::mapped(ConstIterator begin, ConstIterator end, MapFunction function) - \relates Calls \a function once for each item from \a begin to \a end and returns a future with each mapped item as a result. You can use @@ -274,8 +268,6 @@ MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) - \relates - Calls \a mapFunction once for each item in \a sequence. The return value of each \a mapFunction is passed to \a reduceFunction. @@ -289,8 +281,6 @@ ConstIterator end, MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) - \relates - Calls \a mapFunction once for each item from \a begin to \a end. The return value of each \a mapFunction is passed to \a reduceFunction. @@ -357,8 +347,6 @@ /*! \fn T QtConcurrent::blockingMappedReduced(const Sequence &sequence, MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) - \relates - Calls \a mapFunction once for each item in \a sequence. The return value of each \a mapFunction is passed to \a reduceFunction. @@ -374,8 +362,6 @@ /*! \fn T QtConcurrent::blockingMappedReduced(ConstIterator begin, ConstIterator end, MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) - \relates - Calls \a mapFunction once for each item from \a begin to \a end. The return value of each \a mapFunction is passed to \a reduceFunction. diff --git a/src/concurrent/qtconcurrentrun.cpp b/src/concurrent/qtconcurrentrun.cpp index c60fa14777..c71fc9048f 100644 --- a/src/concurrent/qtconcurrentrun.cpp +++ b/src/concurrent/qtconcurrentrun.cpp @@ -40,19 +40,15 @@ ****************************************************************************/ /*! - \headerfile - \title Asynchronous Run - - \brief The header provides a way to run a function in a - separate thread. - + \page qtconcurrentrun.html + \title Concurrent Run \ingroup thread - This function is a part of the \l {Qt Concurrent} framework. - The QtConcurrent::run() function runs a function in a separate thread. The return value of the function is made available through the QFuture API. + This function is a part of the \l {Qt Concurrent} framework. + \section1 Running a Function in a Separate Thread To run a function in another thread, use QtConcurrent::run(): @@ -133,7 +129,6 @@ /*! \fn QFuture QtConcurrent::run(Function function, ...); - \relates Runs \a function in a separate thread. The thread is taken from the global QThreadPool. Note that the function may not run immediately; the function -- cgit v1.2.3 From c3c1faafe63d19039ccab3c5829561ce7a24fdfb Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Mon, 28 Oct 2013 19:18:19 +0800 Subject: Issue correct warnings with QObject::startTimer() These are not specific to QTimer Change-Id: Idcffab51a3277413889a727afa1cf7ce15171ec9 Reviewed-by: Olivier Goffart --- src/corelib/kernel/qobject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index a52fd25e08..8ee43f2e97 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1484,12 +1484,12 @@ int QObject::startTimer(int interval, Qt::TimerType timerType) Q_D(QObject); if (interval < 0) { - qWarning("QObject::startTimer: QTimer cannot have a negative interval"); + qWarning("QObject::startTimer: Timers cannot have negative intervals"); return 0; } if (!d->threadData->eventDispatcher.load()) { - qWarning("QObject::startTimer: QTimer can only be used with threads started with QThread"); + qWarning("QObject::startTimer: Timers can only be used with threads started with QThread"); return 0; } int timerId = d->threadData->eventDispatcher.load()->registerTimer(interval, timerType, this); -- cgit v1.2.3 From 0d7d5ff5d050537e33bc35d56c5214063821a1a4 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Tue, 29 Oct 2013 00:07:56 +0800 Subject: Doc: Fix miscellaneous typos Change-Id: Iaf0dd8974c3ad78beffa995c596a76fb3e4cceab Reviewed-by: Jerome Pasion Reviewed-by: Kurt Pattyn --- src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp | 4 ++-- src/corelib/doc/src/threads.qdoc | 4 ++-- src/corelib/io/qfileinfo.cpp | 2 +- src/corelib/thread/qreadwritelock.cpp | 2 +- src/network/bearer/qnetworkconfiguration.cpp | 1 - src/sql/models/qsqltablemodel.cpp | 2 +- src/widgets/itemviews/qabstractitemview.cpp | 2 +- src/widgets/itemviews/qlistwidget.cpp | 2 +- src/widgets/itemviews/qtablewidget.cpp | 2 +- 9 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp index 003fce580b..9210d2737f 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp @@ -416,7 +416,7 @@ text.data(); // returns "Qt is great!" //! [46] QString tmp = "test"; QByteArray text = tmp.toLocal8Bit(); -char *data = new char[text.size()] +char *data = new char[text.size()]; strcpy(data, text.data()); delete [] data; //! [46] @@ -424,7 +424,7 @@ delete [] data; //! [47] QString tmp = "test"; QByteArray text = tmp.toLocal8Bit(); -char *data = new char[text.size() + 1] +char *data = new char[text.size() + 1]; strcpy(data, text.data()); delete [] data; //! [47] diff --git a/src/corelib/doc/src/threads.qdoc b/src/corelib/doc/src/threads.qdoc index 890fd9f6ff..25276404b0 100644 --- a/src/corelib/doc/src/threads.qdoc +++ b/src/corelib/doc/src/threads.qdoc @@ -395,7 +395,7 @@ If a thread locks a resource but does not unlock it, the application may freeze because the resource will become permanently unavailable to other threads. - This can happen, for example, if a an exception is thrown and forces the current + This can happen, for example, if an exception is thrown and forces the current function to return without releasing its lock. Another similar scenario is a \e{deadlock}. For example, suppose that @@ -408,7 +408,7 @@ QMutexLocker, QReadLocker and QWriteLocker are convenience classes that make it easier to use QMutex and QReadWriteLock. They lock a resource when they are constructed, and automatically unlock it when they are destroyed. They are - designed to simplify code that use QMutex and QReadWriteLocker, thus reducing + designed to simplify code that use QMutex and QReadWriteLock, thus reducing the chances that a resource becomes permanently locked by accident. \section1 High-Level Event Queues diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 897af352c9..2cf97ef94e 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -682,7 +682,7 @@ bool QFileInfo::exists() const \note If \a file is a symlink that points to a non-existing file, false is returned. - \note Using this function is faster for than using + \note Using this function is faster than using \c QFileInfo(file).exists() for file system access. */ bool QFileInfo::exists(const QString &file) diff --git a/src/corelib/thread/qreadwritelock.cpp b/src/corelib/thread/qreadwritelock.cpp index e4cdf7a985..ffda3c4fad 100644 --- a/src/corelib/thread/qreadwritelock.cpp +++ b/src/corelib/thread/qreadwritelock.cpp @@ -98,7 +98,7 @@ QT_BEGIN_NAMESPACE \since 4.4 \value Recursive In this mode, a thread can lock the same - QReadWriteLock multiple times and the mutex won't be unlocked + QReadWriteLock multiple times. The QReadWriteLock won't be unlocked until a corresponding number of unlock() calls have been made. \value NonRecursive In this mode, a thread may only lock a diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index 8d34db19cd..a66b39f733 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -591,7 +591,6 @@ QNetworkConfiguration::BearerType QNetworkConfiguration::bearerTypeFamily() cons \li Value \row \li BearerUnknown - \li \li The session is based on an unknown or unspecified bearer type. The value of the string returned describes the bearer type. \row diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index da9b96a625..7367f6e7f4 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -204,7 +204,7 @@ bool QSqlTableModelPrivate::exec(const QString &stmt, bool prepStatement, \inmodule QtSql QSqlTableModel is a high-level interface for reading and writing - database records from a single table. It is build on top of the + database records from a single table. It is built on top of the lower-level QSqlQuery and can be used to provide data to view classes such as QTableView. For example: diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 726c2704c4..fd704e479b 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -1042,7 +1042,7 @@ QAbstractItemView::SelectionBehavior QAbstractItemView::selectionBehavior() cons Sets the current item to be the item at \a index. Unless the current selection mode is - \l{QAbstractItemView::}{NoSelection}, the item is also be selected. + \l{QAbstractItemView::}{NoSelection}, the item is also selected. Note that this function also updates the starting position for any new selections the user performs. diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp index aa1dbf1de3..5040192f31 100644 --- a/src/widgets/itemviews/qlistwidget.cpp +++ b/src/widgets/itemviews/qlistwidget.cpp @@ -1456,7 +1456,7 @@ QListWidgetItem *QListWidget::currentItem() const Sets the current item to \a item. Unless the selection mode is \l{QAbstractItemView::}{NoSelection}, - the item is also be selected. + the item is also selected. */ void QListWidget::setCurrentItem(QListWidgetItem *item) { diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp index 43b6b62cc1..71034f6165 100644 --- a/src/widgets/itemviews/qtablewidget.cpp +++ b/src/widgets/itemviews/qtablewidget.cpp @@ -2125,7 +2125,7 @@ QTableWidgetItem *QTableWidget::currentItem() const Sets the current item to \a item. Unless the selection mode is \l{QAbstractItemView::}{NoSelection}, - the item is also be selected. + the item is also selected. \sa currentItem(), setCurrentCell() */ -- cgit v1.2.3 From ac693bf7541552fad9cb216e200c85b441fcde58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 25 Oct 2013 14:19:10 +0200 Subject: Add QGuiApplication::sync() function This will allow applications to make sure Qt has the same state as the window system at any given point. The use of this function is discouraged but it is very useful for auto tests. Change-Id: I691bff365fc391e9d7213f2607008983505bb774 Reviewed-by: Paul Olav Tvete --- src/gui/kernel/qguiapplication.cpp | 21 +++++++++++++++++++++ src/gui/kernel/qguiapplication.h | 1 + src/gui/kernel/qplatformintegration.cpp | 15 +++++++++++++++ src/gui/kernel/qplatformintegration.h | 5 ++++- src/plugins/platforms/xcb/qxcbintegration.cpp | 8 ++++++++ src/plugins/platforms/xcb/qxcbintegration.h | 1 + 6 files changed, 50 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 2e6000625e..077084b80f 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2801,6 +2801,27 @@ bool QGuiApplication::isSavingSession() const return d->is_saving_session; } +/*! + \since 5.2 + + Function that can be used to sync Qt state with the Window Systems state. + + This function will first empty Qts events by calling QCoreApplication::processEvents(), + then the platform plugin will sync up with the windowsystem, and finally Qts events + will be delived by another call to QCoreApplication::processEvents(); + + This function is timeconsuming and its use is discouraged. +*/ +void QGuiApplication::sync() +{ + QCoreApplication::processEvents(); + if (QGuiApplicationPrivate::platform_integration + && QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::SyncState)) { + QGuiApplicationPrivate::platform_integration->sync(); + QCoreApplication::processEvents(); + } +} + void QGuiApplicationPrivate::commitData() { Q_Q(QGuiApplication); diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index bd42f18418..0089d48fa6 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -155,6 +155,7 @@ public: bool isSavingSession() const; #endif + static void sync(); Q_SIGNALS: void fontDatabaseChanged(); void screenAdded(QScreen *screen); diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index 49ac7836cb..e583606e41 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -435,4 +435,19 @@ QPlatformSessionManager *QPlatformIntegration::createPlatformSessionManager(cons } #endif +/*! + \since 5.2 + + Function to sync the platform integrations state with the window system. + + This is often implemented as a roundtrip from the platformintegration to the window system. + + This function should not call QWindowSystemInterface::flushWindowSystemEvents() or + QCoreApplication::processEvents() +*/ +void QPlatformIntegration::sync() +{ + +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index d3189f8641..4be675a37a 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -94,7 +94,8 @@ public: ForeignWindows, NonFullScreenWindows, NativeWidgets, - WindowManagement + WindowManagement, + SyncState }; virtual ~QPlatformIntegration() { } @@ -162,6 +163,8 @@ public: #ifndef QT_NO_SESSIONMANAGER virtual QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const; #endif + + virtual void sync(); protected: void screenAdded(QPlatformScreen *screen); }; diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 6b5ea93638..d794065d45 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -282,6 +282,7 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const case WindowMasks: return true; case MultipleWindows: return true; case ForeignWindows: return true; + case SyncState: return true; default: return QPlatformIntegration::hasCapability(cap); } } @@ -458,4 +459,11 @@ QPlatformSessionManager *QXcbIntegration::createPlatformSessionManager(const QSt } #endif +void QXcbIntegration::sync() +{ + for (int i = 0; i < m_connections.size(); i++) { + m_connections.at(i)->sync(); + } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index 79fb1965c4..6ae23125c8 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -106,6 +106,7 @@ public: QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const Q_DECL_OVERRIDE; #endif + void sync(); private: QList m_connections; -- cgit v1.2.3 From 43002e25723e923f035f1507eb5b66312ab708cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 25 Oct 2013 12:02:21 +0200 Subject: Silence the _COMPIZ_DECOR_* warnings on Ubuntu Earliest occurrence is to my knowledge in 12.04. It is still unclear how to act on those messages Change-Id: I7da48281c6bec973448a1d4cd800d445a80695a2 Reviewed-by: Gatis Paeglis Reviewed-by: Gunnar Sletta --- src/plugins/platforms/xcb/qxcbconnection.cpp | 5 ++++- src/plugins/platforms/xcb/qxcbconnection.h | 4 ++++ src/plugins/platforms/xcb/qxcbwindow.cpp | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index e6ef6b2a09..cc8c42f96b 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1438,7 +1438,10 @@ static const char * xcb_atomnames = { #if XCB_USE_MAEMO_WINDOW_PROPERTIES "_MEEGOTOUCH_ORIENTATION_ANGLE\0" #endif - "_XSETTINGS_SETTINGS\0" // \0\0 terminates loop. + "_XSETTINGS_SETTINGS\0" + "_COMPIZ_DECOR_PENDING\0" + "_COMPIZ_DECOR_REQUEST\0" + "_COMPIZ_DECOR_DELETE_PIXMAP\0" // \0\0 terminates loop. }; QXcbAtom::Atom QXcbConnection::qatom(xcb_atom_t xatom) const diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 0e52b2ec46..ff7a6dd606 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -277,6 +277,10 @@ namespace QXcbAtom { #endif _XSETTINGS_SETTINGS, + _COMPIZ_DECOR_PENDING, + _COMPIZ_DECOR_REQUEST, + _COMPIZ_DECOR_DELETE_PIXMAP, + NPredefinedAtoms, _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms, diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index aa53093868..c1650f6576 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1549,6 +1549,10 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even || event->type == atom(QXcbAtom::WM_CHANGE_STATE)) { // Ignore _NET_ACTIVE_WINDOW, _NET_WM_STATE, MANAGER which are relate to tray icons // and other messages. + } else if (event->type == atom(QXcbAtom::_COMPIZ_DECOR_PENDING) + || event->type == atom(QXcbAtom::_COMPIZ_DECOR_REQUEST) + || event->type == atom(QXcbAtom::_COMPIZ_DECOR_DELETE_PIXMAP)) { + //silence the _COMPIZ messages for now } else { qWarning() << "QXcbWindow: Unhandled client message:" << connection()->atomName(event->type); } -- cgit v1.2.3 From f18fd0450c2490bbbe1f59a99580139815a82e2f Mon Sep 17 00:00:00 2001 From: Joshua Grauman Date: Sat, 26 Oct 2013 15:25:03 -0700 Subject: Fix finding cursor position in words with accents In positionInLigature() we were mixing indexes into the script item with indexes into the entire string. The getClusterLength() function would expect an attributes array for the current script item and it thus needs to be adjusted by si->position. In addition, when looking for the next grapheme boundary, we were comparing pos (which indexed the string) with end (which indexed the script item). This has also now been fixed by adjusting for si->position as well. Task-number: QTBUG-30123 Change-Id: Id02e2eddcc5b7888eacb34bd1e39cc6911880ca1 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextengine.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 2b0f9ffeb6..6345ed7682 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -3100,7 +3100,7 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end, glyph_pos--; } - const QCharAttributes *attrs = attributes(); + const QCharAttributes *attrs = attributes() + si->position; logClusters = this->logClusters(si); clusterLength = getClusterLength(logClusters, attrs, 0, end, glyph_pos, &clusterStart); @@ -3117,11 +3117,11 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end, int closestItem = dist > (perItemWidth / 2) ? n + 1 : n; if (cursorOnCharacter && closestItem > 0) closestItem--; - int pos = si->position + clusterStart + closestItem; + int pos = clusterStart + closestItem; // Jump to the next grapheme boundary while (pos < end && !attrs[pos].graphemeBoundary) pos++; - return pos; + return si->position + pos; } return si->position + end; } -- cgit v1.2.3 From f0625d2b88b1bf15379f17932a36ad5824ad8a14 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 18 Oct 2013 14:43:27 +0200 Subject: Use Q_UNLIKELY in qCDebug, qCTrace By default debug, trace is disabled, so this can be marked as unlikely. Change-Id: I221a688c953c1ff1fdfda65d2d99457785d3ff47 Reviewed-by: hjk Reviewed-by: Thiago Macieira --- src/corelib/io/qloggingcategory.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h index 7a119f4937..da96dee12e 100644 --- a/src/corelib/io/qloggingcategory.h +++ b/src/corelib/io/qloggingcategory.h @@ -154,7 +154,7 @@ private: } #define qCDebug(category) \ - for (bool enabled = category().isDebugEnabled(); enabled; enabled = false) \ + for (bool enabled = category().isDebugEnabled(); Q_UNLIKELY(enabled); enabled = false) \ QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug() #define qCWarning(category) \ for (bool enabled = category().isWarningEnabled(); enabled; enabled = false) \ @@ -163,7 +163,7 @@ private: for (bool enabled = category().isCriticalEnabled(); enabled; enabled = false) \ QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical() #define qCTrace(category) \ - for (bool enabled = category.isTraceEnabled(); enabled; enabled = false) \ + for (bool enabled = category.isTraceEnabled(); Q_UNLIKELY(enabled); enabled = false) \ QTraceGuard(category) -- cgit v1.2.3 From 3655d71719a4746938f364bfe0d82c1609c3eacb Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 18 Jul 2013 18:20:42 +0200 Subject: Fix the network proxy code for windows to detect properly services This patch makes it so even sub processes of services are also detected to be running in the context of a service. With the previous code it would only detect that the current process is a service and not the sub processes. This fix makes sure we detect properly if the current process is running in the context of a service. This is important to detect properly the proxy configuration of the current user. Change-Id: I110dee62597aec3f8e2f6925166a428f72d14fd0 Reviewed-by: Joerg Bornemann Reviewed-by: Friedemann Kleint --- src/network/kernel/qnetworkproxy_win.cpp | 52 ++++++++++++-------------------- 1 file changed, 20 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index f1893ae322..e16d7e557e 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include "qnetworkfunctions_wince.h" /* @@ -115,48 +116,38 @@ typedef HINTERNET (WINAPI * PtrWinHttpOpen)(LPCWSTR, DWORD, LPCWSTR, LPCWSTR,DWO typedef BOOL (WINAPI * PtrWinHttpGetDefaultProxyConfiguration)(WINHTTP_PROXY_INFO*); typedef BOOL (WINAPI * PtrWinHttpGetIEProxyConfigForCurrentUser)(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG*); typedef BOOL (WINAPI * PtrWinHttpCloseHandle)(HINTERNET); -typedef SC_HANDLE (WINAPI * PtrOpenSCManager)(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess); -typedef BOOL (WINAPI * PtrEnumServicesStatusEx)(SC_HANDLE hSCManager, SC_ENUM_TYPE InfoLevel, DWORD dwServiceType, DWORD dwServiceState, LPBYTE lpServices, DWORD cbBufSize, LPDWORD pcbBytesNeeded, - LPDWORD lpServicesReturned, LPDWORD lpResumeHandle, LPCWSTR pszGroupName); typedef BOOL (WINAPI * PtrCloseServiceHandle)(SC_HANDLE hSCObject); static PtrWinHttpGetProxyForUrl ptrWinHttpGetProxyForUrl = 0; static PtrWinHttpOpen ptrWinHttpOpen = 0; static PtrWinHttpGetDefaultProxyConfiguration ptrWinHttpGetDefaultProxyConfiguration = 0; static PtrWinHttpGetIEProxyConfigForCurrentUser ptrWinHttpGetIEProxyConfigForCurrentUser = 0; static PtrWinHttpCloseHandle ptrWinHttpCloseHandle = 0; -static PtrOpenSCManager ptrOpenSCManager = 0; -static PtrEnumServicesStatusEx ptrEnumServicesStatusEx = 0; -static PtrCloseServiceHandle ptrCloseServiceHandle = 0; +#ifndef Q_OS_WINCE static bool currentProcessIsService() { - if (!ptrOpenSCManager || !ptrEnumServicesStatusEx|| !ptrCloseServiceHandle) - return false; - - SC_HANDLE hSCM = ptrOpenSCManager(0, 0, SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_CONNECT); - if (!hSCM) - return false; - - ULONG bufSize = 0; - ULONG nbServices = 0; - if (ptrEnumServicesStatusEx(hSCM, SC_ENUM_PROCESS_INFO, SERVICE_WIN32, SERVICE_ACTIVE, 0, bufSize, &bufSize, &nbServices, 0, 0)) - return false; //error case - - LPENUM_SERVICE_STATUS_PROCESS info = reinterpret_cast(malloc(bufSize)); - bool foundService = false; - if (ptrEnumServicesStatusEx(hSCM, SC_ENUM_PROCESS_INFO, SERVICE_WIN32, SERVICE_ACTIVE, (LPBYTE)info, bufSize, &bufSize, &nbServices, 0, 0)) { - DWORD currProcId = GetCurrentProcessId(); - for (ULONG i = 0; i < nbServices && !foundService; i++) { - if (info[i].ServiceStatusProcess.dwProcessId == currProcId) - foundService = true; + typedef BOOL (WINAPI *PtrGetUserName)(LPTSTR lpBuffer, LPDWORD lpnSize); + typedef BOOL (WINAPI *PtrLookupAccountName)(LPCTSTR lpSystemName, LPCTSTR lpAccountName, PSID Sid, + LPDWORD cbSid, LPTSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse); + static PtrGetUserName ptrGetUserName = (PtrGetUserName)QSystemLibrary::resolve(QLatin1String("Advapi32"), "GetUserNameW"); + static PtrLookupAccountName ptrLookupAccountName = (PtrLookupAccountName)QSystemLibrary::resolve(QLatin1String("Advapi32"), "LookupAccountNameW"); + + if (ptrGetUserName && ptrLookupAccountName) { + wchar_t userName[UNLEN + 1] = L""; + DWORD size = UNLEN; + if (ptrGetUserName(userName, &size)) { + SID_NAME_USE type = SidTypeUser; + DWORD dummy = MAX_PATH; + wchar_t dummyStr[MAX_PATH] = L""; + PSID psid = 0; + if (ptrLookupAccountName(NULL, userName, &psid, &dummy, dummyStr, &dummy, &type)) + return type != SidTypeUser; //returns true if the current user is not a user } } - - ptrCloseServiceHandle(hSCM); - free(info); - return foundService; + return false; } +#endif // ! Q_OS_WINCE static QStringList splitSpaceSemicolon(const QString &source) { @@ -418,9 +409,6 @@ void QWindowsSystemProxy::init() ptrWinHttpGetProxyForUrl = (PtrWinHttpGetProxyForUrl)lib.resolve("WinHttpGetProxyForUrl"); ptrWinHttpGetDefaultProxyConfiguration = (PtrWinHttpGetDefaultProxyConfiguration)lib.resolve("WinHttpGetDefaultProxyConfiguration"); ptrWinHttpGetIEProxyConfigForCurrentUser = (PtrWinHttpGetIEProxyConfigForCurrentUser)lib.resolve("WinHttpGetIEProxyConfigForCurrentUser"); - ptrOpenSCManager = (PtrOpenSCManager) QSystemLibrary(L"advapi32").resolve("OpenSCManagerW"); - ptrEnumServicesStatusEx = (PtrEnumServicesStatusEx) QSystemLibrary(L"advapi32").resolve("EnumServicesStatusExW"); - ptrCloseServiceHandle = (PtrCloseServiceHandle) QSystemLibrary(L"advapi32").resolve("CloseServiceHandle"); // Try to obtain the Internet Explorer configuration. WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ieProxyConfig; -- cgit v1.2.3 From 105e228d1c733e20787fd80e669be22064149c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 30 Oct 2013 10:44:40 +0100 Subject: xcb: Act on the _NET_ACTIVE_WINDOW event It happens that we don't get a focus inn event for top level windows when focus goes from a window mapped. But we do get a _NET_ACTIVE_WINDOW event. Task-number: QTBUG-34426 Change-Id: Id1d9eb708a968e0e8934e56dec19abe2dd203bc7 Reviewed-by: Gunnar Sletta --- src/plugins/platforms/xcb/qxcbwindow.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index c1650f6576..dd404d044d 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1544,10 +1544,13 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even #endif } else if (event->type == atom(QXcbAtom::_XEMBED)) { handleXEmbedMessage(event); - } else if (event->type == atom(QXcbAtom::MANAGER) || event->type == atom(QXcbAtom::_NET_ACTIVE_WINDOW) - || event->type == atom(QXcbAtom::_NET_WM_STATE) || event->type == atom(QXcbAtom::MANAGER) + } else if (event->type == atom(QXcbAtom::_NET_ACTIVE_WINDOW)) { + connection()->setFocusWindow(this); + QWindowSystemInterface::handleWindowActivated(window()); + } else if (event->type == atom(QXcbAtom::MANAGER) + || event->type == atom(QXcbAtom::_NET_WM_STATE) || event->type == atom(QXcbAtom::WM_CHANGE_STATE)) { - // Ignore _NET_ACTIVE_WINDOW, _NET_WM_STATE, MANAGER which are relate to tray icons + // Ignore _NET_WM_STATE, MANAGER which are relate to tray icons // and other messages. } else if (event->type == atom(QXcbAtom::_COMPIZ_DECOR_PENDING) || event->type == atom(QXcbAtom::_COMPIZ_DECOR_REQUEST) -- cgit v1.2.3 From f1927370cbb89438c95d56e9fb4556e7c2f4f666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 30 Oct 2013 12:06:17 +0100 Subject: xcb: Compilefix #ifdef glx code Change-Id: I4204cab76b2621318dda909d24ceb2abab6e0ba3 Reviewed-by: Gunnar Sletta --- src/plugins/platforms/xcb/qxcbintegration.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index d794065d45..ecbf28bab9 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -278,7 +278,11 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const #else case OpenGL: return false; #endif +#if defined(XCB_USE_GLX) case ThreadedOpenGL: return m_connections.at(0)->supportsThreadedRendering() && QGLXContext::supportsThreading(); +#else + case ThreadedOpenGL: return m_connections.at(0)->supportsThreadedRendering(); +#endif case WindowMasks: return true; case MultipleWindows: return true; case ForeignWindows: return true; -- cgit v1.2.3 From fb5036b7f12dd648340aaa7f90245afd353759e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Tue, 29 Oct 2013 17:40:56 +0100 Subject: Android: Fix problem with leaking local refs. In some cases we where not releasing the local references and since we no longer disconnect from the VM on each call, the number of local refs. would accumulating until it hit the hard-limit of 512. Change-Id: I6826620e4cb61a37af26d276667489e876080076 Reviewed-by: Yoann Lopes --- src/corelib/kernel/qjni.cpp | 29 ++++++++++++++++++++++------- src/corelib/kernel/qjni_p.h | 4 +++- src/corelib/kernel/qjnihelpers.cpp | 2 ++ 3 files changed, 27 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qjni.cpp b/src/corelib/kernel/qjni.cpp index cf839cfaef..4e06d12aee 100644 --- a/src/corelib/kernel/qjni.cpp +++ b/src/corelib/kernel/qjni.cpp @@ -351,7 +351,9 @@ QJNIObjectPrivate::QJNIObjectPrivate(jobject obj) QJNIEnvironmentPrivate env; d->m_jobject = env->NewGlobalRef(obj); - d->m_jclass = static_cast(env->NewGlobalRef(env->GetObjectClass(d->m_jobject))); + jclass objectClass = env->GetObjectClass(d->m_jobject); + d->m_jclass = static_cast(env->NewGlobalRef(objectClass)); + env->DeleteLocalRef(objectClass); } template <> @@ -1262,7 +1264,10 @@ QJNIObjectPrivate QJNIObjectPrivate::callObjectMethod(const char *methodName, if (id) { res = env->CallObjectMethodV(d->m_jobject, id, args); } - return res; + + QJNIObjectPrivate obj(res); + env->DeleteLocalRef(res); + return obj; } QJNIObjectPrivate QJNIObjectPrivate::callObjectMethod(const char *methodName, @@ -1339,7 +1344,9 @@ QJNIObjectPrivate QJNIObjectPrivate::callStaticObjectMethod(const char *classNam } } - return res; + QJNIObjectPrivate obj(res); + env->DeleteLocalRef(res); + return obj; } QJNIObjectPrivate QJNIObjectPrivate::callStaticObjectMethod(const char *className, @@ -1366,7 +1373,9 @@ QJNIObjectPrivate QJNIObjectPrivate::callStaticObjectMethod(jclass clazz, res = env->CallStaticObjectMethodV(clazz, id, args); } - return res; + QJNIObjectPrivate obj(res); + env->DeleteLocalRef(res); + return obj; } QJNIObjectPrivate QJNIObjectPrivate::callStaticObjectMethod(jclass clazz, @@ -1678,7 +1687,9 @@ QJNIObjectPrivate QJNIObjectPrivate::getObjectField(const char *fieldName, if (id) res = env->GetObjectField(d->m_jobject, id); - return res; + QJNIObjectPrivate obj(res); + env->DeleteLocalRef(res); + return obj; } QJNIObjectPrivate QJNIObjectPrivate::getStaticObjectField(const char *className, @@ -1704,7 +1715,9 @@ QJNIObjectPrivate QJNIObjectPrivate::getStaticObjectField(jclass clazz, if (id) res = env->GetStaticObjectField(clazz, id); - return res; + QJNIObjectPrivate obj(res); + env->DeleteLocalRef(res); + return obj; } template <> @@ -2106,7 +2119,9 @@ QJNIObjectPrivate QJNIObjectPrivate::fromString(const QString &string) QJNIEnvironmentPrivate env; jstring res = env->NewString(reinterpret_cast(string.constData()), string.length()); - return res; + QJNIObjectPrivate obj(res); + env->DeleteLocalRef(res); + return obj; } QString QJNIObjectPrivate::toString() const diff --git a/src/corelib/kernel/qjni_p.h b/src/corelib/kernel/qjni_p.h index c5bbae26b9..ab98aec1bf 100644 --- a/src/corelib/kernel/qjni_p.h +++ b/src/corelib/kernel/qjni_p.h @@ -180,7 +180,9 @@ public: d = QSharedPointer(new QJNIObjectData()); QJNIEnvironmentPrivate env; d->m_jobject = env->NewGlobalRef(jobj); - d->m_jclass = static_cast(env->NewGlobalRef(env->GetObjectClass(jobj))); + jclass objectClass = env->GetObjectClass(jobj); + d->m_jclass = static_cast(env->NewGlobalRef(objectClass)); + env->DeleteLocalRef(objectClass); } return *this; diff --git a/src/corelib/kernel/qjnihelpers.cpp b/src/corelib/kernel/qjnihelpers.cpp index fbcd0606e6..9ec491f6a9 100644 --- a/src/corelib/kernel/qjnihelpers.cpp +++ b/src/corelib/kernel/qjnihelpers.cpp @@ -94,7 +94,9 @@ jint QtAndroidPrivate::initJNI(JavaVM *vm, JNIEnv *env) return JNI_ERR; g_jClassLoader = env->NewGlobalRef(classLoader); + env->DeleteLocalRef(classLoader); g_jActivity = env->NewGlobalRef(activity); + env->DeleteLocalRef(activity); g_javaVM = vm; return JNI_OK; -- cgit v1.2.3 From b280182053a8ccd912eb165b59928e88a6d62c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Tue, 29 Oct 2013 15:06:34 +0100 Subject: Android: Don't rely on QIcon::isNull() to validate icon data. QIcon::isNull() only checks if it has a valid d pointer and not if it actually contains any image data. The result is that the QImage create from the icon would be invalid, and later cause an exception to be thrown. To avoid this we should check the QImage as well. Task-number: QTBUG-34416 Change-Id: I9dd0a2387d73bfc2c27ceb9df247ddc186dd659f Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/src/androidjnimenu.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/android/src/androidjnimenu.cpp b/src/plugins/platforms/android/src/androidjnimenu.cpp index bb180347c1..8964995832 100644 --- a/src/plugins/platforms/android/src/androidjnimenu.cpp +++ b/src/plugins/platforms/android/src/androidjnimenu.cpp @@ -197,16 +197,18 @@ namespace QtAndroidMenu env->CallObjectMethod(menuItem, setCheckedMenuItemMethodID, checked); env->CallObjectMethod(menuItem, setEnabledMenuItemMethodID, enabled); - if (!icon.isNull()) { + if (!icon.isNull()) { // isNull() only checks the d pointer, not the actual image data. int sz = qMax(36, qgetenv("QT_ANDROID_APP_ICON_SIZE").toInt()); QImage img = icon.pixmap(QSize(sz,sz), enabled ? QIcon::Normal : QIcon::Disabled, QIcon::On).toImage(); - env->CallObjectMethod(menuItem, - setIconMenuItemMethodID, - createBitmapDrawable(createBitmap(img, env), env)); + if (!img.isNull()) { // Make sure we have a valid image. + env->CallObjectMethod(menuItem, + setIconMenuItemMethodID, + createBitmapDrawable(createBitmap(img, env), env)); + } } env->CallObjectMethod(menuItem, setVisibleMenuItemMethodID, visible); -- cgit v1.2.3 From 195cd51f7d1d853220c16d043f1dfabd852de98b Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Mon, 28 Oct 2013 09:21:33 +0100 Subject: Fix QSpinBox size calculation problem with empty stylesheets Task-number: QTBUG-34305 Change-Id: I3e89dc66446e9f5e9e1810be367830b9df98ab0b Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qstylesheetstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 417e092e11..ab98dfbdcf 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -4821,7 +4821,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op QSize defaultUpSize = defaultSize(w, subRule.size(), spinbox->rect, PseudoElement_SpinBoxUpButton); sz += QSize(defaultUpSize.width(), 0); } - if (rule.hasBox() || !rule.hasNativeBorder()) + if (rule.hasBox() || rule.hasBorder() || !rule.hasNativeBorder()) sz = rule.boxSize(sz); return sz; } -- cgit v1.2.3 From a3d72efc650db6b0663e11e3448b77ba93a0a925 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 30 Oct 2013 14:03:19 +0100 Subject: Consider multi-monitor setups in QPlatformWindow::initialGeometry(). Task-number: QTBUG-34204 Change-Id: Id79efe33ece071ad94578b6ac0370b0f040d1c3c Reviewed-by: Andy Shaw Reviewed-by: Laszlo Agocs --- src/gui/kernel/qplatformwindow.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index 1f9183db44..954d47f18c 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -487,6 +487,27 @@ bool QPlatformWindow::isAlertState() const return false; } +// Return the effective screen for the initial geometry of a window. In a +// multimonitor-setup, try to find the right screen by checking the transient +// parent or the mouse cursor for parentless windows (cf QTBUG-34204, +// QDialog::adjustPosition()). +static inline const QScreen *effectiveScreen(const QWindow *window) +{ + if (!window) + return QGuiApplication::primaryScreen(); + const QScreen *screen = window->screen(); + if (!screen) + return QGuiApplication::primaryScreen(); + const QList siblings = screen->virtualSiblings(); + if (siblings.size() > 1) { + const QPoint referencePoint = window->transientParent() ? window->transientParent()->geometry().center() : QCursor::pos(); + foreach (const QScreen *sibling, siblings) + if (sibling->geometry().contains(referencePoint)) + return sibling; + } + return screen; +} + /*! Helper function to get initial geometry on windowing systems which do not do smart positioning and also do not provide a means of centering a @@ -511,8 +532,8 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w, } if (w->isTopLevel() && qt_window_private(const_cast(w))->positionAutomatic && w->type() != Qt::Popup) { - if (const QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(w)) { - const QRect availableGeometry = platformScreen->availableGeometry(); + if (const QScreen *screen = effectiveScreen(w)) { + const QRect availableGeometry = screen->availableGeometry(); // Center unless the geometry ( + unknown window frame) is too large for the screen). if (rect.height() < (availableGeometry.height() * 8) / 9 && rect.width() < (availableGeometry.width() * 8) / 9) { -- cgit v1.2.3 From 769abe8d2f34fdd5c67f82cd104187c4ca377f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 29 Oct 2013 15:56:24 +0100 Subject: iOS: Fix logic for determining whether to exit the root event loop Instead of trying to hook into various places where we might be in a situation where the root event loop should exit, and then enabling the runloop-observer, we always keep the observer active, and then do the relevant checks whenever the run-loop exits. The reason for checking if the event loop is running is that iOS will enter and exit the root runloop as part of normal operation, eg due to flicking a scroll view and switching the runloop mode, so we need to ensure that we're actually supposed to exit the root event loop. Change-Id: I9b84b47ee45e0c9e2b1d2ebb5a432ea92700b324 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioseventdispatcher.h | 2 -- src/plugins/platforms/ios/qioseventdispatcher.mm | 38 +++++------------------- 2 files changed, 8 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioseventdispatcher.h b/src/plugins/platforms/ios/qioseventdispatcher.h index f2272ecd68..5caa7f5d2d 100644 --- a/src/plugins/platforms/ios/qioseventdispatcher.h +++ b/src/plugins/platforms/ios/qioseventdispatcher.h @@ -54,11 +54,9 @@ public: explicit QIOSEventDispatcher(QObject *parent = 0); bool processEvents(QEventLoop::ProcessEventsFlags flags) Q_DECL_OVERRIDE; - void interrupt() Q_DECL_OVERRIDE; void handleRunLoopExit(CFRunLoopActivity activity); - void checkIfEventLoopShouldExit(); void interruptEventLoopExec(); private: diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm index 3dd9c7ad9f..51eb10d385 100644 --- a/src/plugins/platforms/ios/qioseventdispatcher.mm +++ b/src/plugins/platforms/ios/qioseventdispatcher.mm @@ -446,6 +446,8 @@ bool __attribute__((returns_twice)) QIOSEventDispatcher::processEvents(QEventLoo if (!m_processEventCallsAfterExec && (flags & QEventLoop::EventLoopExec)) { ++m_processEventCallsAfterExec; + m_runLoopExitObserver.addToMode(kCFRunLoopCommonModes); + // We set a new jump point here that we can return to when the event loop // is asked to exit, so that we can return from QEventLoop::exec(). switch (setjmp(processEventExitJumpPoint)) { @@ -475,44 +477,18 @@ bool __attribute__((returns_twice)) QIOSEventDispatcher::processEvents(QEventLoo if (m_processEventCallsAfterExec) --m_processEventCallsAfterExec; - // If we're running with nested event loops and the application is quit, - // then the forwarded interrupt call will happen while our processEvent - // counter is still 2, and we won't detect that we're about to fall down - // to the root iOS run-loop. We do an extra check here to catch that case. - checkIfEventLoopShouldExit(); - return processedEvents; } -void QIOSEventDispatcher::interrupt() -{ - QEventDispatcherCoreFoundation::interrupt(); - - if (!rootLevelRunLoopIntegration()) - return; - - // If an interrupt happens as part of a non-nested event loop, that is, - // by processing an event or timer in the root iOS run-loop, we'll be - // able to detect it here. - checkIfEventLoopShouldExit(); -} - -void QIOSEventDispatcher::checkIfEventLoopShouldExit() -{ - if (m_processEventCallsAfterExec == 1) { - qEventDispatcherDebug() << "Hit root runloop level, watching for runloop exit"; - m_runLoopExitObserver.addToMode(kCFRunLoopCommonModes); - } -} - void QIOSEventDispatcher::handleRunLoopExit(CFRunLoopActivity activity) { Q_UNUSED(activity); Q_ASSERT(activity == kCFRunLoopExit); - m_runLoopExitObserver.removeFromMode(kCFRunLoopCommonModes); - - interruptEventLoopExec(); + if (m_processEventCallsAfterExec == 1 && !QThreadData::current()->eventLoops.top()->isRunning()) { + qEventDispatcherDebug() << "Root runloop level exited"; + interruptEventLoopExec(); + } } void QIOSEventDispatcher::interruptEventLoopExec() @@ -521,6 +497,8 @@ void QIOSEventDispatcher::interruptEventLoopExec() --m_processEventCallsAfterExec; + m_runLoopExitObserver.removeFromMode(kCFRunLoopCommonModes); + // We re-set applicationProcessEventsReturnPoint here so that future // calls to QEventLoop::exec() will end up back here after entering // processEvents, instead of back in didFinishLaunchingWithOptions. -- cgit v1.2.3 From 44e68b90266336d3d46279eddcbb2a4a775f0d2a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 30 Oct 2013 13:19:26 +0200 Subject: Windows: Do not use blend function for GL windows with alpha. Task-number: QTBUG-34376 Change-Id: I81a5ee6ff14e5472eb1f3846577d86b615be34e0 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowswindow.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 1909e0313b..d3d381ae28 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -305,7 +305,7 @@ bool QWindowsWindow::setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool has #endif // Q_OS_WINCE } -static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal level) +static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, bool openGL, qreal level) { #ifdef Q_OS_WINCE // WINCE does not support that feature and microsoft explicitly warns to use those calls Q_UNUSED(hwnd); @@ -314,8 +314,8 @@ static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qr Q_UNUSED(level); #else if (QWindowsWindow::setWindowLayered(hwnd, flags, hasAlpha, level)) { - if (hasAlpha && (flags & Qt::FramelessWindowHint)) { - // Windows with alpha: Use blend function to update. + if (hasAlpha && !openGL && (flags & Qt::FramelessWindowHint)) { + // Non-GL windows with alpha: Use blend function to update. BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * level), AC_SRC_ALPHA}; QWindowsContext::user32dll.updateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA); } else { @@ -661,7 +661,7 @@ void WindowCreationData::initialize(HWND hwnd, bool frameChange, qreal opacityLe EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_GRAYED); } - setWindowOpacity(hwnd, flags, hasAlpha, opacityLevel); + setWindowOpacity(hwnd, flags, hasAlpha, isGL, opacityLevel); } else { // child. SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, swpFlags); } @@ -1745,7 +1745,9 @@ void QWindowsWindow::setOpacity(qreal level) if (m_opacity != level) { m_opacity = level; if (m_data.hwnd) - setWindowOpacity(m_data.hwnd, m_data.flags, window()->format().hasAlpha(), level); + setWindowOpacity(m_data.hwnd, m_data.flags, + window()->format().hasAlpha(), testFlag(OpenGLSurface), + level); } } -- cgit v1.2.3 From fe41442575b64956aec5c67f909f1eab7da1015b Mon Sep 17 00:00:00 2001 From: Ian Dean Date: Tue, 15 Oct 2013 12:32:21 +0100 Subject: iOS: Add standard paths implementation for iOS A standard paths implementation for iOS. The APIs used on iOS require that the source file be "Objective-C++" (with a .MM extension), as there are no APIs available in C++ for this. The implementation complies with the latest documentation on standard paths. Change-Id: I349d3c5d4ddb6fb1297a45dc9ae26b56ac528abb Reviewed-by: Thiago Macieira Reviewed-by: David Faure --- src/corelib/io/io.pri | 2 + src/corelib/io/qstandardpaths_ios.mm | 135 +++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 src/corelib/io/qstandardpaths_ios.mm (limited to 'src') diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index eab3981f7a..f06bf61b09 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -135,6 +135,8 @@ win32 { mac { macx { SOURCES += io/qstandardpaths_mac.cpp + } else:ios { + OBJECTIVE_SOURCES += io/qstandardpaths_ios.mm } else { SOURCES += io/qstandardpaths_unix.cpp } diff --git a/src/corelib/io/qstandardpaths_ios.mm b/src/corelib/io/qstandardpaths_ios.mm new file mode 100644 index 0000000000..332400eaf2 --- /dev/null +++ b/src/corelib/io/qstandardpaths_ios.mm @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#import + +#include "qstandardpaths.h" + +#ifndef QT_NO_STANDARDPATHS + +QT_BEGIN_NAMESPACE + +static QString pathForDirectory(NSSearchPathDirectory directory) +{ + return QString::fromNSString( + [NSSearchPathForDirectoriesInDomains(directory, NSUserDomainMask, YES) lastObject]); +} + +static QString bundlePath() +{ + return QString::fromNSString([[NSBundle mainBundle] bundlePath]); +} + +QString QStandardPaths::writableLocation(StandardLocation type) +{ + QString location; + + switch (type) { + case DesktopLocation: + location = pathForDirectory(NSDesktopDirectory); + break; + case DocumentsLocation: + location = pathForDirectory(NSDocumentDirectory); + break; + case FontsLocation: + location = bundlePath() + QLatin1String("/.fonts"); + break; + case ApplicationsLocation: + location = pathForDirectory(NSApplicationDirectory); + break; + case MusicLocation: + location = pathForDirectory(NSMusicDirectory); + break; + case MoviesLocation: + location = pathForDirectory(NSMoviesDirectory); + break; + case PicturesLocation: + location = pathForDirectory(NSPicturesDirectory); + break; + case TempLocation: + location = QString::fromNSString(NSTemporaryDirectory()); + break; + case HomeLocation: + location = bundlePath(); + break; + case DataLocation: + case GenericDataLocation: + location = pathForDirectory(NSDocumentDirectory); + break; + case CacheLocation: + case GenericCacheLocation: + location = pathForDirectory(NSCachesDirectory); + break; + case ConfigLocation: + location = pathForDirectory(NSDocumentDirectory); + break; + case DownloadLocation: + location = pathForDirectory(NSDownloadsDirectory); + break; + default: + break; + } + + switch (type) { + case RuntimeLocation: + break; + default: + // All other types must return something, so use the document directory + // as a reasonable fall-back (which will always exist). + if (location.isEmpty()) + location = pathForDirectory(NSDocumentDirectory); + break; + } + + return location; +} + +QStringList QStandardPaths::standardLocations(StandardLocation type) +{ + QStringList dirs; + const QString localDir = writableLocation(type); + dirs.prepend(localDir); + return dirs; +} + +QT_END_NAMESPACE + +#endif // QT_NO_STANDARDPATHS -- cgit v1.2.3 From fe220f3b5b6dcc5b98ce35684e9408c0fc669ddd Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 29 Oct 2013 22:04:19 +0100 Subject: Don't use NO_DEFAULT_PATH on mac when finding GL headers and libraries. The paths may be relative to a sysroot or osx SDK. The existing logic assumed that we always get fully resolved absolute paths from qmake. However, qmake populates and uses the -isysroot option separately. Task-number: QTBUG-32308 Change-Id: Ia23600cdc047d0844bfec32dd4feae3a2b5c95c0 Reviewed-by: James Turner Reviewed-by: Stephen Kelly --- src/gui/Qt5GuiConfigExtras.cmake.in | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in index f2f75d0ea0..b79845b07c 100644 --- a/src/gui/Qt5GuiConfigExtras.cmake.in +++ b/src/gui/Qt5GuiConfigExtras.cmake.in @@ -57,7 +57,10 @@ set(Qt5Gui_OPENGL_LIBRARIES Qt5::Gui_GLESv2) set(_GL_INCDIRS $$CMAKE_GL_INCDIRS) find_path(_qt5gui_OPENGL_INCLUDE_DIR $$CMAKE_GL_HEADER_NAME PATHS ${_GL_INCDIRS} - NO_DEFAULT_PATH) +!!IF !mac + NO_DEFAULT_PATH +!!ENDIF +) if (NOT _qt5gui_OPENGL_INCLUDE_DIR) message(FATAL_ERROR \"Failed to find \\\"$$CMAKE_GL_HEADER_NAME\\\" in \\\"${_GL_INCDIRS}\\\".\") endif() @@ -80,7 +83,10 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs) if (NOT TARGET Qt5::Gui_${_cmake_lib_name}) find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY ${_lib} !!IF !isEmpty(CROSS_COMPILE) - PATHS \"${LibDir}\" NO_DEFAULT_PATH + PATHS \"${LibDir}\" +!!IF !mac + NO_DEFAULT_PATH +!!ENDIF !!ENDIF ) !!IF mac @@ -106,7 +112,11 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs) unset(Qt5Gui_${_cmake_lib_name}_LIBRARY CACHE) find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG ${_lib}d - PATHS \"${LibDir}\" NO_DEFAULT_PATH) + PATHS \"${LibDir}\" +!!IF !mac + NO_DEFAULT_PATH +!!ENDIF + ) if (Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG) set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) _qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\") -- cgit v1.2.3 From e00a961732ad028a1ead1eae1d8aecf1492d3008 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 30 Oct 2013 15:18:25 +0100 Subject: Clean up QPlatformPrinterSupport via post routine. Change-Id: I5aff587f0186f15c9fa65d236e5ebe9a7901dd86 Reviewed-by: Lars Knoll --- src/printsupport/kernel/qplatformprintplugin.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/printsupport/kernel/qplatformprintplugin.cpp b/src/printsupport/kernel/qplatformprintplugin.cpp index ce6d7a0f7e..e38b481a0e 100644 --- a/src/printsupport/kernel/qplatformprintplugin.cpp +++ b/src/printsupport/kernel/qplatformprintplugin.cpp @@ -40,7 +40,10 @@ ****************************************************************************/ #include "qplatformprintplugin.h" +#include "qplatformprintersupport.h" +#include "qprinterinfo.h" #include "private/qfactoryloader_p.h" +#include QT_BEGIN_NAMESPACE @@ -58,6 +61,14 @@ QPlatformPrinterSupportPlugin::~QPlatformPrinterSupportPlugin() { } +static QPlatformPrinterSupport *printerSupport = 0; + +static void cleanupPrinterSupport() +{ + delete printerSupport; + printerSupport = 0; +} + /*! \internal @@ -68,13 +79,14 @@ QPlatformPrinterSupportPlugin::~QPlatformPrinterSupportPlugin() */ QPlatformPrinterSupport *QPlatformPrinterSupportPlugin::get() { - static QPlatformPrinterSupport *singleton = 0; - if (!singleton) { + if (!printerSupport) { const QMultiMap keyMap = loader()->keyMap(); if (!keyMap.isEmpty()) - singleton = qLoadPlugin(loader(), keyMap.constBegin().value()); + printerSupport = qLoadPlugin(loader(), keyMap.constBegin().value()); + if (printerSupport) + qAddPostRoutine(cleanupPrinterSupport); } - return singleton; + return printerSupport; } QT_END_NAMESPACE -- cgit v1.2.3 From a316bdadc0200cf1a0e60562364f84c0f49d1488 Mon Sep 17 00:00:00 2001 From: Kari P Date: Thu, 24 Oct 2013 08:56:30 +0300 Subject: Mac: Modify Qt::SizeAllCursor to look like arrows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Mac, Qt::SizeAllCursor showed a spreadsheet cell selection cursor. It has been changed to look like it looks in the Qt Documentation. Task-number: QTBUG-27577 Change-Id: I2d50ab0d813137366b56cb30b8784ecf70392d4e Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/images/sizeallcursor.png | Bin 0 -> 703 bytes src/plugins/platforms/cocoa/qcocoacursor.mm | 4 ++-- src/plugins/platforms/cocoa/qcocoaresources.qrc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 src/plugins/platforms/cocoa/images/sizeallcursor.png (limited to 'src') diff --git a/src/plugins/platforms/cocoa/images/sizeallcursor.png b/src/plugins/platforms/cocoa/images/sizeallcursor.png new file mode 100644 index 0000000000..bb5381ba32 Binary files /dev/null and b/src/plugins/platforms/cocoa/images/sizeallcursor.png differ diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm index e5b41e7a88..d734c36d6f 100644 --- a/src/plugins/platforms/cocoa/qcocoacursor.mm +++ b/src/plugins/platforms/cocoa/qcocoacursor.mm @@ -218,8 +218,8 @@ NSCursor *QCocoaCursor::createCursorData(QCursor *cursor) return createCursorFromPixmap(pixmap, hotspot); break; } case Qt::SizeAllCursor: { - QPixmap pixmap = QPixmap(QLatin1String(":/qt-project.org/mac/cursors/images/pluscursor.png")); - return createCursorFromPixmap(pixmap, hotspot); + QPixmap pixmap = QPixmap(QLatin1String(":/qt-project.org/mac/cursors/images/sizeallcursor.png")); + return createCursorFromPixmap(pixmap, QPoint(8, 8)); break; } case Qt::BusyCursor: { QPixmap pixmap = QPixmap(QLatin1String(":/qt-project.org/mac/cursors/images/waitcursor.png")); diff --git a/src/plugins/platforms/cocoa/qcocoaresources.qrc b/src/plugins/platforms/cocoa/qcocoaresources.qrc index 392300bb03..9e0640db7d 100644 --- a/src/plugins/platforms/cocoa/qcocoaresources.qrc +++ b/src/plugins/platforms/cocoa/qcocoaresources.qrc @@ -4,7 +4,7 @@ images/forbiddencursor.png images/spincursor.png images/waitcursor.png -images/pluscursor.png +images/sizeallcursor.png images/leopard-unified-toolbar-on.png -- cgit v1.2.3 From 22aea3f42b17a3675f95f39c6d9d33f4075f8f8e Mon Sep 17 00:00:00 2001 From: Laszlo Papp Date: Thu, 31 Oct 2013 04:31:05 +0000 Subject: Include unistd.h in the unix implementation source of QLockFile This is necessary to avoid hidden dependencies for int gethostname(char *name, size_t namelen); This was revelead while backporting the class to Qt 4 for QtSerialPort. Change-Id: I1c477d295eeae90b3136fc6aae5d45982d5b1d73 Reviewed-by: Thiago Macieira --- src/corelib/io/qlockfile_unix.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index d1dbb51e76..d1ef9c1770 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -54,6 +54,7 @@ #include // flock #include // kill #include // kill +#include // gethostname QT_BEGIN_NAMESPACE -- cgit v1.2.3 From e8f2c4d2cd5432e0570f70a6f9379f2eaa43170c Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 23 Oct 2013 13:36:15 +0200 Subject: QFileDialog: document the consequences of being "widgetless" After 37ca2224eca671200a2710f57f970d2993e62aa5 it's an exposed behavior change that the widgets and related paraphernalia don't exist. Task-number: QTBUG-34100 Change-Id: Ie0ebcb8c5c5668b6c12c5447f25bfbfd893dec6c Reviewed-by: Jerome Pasion --- src/widgets/dialogs/qfiledialog.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 383e3ab3f4..22d467661e 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -184,6 +184,13 @@ Q_WIDGETS_EXPORT _qt_filedialog_save_file_url_hook qt_filedialog_save_file_url_h The \l{dialogs/standarddialogs}{Standard Dialogs} example shows how to use QFileDialog as well as other built-in Qt dialogs. + By default, a platform-native file dialog will be used if the platform has + one. In that case, the widgets which would otherwise be used to construct the + dialog will not be instantiated, so related accessors such as layout() and + itemDelegate() will return null. You can set the \l DontUseNativeDialog option to + ensure that the widget-based implementation will be used instead of the + native dialog. + \sa QDir, QFileInfo, QFile, QColorDialog, QFontDialog, {Standard Dialogs Example}, {Application Example} */ @@ -243,7 +250,8 @@ Q_WIDGETS_EXPORT _qt_filedialog_save_file_url_hook qt_filedialog_save_file_url_h \value DontUseNativeDialog Don't use the native file dialog. By default, the native file dialog is used unless you use a subclass - of QFileDialog that contains the Q_OBJECT macro. + of QFileDialog that contains the Q_OBJECT macro, or the platform + does not have a native dialog of the type that you require. \value ReadOnly Indicates that the model is readonly. -- cgit v1.2.3 From 65b12fbdb13d34c61bcadd5cc8fd6ee28a8dfafd Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Wed, 30 Oct 2013 17:53:40 +0100 Subject: Store the font's scalability in QFontEngine. This is an enabler to fallback to native font rendering when using a bitmap font in Qt Quick. Task-number: QTBUG-32737 Change-Id: I6d841dd5ef54d78a00f7fab9d80e9c95ff7f7b98 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontdatabase_qpa.cpp | 1 + src/gui/text/qfontengine.cpp | 3 ++- src/gui/text/qfontengine_p.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index 6c0be950dc..fddbb11122 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -184,6 +184,7 @@ QFontEngine *loadSingleEngine(int script, if (!engine) { engine = pfdb->fontEngine(def, QChar::Script(script), size->handle); if (engine) { + engine->smoothScalable = style->smoothScalable; QFontCache::Key key(def,script); QFontCache::instance()->instance()->insertEngine(key,engine); } diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 303c85ce75..7d1afbbfb6 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -208,7 +208,8 @@ Q_AUTOTEST_EXPORT QList QFontEngine_stopCollectingEngines() QFontEngine::QFontEngine() : ref(0), font_(0), font_destroy_func(0), - face_(0), face_destroy_func(0) + face_(0), face_destroy_func(0), + smoothScalable(false) { cache_cost = 0; fsType = 0; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index c181d61d73..07be498764 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -302,6 +302,8 @@ public: inline QVariant userData() const { return m_userData; } + bool smoothScalable; + protected: QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false); -- cgit v1.2.3 From c1e9c0bb0b1eb5438be07b21194ac03ee6c8636f Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 30 Oct 2013 15:57:33 +0100 Subject: Assert in QImage conversion from rgba8888pm -> rgba8888 Fix typo in assert. Change-Id: I7dc056957b31a869eabe2e45feb99ae4fccb2d97 Reviewed-by: Gunnar Sletta --- src/gui/image/qimage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 234742e6b9..69ff27dc73 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2324,7 +2324,7 @@ static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFl static void convert_ARGB_PM_to_ARGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) { Q_ASSERT(src->format == QImage::Format_ARGB32_Premultiplied || src->format == QImage::Format_RGBA8888_Premultiplied); - Q_ASSERT(dest->format == QImage::Format_ARGB32 || src->format == QImage::Format_RGBA8888); + Q_ASSERT(dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_RGBA8888); Q_ASSERT(src->width == dest->width); Q_ASSERT(src->height == dest->height); -- cgit v1.2.3 From f4d85c6548750fdd5e10602af50f085b53eaf24c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 31 Oct 2013 12:23:48 +0100 Subject: Remove compiler warning when QT_NO_PRINTER is defined This broke the build on Android with warnings-are-errors. Change-Id: I9edb9539c4a6f7286ff46cbaa53bcfef4cf5280f Reviewed-by: Friedemann Kleint --- src/printsupport/kernel/qplatformprintplugin.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/printsupport/kernel/qplatformprintplugin.cpp b/src/printsupport/kernel/qplatformprintplugin.cpp index e38b481a0e..f3e88e7cf7 100644 --- a/src/printsupport/kernel/qplatformprintplugin.cpp +++ b/src/printsupport/kernel/qplatformprintplugin.cpp @@ -65,7 +65,9 @@ static QPlatformPrinterSupport *printerSupport = 0; static void cleanupPrinterSupport() { +#ifndef QT_NO_PRINTER delete printerSupport; +#endif printerSupport = 0; } -- cgit v1.2.3 From 04de24c6449422d29a0d4760375aa94f59222fa3 Mon Sep 17 00:00:00 2001 From: Chengyong Xie Date: Fri, 13 Sep 2013 16:25:22 +0800 Subject: Fix setVisible() of QWidget has no effect in QTreeWidgetItem Check if the item is hidden before show the item(QWidget) Task-number: QTBUG-13522 Change-Id: I1c605d5cb8a80f340e9b7601612d3760f51cb4a7 Reviewed-by: Liang Qi Reviewed-by: Stephen Kelly Reviewed-by: David Faure --- src/widgets/itemviews/qabstractitemview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index fd704e479b..ef7207229c 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -2637,7 +2637,8 @@ void QAbstractItemView::updateEditorGeometries() if (index.isValid() && editor) { option.rect = visualRect(index); if (option.rect.isValid()) { - editor->show(); + if (!editor->isHidden()) + editor->show(); QAbstractItemDelegate *delegate = d->delegateForIndex(index); if (delegate) delegate->updateEditorGeometry(editor, option, index); -- cgit v1.2.3 From 418e06f78f8b6cbc33b42f9b300c9c46c1ea2a32 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Tue, 8 Oct 2013 22:41:20 +0200 Subject: Don't cache QCoreApplication::appName. This isn't a hot codepath, there is no gain to doing this. It introduces unnecessary bloat (see e.g. https://www.webkit.org/blog/2826/unusual-speed-boost-size-matters/) and complicates boosting Qt application startup in cases where argv[0] is overwritten. Change-Id: I55b2b98b0de6b06fe7a049de262f3e19936b73db Reviewed-by: Thiago Macieira --- src/corelib/kernel/qcoreapplication.cpp | 14 +++++--------- src/corelib/kernel/qcoreapplication_p.h | 1 - 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 0460c52d1c..1ae4da12e8 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -147,17 +147,13 @@ QString QCoreApplicationPrivate::macMenuBarName() #endif QString QCoreApplicationPrivate::appName() const { - static QBasicMutex applicationNameMutex; - QMutexLocker locker(&applicationNameMutex); - - if (applicationName.isNull()) { + QString applicationName; #ifdef Q_OS_MAC - applicationName = macMenuBarName(); + applicationName = macMenuBarName(); #endif - if (applicationName.isEmpty() && argv[0]) { - char *p = strrchr(argv[0], '/'); - applicationName = QString::fromLocal8Bit(p ? p + 1 : argv[0]); - } + if (applicationName.isEmpty() && argv[0]) { + char *p = strrchr(argv[0], '/'); + applicationName = QString::fromLocal8Bit(p ? p + 1 : argv[0]); } return applicationName; diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 4b57a7b67d..ad0449f02c 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -83,7 +83,6 @@ public: ~QCoreApplicationPrivate(); QString appName() const; - mutable QString applicationName; #ifdef Q_OS_MAC static QString macMenuBarName(); -- cgit v1.2.3 From e469e667e39d638d3c4649b9793ee3eefe3c5784 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 31 Oct 2013 12:43:38 +0100 Subject: use the right scope "windows" only worked more or less by accident (it's the opposite of "console" and just happens to be the default on windows). Change-Id: Ib60c8ae5aea04f28207c05cc0005183dd6eb6244 Reviewed-by: Joerg Bornemann Reviewed-by: Thiago Macieira --- src/network/ssl/ssl.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri index 0fe231357b..afb1df5aa4 100644 --- a/src/network/ssl/ssl.pri +++ b/src/network/ssl/ssl.pri @@ -45,5 +45,5 @@ android:!android-no-sdk: SOURCES += ssl/qsslsocket_openssl_android.cpp QMAKE_CXXFLAGS += $$OPENSSL_CFLAGS LIBS_PRIVATE += $$OPENSSL_LIBS - windows:LIBS += -lcrypt32 + win32: LIBS += -lcrypt32 } -- cgit v1.2.3 From 43684a20d044de6d4daac750809750777b68c9e5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 31 Oct 2013 13:34:10 +0100 Subject: use private linkage where possible Change-Id: Ie8eaa71bee87654c21218a23efd7e9d65b71f022 Reviewed-by: Joerg Bornemann Reviewed-by: Thiago Macieira --- src/angle/src/common/common.pri | 4 ++-- src/angle/src/libEGL/libEGL.pro | 6 +++--- src/angle/src/libGLESv2/libGLESv2.pro | 8 ++++---- src/concurrent/concurrent.pro | 2 +- src/corelib/corelib.pro | 2 +- src/network/kernel/kernel.pri | 2 +- src/network/socket/socket.pri | 2 +- src/network/ssl/ssl.pri | 2 +- src/platformsupport/input/evdevtouch/evdevtouch.pri | 2 +- src/printsupport/dialogs/dialogs.pri | 2 +- src/printsupport/kernel/kernel.pri | 2 +- src/widgets/kernel/win.pri | 2 +- 12 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/angle/src/common/common.pri b/src/angle/src/common/common.pri index e5b01d5051..514c80dbd1 100644 --- a/src/angle/src/common/common.pri +++ b/src/angle/src/common/common.pri @@ -4,7 +4,7 @@ INCLUDEPATH += \ $$ANGLE_DIR/src \ $$ANGLE_DIR/include -LIBS = $$QMAKE_LIBS_CORE $$QMAKE_LIBS_GUI +LIBS_PRIVATE = $$QMAKE_LIBS_CORE $$QMAKE_LIBS_GUI # DirectX is included in the Windows 8 Kit, but everything else requires the DX SDK. win32-msvc2012|win32-msvc2013 { @@ -36,7 +36,7 @@ win32-msvc2012|win32-msvc2013 { # Similarly we want the MinGW linker to use the import libraries shipped with the compiler # instead of those from the SDK which cause a crash on startup. - LIBS += -L\"$$DXLIB_DIR\" + LIBS_PRIVATE += -L\"$$DXLIB_DIR\" } } diff --git a/src/angle/src/libEGL/libEGL.pro b/src/angle/src/libEGL/libEGL.pro index 3781bd7868..b5854189f9 100644 --- a/src/angle/src/libEGL/libEGL.pro +++ b/src/angle/src/libEGL/libEGL.pro @@ -4,11 +4,11 @@ TARGET = $$qtLibraryTarget(libEGL) include(../common/common.pri) angle_d3d11 { - LIBS += -ld3d11 + LIBS_PRIVATE += -ld3d11 } else { - LIBS += -ld3d9 + LIBS_PRIVATE += -ld3d9 } -LIBS += -ldxguid -L$$QT_BUILD_TREE/lib -l$$qtLibraryTarget(libGLESv2) +LIBS_PRIVATE += -ldxguid -L$$QT_BUILD_TREE/lib -l$$qtLibraryTarget(libGLESv2) HEADERS += \ $$ANGLE_DIR/src/libEGL/Config.h \ diff --git a/src/angle/src/libGLESv2/libGLESv2.pro b/src/angle/src/libGLESv2/libGLESv2.pro index ff2f888b1d..5d54c0f86a 100644 --- a/src/angle/src/libGLESv2/libGLESv2.pro +++ b/src/angle/src/libGLESv2/libGLESv2.pro @@ -8,18 +8,18 @@ INCLUDEPATH += $$OUT_PWD/.. $$ANGLE_DIR/src/libGLESv2 # Remember to adapt tools/configure/configureapp.cpp if the Direct X version changes. angle_d3d11 { - LIBS += -ldxgi -ld3d11 + LIBS_PRIVATE += -ldxgi -ld3d11 } else { - LIBS += -ld3d9 + LIBS_PRIVATE += -ld3d9 } -LIBS += -ldxguid +LIBS_PRIVATE += -ldxguid STATICLIBS = translator_common translator_hlsl preprocessor for(libname, STATICLIBS) { # Appends 'd' to the library for debug builds and builds up the fully # qualified path to pass to the linker. staticlib = $$QT_BUILD_TREE/lib/$${QMAKE_PREFIX_STATICLIB}$$qtLibraryTarget($$libname).$${QMAKE_EXTENSION_STATICLIB} - LIBS += $$staticlib + LIBS_PRIVATE += $$staticlib PRE_TARGETDEPS += $$staticlib } diff --git a/src/concurrent/concurrent.pro b/src/concurrent/concurrent.pro index 53b6bd0472..2b8fef2d6a 100644 --- a/src/concurrent/concurrent.pro +++ b/src/concurrent/concurrent.pro @@ -39,5 +39,5 @@ HEADERS += \ HEADERS += \ contains(QT_CONFIG, clock-gettime) { - linux-*|hpux-*|solaris-*:LIBS *= -lrt + linux-*|hpux-*|solaris-*: LIBS_PRIVATE *= -lrt } diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index bc618ed843..2e4181efb1 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -48,7 +48,7 @@ mac|darwin { LIBS_PRIVATE += -framework CoreServices } LIBS_PRIVATE += -framework CoreFoundation - LIBS += -framework Foundation + LIBS_PRIVATE += -framework Foundation } win32:DEFINES-=QT_NO_CAST_TO_ASCII DEFINES += $$MODULE_DEFINES diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri index a4a19988b3..97f52fdb6e 100644 --- a/src/network/kernel/kernel.pri +++ b/src/network/kernel/kernel.pri @@ -35,7 +35,7 @@ android { win32: { HEADERS += kernel/qnetworkinterface_win_p.h SOURCES += kernel/qdnslookup_win.cpp kernel/qhostinfo_win.cpp kernel/qnetworkinterface_win.cpp - LIBS += -ldnsapi + LIBS_PRIVATE += -ldnsapi } integrity:SOURCES += kernel/qdnslookup_unix.cpp kernel/qhostinfo_unix.cpp kernel/qnetworkinterface_unix.cpp diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri index 0204a92999..c0c6d750d9 100644 --- a/src/network/socket/socket.pri +++ b/src/network/socket/socket.pri @@ -40,7 +40,7 @@ win32:SOURCES += socket/qnativesocketengine_win.cpp \ socket/qlocalsocket_win.cpp \ socket/qlocalserver_win.cpp -win32:!wince*:LIBS += -ladvapi32 +win32:!wince*: LIBS_PRIVATE += -ladvapi32 wince*: { SOURCES -= socket/qlocalsocket_win.cpp \ diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri index afb1df5aa4..eb8268515e 100644 --- a/src/network/ssl/ssl.pri +++ b/src/network/ssl/ssl.pri @@ -45,5 +45,5 @@ android:!android-no-sdk: SOURCES += ssl/qsslsocket_openssl_android.cpp QMAKE_CXXFLAGS += $$OPENSSL_CFLAGS LIBS_PRIVATE += $$OPENSSL_LIBS - win32: LIBS += -lcrypt32 + win32: LIBS_PRIVATE += -lcrypt32 } diff --git a/src/platformsupport/input/evdevtouch/evdevtouch.pri b/src/platformsupport/input/evdevtouch/evdevtouch.pri index a6b90937f2..16e1a981fa 100644 --- a/src/platformsupport/input/evdevtouch/evdevtouch.pri +++ b/src/platformsupport/input/evdevtouch/evdevtouch.pri @@ -10,4 +10,4 @@ contains(QT_CONFIG, libudev) { # DEFINES += USE_MTDEV -contains(DEFINES, USE_MTDEV): LIBS += -lmtdev +contains(DEFINES, USE_MTDEV): LIBS_PRIVATE += -lmtdev diff --git a/src/printsupport/dialogs/dialogs.pri b/src/printsupport/dialogs/dialogs.pri index 9659046f60..bb07167f68 100644 --- a/src/printsupport/dialogs/dialogs.pri +++ b/src/printsupport/dialogs/dialogs.pri @@ -11,7 +11,7 @@ HEADERS += \ mac:!ios { OBJECTIVE_SOURCES += dialogs/qpagesetupdialog_mac.mm \ dialogs/qprintdialog_mac.mm - LIBS += -framework Cocoa + LIBS_PRIVATE += -framework Cocoa } win32 { diff --git a/src/printsupport/kernel/kernel.pri b/src/printsupport/kernel/kernel.pri index 8bdccd0f5b..67fcc8597c 100644 --- a/src/printsupport/kernel/kernel.pri +++ b/src/printsupport/kernel/kernel.pri @@ -24,7 +24,7 @@ win32 { $$PWD/qprintengine_win_p.h SOURCES += \ $$PWD/qprintengine_win.cpp - LIBS += -lwinspool -lcomdlg32 -lgdi32 -luser32 + LIBS_PRIVATE += -lwinspool -lcomdlg32 -lgdi32 -luser32 } unix:!mac:contains(QT_CONFIG, cups): { diff --git a/src/widgets/kernel/win.pri b/src/widgets/kernel/win.pri index dd47664c28..d5cba740d1 100644 --- a/src/widgets/kernel/win.pri +++ b/src/widgets/kernel/win.pri @@ -3,5 +3,5 @@ INCLUDEPATH += ../3rdparty/wintab !wince* { - LIBS *= -lshell32 + LIBS_PRIVATE *= -lshell32 } -- cgit v1.2.3 From e7db02e79eec24015fcc4c2d2bc56c8c40c50e42 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 31 Oct 2013 15:41:26 +0200 Subject: Remove android specific qmake variables. Change-Id: Iba2b929ba70588ffcbcc9395501753521cfe5154 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/android/java/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/android/java/AndroidManifest.xml b/src/android/java/AndroidManifest.xml index 6463793e0b..da34e4efac 100644 --- a/src/android/java/AndroidManifest.xml +++ b/src/android/java/AndroidManifest.xml @@ -34,7 +34,7 @@ - + -- cgit v1.2.3 From 1da1259c281f2098ae11d928f1664cf00d379076 Mon Sep 17 00:00:00 2001 From: John Layt Date: Thu, 26 Sep 2013 16:51:48 +0200 Subject: QDateTime - Optimize date() and time() methods Optimize the performance of date() and time(), resulting in a one-third improvement, and subsequent improvements in all date/time based functions. Tested over 1000 iterations of the standard benchmarks, in msecs per iteration: Before After date()/time() 0.3 0.2 setDate()/setTime() 0.9 0.8 daysTo() 0.6 0.4 Note original performance before msecs storage was 0.06. Change-Id: Ie838e560ddf7129281531dc965af56ac19cce91d Reviewed-by: Mitch Curtis Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 5ce11a43aa..935fd65ae1 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2682,10 +2682,10 @@ void QDateTimePrivate::getDateTime(QDate *date, QTime *time) const { msecsToTime(m_msecs, date, time); - if (isNullDate()) + if (date && isNullDate()) *date = QDate(); - if (isNullTime()) + if (time && isNullTime()) *time = QTime(); } @@ -3094,9 +3094,10 @@ bool QDateTime::isValid() const QDate QDateTime::date() const { + if (d->isNullDate()) + return QDate(); QDate dt; - QTime tm; - d->getDateTime(&dt, &tm); + msecsToTime(d->m_msecs, &dt, 0); return dt; } @@ -3108,9 +3109,10 @@ QDate QDateTime::date() const QTime QDateTime::time() const { - QDate dt; + if (d->isNullTime()) + return QTime(); QTime tm; - d->getDateTime(&dt, &tm); + msecsToTime(d->m_msecs, 0, &tm); return tm; } -- cgit v1.2.3 From 24733dea6c5c5500d3c01fcfa46c2b05d7557b47 Mon Sep 17 00:00:00 2001 From: John Layt Date: Sat, 28 Sep 2013 16:46:19 +0200 Subject: QDateTime - Optimize refreshDateTime() A small optimization to the private refreshDateTime() function, improves standard performance tests by 0.3 msecs per iteration for affected functions, e.g. isValid() and offsetFromUtc() improve from 5.4 to 5.1. Change-Id: Ie67812649ef244388b484af35848b09d92dee38a Reviewed-by: Mitch Curtis Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 935fd65ae1..42721c018f 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2765,9 +2765,6 @@ void QDateTimePrivate::refreshDateTime() } // We have a valid date and time and a Qt::LocalTime or Qt::TimeZone that needs calculating - QDate date; - QTime time; - getDateTime(&date, &time); // LocalTime and TimeZone might fall into "missing" DaylightTime transition hour // Calling toEpochMSecs will adjust the returned date/time if it does QDate testDate; @@ -2781,7 +2778,7 @@ void QDateTimePrivate::refreshDateTime() epochMSecs = zoneMSecsToEpochMSecs(m_msecs, m_timeZone, &testDate, &testTime); #endif // QT_BOOTSTRAPPED } - if (testDate == date && testTime == time) { + if (timeToMSecs(testDate, testTime) == m_msecs) { setValidDateTime(); // Cache the offset to use in toMSecsSinceEpoch() m_offsetFromUtc = (m_msecs - epochMSecs) / 1000; -- cgit v1.2.3 From e696bef863ba4cc21a36cbfdc0d6e811060916f7 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 31 Oct 2013 08:19:52 +0100 Subject: Fix compilation with QT_COORD_TYPE=double on ARM Add a missing template specialization in the neon drawhelper. Task-number: QTBUG-33781 Change-Id: Iec02a93aee9403dc1275c32436db5527585b1088 Reviewed-by: Paul Olav Tvete Reviewed-by: Oswald Buddenhagen --- src/gui/painting/qdrawhelper_neon.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index b12fd71563..541b3ef619 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -964,6 +964,7 @@ public: union Vect_buffer_i { Int32x4 v; int i[4]; }; union Vect_buffer_f { Float32x4 v; float f[4]; }; + static inline Float32x4 v_dup(double x) { return vdupq_n_f32(float(x)); } static inline Float32x4 v_dup(float x) { return vdupq_n_f32(x); } static inline Int32x4 v_dup(int x) { return vdupq_n_s32(x); } static inline Int32x4 v_dup(uint x) { return vdupq_n_s32(x); } -- cgit v1.2.3 From d8bf317546bcfab0b6b50375218429fa9d470705 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 1 Oct 2013 12:34:20 +0200 Subject: make qreal double by default on all platforms On modern ARM CPUs there is no speed difference between float and double anymore, so let's rather use double for qreal to avoid rounding and precision issues. Like this we also get much better compatibility with our desktop OSes. This is not binary compatible on ARM, but the old behavior can be restored by passing -qreal float to configure. Change-Id: I2a4b61e19a3dfa6b0bd76734cecf2634c97207fc Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 0fd9bab979..5bb675728a 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -213,11 +213,8 @@ typedef unsigned int uint; typedef unsigned long ulong; QT_END_INCLUDE_NAMESPACE -// This logic must match the one in qmetatype.h #if defined(QT_COORD_TYPE) typedef QT_COORD_TYPE qreal; -#elif defined(QT_NO_FPU) || defined(Q_PROCESSOR_ARM) || defined(Q_OS_WINCE) -typedef float qreal; #else typedef double qreal; #endif -- cgit v1.2.3 From cfa85c76c7c7e1622cb02edcbbc3d948edca1e7f Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 29 Oct 2013 23:10:15 +0100 Subject: QWindowPrivate: add virtual function 'clearFocusObject' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On mobile platforms, a line edit should only have keyboard focus when the virtual keyboard is open. As it stands, the only way to clear focus when the user hides the keyboard, is to deactivate the whole window. This is a bit too much, since Qt still expects the window in front to be active/focused. What we need is a way to remove focus from the current focus object without disturbing the state of the window. QWindow has a virtual function 'focusObject' from before. We now add a virtual function 'clearFocusObject' to QWindowPrivate that can be overridden by QWidgetWindowPrivate and QQuickWindowPrivate. That way we can remove focus from current focus object when the virtual keyboard is closed from the platform plugins. Change-Id: Ica4ec76f8a69cd6107236a8000ff8bd742e988b5 Reviewed-by: Tor Arne Vestbø Reviewed-by: Friedemann Kleint Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Gunnar Sletta --- src/gui/kernel/qwindow.cpp | 4 ++++ src/gui/kernel/qwindow_p.h | 2 ++ src/widgets/kernel/qwidgetwindow.cpp | 7 +++++++ 3 files changed, 13 insertions(+) (limited to 'src') diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 13218fa178..a3841d3cfb 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -367,6 +367,10 @@ void QWindowPrivate::setScreen(QScreen *newScreen, bool recreate) } } +void QWindowPrivate::clearFocusObject() +{ +} + /*! Sets the \a surfaceType of the window. diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index f43c1ea8ec..8d8fca3ce6 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -129,6 +129,8 @@ public: void setScreen(QScreen *newScreen, bool recreate); + virtual void clearFocusObject(); + QWindow::SurfaceType surfaceType; Qt::WindowFlags windowFlags; QWindow *parentWindow; diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 51a0eb7d72..e977ab3d6f 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -76,6 +76,13 @@ public: } return w; } + + void clearFocusObject() + { + if (QApplicationPrivate::focus_widget) + QApplicationPrivate::focus_widget->clearFocus(); + } + }; QWidgetWindow::QWidgetWindow(QWidget *widget) -- cgit v1.2.3 From eb64c765e3aa37da1373360c557e23aa29a2db48 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 30 Oct 2013 09:36:44 +0100 Subject: iOS: clear focus object when resigning first responder status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of deactivating the window when we resign first responder status, we now leave it focused, and tell it to clear its focus object instead. This will work better with the rest of Qt, which expects a window to have focus when its in front. Change-Id: I6fcc232467af306b791a834f4843bfd2786b206f Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index dbeec5f5f2..74a56b0934 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -48,6 +48,7 @@ #include "qiosviewcontroller.h" #include "qiosintegration.h" #include +#include #include #import @@ -256,7 +257,10 @@ - (BOOL)resignFirstResponder { - QWindowSystemInterface::handleWindowActivated(0); + // Resigning first responed status means that the virtual keyboard was closed, or + // some other view became first responder. In either case we clear the focus object to + // avoid blinking cursors in line edits etc: + static_cast(QObjectPrivate::get(m_qioswindow->window()))->clearFocusObject(); return [super resignFirstResponder]; } -- cgit v1.2.3 From fecc820c582f604babbbaabb86ecd0c1f51c3487 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 28 Oct 2013 12:50:59 +0100 Subject: iOS: bugfix touch events when not using alien MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems that 130ee40b broke touch handling for non-alien QWindows. For those cases, a QWindow that is a child of another QWindow will get its own UIView to back it up. The current code did not take this into account when calculating the global coordinates of touch events. Instead we need to search for the top level QWindow it might be inside before we find the view that acts as the "desktop" for it. Change-Id: Ie3c19bf86c92fa3f247a0764116830e91b8322d2 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.mm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 74a56b0934..5a2a1122ec 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -151,9 +151,16 @@ - (void)updateTouchList:(NSSet *)touches withState:(Qt::TouchPointState)state { - // We deliver touch events with global coordinates. But global in this respect means - // the coordinate system where this QWindow lives. And that is our superview. - CGSize parentSize = self.superview.frame.size; + // We deliver touch events in global coordinates. But global in this respect + // means the same coordinate system that we use for describing the geometry + // of the top level QWindow we're inside. And that would be the coordinate + // system of the superview of the UIView that backs that window: + QPlatformWindow *topLevel = m_qioswindow; + while (QPlatformWindow *topLevelParent = topLevel->parent()) + topLevel = topLevelParent; + UIView *rootView = reinterpret_cast(topLevel->winId()).superview; + CGSize rootViewSize = rootView.frame.size; + foreach (UITouch *uiTouch, m_activeTouches.keys()) { QWindowSystemInterface::TouchPoint &touchPoint = m_activeTouches[uiTouch]; if (![touches containsObject:uiTouch]) { @@ -161,9 +168,9 @@ } else { touchPoint.state = state; touchPoint.pressure = (state == Qt::TouchPointReleased) ? 0.0 : 1.0; - QPoint touchPos = fromCGPoint([uiTouch locationInView:self.superview]); + QPoint touchPos = fromCGPoint([uiTouch locationInView:rootView]); touchPoint.area = QRectF(touchPos, QSize(0, 0)); - touchPoint.normalPosition = QPointF(touchPos.x() / parentSize.width, touchPos.y() / parentSize.height); + touchPoint.normalPosition = QPointF(touchPos.x() / rootViewSize.width, touchPos.y() / rootViewSize.height); } } } -- cgit v1.2.3 From d1114669e301e35cc4e9b2e4c8c4b9476180fb56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 9 Oct 2013 08:43:34 +0200 Subject: Cocoa: Improve cursor setting. Implement cursor setting in terms of [NSCursor set] and [NSView cursorUpdate] using the window tracking area. Refactor cursor conversion into QCocoaCursor:: convertCursor. Rename QCoocaWindow::m_underMouseWindow to m_enterLeaveTargetWindow since it's set according to spesific enter/leave logic. Add m_windowUnderMouse which tracks mouseEntered/mouseExited state. Task-number: QTBUG-33961 Change-Id: Id5e12594f5db365e09c9926a4c08d748a9afb935 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoacursor.h | 5 +- src/plugins/platforms/cocoa/qcocoacursor.mm | 75 ++++++++++++++++------------- src/plugins/platforms/cocoa/qcocoawindow.h | 6 ++- src/plugins/platforms/cocoa/qcocoawindow.mm | 19 ++++++++ src/plugins/platforms/cocoa/qnsview.mm | 27 ++++++++--- 5 files changed, 88 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoacursor.h b/src/plugins/platforms/cocoa/qcocoacursor.h index dfa1fcff81..f332240724 100644 --- a/src/plugins/platforms/cocoa/qcocoacursor.h +++ b/src/plugins/platforms/cocoa/qcocoacursor.h @@ -55,12 +55,13 @@ public: QCocoaCursor(); ~QCocoaCursor(); - virtual void changeCursor(QCursor * widgetCursor, QWindow * widget); + virtual void changeCursor(QCursor *cursor, QWindow *window); virtual QPoint pos() const; virtual void setPos(const QPoint &position); private: QHash m_cursors; - NSCursor *createCursorData(QCursor *); + NSCursor *convertCursor(QCursor *cursor); + NSCursor *createCursorData(QCursor * cursor); NSCursor *createCursorFromBitmap(const QBitmap *bitmap, const QBitmap *mask, const QPoint hotspot = QPoint()); NSCursor *createCursorFromPixmap(const QPixmap pixmap, const QPoint hotspot = QPoint()); }; diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm index d734c36d6f..13f6423701 100644 --- a/src/plugins/platforms/cocoa/qcocoacursor.mm +++ b/src/plugins/platforms/cocoa/qcocoacursor.mm @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qcocoacursor.h" +#include "qcocoawindow.h" #include "qcocoahelpers.h" #include "qcocoaautoreleasepool.h" @@ -63,82 +64,90 @@ QCocoaCursor::~QCocoaCursor() void QCocoaCursor::changeCursor(QCursor *cursor, QWindow *window) { - Q_UNUSED(window); + NSCursor * cocoaCursor = convertCursor(cursor); + if (QPlatformWindow * platformWindow = window->handle()) + static_cast(platformWindow)->setWindowCursor(cocoaCursor); +} + +QPoint QCocoaCursor::pos() const +{ + return qt_mac_flipPoint([NSEvent mouseLocation]).toPoint(); +} + +void QCocoaCursor::setPos(const QPoint &position) +{ + CGPoint pos; + pos.x = position.x(); + pos.y = position.y(); + + CGEventRef e = CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, 0); + CGEventPost(kCGHIDEventTap, e); + CFRelease(e); +} + +NSCursor *QCocoaCursor::convertCursor(QCursor * cursor) +{ const Qt::CursorShape newShape = cursor ? cursor->shape() : Qt::ArrowCursor; + NSCursor *cocoaCursor; + // Check for a suitable built-in NSCursor first: switch (newShape) { case Qt::ArrowCursor: - [[NSCursor arrowCursor] set]; + cocoaCursor= [NSCursor arrowCursor]; break; case Qt::CrossCursor: - [[NSCursor crosshairCursor] set]; + cocoaCursor = [NSCursor crosshairCursor]; break; case Qt::IBeamCursor: - [[NSCursor IBeamCursor] set]; + cocoaCursor = [NSCursor IBeamCursor]; break; case Qt::WhatsThisCursor: //for now just use the pointing hand case Qt::PointingHandCursor: - [[NSCursor pointingHandCursor] set]; + cocoaCursor = [NSCursor pointingHandCursor]; break; case Qt::SplitVCursor: - [[NSCursor resizeUpDownCursor] set]; + cocoaCursor = [NSCursor resizeUpDownCursor]; break; case Qt::SplitHCursor: - [[NSCursor resizeLeftRightCursor] set]; + cocoaCursor = [NSCursor resizeLeftRightCursor]; break; case Qt::OpenHandCursor: - [[NSCursor openHandCursor] set]; + cocoaCursor = [NSCursor openHandCursor]; break; case Qt::ClosedHandCursor: - [[NSCursor closedHandCursor] set]; + cocoaCursor = [NSCursor closedHandCursor]; break; case Qt::DragMoveCursor: - [[NSCursor crosshairCursor] set]; + cocoaCursor = [NSCursor crosshairCursor]; break; case Qt::DragCopyCursor: - [[NSCursor crosshairCursor] set]; + cocoaCursor = [NSCursor crosshairCursor]; break; case Qt::DragLinkCursor: - [[NSCursor dragLinkCursor] set]; + cocoaCursor = [NSCursor dragLinkCursor]; break; default : { // No suitable OS cursor exist, use cursors provided // by Qt for the rest. Check for a cached cursor: - NSCursor *cocoaCursor = m_cursors.value(newShape); + cocoaCursor = m_cursors.value(newShape); if (cocoaCursor && cursor->shape() == Qt::BitmapCursor) { [cocoaCursor release]; cocoaCursor = 0; } if (cocoaCursor == 0) { cocoaCursor = createCursorData(cursor); - if (cocoaCursor == 0) { - [[NSCursor arrowCursor] set]; - return; - } + if (cocoaCursor == 0) + return [NSCursor arrowCursor]; + m_cursors.insert(newShape, cocoaCursor); } - [cocoaCursor set]; break; } } + return cocoaCursor; } -QPoint QCocoaCursor::pos() const -{ - return qt_mac_flipPoint([NSEvent mouseLocation]).toPoint(); -} - -void QCocoaCursor::setPos(const QPoint &position) -{ - CGPoint pos; - pos.x = position.x(); - pos.y = position.y(); - - CGEventRef e = CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, 0); - CGEventPost(kCGHIDEventTap, e); - CFRelease(e); -} // Creates an NSCursor for the given QCursor. NSCursor *QCocoaCursor::createCursorData(QCursor *cursor) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 7f0f07e912..4f5a208f43 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -154,6 +154,8 @@ public: void setMenubar(QCocoaMenuBar *mb); QCocoaMenuBar *menubar() const; + void setWindowCursor(NSCursor *cursor); + void registerTouch(bool enable); qreal devicePixelRatio() const; @@ -190,11 +192,13 @@ public: // for QNSView Qt::WindowState m_synchedWindowState; Qt::WindowModality m_windowModality; QPointer m_activePopupWindow; - QPointer m_underMouseWindow; + QPointer m_enterLeaveTargetWindow; + bool m_windowUnderMouse; bool m_inConstructor; QCocoaGLContext *m_glContext; QCocoaMenuBar *m_menubar; + NSCursor *m_windowCursor; bool m_hasModalSession; bool m_frameStrutEventsEnabled; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 845cc1202f..565594a98a 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -206,9 +206,11 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) , m_nsWindowDelegate(0) , m_synchedWindowState(Qt::WindowActive) , m_windowModality(Qt::NonModal) + , m_windowUnderMouse(false) , m_inConstructor(true) , m_glContext(0) , m_menubar(0) + , m_windowCursor(0) , m_hasModalSession(false) , m_frameStrutEventsEnabled(false) , m_isExposed(false) @@ -1030,6 +1032,23 @@ QCocoaMenuBar *QCocoaWindow::menubar() const return m_menubar; } +void QCocoaWindow::setWindowCursor(NSCursor *cursor) +{ + // This function is called (via QCocoaCursor) by Qt to set + // the cursor for this window. It can be called for a window + // that is not currenly under the mouse pointer (for example + // for a popup window.) Qt expects the set cursor to "stick": + // it should be accociated with the window until a different + // cursor is set. + + // Cocoa has different abstractions. We can set the cursor *now*: + if (m_windowUnderMouse) + [cursor set]; + // or we can set the cursor on mouse enter/leave using tracking + // areas. This is done in QNSView, save the cursor: + m_windowCursor = cursor; +} + void QCocoaWindow::registerTouch(bool enable) { m_registerTouchCount += enable ? 1 : -1; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 8f839384df..71c4de3b69 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -671,7 +671,7 @@ static QTouchDevice *touchDevice = 0; // mouse moves delivered to it (Apple recommends keeping it OFF because there // is a performance hit). So it goes. NSUInteger trackingOptions = NSTrackingMouseEnteredAndExited | NSTrackingActiveInActiveApp - | NSTrackingInVisibleRect | NSTrackingMouseMoved; + | NSTrackingInVisibleRect | NSTrackingMouseMoved | NSTrackingCursorUpdate; NSTrackingArea *ta = [[[NSTrackingArea alloc] initWithRect:[self frame] options:trackingOptions owner:self @@ -680,6 +680,13 @@ static QTouchDevice *touchDevice = 0; [self addTrackingArea:ta]; } +-(void)cursorUpdate:(NSEvent *)theEvent +{ + Q_UNUSED(theEvent) + if (m_platformWindow->m_windowCursor) + [m_platformWindow->m_windowCursor set]; +} + - (void)mouseMoved:(NSEvent *)theEvent { if (m_window->flags() & Qt::WindowTransparentForInput) @@ -696,9 +703,9 @@ static QTouchDevice *touchDevice = 0; // handling mouseEnter and mouseLeave envents, since they are sent // individually to different views. if (m_platformWindow->m_nsWindow && childWindow) { - if (childWindow != m_platformWindow->m_underMouseWindow) { - QWindowSystemInterface::handleEnterLeaveEvent(childWindow, m_platformWindow->m_underMouseWindow, windowPoint, screenPoint); - m_platformWindow->m_underMouseWindow = childWindow; + if (childWindow != m_platformWindow->m_enterLeaveTargetWindow) { + QWindowSystemInterface::handleEnterLeaveEvent(childWindow, m_platformWindow->m_enterLeaveTargetWindow, windowPoint, screenPoint); + m_platformWindow->m_enterLeaveTargetWindow = childWindow; } } @@ -712,6 +719,8 @@ static QTouchDevice *touchDevice = 0; - (void)mouseEntered:(NSEvent *)theEvent { + m_platformWindow->m_windowUnderMouse = true; + if (m_window->flags() & Qt::WindowTransparentForInput) return [super mouseEntered:theEvent]; @@ -722,12 +731,14 @@ static QTouchDevice *touchDevice = 0; QPointF windowPoint; QPointF screenPoint; [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; - m_platformWindow->m_underMouseWindow = m_platformWindow->childWindowAt(windowPoint.toPoint()); - QWindowSystemInterface::handleEnterEvent(m_platformWindow->m_underMouseWindow, windowPoint, screenPoint); + m_platformWindow->m_enterLeaveTargetWindow = m_platformWindow->childWindowAt(windowPoint.toPoint()); + QWindowSystemInterface::handleEnterEvent(m_platformWindow->m_enterLeaveTargetWindow, windowPoint, screenPoint); } - (void)mouseExited:(NSEvent *)theEvent { + m_platformWindow->m_windowUnderMouse = false; + if (m_window->flags() & Qt::WindowTransparentForInput) return [super mouseExited:theEvent]; Q_UNUSED(theEvent); @@ -736,8 +747,8 @@ static QTouchDevice *touchDevice = 0; if (!m_platformWindow->m_nsWindow) return; - QWindowSystemInterface::handleLeaveEvent(m_platformWindow->m_underMouseWindow); - m_platformWindow->m_underMouseWindow = 0; + QWindowSystemInterface::handleLeaveEvent(m_platformWindow->m_enterLeaveTargetWindow); + m_platformWindow->m_enterLeaveTargetWindow = 0; } - (void)rightMouseDown:(NSEvent *)theEvent -- cgit v1.2.3 From b7440536c788b04861591187edd071bf2c2ec137 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 31 Oct 2013 18:00:30 +0200 Subject: Android: Handle virtual keyboard visibility changes. emitInputPanelVisibleChanged when virtual keyboard visibility is changed. Task-number: QTBUG-34347 Change-Id: Iab7374db42ff8ce6f33dcc793b23f84d3c8692d5 Reviewed-by: Paul Olav Tvete --- .../qtproject/qt5/android/QtActivityDelegate.java | 47 ++++++------- .../src/org/qtproject/qt5/android/QtEditText.java | 13 ++-- .../qtproject/qt5/android/QtInputConnection.java | 80 ++++++++++++++++------ .../src/org/qtproject/qt5/android/QtNative.java | 22 ++---- .../platforms/android/src/androidjniinput.cpp | 31 ++++++++- .../platforms/android/src/qandroidinputcontext.cpp | 5 ++ .../platforms/android/src/qandroidinputcontext.h | 1 + 7 files changed, 133 insertions(+), 66 deletions(-) (limited to 'src') diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 1f99440428..82533dc9cb 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -42,13 +42,6 @@ package org.qtproject.qt5.android; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Iterator; - import android.app.Activity; import android.content.Context; import android.content.pm.PackageManager; @@ -68,11 +61,18 @@ import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; +import android.view.Surface; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; -import android.view.Surface; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Iterator; public class QtActivityDelegate { @@ -111,7 +111,7 @@ public class QtActivityDelegate private boolean m_quitApp = true; private Process m_debuggerProcess = null; // debugger process - public boolean m_keyboardIsVisible = false; + private boolean m_keyboardIsVisible = false; public boolean m_backKeyPressedSent = false; @@ -176,6 +176,13 @@ public class QtActivityDelegate private final int ApplicationInactive = 0x2; private final int ApplicationActive = 0x4; + public void setKeyboardVisibility(boolean visibility) + { + if (m_keyboardIsVisible == visibility) + return; + m_keyboardIsVisible = visibility; + QtNative.keyboardVisibilityChanged(m_keyboardIsVisible); + } public void resetSoftwareKeyboard() { if (m_imm == null) @@ -256,27 +263,21 @@ public class QtActivityDelegate m_editText.postDelayed(new Runnable() { @Override public void run() { - m_imm.showSoftInput(m_editText, 0, new ResultReceiver( new Handler()){ + m_imm.showSoftInput(m_editText, 0, new ResultReceiver(new Handler()) { @Override protected void onReceiveResult(int resultCode, Bundle resultData) { switch (resultCode) { case InputMethodManager.RESULT_SHOWN: case InputMethodManager.RESULT_UNCHANGED_SHOWN: - m_keyboardIsVisible = true; + setKeyboardVisibility(true); break; case InputMethodManager.RESULT_HIDDEN: case InputMethodManager.RESULT_UNCHANGED_HIDDEN: - m_keyboardIsVisible = false; + setKeyboardVisibility(false); break; } } - }) ; - m_editText.postDelayed(new Runnable() { - @Override - public void run() { - m_imm.restartInput(m_editText); - } - }, 25); + }); } }, 15); } @@ -291,11 +292,11 @@ public class QtActivityDelegate switch (resultCode) { case InputMethodManager.RESULT_SHOWN: case InputMethodManager.RESULT_UNCHANGED_SHOWN: - m_keyboardIsVisible = true; + setKeyboardVisibility(true); break; case InputMethodManager.RESULT_HIDDEN: case InputMethodManager.RESULT_UNCHANGED_HIDDEN: - m_keyboardIsVisible = false; + setKeyboardVisibility(false); break; } } @@ -612,7 +613,7 @@ public class QtActivityDelegate } m_layout = new QtLayout(m_activity); m_surface = new QtSurface(m_activity, 0); - m_editText = new QtEditText(m_activity); + m_editText = new QtEditText(m_activity, this); m_imm = (InputMethodManager)m_activity.getSystemService(Context.INPUT_METHOD_SERVICE); m_layout.addView(m_surface,0); m_activity.setContentView(m_layout, @@ -770,7 +771,7 @@ public class QtActivityDelegate if (keyCode == KeyEvent.KEYCODE_BACK && !m_backKeyPressedSent) { hideSoftwareKeyboard(); - m_keyboardIsVisible = false; + setKeyboardVisibility(false); return true; } diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java b/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java index b95e0c070c..7e3ebb539a 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java @@ -50,10 +50,10 @@ import android.view.inputmethod.InputConnection; public class QtEditText extends View { - QtInputConnection m_inputConnection; int m_initialCapsMode = 0; int m_imeOptions = 0; int m_inputType = InputType.TYPE_CLASS_TEXT; + QtActivityDelegate m_activityDelegate; public void setImeOptions(int m_imeOptions) { @@ -71,12 +71,16 @@ public class QtEditText extends View this.m_inputType = m_inputType; } - public QtEditText(Context context) + public QtEditText(Context context, QtActivityDelegate activityDelegate) { super(context); setFocusable(true); setFocusableInTouchMode(true); - m_inputConnection = new QtInputConnection(this); + m_activityDelegate = activityDelegate; + } + public QtActivityDelegate getActivityDelegate() + { + return m_activityDelegate; } @Override @@ -86,8 +90,9 @@ public class QtEditText extends View outAttrs.imeOptions = m_imeOptions; outAttrs.initialCapsMode = m_initialCapsMode; outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_EXTRACT_UI; - return m_inputConnection; + return new QtInputConnection(this); } + // // DEBUG CODE // @Override // protected void onDraw(Canvas canvas) { diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java b/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java index f28ea3be83..4b2d50ca1f 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java @@ -43,7 +43,6 @@ package org.qtproject.qt5.android; import android.content.Context; -import android.view.View; import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.ExtractedText; @@ -81,6 +80,22 @@ class QtNativeInputConnection static native boolean paste(); } +class HideKeyboardRunnable implements Runnable { + private QtInputConnection m_connection; + HideKeyboardRunnable(QtInputConnection connection) + { + m_connection = connection; + } + + @Override + public void run() { + if (m_connection.getInputState() == QtInputConnection.InputStates.Hiding) { + QtNative.activityDelegate().setKeyboardVisibility(false); + m_connection.reset(); + } + } +} + public class QtInputConnection extends BaseInputConnection { private static final int ID_SELECT_ALL = android.R.id.selectAll; @@ -91,65 +106,83 @@ public class QtInputConnection extends BaseInputConnection private static final int ID_SWITCH_INPUT_METHOD = android.R.id.switchInputMethod; private static final int ID_ADD_TO_DICTIONARY = android.R.id.addToDictionary; - View m_view; - boolean m_closing; - public QtInputConnection(View targetView) + + enum InputStates { Visible, FinishComposing, Hiding }; + + private QtEditText m_view = null; + private InputStates m_inputState = InputStates.Visible; + + public void reset() + { + m_inputState = InputStates.Visible; + } + + public InputStates getInputState() + { + return m_inputState; + } + + private void setClosing(boolean closing) + { + if (closing && m_inputState == InputStates.Hiding) + return; + + if (closing && m_inputState == InputStates.FinishComposing && m_view.getActivityDelegate().isSoftwareKeyboardVisible()) { + m_view.postDelayed(new HideKeyboardRunnable(this), 100); + m_inputState = InputStates.Hiding; + } else { + if (m_inputState == InputStates.Hiding) + QtNative.activityDelegate().setKeyboardVisibility(true); + m_inputState = closing ? InputStates.FinishComposing : InputStates.Visible; + } + } + + public QtInputConnection(QtEditText targetView) { super(targetView, true); m_view = targetView; - m_closing = false; } @Override public boolean beginBatchEdit() { - m_closing = false; + setClosing(false); return true; } @Override public boolean endBatchEdit() { - m_closing = false; +// setClosing(false); return true; } @Override public boolean commitCompletion(CompletionInfo text) { - m_closing = false; + setClosing(false); return QtNativeInputConnection.commitCompletion(text.getText().toString(), text.getPosition()); } @Override public boolean commitText(CharSequence text, int newCursorPosition) { - m_closing = false; + setClosing(false); return QtNativeInputConnection.commitText(text.toString(), newCursorPosition); } @Override public boolean deleteSurroundingText(int leftLength, int rightLength) { - m_closing = false; + setClosing(false); return QtNativeInputConnection.deleteSurroundingText(leftLength, rightLength); } @Override public boolean finishComposingText() { - if (m_closing) { - m_view.postDelayed(new Runnable() { - @Override - public void run() { - QtNative.activityDelegate().m_keyboardIsVisible=false; - } - }, 100); // it seems finishComposingText comes much faster than onKeyUp event, - // so we must delay hide notification - m_closing = false; - } else { - m_closing = true; - } + // on some/all android devices hide event is not coming, but instead finishComposingText() is called twice + setClosing(true); return QtNativeInputConnection.finishComposingText(); } @@ -231,18 +264,21 @@ public class QtInputConnection extends BaseInputConnection @Override public boolean setComposingText(CharSequence text, int newCursorPosition) { + setClosing(false); return QtNativeInputConnection.setComposingText(text.toString(), newCursorPosition); } @Override public boolean setComposingRegion(int start, int end) { + setClosing(false); return QtNativeInputConnection.setComposingRegion(start, end); } @Override public boolean setSelection(int start, int end) { + setClosing(false); return QtNativeInputConnection.setSelection(start, end); } } diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java index b37f1e87fd..67093a007e 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -418,30 +418,21 @@ public class QtNative private static boolean isSoftwareKeyboardVisible() { - Semaphore semaphore = new Semaphore(1); - Boolean ret = false; - class RunnableRes implements Runnable { - @SuppressWarnings("unused") - Boolean returnValue = null; - Semaphore semaphore = null; - RunnableRes(Boolean ret, Semaphore sem) { - semaphore = sem; - returnValue = ret; - } + final Semaphore semaphore = new Semaphore(0); + final Boolean[] ret = {false}; + runAction(new Runnable() { @Override public void run() { - returnValue = m_activityDelegate.isSoftwareKeyboardVisible(); + ret[0] = m_activityDelegate.isSoftwareKeyboardVisible(); semaphore.release(); } - } - - runAction(new RunnableRes(ret, semaphore)); + }); try { semaphore.acquire(); } catch (Exception e) { e.printStackTrace(); } - return ret; + return ret[0]; } private static void setFullScreen(final boolean fullScreen) @@ -568,6 +559,7 @@ public class QtNative // keyboard methods public static native void keyDown(int key, int unicode, int modifier); public static native void keyUp(int key, int unicode, int modifier); + public static native void keyboardVisibilityChanged(boolean visibility); // keyboard methods // surface methods diff --git a/src/plugins/platforms/android/src/androidjniinput.cpp b/src/plugins/platforms/android/src/androidjniinput.cpp index 30d4e69afe..27d29129f8 100644 --- a/src/plugins/platforms/android/src/androidjniinput.cpp +++ b/src/plugins/platforms/android/src/androidjniinput.cpp @@ -47,6 +47,10 @@ #include #include +#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL +# include +#endif + using namespace QtAndroid; namespace QtAndroidInput @@ -86,6 +90,9 @@ namespace QtAndroidInput width, height, inputHints); +#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL + qDebug() << "@@@ SHOWSOFTWAREKEYBOARD" << left << top << width << height << inputHints; +#endif } void resetSoftwareKeyboard() @@ -95,6 +102,9 @@ namespace QtAndroidInput return; env.jniEnv->CallStaticVoidMethod(applicationClass(), m_resetSoftwareKeyboardMethodID); +#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL + qDebug() << "@@@ RESETSOFTWAREKEYBOARD"; +#endif } void hideSoftwareKeyboard() @@ -104,6 +114,9 @@ namespace QtAndroidInput return; env.jniEnv->CallStaticVoidMethod(applicationClass(), m_hideSoftwareKeyboardMethodID); +#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL + qDebug() << "@@@ HIDESOFTWAREKEYBOARD"; +#endif } bool isSoftwareKeyboardVisible() @@ -112,7 +125,11 @@ namespace QtAndroidInput if (!env.jniEnv) return false; - return env.jniEnv->CallStaticBooleanMethod(applicationClass(), m_isSoftwareKeyboardVisibleMethodID); + bool visibility = env.jniEnv->CallStaticBooleanMethod(applicationClass(), m_isSoftwareKeyboardVisibleMethodID); +#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL + qDebug() << "@@@ ISSOFTWAREKEYBOARDVISIBLE" << visibility; +#endif + return visibility; } @@ -511,6 +528,15 @@ namespace QtAndroidInput false); } + static void keyboardVisibilityChanged(JNIEnv */*env*/, jobject /*thiz*/, jboolean /*visibility*/) + { + QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext(); + if (inputContext) + inputContext->emitInputPanelVisibleChanged(); +#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL + qDebug() << "@@@ KEYBOARDVISIBILITYCHANGED" << inputContext; +#endif + } static JNINativeMethod methods[] = { {"touchBegin","(I)V",(void*)touchBegin}, @@ -521,7 +547,8 @@ namespace QtAndroidInput {"mouseMove", "(III)V", (void *)mouseMove}, {"longPress", "(III)V", (void *)longPress}, {"keyDown", "(III)V", (void *)keyDown}, - {"keyUp", "(III)V", (void *)keyUp} + {"keyUp", "(III)V", (void *)keyUp}, + {"keyboardVisibilityChanged", "(Z)V", (void *)keyboardVisibilityChanged} }; #define GET_AND_CHECK_STATIC_METHOD(VAR, CLASS, METHOD_NAME, METHOD_SIGNATURE) \ diff --git a/src/plugins/platforms/android/src/qandroidinputcontext.cpp b/src/plugins/platforms/android/src/qandroidinputcontext.cpp index 386c8e006a..8556e8ebf1 100644 --- a/src/plugins/platforms/android/src/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/src/qandroidinputcontext.cpp @@ -381,6 +381,11 @@ QAndroidInputContext::~QAndroidInputContext() m_textFieldID = 0; } +QAndroidInputContext *QAndroidInputContext::androidInputContext() +{ + return m_androidInputContext; +} + void QAndroidInputContext::reset() { clear(); diff --git a/src/plugins/platforms/android/src/qandroidinputcontext.h b/src/plugins/platforms/android/src/qandroidinputcontext.h index d19dcc384b..041bd0dc49 100644 --- a/src/plugins/platforms/android/src/qandroidinputcontext.h +++ b/src/plugins/platforms/android/src/qandroidinputcontext.h @@ -80,6 +80,7 @@ public: public: QAndroidInputContext(); ~QAndroidInputContext(); + static QAndroidInputContext * androidInputContext(); bool isValid() const { return true; } void reset(); -- cgit v1.2.3 From c95e1567e9f42239bb83a64c4e5f18c48f3ee022 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 1 Nov 2013 11:01:04 +0200 Subject: Remove unused field. Fix crash on Android 4.4 Change-Id: Ibee584c0154b0b116af58477302e7e8385f0290d Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/src/androidjnimain.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp index abfc2fa19c..8b29a895b1 100644 --- a/src/plugins/platforms/android/src/androidjnimain.cpp +++ b/src/plugins/platforms/android/src/androidjnimain.cpp @@ -111,8 +111,6 @@ static jobject m_surface = NULL; static EGLNativeWindowType m_nativeWindow = 0; static QSemaphore m_waitForWindowSemaphore; static bool m_waitForWindow = false; - -static jfieldID m_surfaceFieldID = 0; #endif @@ -763,11 +761,6 @@ static int registerNatives(JNIEnv *env) GET_AND_CHECK_STATIC_METHOD(m_redrawSurfaceMethodID, m_applicationClass, "redrawSurface", "(IIII)V"); -#ifdef ANDROID_PLUGIN_OPENGL - FIND_AND_CHECK_CLASS("android/view/Surface"); - GET_AND_CHECK_FIELD(m_surfaceFieldID, clazz, "mNativeSurface", "I"); -#endif - jmethodID methodID; GET_AND_CHECK_STATIC_METHOD(methodID, m_applicationClass, "activity", "()Landroid/app/Activity;"); jobject activityObject = env->CallStaticObjectMethod(m_applicationClass, methodID); -- cgit v1.2.3 From 48dcdbe51040c50ada8f709830e66644a31fb82b Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 1 Nov 2013 11:45:21 +0200 Subject: Android: implement a simple cache mechanism for assets dirs. AAssetManager_openDir is a pretty slow operation, so we are caching the most used dir contents. Task-number: QTBUG-34464 Change-Id: If198f7dae0d6961291c992e6eb46839ba5455819 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../src/qandroidassetsfileenginehandler.cpp | 73 ++++++++++++++-------- .../android/src/qandroidassetsfileenginehandler.h | 8 ++- 2 files changed, 54 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.cpp b/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.cpp index f3cb2586cc..95844fc649 100644 --- a/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.cpp +++ b/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.cpp @@ -43,20 +43,32 @@ #include "androidjnimain.h" #include +#include + +typedef QVector FilesList; + +struct AndroidAssetDir +{ + AndroidAssetDir(AAssetDir* ad) + { + const char *fileName; + while ((fileName = AAssetDir_getNextFileName(ad))) + m_items.push_back(QString::fromUtf8(fileName)); + AAssetDir_close(ad); + } + FilesList m_items; +}; class AndroidAbstractFileEngineIterator: public QAbstractFileEngineIterator { public: AndroidAbstractFileEngineIterator(QDir::Filters filters, const QStringList &nameFilters, - AAssetDir *asset, + QSharedPointer asset, const QString &path) : QAbstractFileEngineIterator(filters, nameFilters) { - AAssetDir_rewind(asset); - const char *fileName; - while ((fileName = AAssetDir_getNextFileName(asset))) - m_items << fileName; + m_items = asset->m_items; m_index = -1; m_path = path; } @@ -93,7 +105,7 @@ public: private: QString m_path; - QStringList m_items; + FilesList m_items; int m_index; }; @@ -102,12 +114,11 @@ class AndroidAbstractFileEngine: public QAbstractFileEngine public: explicit AndroidAbstractFileEngine(AAsset *asset, const QString &fileName) { - m_assetDir = 0; m_assetFile = asset; m_fileName = fileName; } - explicit AndroidAbstractFileEngine(AAssetDir *asset, const QString &fileName) + explicit AndroidAbstractFileEngine(QSharedPointer asset, const QString &fileName) { m_assetFile = 0; m_assetDir = asset; @@ -119,8 +130,6 @@ public: ~AndroidAbstractFileEngine() { close(); - if (m_assetDir) - AAssetDir_close(m_assetDir); } virtual bool open(QIODevice::OpenMode openMode) @@ -188,7 +197,7 @@ public: FileFlags flags(ReadOwnerPerm|ReadUserPerm|ReadGroupPerm|ReadOtherPerm|ExistsFlag); if (m_assetFile) flags |= FileType; - if (m_assetDir) + if (!m_assetDir.isNull()) flags |= DirectoryType; return type & flags; @@ -233,19 +242,19 @@ public: virtual Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) { - if (m_assetDir) + if (!m_assetDir.isNull()) return new AndroidAbstractFileEngineIterator(filters, filterNames, m_assetDir, m_fileName); return 0; } private: AAsset *m_assetFile; - AAssetDir *m_assetDir; + QSharedPointer m_assetDir; QString m_fileName; }; -AndroidAssetsFileEngineHandler::AndroidAssetsFileEngineHandler() +AndroidAssetsFileEngineHandler::AndroidAssetsFileEngineHandler():m_assetsCache(std::max(5, qgetenv("QT_ANDROID_MAX_ASSETS_CACHE_SIZE").toInt())) { m_assetManager = QtAndroid::assetManager(); } @@ -264,25 +273,37 @@ QAbstractFileEngine * AndroidAssetsFileEngineHandler::create(const QString &file int prefixSize=8; - m_path.clear(); + QByteArray path; if (!fileName.endsWith(QLatin1Char('/'))) { - m_path = fileName.toUtf8(); + path = fileName.toUtf8(); AAsset *asset = AAssetManager_open(m_assetManager, - m_path.constData() + prefixSize, + path.constData() + prefixSize, AASSET_MODE_BUFFER); if (asset) return new AndroidAbstractFileEngine(asset, fileName); } - if (!m_path.size()) - m_path = fileName.left(fileName.length() - 1).toUtf8(); - - AAssetDir *assetDir = AAssetManager_openDir(m_assetManager, m_path.constData() + prefixSize); - if (assetDir) { - if (AAssetDir_getNextFileName(assetDir)) - return new AndroidAbstractFileEngine(assetDir, fileName); - else - AAssetDir_close(assetDir); + if (!path.size()) + path = fileName.left(fileName.length() - 1).toUtf8(); + + m_assetsCacheMutext.lock(); + QSharedPointer *aad = m_assetsCache.object(path); + m_assetsCacheMutext.unlock(); + if (!aad) { + AAssetDir *assetDir = AAssetManager_openDir(m_assetManager, path.constData() + prefixSize); + if (assetDir) { + if (AAssetDir_getNextFileName(assetDir)) { + aad = new QSharedPointer(new AndroidAssetDir(assetDir)); + m_assetsCacheMutext.lock(); + m_assetsCache.insert(path, aad); + m_assetsCacheMutext.unlock(); + return new AndroidAbstractFileEngine(*aad, fileName); + } else { + AAssetDir_close(assetDir); + } + } + } else { + return new AndroidAbstractFileEngine(*aad, fileName); } return 0; } diff --git a/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.h b/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.h index 9bff6a012e..7bd560886c 100644 --- a/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.h +++ b/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.h @@ -43,8 +43,13 @@ #define QANDROIDASSETSFILEENGINEHANDLER_H #include +#include +#include +#include + #include +struct AndroidAssetDir; class AndroidAssetsFileEngineHandler: public QAbstractFileEngineHandler { public: @@ -54,7 +59,8 @@ public: private: AAssetManager *m_assetManager; - mutable QByteArray m_path; + mutable QCache> m_assetsCache; + mutable QMutex m_assetsCacheMutext; }; #endif // QANDROIDASSETSFILEENGINEHANDLER_H -- cgit v1.2.3 From 159f086a7f7bbe4deb6d95bde66ba875152e1cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Thu, 24 Oct 2013 16:47:32 +0200 Subject: Android: Avoid re-creating Random objects. We where re-creating a Java Random object each time the seed was set, this causes unnecessary overhead as the old objects becomes subject for garbage collection. Change-Id: I7aa48f5380f86d6c0d57eaeadc71b9b2b146034d Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/corelib/global/qglobal.cpp | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 51cf91a77d..ca780346bc 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2410,9 +2410,14 @@ void qsrand(uint seed) srand(seed); } #elif defined(Q_OS_ANDROID) - QJNIObjectPrivate random = QJNIObjectPrivate("java/util/Random", - "(J)V", - jlong(seed)); + if (randomTLS->hasLocalData()) { + randomTLS->localData().callMethod("setSeed", "(J)V", jlong(seed)); + return; + } + + QJNIObjectPrivate random("java/util/Random", + "(J)V", + jlong(seed)); if (!random.isValid()) { srand(seed); return; @@ -2465,19 +2470,20 @@ int qrand() if (!randomStorage) return rand(); - QJNIObjectPrivate random; - if (!randomStorage->hasLocalData()) { - random = QJNIObjectPrivate("java/util/Random", - "(J)V", - jlong(1)); - if (!random.isValid()) - return rand(); - - randomStorage->setLocalData(random); - } else { - random = randomStorage->localData(); + if (randomStorage->hasLocalData()) { + return randomStorage->localData().callMethod("nextInt", + "(I)I", + RAND_MAX); } + QJNIObjectPrivate random("java/util/Random", + "(J)V", + jlong(1)); + + if (!random.isValid()) + return rand(); + + randomStorage->setLocalData(random); return random.callMethod("nextInt", "(I)I", RAND_MAX); #else // On Windows srand() and rand() already use Thread-Local-Storage -- cgit v1.2.3 From efc61299bd51018df272b296b2c849071f685a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Mon, 21 Oct 2013 17:58:43 +0200 Subject: Android: Check for null pointer before calling ANativeWindow_release() Calling ANativeWindow_release() with a null pointer will cause a SIGSEGV. Task-number: QTBUG-33955 Change-Id: If7d1afa3baea04360507eec5042b4e18a0272527 Reviewed-by: Laszlo Agocs Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp b/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp index e7e53e72a2..278cd553f4 100644 --- a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp +++ b/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp @@ -120,7 +120,8 @@ EGLNativeWindowType QEglFSAndroidHooks::createNativeWindow(QPlatformWindow *plat void QEglFSAndroidHooks::destroyNativeWindow(EGLNativeWindowType window) { - ANativeWindow_release(window); + if (window != 0) + ANativeWindow_release(window); } bool QEglFSAndroidHooks::hasCapability(QPlatformIntegration::Capability capability) const -- cgit v1.2.3 From b6a4545b8f8714961025dd4475e966a5f505e9eb Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 4 Oct 2013 12:52:22 +0200 Subject: qdoc: Include internal types in the index files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Internal types can be inherited. Documentation is not created for internal types, but if an internal type is abstract, its properties must be listed on the documentation page of each subtype that inherits the internal type. This fix includes internal types in the index file. Task-number: QTBUG-33814 Change-Id: Ib6ef7cbd92804b3c605009802ddb15d35b32692c Reviewed-by: Topi Reiniö Reviewed-by: Nico Vertriest Reviewed-by: Jerome Pasion --- src/tools/qdoc/ditaxmlgenerator.cpp | 3 ++- src/tools/qdoc/htmlgenerator.cpp | 3 ++- src/tools/qdoc/qdocindexfiles.cpp | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index 095e3c9d30..e3b9bdd264 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -682,7 +682,8 @@ void DitaXmlGenerator::generateTree() qdb_->generateIndex(outputDir() + QLatin1Char('/') + fileBase + ".index", projectUrl, projectDescription, - this); + this, + true); } if (!runPrepareOnly()) { diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 2387502b8a..a7dd6666db 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -279,7 +279,8 @@ void HtmlGenerator::generateTree() qdb_->generateIndex(outputDir() + QLatin1Char('/') + fileBase + ".index", projectUrl, projectDescription, - this); + this, + true); } if (!runPrepareOnly()) { diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index 7424971b13..c84caa7eb5 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -196,6 +196,10 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, location = Location(indexUrl + QLatin1Char('/') + name.toLower() + ".html"); else if (!indexUrl.isNull()) location = Location(name.toLower() + ".html"); + bool abstract = false; + if (element.attribute("abstract") == "true") + abstract = true; + node->setAbstract(abstract); } else if ((element.nodeName() == "qmlclass") || ((element.nodeName() == "page") && (element.attribute("subtype") == "qmlclass"))) { @@ -204,6 +208,10 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, QString qmlModuleName = element.attribute("qml-module-name"); if (!qmlModuleName.isEmpty()) qdb_->addToQmlModule(qmlModuleName, qcn); + bool abstract = false; + if (element.attribute("abstract") == "true") + abstract = true; + qcn->setAbstract(abstract); QString qmlFullBaseName = element.attribute("qml-base-type"); if (!qmlFullBaseName.isEmpty()) qcn->setQmlBaseName(qmlFullBaseName); @@ -729,7 +737,6 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, writer.writeStartElement(nodeName); QXmlStreamAttributes attributes; - writer.writeAttribute("access", access); if (node->type() != Node::Document) { QString threadSafety; @@ -776,7 +783,6 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, status = "main"; break; } - writer.writeAttribute("status", status); writer.writeAttribute("name", objName); if (node->isQmlModule()) { @@ -806,6 +812,10 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, href = node->name(); writer.writeAttribute("href", href); + writer.writeAttribute("access", access); + writer.writeAttribute("status", status); + if (node->isAbstract()) + writer.writeAttribute("abstract", "true"); writer.writeAttribute("location", node->location().fileName()); if (!node->location().filePath().isEmpty()) { writer.writeAttribute("filepath", node->location().filePath()); -- cgit v1.2.3 From 9205ae8fa49ad8ce330c522048f601bcab4e2174 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 10 Oct 2013 12:25:01 +0200 Subject: qdoc:headers and sources paths are canonicalized MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This eliminates the possibility that the same file could appear in the file list twice causing qdoc to parse it twice. Task-number: QTBUG-34002 Change-Id: Iab63d778c9f955076515a8ae2f1bd9560099b13d Reviewed-by: Topi Reiniö Reviewed-by: Nico Vertriest Reviewed-by: Jerome Pasion --- src/tools/qdoc/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp index cb9b8c3269..2d8e98d64c 100644 --- a/src/tools/qdoc/config.cpp +++ b/src/tools/qdoc/config.cpp @@ -703,7 +703,7 @@ QStringList Config::getAllFiles(const QString &filesVar, const QSet &excludedDirs, const QSet &excludedFiles) { - QStringList result = getStringList(filesVar); + QStringList result = getCanonicalPathList(filesVar); QStringList dirs = getCanonicalPathList(dirsVar); QString nameFilter = getString(filesVar + dot + CONFIG_FILEEXTENSIONS); -- cgit v1.2.3 From b21c82908c640068bed9bdcd80281d0e6f7adede Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 10 Oct 2013 12:33:28 +0200 Subject: qdoc: Snippets files no longer parsed by qdoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The files in the doc/snippets subdirectory of each example subdirectory are no longer parsed by qdoc as source files. They continue to be used as snippets files. This fix also ensures that there are no duplicates in the list of files to be parsed. Task-number: QTBUG-34003 Change-Id: Icec1a2a539237f24ee6bae89c6401f0dc81826d1 Reviewed-by: Topi Reiniö Reviewed-by: Nico Vertriest Reviewed-by: Jerome Pasion --- src/tools/qdoc/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp index 246e4d2d82..4573724137 100644 --- a/src/tools/qdoc/main.cpp +++ b/src/tools/qdoc/main.cpp @@ -393,6 +393,10 @@ static void processQdocconfFile(const QString &fileName) QMap headers; QMultiMap headerFileNames; for (int i=0; i sources; QMultiMap sourceFileNames; for (int i=0; i Date: Thu, 10 Oct 2013 14:50:36 +0200 Subject: qdoc: Internal QML Types no longer marked public MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a QML type marked with \internal is read from an index file, it is given private access instead of public access. Task-number: QTBUG-34010 Change-Id: If9270372cf4db835dca9731bce8c446a2fa4e140 Reviewed-by: Topi Reiniö Reviewed-by: Nico Vertriest Reviewed-by: Jerome Pasion --- src/tools/qdoc/qdocindexfiles.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index c84caa7eb5..02508e3589 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -120,6 +120,7 @@ void QDocIndexFiles::readIndexFile(const QString& path) { QFile file(path); if (file.open(QFile::ReadOnly)) { + //qDebug() << "READING:" << path; QDomDocument document; document.setContent(&file); file.close(); @@ -472,7 +473,7 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, node->setAccess(Node::Public); else if (access == "protected") node->setAccess(Node::Protected); - else if (access == "private") + else if ((access == "private") || (access == "internal")) node->setAccess(Node::Private); else node->setAccess(Node::Public); -- cgit v1.2.3 From 6893a0d656f8e08d93b44794e78c9b980a2937d5 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 16 Oct 2013 16:28:56 +0200 Subject: qdoc: Part 2 of fix for inheriting abstract QML types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fix not only gets the property lists correct but also creates correct links to the property docs. A side effect is that QML properties, methods, and signals whose names begin with "__" are automatically treated as if they are marked \internal. This had been agreed earlier but had not been implemented. It is also required to fix this bug so it is included here. Task-number: QTBUG-33814 Change-Id: I57de1e49774db47cb57c042f181ccc8edec62d13 Reviewed-by: Topi Reiniö Reviewed-by: Nico Vertriest Reviewed-by: Jerome Pasion --- src/tools/qdoc/cppcodemarker.cpp | 8 ++++++++ src/tools/qdoc/htmlgenerator.cpp | 5 +++-- src/tools/qdoc/node.cpp | 7 ++++++- src/tools/qdoc/node.h | 2 ++ src/tools/qdoc/qdocindexfiles.cpp | 34 +++++++++++++++++++++++++++------- src/tools/qdoc/qmlvisitor.cpp | 1 - 6 files changed, 46 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp index 24bd654238..64b11109f7 100644 --- a/src/tools/qdoc/cppcodemarker.cpp +++ b/src/tools/qdoc/cppcodemarker.cpp @@ -1111,6 +1111,10 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno while (qcn != 0) { NodeList::ConstIterator c = qcn->childNodes().constBegin(); while (c != qcn->childNodes().constEnd()) { + if ((*c)->status() == Node::Internal) { + ++c; + continue; + } if ((*c)->type() == Node::QmlPropertyGroup) { insert(qmlproperties, *c, style, Okay); } @@ -1172,6 +1176,10 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno while (qcn != 0) { NodeList::ConstIterator c = qcn->childNodes().constBegin(); while (c != qcn->childNodes().constEnd()) { + if ((*c)->status() == Node::Internal) { + ++c; + continue; + } if ((*c)->type() == Node::QmlPropertyGroup) { insert(qmlproperties,*c,style,Okay); } diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index a7dd6666db..986b4ae261 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -2311,7 +2311,7 @@ QString HtmlGenerator::generateAllQmlMembersFile(const QmlClassNode* qml_cn, } out() << "
    \n"; for (int j=0; jaccess() == Node::Private) { + if (nodes[j]->access() == Node::Private || nodes[j]->status() == Node::Internal) { continue; } out() << "
  • "; @@ -2320,7 +2320,8 @@ QString HtmlGenerator::generateAllQmlMembersFile(const QmlClassNode* qml_cn, prefix = keys.at(j).mid(1); prefix = prefix.left(keys.at(j).indexOf("::")+1); } - generateSynopsis(nodes[j], qcn, marker, CodeMarker::Summary, false, &prefix); + generateQmlItem(nodes[j], qcn, marker, true); + //generateSynopsis(nodes[j], qcn, marker, CodeMarker::Subpage, false, &prefix); out() << "
  • \n"; } out() << "
\n"; diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp index 75896e2718..c88ebfc760 100644 --- a/src/tools/qdoc/node.cpp +++ b/src/tools/qdoc/node.cpp @@ -1867,7 +1867,10 @@ FunctionNode::FunctionNode(Type type, InnerNode *parent, const QString& name, bo rf(0), ap(0) { - // nothing. + if (type == QmlMethod || type == QmlSignal) { + if (name.startsWith("__")) + setStatus(Internal); + } } /*! @@ -2326,6 +2329,8 @@ QmlPropertyNode::QmlPropertyNode(InnerNode* parent, setPageType(ApiPage); if (type_ == QString("alias")) isAlias_ = true; + if (name.startsWith("__")) + setStatus(Internal); } /*! diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h index 9e736aeba6..236b495bd0 100644 --- a/src/tools/qdoc/node.h +++ b/src/tools/qdoc/node.h @@ -195,6 +195,7 @@ public: virtual bool isInnerNode() const = 0; virtual bool isQmlModule() const { return false; } + virtual bool isQmlType() const { return false; } virtual bool isExample() const { return false; } virtual bool isExampleFile() const { return false; } virtual bool isLeaf() const { return false; } @@ -610,6 +611,7 @@ public: QmlClassNode(InnerNode* parent, const QString& name); virtual ~QmlClassNode(); virtual bool isQmlNode() const { return true; } + virtual bool isQmlType() const { return true; } virtual bool isQtQuickNode() const { return (qmlModuleName() == QLatin1String("QtQuick")); } virtual ClassNode* classNode() { return cnode_; } virtual void setClassNode(ClassNode* cn) { cnode_ = cn; } diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index 02508e3589..47e302dad6 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -120,7 +120,6 @@ void QDocIndexFiles::readIndexFile(const QString& path) { QFile file(path); if (file.open(QFile::ReadOnly)) { - //qDebug() << "READING:" << path; QDomDocument document; document.setContent(&file); file.close(); @@ -515,10 +514,12 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, QString moduleName = element.attribute("module"); if (!moduleName.isEmpty()) node->setModuleName(moduleName); - if (node->isExternalPage()) - node->setUrl(href); - else if (!indexUrl.isEmpty()) - node->setUrl(indexUrl + QLatin1Char('/') + href); + if (!href.isEmpty()) { + if (node->isExternalPage()) + node->setUrl(href); + else if (!indexUrl.isEmpty()) + node->setUrl(indexUrl + QLatin1Char('/') + href); + } QString since = element.attribute("since"); if (!since.isEmpty()) { @@ -717,6 +718,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, access = "protected"; break; case Node::Private: +#if 0 // Do not include private non-internal nodes in the index. // (Internal public and protected nodes are marked as private // by qdoc. We can check their internal status to determine @@ -725,6 +727,13 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, access = "internal"; else return false; +#endif + { + access = "private"; + bool b = generateInternalNodes; + if (b) + b = false; + } break; default: return false; @@ -811,13 +820,24 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, } else href = node->name(); - writer.writeAttribute("href", href); + if (node->isQmlNode()) { + InnerNode* p = node->parent(); + if (p) { + if (p->isQmlPropertyGroup()) + p = p->parent(); + if (p && p->isQmlType() && p->isAbstract()) + href.clear(); + } + } + if (!href.isEmpty()) + writer.writeAttribute("href", href); writer.writeAttribute("access", access); writer.writeAttribute("status", status); if (node->isAbstract()) writer.writeAttribute("abstract", "true"); - writer.writeAttribute("location", node->location().fileName()); + if (!node->location().fileName().isEmpty()) + writer.writeAttribute("location", node->location().fileName()); if (!node->location().filePath().isEmpty()) { writer.writeAttribute("filepath", node->location().filePath()); writer.writeAttribute("lineno", QString("%1").arg(node->location().lineNo())); diff --git a/src/tools/qdoc/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp index 323c312eb5..fb90dcd59a 100644 --- a/src/tools/qdoc/qmlvisitor.cpp +++ b/src/tools/qdoc/qmlvisitor.cpp @@ -404,7 +404,6 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation, } } else if (command == COMMAND_INTERNAL) { - node->setAccess(Node::Private); node->setStatus(Node::Internal); } else if (command == COMMAND_OBSOLETE) { -- cgit v1.2.3 From e9fe369321939a6c1cb0ba822272875481dc038e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 22 Oct 2013 12:02:36 +0200 Subject: qdoc: Corrected error in QDocDatabase::findQmlType() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was still using the QML module version number as part of the search key. e.g. it tried to find the type node for QtQuick.Controls::Button using QtQuick.Controls2.Button, but now it searches without the 2. Task-number: QTBUG-34173 Change-Id: Ibc8b6d9ef4ceebb20c1be00ec3bc9190c51bcdf3 Reviewed-by: Topi Reiniö Reviewed-by: Jerome Pasion Reviewed-by: Nico Vertriest --- src/tools/qdoc/qdocdatabase.cpp | 35 ++--------------------------------- src/tools/qdoc/qmlvisitor.cpp | 36 ++++++++++++------------------------ src/tools/qdoc/qmlvisitor.h | 4 ++-- 3 files changed, 16 insertions(+), 59 deletions(-) (limited to 'src') diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index e371d448c6..f2ecb02a2f 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -357,23 +357,10 @@ QmlClassNode* QDocDatabase::findQmlType(const ImportRec& import, const QString& else qmName = import.importUri_; for (int i=0; i 1) { - int dot = import.version_.lastIndexOf(QChar('.')); - if (dot > 0) { - qmid = import.name_ + import.version_.left(dot); - qualifiedName = qmid + "::" + dotSplit[i]; - qcn = qmlTypeMap_.value(qualifiedName); - if (qcn) { - return qcn; - } - } - } } } return 0; @@ -1000,24 +987,6 @@ void QDocDatabase::resolveQmlInheritance(InnerNode* root) } } -#if 0 -void QDocDatabase::resolveQmlInheritance(InnerNode* root) -{ - // Dop we need recursion? - foreach (Node* child, root->childNodes()) { - if (child->type() == Node::Document && child->subType() == Node::QmlClass) { - QmlClassNode* qcn = static_cast(child); - if ((qcn->qmlBaseNode() == 0) && !qcn->qmlBaseName().isEmpty()) { - QmlClassNode* bqcn = findQmlType(QString(), qcn->qmlBaseName()); - if (bqcn) { - qcn->setQmlBaseNode(bqcn); - } - } - } - } -} -#endif - /*! */ void QDocDatabase::resolveTargets(InnerNode* root) diff --git a/src/tools/qdoc/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp index fb90dcd59a..ec1ef41256 100644 --- a/src/tools/qdoc/qmlvisitor.cpp +++ b/src/tools/qdoc/qmlvisitor.cpp @@ -464,6 +464,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition) QmlClassNode *component = new QmlClassNode(current, name); component->setTitle(name); component->setImportList(importList); + importList.clear(); if (applyDocumentation(definition->firstSourceLocation(), component)) { QmlClassNode::addInheritedBy(type, component); component->setQmlBaseName(type); @@ -488,34 +489,21 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::UiObjectDefinition *definition) lastEndOffset = definition->lastSourceLocation().end(); } -/*! - Note that the imports list can be traversed by iteration to obtain - all the imports in the document at once, having found just one: - - *it = imports; it; it = it->next - - */ -bool QmlDocVisitor::visit(QQmlJS::AST::UiImportList *imports) +bool QmlDocVisitor::visit(QQmlJS::AST::UiImport *import) { - while (imports != 0) { - QQmlJS::AST::UiImport* imp = imports->import; - - QString name = document.mid(imp->fileNameToken.offset, imp->fileNameToken.length); - if (name[0] == '\"') - name = name.mid(1, name.length()-2); - QString version = document.mid(imp->versionToken.offset, imp->versionToken.length); - QString importId = document.mid(imp->importIdToken.offset, imp->importIdToken.length); - QString importUri = getFullyQualifiedId(imp->importUri); - importList.append(ImportRec(name, version, importId, importUri)); - imports = imports->next; - } + QString name = document.mid(import->fileNameToken.offset, import->fileNameToken.length); + if (name[0] == '\"') + name = name.mid(1, name.length()-2); + QString version = document.mid(import->versionToken.offset, import->versionToken.length); + QString importId = document.mid(import->importIdToken.offset, import->importIdToken.length); + QString importUri = getFullyQualifiedId(import->importUri); + QString reconstructed = importUri + QString(" ") + version; + importList.append(ImportRec(name, version, importId, importUri)); + return true; } -/*! - End the visit of the imports list. - */ -void QmlDocVisitor::endVisit(QQmlJS::AST::UiImportList *definition) +void QmlDocVisitor::endVisit(QQmlJS::AST::UiImport *definition) { lastEndOffset = definition->lastSourceLocation().end(); } diff --git a/src/tools/qdoc/qmlvisitor.h b/src/tools/qdoc/qmlvisitor.h index cdb7ae7391..feeeb13497 100644 --- a/src/tools/qdoc/qmlvisitor.h +++ b/src/tools/qdoc/qmlvisitor.h @@ -75,8 +75,8 @@ public: const QSet &topics); virtual ~QmlDocVisitor(); - bool visit(QQmlJS::AST::UiImportList *imports); - void endVisit(QQmlJS::AST::UiImportList *definition); + bool visit(QQmlJS::AST::UiImport *import); + void endVisit(QQmlJS::AST::UiImport *definition); bool visit(QQmlJS::AST::UiObjectDefinition *definition); void endVisit(QQmlJS::AST::UiObjectDefinition *definition); -- cgit v1.2.3 From 0b152831ccee309f020435ab0737af6c73362dec Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 23 Oct 2013 13:55:53 +0200 Subject: qdoc: Update qdoc's QML parser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because qdoc is part of qtbase/src/tools, it is not allowed to depend on anything outside of qtbase. But qdoc uses the QML parser from qtdeclarative, so qdoc has its own copy of the QML parser sources. The QML parser has been updated to the current version for Qt 5.2. Task-number: QTBUG-34269 Change-Id: I5ac9c8ff08a3494d5c35a0014a437be88f2dc31d Reviewed-by: Simon Hausmann Reviewed-by: Topi Reiniö Reviewed-by: Jerome Pasion Reviewed-by: Nico Vertriest --- src/tools/qdoc/qmlparser/qqmljs.g | 84 +- src/tools/qdoc/qmlparser/qqmljsast.cpp | 24 +- src/tools/qdoc/qmlparser/qqmljsast_p.h | 160 ++- src/tools/qdoc/qmlparser/qqmljsastfwd_p.h | 4 +- src/tools/qdoc/qmlparser/qqmljsastvisitor_p.h | 8 +- src/tools/qdoc/qmlparser/qqmljsengine_p.h | 1 + src/tools/qdoc/qmlparser/qqmljsglobal_p.h | 4 +- src/tools/qdoc/qmlparser/qqmljsgrammar.cpp | 1670 +++++++++++++------------ src/tools/qdoc/qmlparser/qqmljsgrammar_p.h | 43 +- src/tools/qdoc/qmlparser/qqmljskeywords_p.h | 11 + src/tools/qdoc/qmlparser/qqmljslexer.cpp | 76 +- src/tools/qdoc/qmlparser/qqmljslexer_p.h | 4 +- src/tools/qdoc/qmlparser/qqmljsparser.cpp | 481 +++---- src/tools/qdoc/qmlparser/qqmljsparser_p.h | 9 +- 14 files changed, 1422 insertions(+), 1157 deletions(-) (limited to 'src') diff --git a/src/tools/qdoc/qmlparser/qqmljs.g b/src/tools/qdoc/qmlparser/qqmljs.g index 7ba6859534..de4fec4d56 100644 --- a/src/tools/qdoc/qmlparser/qqmljs.g +++ b/src/tools/qdoc/qmlparser/qqmljs.g @@ -65,6 +65,7 @@ --- context keywords. %token T_PUBLIC "public" %token T_IMPORT "import" +%token T_PRAGMA "pragma" %token T_AS "as" %token T_ON "on" %token T_GET "get" @@ -253,7 +254,8 @@ public: AST::VariableDeclarationList *VariableDeclarationList; AST::UiProgram *UiProgram; - AST::UiImportList *UiImportList; + AST::UiHeaderItemList *UiHeaderItemList; + AST::UiPragma *UiPragma; AST::UiImport *UiImport; AST::UiParameterList *UiParameterList; AST::UiPublicMember *UiPublicMember; @@ -266,6 +268,7 @@ public: AST::UiObjectMemberList *UiObjectMemberList; AST::UiArrayMemberList *UiArrayMemberList; AST::UiQualifiedId *UiQualifiedId; + AST::UiQualifiedPragmaId *UiQualifiedPragmaId; }; public: @@ -347,6 +350,7 @@ protected: { return location_stack [tos + index - 1]; } AST::UiQualifiedId *reparseAsQualifiedId(AST::ExpressionNode *expr); + AST::UiQualifiedPragmaId *reparseAsQualifiedPragmaId(AST::ExpressionNode *expr); protected: Engine *driver; @@ -486,6 +490,19 @@ AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr) return 0; } +AST::UiQualifiedPragmaId *Parser::reparseAsQualifiedPragmaId(AST::ExpressionNode *expr) +{ + if (AST::IdentifierExpression *idExpr = AST::cast(expr)) { + AST::UiQualifiedPragmaId *q = new (pool) AST::UiQualifiedPragmaId(idExpr->name); + q->identifierToken = idExpr->identifierToken; + + return q->finish(); + } + + return 0; +} + + bool Parser::parse(int startToken) { Lexer *lexer = driver->lexer(); @@ -594,38 +611,62 @@ case $rule_number: { } break; ./ -UiProgram: UiImportListOpt UiRootMember ; +UiProgram: UiHeaderItemListOpt UiRootMember; /. case $rule_number: { - sym(1).UiProgram = new (pool) AST::UiProgram(sym(1).UiImportList, + sym(1).UiProgram = new (pool) AST::UiProgram(sym(1).UiHeaderItemList, sym(2).UiObjectMemberList->finish()); } break; ./ -UiImportListOpt: Empty ; -UiImportListOpt: UiImportList ; +UiHeaderItemListOpt: Empty ; +UiHeaderItemListOpt: UiHeaderItemList ; /. case $rule_number: { - sym(1).Node = sym(1).UiImportList->finish(); + sym(1).Node = sym(1).UiHeaderItemList->finish(); } break; ./ -UiImportList: UiImport ; +UiHeaderItemList: UiPragma ; /. case $rule_number: { - sym(1).Node = new (pool) AST::UiImportList(sym(1).UiImport); + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiPragma); } break; ./ -UiImportList: UiImportList UiImport ; +UiHeaderItemList: UiImport ; /. case $rule_number: { - sym(1).Node = new (pool) AST::UiImportList(sym(1).UiImportList, sym(2).UiImport); + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiImport); } break; ./ +UiHeaderItemList: UiHeaderItemList UiPragma ; +/. +case $rule_number: { + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiPragma); +} break; +./ + +UiHeaderItemList: UiHeaderItemList UiImport ; +/. +case $rule_number: { + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiImport); +} break; +./ + +PragmaId: MemberExpression ; + ImportId: MemberExpression ; +UiPragma: UiPragmaHead T_AUTOMATIC_SEMICOLON ; +UiPragma: UiPragmaHead T_SEMICOLON ; +/. +case $rule_number: { + sym(1).UiPragma->semicolonToken = loc(2); +} break; +./ + UiImport: UiImportHead T_AUTOMATIC_SEMICOLON ; UiImport: UiImportHead T_SEMICOLON ; /. @@ -666,6 +707,28 @@ case $rule_number: { } break; ./ +UiPragmaHead: T_PRAGMA PragmaId ; +/. +case $rule_number: { + AST::UiPragma *node = 0; + + if (AST::UiQualifiedPragmaId *qualifiedId = reparseAsQualifiedPragmaId(sym(2).Expression)) { + node = new (pool) AST::UiPragma(qualifiedId); + } + + sym(1).Node = node; + + if (node) { + node->pragmaToken = loc(1); + } else { + diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1), + QLatin1String("Expected a qualified name id"))); + + return false; // ### remove me + } +} break; +./ + UiImportHead: T_IMPORT ImportId ; /. @@ -1261,6 +1324,7 @@ case $rule_number: { } break; ./ + UiQualifiedId: MemberExpression ; /. case $rule_number: { diff --git a/src/tools/qdoc/qmlparser/qqmljsast.cpp b/src/tools/qdoc/qmlparser/qqmljsast.cpp index ea0df4a537..33b3868e66 100644 --- a/src/tools/qdoc/qmlparser/qqmljsast.cpp +++ b/src/tools/qdoc/qmlparser/qqmljsast.cpp @@ -821,7 +821,7 @@ void DebuggerStatement::accept0(Visitor *visitor) void UiProgram::accept0(Visitor *visitor) { if (visitor->visit(this)) { - accept(imports, visitor); + accept(headers, visitor); accept(members, visitor); } @@ -932,16 +932,34 @@ void UiImport::accept0(Visitor *visitor) visitor->endVisit(this); } -void UiImportList::accept0(Visitor *visitor) +void UiQualifiedPragmaId::accept0(Visitor *visitor) { if (visitor->visit(this)) { - accept(import, visitor); + } + + visitor->endVisit(this); +} + +void UiPragma::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + accept(pragmaType, visitor); + } + + visitor->endVisit(this); +} + +void UiHeaderItemList::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) { + accept(headerItem, visitor); accept(next, visitor); } visitor->endVisit(this); } + void UiSourceElement::accept0(Visitor *visitor) { if (visitor->visit(this)) { diff --git a/src/tools/qdoc/qmlparser/qqmljsast_p.h b/src/tools/qdoc/qmlparser/qqmljsast_p.h index 01a872f1e8..6cc3b7649e 100644 --- a/src/tools/qdoc/qmlparser/qqmljsast_p.h +++ b/src/tools/qdoc/qmlparser/qqmljsast_p.h @@ -207,18 +207,20 @@ public: Kind_UiArrayBinding, Kind_UiImport, - Kind_UiImportList, Kind_UiObjectBinding, Kind_UiObjectDefinition, Kind_UiObjectInitializer, Kind_UiObjectMemberList, Kind_UiArrayMemberList, + Kind_UiPragma, Kind_UiProgram, Kind_UiParameterList, Kind_UiPublicMember, Kind_UiQualifiedId, + Kind_UiQualifiedPragmaId, Kind_UiScriptBinding, - Kind_UiSourceElement + Kind_UiSourceElement, + Kind_UiHeaderItemList }; inline Node() @@ -2271,27 +2273,72 @@ public: SourceLocation semicolonToken; }; -class QML_PARSER_EXPORT UiImportList: public Node +class QML_PARSER_EXPORT UiObjectMember: public Node { public: - QQMLJS_DECLARE_AST_NODE(UiImportList) + virtual SourceLocation firstSourceLocation() const = 0; + virtual SourceLocation lastSourceLocation() const = 0; - UiImportList(UiImport *import) - : import(import), - next(this) + virtual UiObjectMember *uiObjectMemberCast(); +}; + +class QML_PARSER_EXPORT UiObjectMemberList: public Node +{ +public: + QQMLJS_DECLARE_AST_NODE(UiObjectMemberList) + + UiObjectMemberList(UiObjectMember *member) + : next(this), member(member) { kind = K; } - UiImportList(UiImportList *previous, UiImport *import) - : import(import) + UiObjectMemberList(UiObjectMemberList *previous, UiObjectMember *member) + : member(member) { kind = K; next = previous->next; previous->next = this; } - UiImportList *finish() + virtual void accept0(Visitor *visitor); + + virtual SourceLocation firstSourceLocation() const + { return member->firstSourceLocation(); } + + virtual SourceLocation lastSourceLocation() const + { return next ? next->lastSourceLocation() : member->lastSourceLocation(); } + + UiObjectMemberList *finish() { - UiImportList *head = next; + UiObjectMemberList *head = next; + next = 0; + return head; + } + +// attributes + UiObjectMemberList *next; + UiObjectMember *member; +}; + +class QML_PARSER_EXPORT UiQualifiedPragmaId: public Node +{ +public: + QQMLJS_DECLARE_AST_NODE(UiQualifiedPragmaId) + + UiQualifiedPragmaId(const QStringRef &name) + : next(this), name(name) + { kind = K; } + + UiQualifiedPragmaId(UiQualifiedPragmaId *previous, const QStringRef &name) + : name(name) + { + kind = K; + next = previous->next; + previous->next = this; + } + + UiQualifiedPragmaId *finish() + { + UiQualifiedPragmaId *head = next; next = 0; return head; } @@ -2299,60 +2346,87 @@ public: virtual void accept0(Visitor *visitor); virtual SourceLocation firstSourceLocation() const - { return import->firstSourceLocation(); } + { return identifierToken; } virtual SourceLocation lastSourceLocation() const - { return next ? next->lastSourceLocation() : import->lastSourceLocation(); } + { return next ? next->lastSourceLocation() : identifierToken; } // attributes - UiImport *import; - UiImportList *next; + UiQualifiedPragmaId *next; + QStringRef name; + SourceLocation identifierToken; }; -class QML_PARSER_EXPORT UiObjectMember: public Node +class QML_PARSER_EXPORT UiPragma: public Node { public: - virtual SourceLocation firstSourceLocation() const = 0; - virtual SourceLocation lastSourceLocation() const = 0; + QQMLJS_DECLARE_AST_NODE(UiPragma) - virtual UiObjectMember *uiObjectMemberCast(); + UiPragma(UiQualifiedPragmaId *type) + : pragmaType(type) + { kind = K; } + + virtual void accept0(Visitor *visitor); + + virtual SourceLocation firstSourceLocation() const + { return pragmaToken; } + + virtual SourceLocation lastSourceLocation() const + { return semicolonToken; } + +// attributes + UiQualifiedPragmaId *pragmaType; + SourceLocation pragmaToken; + SourceLocation semicolonToken; }; -class QML_PARSER_EXPORT UiObjectMemberList: public Node +class QML_PARSER_EXPORT UiHeaderItemList: public Node { public: - QQMLJS_DECLARE_AST_NODE(UiObjectMemberList) + QQMLJS_DECLARE_AST_NODE(UiHeaderItemList) - UiObjectMemberList(UiObjectMember *member) - : next(this), member(member) + UiHeaderItemList(UiImport *import) + : headerItem(import), next(this) { kind = K; } - UiObjectMemberList(UiObjectMemberList *previous, UiObjectMember *member) - : member(member) + UiHeaderItemList(UiPragma *pragma) + : headerItem(pragma), next(this) + { kind = K; } + + UiHeaderItemList(UiHeaderItemList *previous, UiImport *import) + : headerItem(import) { kind = K; next = previous->next; previous->next = this; } - virtual void accept0(Visitor *visitor); - - virtual SourceLocation firstSourceLocation() const - { return member->firstSourceLocation(); } - - virtual SourceLocation lastSourceLocation() const - { return next ? next->lastSourceLocation() : member->lastSourceLocation(); } + UiHeaderItemList(UiHeaderItemList *previous, UiPragma *pragma) + : headerItem(pragma) + { + kind = K; + next = previous->next; + previous->next = this; + } - UiObjectMemberList *finish() + UiHeaderItemList *finish() { - UiObjectMemberList *head = next; + UiHeaderItemList *head = next; next = 0; return head; } + virtual void accept0(Visitor *visitor); + + virtual SourceLocation firstSourceLocation() const + { return headerItem->firstSourceLocation(); } + + virtual SourceLocation lastSourceLocation() const + { return next ? next->lastSourceLocation() : headerItem->lastSourceLocation(); } + // attributes - UiObjectMemberList *next; - UiObjectMember *member; + Node *headerItem; + UiHeaderItemList *next; }; class QML_PARSER_EXPORT UiProgram: public Node @@ -2360,16 +2434,16 @@ class QML_PARSER_EXPORT UiProgram: public Node public: QQMLJS_DECLARE_AST_NODE(UiProgram) - UiProgram(UiImportList *imports, UiObjectMemberList *members) - : imports(imports), members(members) + UiProgram(UiHeaderItemList *headers, UiObjectMemberList *members) + : headers(headers), members(members) { kind = K; } virtual void accept0(Visitor *visitor); virtual SourceLocation firstSourceLocation() const { - if (imports) - return imports->firstSourceLocation(); + if (headers) + return headers->firstSourceLocation(); else if (members) return members->firstSourceLocation(); return SourceLocation(); @@ -2379,13 +2453,13 @@ public: { if (members) return members->lastSourceLocation(); - else if (imports) - return imports->lastSourceLocation(); + else if (headers) + return headers->lastSourceLocation(); return SourceLocation(); } // attributes - UiImportList *imports; + UiHeaderItemList *headers; UiObjectMemberList *members; }; diff --git a/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h b/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h index fe5572c4b2..f8cba4981c 100644 --- a/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h +++ b/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h @@ -167,7 +167,7 @@ class NestedExpression; // ui elements class UiProgram; -class UiImportList; +class UiPragma; class UiImport; class UiPublicMember; class UiParameterList; @@ -181,6 +181,8 @@ class UiObjectMember; class UiObjectMemberList; class UiArrayMemberList; class UiQualifiedId; +class UiQualifiedPragmaId; +class UiHeaderItemList; } } // namespace AST diff --git a/src/tools/qdoc/qmlparser/qqmljsastvisitor_p.h b/src/tools/qdoc/qmlparser/qqmljsastvisitor_p.h index ef022f617c..1d67d4c75d 100644 --- a/src/tools/qdoc/qmlparser/qqmljsastvisitor_p.h +++ b/src/tools/qdoc/qmlparser/qqmljsastvisitor_p.h @@ -71,7 +71,8 @@ public: // Ui virtual bool visit(UiProgram *) { return true; } - virtual bool visit(UiImportList *) { return true; } + virtual bool visit(UiHeaderItemList *) { return true; } + virtual bool visit(UiPragma *) { return true; } virtual bool visit(UiImport *) { return true; } virtual bool visit(UiPublicMember *) { return true; } virtual bool visit(UiSourceElement *) { return true; } @@ -84,10 +85,12 @@ public: virtual bool visit(UiObjectMemberList *) { return true; } virtual bool visit(UiArrayMemberList *) { return true; } virtual bool visit(UiQualifiedId *) { return true; } + virtual bool visit(UiQualifiedPragmaId *) { return true; } virtual void endVisit(UiProgram *) {} - virtual void endVisit(UiImportList *) {} virtual void endVisit(UiImport *) {} + virtual void endVisit(UiHeaderItemList *) {} + virtual void endVisit(UiPragma *) {} virtual void endVisit(UiPublicMember *) {} virtual void endVisit(UiSourceElement *) {} virtual void endVisit(UiObjectDefinition *) {} @@ -99,6 +102,7 @@ public: virtual void endVisit(UiObjectMemberList *) {} virtual void endVisit(UiArrayMemberList *) {} virtual void endVisit(UiQualifiedId *) {} + virtual void endVisit(UiQualifiedPragmaId *) {} // QQmlJS virtual bool visit(ThisExpression *) { return true; } diff --git a/src/tools/qdoc/qmlparser/qqmljsengine_p.h b/src/tools/qdoc/qmlparser/qqmljsengine_p.h index 4f58e7f8ea..195b98bfd7 100644 --- a/src/tools/qdoc/qmlparser/qqmljsengine_p.h +++ b/src/tools/qdoc/qmlparser/qqmljsengine_p.h @@ -102,6 +102,7 @@ public: ~Engine(); void setCode(const QString &code); + const QString &code() const { return _code; } void addComment(int pos, int len, int line, int col); QList comments() const; diff --git a/src/tools/qdoc/qmlparser/qqmljsglobal_p.h b/src/tools/qdoc/qmlparser/qqmljsglobal_p.h index 3aecc863d5..c53e12ea56 100644 --- a/src/tools/qdoc/qmlparser/qqmljsglobal_p.h +++ b/src/tools/qdoc/qmlparser/qqmljsglobal_p.h @@ -61,8 +61,10 @@ # if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB) // QmlDevTools is a static library # define QML_PARSER_EXPORT -# else +# elif defined(QT_BUILD_QML_LIB) # define QML_PARSER_EXPORT Q_AUTOTEST_EXPORT +# else +# define QML_PARSER_EXPORT # endif #endif // QT_CREATOR diff --git a/src/tools/qdoc/qmlparser/qqmljsgrammar.cpp b/src/tools/qdoc/qmlparser/qqmljsgrammar.cpp index 4a5672a796..1e5f7a8c6d 100644 --- a/src/tools/qdoc/qmlparser/qqmljsgrammar.cpp +++ b/src/tools/qdoc/qmlparser/qqmljsgrammar.cpp @@ -54,421 +54,427 @@ const char *const QQmlJSGrammar::spell [] = { ")", ";", 0, "*", "*=", "string literal", "property", "signal", "readonly", "switch", "this", "throw", "~", "try", "typeof", "var", "void", "while", "with", "^", "^=", "null", "true", "false", "const", "debugger", "reserved word", "multiline string literal", "comment", 0, - "public", "import", "as", "on", "get", "set", 0, 0, 0, 0, - 0, 0, 0, 0, 0}; + "public", "import", "pragma", "as", "on", "get", "set", 0, 0, 0, + 0, 0, 0, 0, 0, 0}; const short QQmlJSGrammar::lhs [] = { - 105, 105, 105, 105, 105, 105, 106, 112, 112, 115, - 115, 117, 116, 116, 116, 116, 116, 116, 116, 116, - 119, 114, 113, 122, 122, 123, 123, 124, 124, 121, - 110, 110, 110, 110, 126, 126, 126, 126, 126, 126, - 126, 110, 134, 134, 134, 135, 135, 136, 136, 110, - 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, - 110, 110, 110, 110, 110, 110, 120, 120, 120, 120, - 120, 120, 120, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, - 139, 125, 141, 141, 141, 141, 140, 140, 145, 145, - 145, 143, 143, 146, 146, 146, 146, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 150, 150, - 118, 118, 118, 118, 118, 153, 153, 154, 154, 154, - 154, 152, 152, 155, 155, 156, 156, 157, 157, 157, - 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, - 159, 159, 159, 159, 160, 160, 160, 161, 161, 161, - 161, 162, 162, 162, 162, 162, 162, 162, 163, 163, - 163, 163, 163, 163, 164, 164, 164, 164, 164, 165, - 165, 165, 165, 165, 166, 166, 167, 167, 168, 168, - 169, 169, 170, 170, 171, 171, 172, 172, 173, 173, - 174, 174, 175, 175, 176, 176, 177, 177, 144, 144, - 178, 178, 179, 179, 179, 179, 179, 179, 179, 179, - 179, 179, 179, 179, 108, 108, 180, 180, 181, 181, - 182, 182, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 127, 191, 191, - 190, 190, 138, 138, 192, 192, 193, 193, 195, 195, - 194, 196, 199, 197, 197, 200, 198, 198, 128, 129, - 129, 130, 130, 183, 183, 183, 183, 183, 183, 183, - 183, 184, 184, 184, 184, 185, 185, 185, 185, 186, - 186, 131, 132, 201, 201, 204, 204, 202, 202, 205, - 203, 187, 188, 188, 133, 133, 133, 206, 207, 189, - 189, 208, 137, 151, 151, 209, 209, 148, 148, 147, - 147, 210, 111, 111, 211, 211, 109, 109, 142, 142, - 212}; + 106, 106, 106, 106, 106, 106, 107, 113, 113, 116, + 116, 116, 116, 119, 121, 117, 117, 118, 118, 118, + 118, 118, 118, 118, 118, 122, 123, 115, 114, 126, + 126, 127, 127, 128, 128, 125, 111, 111, 111, 111, + 130, 130, 130, 130, 130, 130, 130, 111, 138, 138, + 138, 139, 139, 140, 140, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 124, 124, 124, 124, 124, 124, 124, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 129, 145, 145, + 145, 145, 144, 144, 149, 149, 149, 147, 147, 150, + 150, 150, 150, 153, 153, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 154, 154, 120, 120, 120, 120, + 120, 157, 157, 158, 158, 158, 158, 156, 156, 159, + 159, 160, 160, 161, 161, 161, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 163, 163, 163, 163, + 164, 164, 164, 165, 165, 165, 165, 166, 166, 166, + 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, + 168, 168, 168, 168, 168, 169, 169, 169, 169, 169, + 170, 170, 171, 171, 172, 172, 173, 173, 174, 174, + 175, 175, 176, 176, 177, 177, 178, 178, 179, 179, + 180, 180, 181, 181, 148, 148, 182, 182, 183, 183, + 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, + 109, 109, 184, 184, 185, 185, 186, 186, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 131, 195, 195, 194, 194, 142, 142, + 196, 196, 197, 197, 199, 199, 198, 200, 203, 201, + 201, 204, 202, 202, 132, 133, 133, 134, 134, 187, + 187, 187, 187, 187, 187, 187, 187, 188, 188, 188, + 188, 189, 189, 189, 189, 190, 190, 135, 136, 205, + 205, 208, 208, 206, 206, 209, 207, 191, 192, 192, + 137, 137, 137, 210, 211, 193, 193, 212, 141, 155, + 155, 213, 213, 152, 152, 151, 151, 214, 112, 112, + 215, 215, 110, 110, 146, 146, 216}; const short QQmlJSGrammar::rhs [] = { 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, - 2, 1, 2, 2, 3, 3, 5, 5, 4, 4, - 2, 0, 1, 1, 2, 1, 3, 2, 3, 2, - 1, 5, 4, 4, 1, 1, 1, 1, 1, 1, - 1, 3, 1, 1, 1, 0, 1, 2, 4, 6, - 6, 3, 3, 7, 7, 4, 4, 5, 5, 5, - 6, 6, 10, 6, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 1, 1, 2, 2, 2, 2, 3, + 3, 5, 5, 4, 4, 2, 2, 0, 1, 1, + 2, 1, 3, 2, 3, 2, 1, 5, 4, 4, + 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, + 1, 0, 1, 2, 4, 6, 6, 3, 3, 7, + 7, 4, 4, 5, 5, 5, 6, 6, 10, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 3, 3, 4, 5, 3, 4, - 3, 1, 1, 2, 3, 4, 1, 2, 3, 7, - 8, 1, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 3, 3, 4, 5, 3, 4, 3, 1, 1, 2, + 3, 4, 1, 2, 3, 7, 8, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 4, 3, 5, 1, 2, 4, 4, 4, - 3, 0, 1, 1, 3, 1, 1, 1, 2, 2, - 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 1, 3, 3, 3, 1, 3, 3, 1, 3, 3, - 3, 1, 3, 3, 3, 3, 3, 3, 1, 3, - 3, 3, 3, 3, 1, 3, 3, 3, 3, 1, - 3, 3, 3, 3, 1, 3, 1, 3, 1, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 4, 3, + 5, 1, 2, 4, 4, 4, 3, 0, 1, 1, + 3, 1, 1, 1, 2, 2, 1, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 3, 3, 3, + 1, 3, 3, 1, 3, 3, 3, 1, 3, 3, + 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, + 1, 3, 3, 3, 3, 1, 3, 3, 3, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, - 1, 3, 1, 3, 1, 5, 1, 5, 1, 3, - 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 0, 1, 1, 3, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 1, 2, - 0, 1, 3, 3, 1, 1, 1, 3, 1, 3, - 2, 2, 2, 0, 1, 2, 0, 1, 1, 2, - 2, 7, 5, 7, 7, 7, 5, 9, 10, 7, - 8, 2, 2, 3, 3, 2, 2, 3, 3, 3, - 3, 5, 5, 3, 5, 1, 2, 0, 1, 4, - 3, 3, 3, 3, 3, 3, 4, 5, 2, 2, - 2, 1, 8, 8, 7, 1, 3, 0, 1, 0, - 1, 1, 1, 1, 1, 2, 1, 1, 0, 1, - 2}; + 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, + 1, 5, 1, 5, 1, 3, 1, 3, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 0, 1, 1, 3, 0, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 1, 2, 0, 1, 3, 3, + 1, 1, 1, 3, 1, 3, 2, 2, 2, 0, + 1, 2, 0, 1, 1, 2, 2, 7, 5, 7, + 7, 7, 5, 9, 10, 7, 8, 2, 2, 3, + 3, 2, 2, 3, 3, 3, 3, 5, 5, 3, + 5, 1, 2, 0, 1, 4, 3, 3, 3, 3, + 3, 3, 4, 5, 2, 2, 2, 1, 8, 8, + 7, 1, 3, 0, 1, 0, 1, 1, 1, 1, + 1, 2, 1, 1, 0, 1, 2}; const short QQmlJSGrammar::action_default [] = { - 0, 0, 22, 0, 0, 0, 22, 0, 178, 245, - 209, 217, 213, 157, 229, 205, 3, 142, 75, 158, - 221, 225, 146, 175, 156, 161, 141, 195, 182, 0, - 82, 83, 78, 0, 72, 67, 349, 0, 0, 0, - 0, 80, 0, 0, 76, 79, 71, 0, 0, 68, - 70, 73, 69, 81, 74, 0, 77, 0, 0, 171, - 0, 0, 158, 177, 160, 159, 0, 0, 0, 173, - 174, 172, 176, 0, 206, 0, 0, 0, 0, 196, - 0, 0, 0, 0, 0, 0, 186, 0, 0, 0, - 180, 181, 179, 184, 188, 187, 185, 183, 198, 197, - 199, 0, 214, 0, 210, 0, 0, 152, 139, 151, - 140, 108, 109, 110, 135, 111, 136, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 137, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 138, 0, 0, 150, 246, 153, 0, 154, 0, - 155, 149, 0, 242, 235, 233, 240, 241, 239, 238, - 244, 237, 236, 234, 243, 230, 0, 218, 0, 0, - 222, 0, 0, 226, 0, 0, 152, 144, 0, 143, - 0, 148, 162, 0, 338, 338, 339, 0, 336, 0, - 337, 0, 340, 253, 260, 259, 267, 255, 0, 256, - 0, 341, 0, 348, 257, 258, 75, 263, 261, 345, - 342, 347, 264, 0, 275, 0, 0, 0, 0, 332, - 0, 349, 247, 289, 0, 0, 0, 276, 0, 0, - 265, 266, 0, 254, 262, 290, 291, 0, 338, 0, - 0, 340, 0, 333, 334, 0, 322, 346, 0, 306, - 307, 308, 309, 0, 302, 303, 304, 305, 330, 331, - 0, 0, 0, 0, 0, 294, 295, 296, 251, 249, - 211, 219, 215, 231, 207, 252, 0, 158, 223, 227, - 200, 189, 0, 0, 208, 0, 0, 0, 0, 201, - 0, 0, 0, 0, 0, 193, 191, 194, 192, 190, - 203, 202, 204, 0, 216, 0, 212, 0, 250, 158, - 0, 232, 247, 248, 0, 247, 0, 0, 298, 0, - 0, 0, 300, 0, 220, 0, 0, 224, 0, 0, - 228, 287, 0, 279, 288, 282, 0, 286, 0, 247, - 280, 0, 247, 0, 0, 299, 0, 0, 0, 301, - 0, 0, 0, 293, 0, 292, 75, 102, 350, 0, - 0, 107, 269, 272, 0, 108, 275, 111, 136, 113, - 114, 78, 118, 119, 72, 120, 123, 76, 79, 247, - 73, 81, 126, 74, 128, 77, 130, 131, 276, 133, - 134, 138, 0, 104, 103, 106, 90, 105, 89, 0, - 99, 270, 268, 0, 0, 0, 340, 0, 100, 146, - 147, 152, 0, 145, 0, 310, 311, 0, 338, 0, - 0, 340, 0, 101, 0, 0, 0, 313, 318, 316, - 319, 0, 0, 317, 318, 0, 314, 0, 315, 271, - 321, 0, 271, 320, 0, 323, 324, 0, 271, 325, - 326, 0, 0, 327, 0, 0, 0, 328, 329, 164, - 163, 0, 0, 0, 297, 0, 0, 0, 312, 284, - 277, 0, 285, 281, 0, 283, 273, 0, 274, 278, - 0, 0, 340, 0, 335, 93, 0, 0, 97, 84, - 0, 86, 95, 0, 87, 96, 98, 88, 94, 85, - 0, 91, 168, 166, 170, 167, 165, 169, 343, 6, - 344, 4, 2, 65, 92, 0, 0, 68, 70, 69, - 31, 5, 0, 66, 0, 45, 44, 43, 0, 0, - 58, 0, 59, 35, 36, 37, 38, 40, 41, 62, - 39, 0, 45, 0, 0, 0, 0, 0, 54, 0, - 55, 0, 0, 26, 0, 0, 63, 27, 0, 30, - 28, 24, 0, 29, 25, 0, 56, 0, 57, 146, - 0, 60, 64, 0, 0, 0, 0, 61, 0, 52, - 46, 53, 47, 0, 0, 0, 0, 49, 0, 50, - 51, 48, 0, 0, 146, 271, 0, 0, 42, 75, - 108, 275, 111, 136, 113, 114, 78, 118, 119, 120, - 123, 76, 79, 247, 81, 126, 74, 128, 77, 130, - 131, 276, 133, 134, 138, 0, 32, 33, 0, 34, - 8, 0, 10, 0, 9, 0, 1, 21, 12, 0, - 13, 0, 14, 0, 19, 20, 0, 15, 16, 0, - 17, 18, 11, 23, 7, 351}; + 0, 0, 28, 0, 0, 0, 28, 0, 184, 251, + 215, 223, 219, 163, 235, 211, 3, 148, 81, 164, + 227, 231, 152, 181, 162, 167, 147, 201, 188, 0, + 88, 89, 84, 0, 78, 73, 355, 0, 0, 0, + 0, 86, 0, 0, 82, 85, 77, 0, 0, 74, + 76, 79, 75, 87, 80, 0, 83, 0, 0, 177, + 0, 0, 164, 183, 166, 165, 0, 0, 0, 179, + 180, 178, 182, 0, 212, 0, 0, 0, 0, 202, + 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, + 186, 187, 185, 190, 194, 193, 191, 189, 204, 203, + 205, 0, 220, 0, 216, 0, 0, 158, 145, 157, + 146, 114, 115, 116, 141, 117, 142, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 143, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 144, 0, 0, 156, 252, 159, 0, 160, 0, + 161, 155, 0, 248, 241, 239, 246, 247, 245, 244, + 250, 243, 242, 240, 249, 236, 0, 224, 0, 0, + 228, 0, 0, 232, 0, 0, 158, 150, 0, 149, + 0, 154, 168, 0, 344, 344, 345, 0, 342, 0, + 343, 0, 346, 259, 266, 265, 273, 261, 0, 262, + 0, 347, 0, 354, 263, 264, 81, 269, 267, 351, + 348, 353, 270, 0, 281, 0, 0, 0, 0, 338, + 0, 355, 253, 295, 0, 0, 0, 282, 0, 0, + 271, 272, 0, 260, 268, 296, 297, 0, 344, 0, + 0, 346, 0, 339, 340, 0, 328, 352, 0, 312, + 313, 314, 315, 0, 308, 309, 310, 311, 336, 337, + 0, 0, 0, 0, 0, 300, 301, 302, 257, 255, + 217, 225, 221, 237, 213, 258, 0, 164, 229, 233, + 206, 195, 0, 0, 214, 0, 0, 0, 0, 207, + 0, 0, 0, 0, 0, 199, 197, 200, 198, 196, + 209, 208, 210, 0, 222, 0, 218, 0, 256, 164, + 0, 238, 253, 254, 0, 253, 0, 0, 304, 0, + 0, 0, 306, 0, 226, 0, 0, 230, 0, 0, + 234, 293, 0, 285, 294, 288, 0, 292, 0, 253, + 286, 0, 253, 0, 0, 305, 0, 0, 0, 307, + 0, 0, 0, 299, 0, 298, 81, 108, 356, 0, + 0, 113, 275, 278, 0, 114, 281, 117, 142, 119, + 120, 84, 124, 125, 78, 126, 129, 82, 85, 253, + 79, 87, 132, 80, 134, 83, 136, 137, 282, 139, + 140, 144, 0, 110, 109, 112, 96, 111, 95, 0, + 105, 276, 274, 0, 0, 0, 346, 0, 106, 152, + 153, 158, 0, 151, 0, 316, 317, 0, 344, 0, + 0, 346, 0, 107, 0, 0, 0, 319, 324, 322, + 325, 0, 0, 323, 324, 0, 320, 0, 321, 277, + 327, 0, 277, 326, 0, 329, 330, 0, 277, 331, + 332, 0, 0, 333, 0, 0, 0, 334, 335, 170, + 169, 0, 0, 0, 303, 0, 0, 0, 318, 290, + 283, 0, 291, 287, 0, 289, 279, 0, 280, 284, + 0, 0, 346, 0, 341, 99, 0, 0, 103, 90, + 0, 92, 101, 0, 93, 102, 104, 94, 100, 91, + 0, 97, 174, 172, 176, 173, 171, 175, 349, 6, + 350, 4, 2, 71, 98, 0, 0, 74, 76, 75, + 37, 5, 0, 72, 0, 51, 50, 49, 0, 0, + 64, 0, 65, 41, 42, 43, 44, 46, 47, 68, + 45, 0, 51, 0, 0, 0, 0, 0, 60, 0, + 61, 0, 0, 32, 0, 0, 69, 33, 0, 36, + 34, 30, 0, 35, 31, 0, 62, 0, 63, 152, + 0, 66, 70, 0, 0, 0, 0, 67, 0, 58, + 52, 59, 53, 0, 0, 0, 0, 55, 0, 56, + 57, 54, 0, 0, 152, 277, 0, 0, 48, 81, + 114, 281, 117, 142, 119, 120, 84, 124, 125, 126, + 129, 82, 85, 253, 87, 132, 80, 134, 83, 136, + 137, 282, 139, 140, 144, 0, 38, 39, 0, 40, + 8, 0, 0, 9, 0, 11, 0, 10, 0, 1, + 27, 15, 14, 26, 13, 12, 29, 7, 0, 18, + 0, 19, 0, 24, 25, 0, 20, 21, 0, 22, + 23, 16, 17, 357}; const short QQmlJSGrammar::goto_default [] = { - 7, 636, 211, 198, 209, 521, 509, 635, 654, 508, - 634, 632, 637, 22, 633, 18, 520, 562, 552, 559, - 554, 539, 193, 197, 199, 204, 234, 212, 231, 543, - 583, 582, 203, 233, 26, 487, 486, 359, 358, 9, - 357, 360, 202, 480, 361, 109, 17, 147, 24, 13, - 146, 19, 25, 59, 23, 8, 28, 27, 280, 15, - 274, 10, 270, 12, 272, 11, 271, 20, 278, 21, - 279, 14, 273, 269, 310, 414, 275, 276, 205, 195, - 194, 208, 207, 230, 196, 364, 363, 232, 471, 470, - 332, 333, 473, 335, 472, 334, 427, 431, 434, 430, - 429, 449, 450, 200, 186, 201, 210, 0}; + 7, 639, 211, 198, 209, 521, 509, 634, 647, 508, + 633, 637, 635, 643, 22, 640, 638, 636, 18, 520, + 562, 552, 559, 554, 539, 193, 197, 199, 204, 234, + 212, 231, 543, 583, 582, 203, 233, 26, 487, 486, + 359, 358, 9, 357, 360, 202, 480, 361, 109, 17, + 147, 24, 13, 146, 19, 25, 59, 23, 8, 28, + 27, 280, 15, 274, 10, 270, 12, 272, 11, 271, + 20, 278, 21, 279, 14, 273, 269, 310, 414, 275, + 276, 205, 195, 194, 208, 207, 230, 196, 364, 363, + 232, 471, 470, 332, 333, 473, 335, 472, 334, 427, + 431, 434, 430, 429, 449, 450, 200, 186, 201, 210, + 0}; const short QQmlJSGrammar::action_index [] = { - 235, 1289, 2663, 2663, 2562, 1005, 64, 90, 103, -105, - 88, 94, 79, 173, -105, 302, 69, -105, -105, 724, - 65, 135, 195, 239, -105, -105, -105, 367, 278, 1289, - -105, -105, -105, 485, -105, -105, 2360, 1772, 1289, 1289, - 1289, -105, 817, 1289, -105, -105, -105, 1289, 1289, -105, - -105, -105, -105, -105, -105, 1289, -105, 1289, 1289, -105, - 1289, 1289, 95, 207, -105, -105, 1289, 1289, 1289, -105, - -105, -105, 202, 1289, 300, 1289, 1289, 1289, 1289, 377, - 1289, 1289, 1289, 1289, 1289, 1289, 253, 1289, 1289, 1289, - 151, 147, 129, 196, 170, 199, 279, 270, 470, 470, - 387, 1289, 53, 1289, 80, 2158, 1289, 1289, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, -105, 128, 1289, -105, -105, 74, 52, -105, 1289, - -105, -105, 1289, -105, -105, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, 1289, 51, 1289, 1289, - 77, 66, 1289, -105, 2158, 1289, 1289, -105, 125, -105, - 48, -105, -105, 47, 451, 374, 83, 87, -105, 397, - -105, 62, 2663, -105, -105, -105, -105, -105, 205, -105, - 415, -105, 68, -105, -105, -105, 86, -105, -105, -105, - 2663, -105, -105, 622, -105, 576, 102, 2562, 75, 89, - 81, 2865, 1289, -105, 70, 1289, 63, -105, 92, 93, - -105, -105, 546, -105, -105, -105, -105, 91, 546, 40, - 45, 2663, 49, -105, -105, 2562, -105, -105, 106, -105, - -105, -105, -105, 121, -105, -105, -105, -105, -105, -105, - 42, 44, 1289, 114, 222, -105, -105, -105, 1481, -105, - 84, 57, 56, -105, 388, 78, 54, 682, 82, 99, - 357, 247, 546, 1289, 295, 1289, 1289, 1289, 1289, 334, - 1289, 1289, 1289, 1289, 1289, 203, 217, 244, 263, 211, - 341, 319, 351, 1289, 56, 1289, 73, 1289, -105, 724, - 1289, -105, 1289, 67, 46, 1289, 61, 2562, -105, 1289, - 136, 2562, -105, 1289, 76, 1289, 1289, 85, 59, 1289, - -105, 71, 133, 72, -105, -105, 1289, -105, 546, 1289, - -105, -53, 1289, -60, 2562, -105, 1289, 143, 2562, -105, - 1289, 132, 2562, 8, 2562, -105, 7, -105, 12, -37, - 107, -105, -105, 2562, -33, 622, 22, 555, 115, 1289, - 2562, 23, -13, 502, 2259, -10, 817, 18, 6, 1387, - 2259, 0, 9, -6, 1289, -4, -23, 1289, 5, 1289, - -25, -27, 2461, -105, -105, -105, -105, -105, -105, 1289, - -105, -105, -105, -3, -1, 21, 2663, 1, -105, 218, - -105, 1289, 4, -105, 111, -105, -105, 26, 466, 16, - 38, 2663, 39, -105, 1289, 110, 37, -105, 55, -105, - 60, 116, 1289, -105, 58, 43, -105, -15, -105, 2562, - -105, 123, 2562, -105, 154, -105, -105, 96, 2562, 32, - -105, 3, 14, -105, 546, -11, 13, -105, -105, -105, - -105, 1289, 126, 2562, -105, 1289, 130, 2562, -105, 15, - -105, 301, -105, -105, 1289, -105, -105, 546, -105, -105, - -45, -12, 2663, -24, -105, -105, 204, 1578, -105, -105, - 1869, -105, -105, 1675, -105, -105, -105, -105, -105, -105, - 101, -105, -105, -105, -105, -105, -105, -105, -105, -105, - 2663, -105, -105, -105, 105, 2, 910, 206, -47, -2, - -105, -105, 246, -105, 214, -105, -105, -105, 364, 232, - -105, 1963, -105, -105, -105, -105, -105, -105, -105, -105, - -105, 191, 24, 394, 172, -18, 384, 215, -105, -30, - -105, 910, 149, -105, -16, 910, -105, -105, 1100, -105, - -105, -105, 1195, -105, -105, 225, -105, 1963, -105, 316, - -17, -105, -105, 269, 418, -5, 1963, -105, 184, -105, - 175, -105, 20, -9, 546, 182, 469, -105, 104, -105, - -105, -105, 2057, 910, 292, 2764, 1772, 10, -105, 35, - 622, 34, 525, 98, 1289, 2562, 50, 17, 536, 19, - 817, 31, 27, 1387, 28, 9, 29, 1289, 30, 11, - 1289, 41, 1289, 33, 36, 137, -105, -105, 25, -105, - -105, 910, -105, 268, -86, 910, -105, -105, 141, 546, - -105, 156, -105, 117, -105, -105, 546, -105, -105, 138, - -105, -105, -105, -105, -105, -105, + 239, 1406, 2692, 2692, 2794, 1119, 115, 29, 168, -106, + 26, -23, -60, 225, -106, 306, 33, -106, -106, 732, + -2, 145, 243, 223, -106, -106, -106, 379, 227, 1406, + -106, -106, -106, 539, -106, -106, 2488, 1698, 1406, 1406, + 1406, -106, 1023, 1406, -106, -106, -106, 1406, 1406, -106, + -106, -106, -106, -106, -106, 1406, -106, 1406, 1406, -106, + 1406, 1406, 114, 206, -106, -106, 1406, 1406, 1406, -106, + -106, -106, 211, 1406, 302, 1406, 1406, 1406, 1406, 369, + 1406, 1406, 1406, 1406, 1406, 1406, 226, 1406, 1406, 1406, + 135, 151, 110, 257, 279, 276, 256, 222, 475, 475, + 475, 1406, 7, 1406, 57, 2284, 1406, 1406, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, 136, 1406, -106, -106, 30, -24, -106, 1406, + -106, -106, 1406, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, 1406, 2, 1406, 1406, + 10, 97, 1406, -106, 2284, 1406, 1406, -106, 141, -106, + -45, -106, -106, 4, 457, 386, 89, 79, -106, 448, + -106, 74, 2692, -106, -106, -106, -106, -106, 164, -106, + 460, -106, 85, -106, -106, -106, 96, -106, -106, -106, + 2692, -106, -106, 547, -106, 629, 143, 2794, 62, 54, + 43, 2998, 1406, -106, 51, 1406, 52, -106, 47, 45, + -106, -106, 454, -106, -106, -106, -106, 64, 352, 31, + 61, 2692, 27, -106, -106, 2794, -106, -106, 139, -106, + -106, -106, -106, 126, -106, -106, -106, -106, -106, -106, + -6, 25, 1406, 130, 159, -106, -106, -106, 1600, -106, + 68, 65, 5, -106, 308, 60, 3, 835, 99, 105, + 337, 207, 408, 1406, 317, 1406, 1406, 1406, 1406, 353, + 1406, 1406, 1406, 1406, 1406, 186, 203, 204, 212, 219, + 333, 343, 359, 1406, 20, 1406, 202, 1406, -106, 732, + 1406, -106, 1406, 81, 72, 1406, 77, 2794, -106, 1406, + 149, 2794, -106, 1406, 80, 1406, 1406, 94, 88, 1406, + -106, -8, 128, -25, -106, -106, 1406, -106, 471, 1406, + -106, -53, 1406, -56, 2794, -106, 1406, 134, 2794, -106, + 1406, 138, 2794, -5, 2794, -106, -4, -106, 9, -9, + 37, -106, -106, 2794, -12, 555, 32, 629, 123, 1406, + 2794, 41, 18, 504, 2386, 21, 1023, 49, 46, 1505, + 2386, 42, 16, 44, 1406, 24, -10, 1406, 17, 1406, + -15, -18, 2590, -106, -106, -106, -106, -106, -106, 1406, + -106, -106, -106, -1, -26, -3, 2692, -27, -106, 277, + -106, 1406, -28, -106, 90, -106, -106, 1, 552, -40, + -11, 2692, -29, -106, 1406, 117, 14, -106, 50, -106, + 40, 119, 1406, -106, 11, 35, -106, -54, -106, 2794, + -106, 116, 2794, -106, 267, -106, -106, 121, 2794, -7, + -106, -31, -19, -106, 376, 6, 78, -106, -106, -106, + -106, 1406, 98, 2794, -106, 1406, 106, 2794, -106, 76, + -106, 254, -106, -106, 1406, -106, -106, 552, -106, -106, + 71, 75, 2692, 67, -106, -106, 122, 1992, -106, -106, + 1796, -106, -106, 1894, -106, -106, -106, -106, -106, -106, + 113, -106, -106, -106, -106, -106, -106, -106, -106, -106, + 2692, -106, -106, -106, 111, 22, 929, 152, 39, 48, + -106, -106, 301, -106, 147, -106, -106, -106, 468, 155, + -106, 2182, -106, -106, -106, -106, -106, -106, -106, -106, + -106, 178, -30, 463, 181, -14, 400, 229, -106, -32, + -106, 929, 104, -106, 0, 929, -106, -106, 1311, -106, + -106, -106, 1215, -106, -106, 248, -106, 2182, -106, 392, + 59, -106, -106, 244, 552, 73, 2182, -106, 236, -106, + 237, -106, 70, 15, 368, 214, 355, -106, 103, -106, + -106, -106, 2087, 721, 392, 2896, 1698, 34, -106, 56, + 598, 55, 629, 107, 1406, 2794, 53, 23, 544, 36, + 1023, 58, 66, 1505, 69, 38, 63, 1406, 95, 84, + 1406, 102, 1406, 83, 82, 124, -106, -106, 87, -106, + -106, 929, 813, 91, 929, -106, 271, -106, 86, -106, + -106, 100, 101, -106, -106, -106, -106, -106, 552, -106, + 209, -106, 109, -106, -106, 552, -106, -106, 92, -106, + -106, -106, -106, -106, - -108, 0, 79, 128, 132, 301, 2, -108, -108, -108, - -108, -108, -108, -108, -108, -108, -108, -108, -108, -47, - -108, -108, -108, -108, -108, -108, -108, -108, -108, 51, - -108, -108, -108, -3, -108, -108, 8, -23, 12, 78, - 106, -108, 69, 74, -108, -108, -108, 195, 204, -108, - -108, -108, -108, -108, -108, 188, -108, 201, 200, -108, - 127, 129, -108, -108, -108, -108, 140, 137, 133, -108, - -108, -108, -108, 146, -108, 177, 168, 170, 167, -108, - 144, 152, 166, 158, 160, 131, -108, 194, 187, 207, - -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, - -108, 88, -108, 112, -108, 121, 90, -38, -108, -108, - -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, - -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, - -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, - -108, -108, -108, 32, -108, -108, -108, -108, -108, 26, - -108, -108, 27, -108, -108, -108, -108, -108, -108, -108, - -108, -108, -108, -108, -108, -108, 102, -108, 103, 41, - -108, -108, 37, -108, 250, 38, 83, -108, -108, -108, - -108, -108, -108, -108, 42, 126, -108, -108, -108, 40, - -108, -108, 43, -108, -108, -108, -108, -108, -108, -108, - 39, -108, -108, -108, -108, -108, -108, -108, -108, -108, - 225, -108, -108, 30, -108, 24, -108, 211, -108, 55, - -108, 77, 60, -108, -108, 66, 34, -108, -108, -108, - -108, -108, -8, -108, -108, -108, -108, -108, 153, -108, - -108, 164, -108, -108, -108, 241, -108, -108, -108, -108, - -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, - -108, -108, 11, -108, -108, -108, -108, -108, 179, -108, - -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, - -108, -108, 19, 259, -108, 255, 228, 240, 246, -108, - 52, 63, 67, 65, 50, -108, -108, -108, -108, -108, - -108, -108, -108, 210, -108, 256, -108, 226, -108, -108, - 252, -108, 161, -108, -108, 268, -108, 197, -108, 5, - -108, 218, -108, 222, -108, 213, 249, -108, -108, 236, - -108, -108, -108, -108, -108, -108, 212, -108, 80, 87, - -108, -108, 86, -108, 98, -108, 61, -108, 245, -108, - 59, -108, 208, -108, 192, -108, -108, -108, -108, -108, - -108, -108, -108, 257, -108, 33, -108, 28, -108, 73, - 71, -108, -108, 36, 57, -108, 62, -108, -108, 46, - 70, -108, -108, -108, 49, -108, 45, 99, -108, 84, - -108, -108, 100, -108, -108, -108, -108, -108, -108, 21, - -108, -108, -108, -108, -108, -108, 118, -108, -108, -108, - -108, 81, -108, -108, -108, -108, -108, -108, 123, -108, - -108, 134, -108, -108, 56, -108, -108, -108, -108, -108, - -58, -108, 47, -108, -57, -108, -108, -108, -108, 265, - -108, -108, 374, -108, -108, -108, -108, -108, 94, -66, - -108, -108, 25, -108, 22, -108, 31, -108, -108, -108, - -108, 58, -108, 229, -108, 35, -108, 235, -108, -108, - -108, -108, -108, -108, 29, -108, -108, 186, -108, -108, - -108, -108, 162, -108, -108, -108, -108, 48, -108, -108, - 163, -108, -108, 44, -108, -108, -108, -108, -108, -108, - -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, - 141, -108, -108, -108, -108, -108, -7, -108, -108, -108, - -108, -108, -108, -108, -19, -108, -108, -108, -6, -108, - -108, 334, -108, -108, -108, -108, -108, -108, -108, -108, - -108, -108, -108, -15, -27, -108, -10, -108, -108, -108, - -108, 159, -108, -108, -108, 176, -108, -108, 319, -108, - -108, -108, 322, -108, -108, -108, -108, 469, -108, -108, - 10, -108, -108, 6, 16, -108, 342, -108, -108, -108, - 17, -108, -108, -108, 15, 3, 9, -108, -108, -108, - -108, -108, 358, 68, -108, 82, 310, 1, -108, -108, - -2, -108, 7, -108, 54, 76, -108, -108, 4, -108, - 64, -108, -108, 23, -108, -108, -108, 18, -108, -5, - 95, -108, 91, -108, -108, -108, -108, -108, -1, -108, - -108, 20, -108, -108, 14, 142, -108, -108, -108, 13, - -108, -108, -108, -108, -108, -108, -11, -108, -108, -108, - -108, -108, -108, -108, -108, -108}; + -111, 43, 59, 70, 71, 369, 40, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, 21, + -111, -111, -111, -111, -111, -111, -111, -111, -111, 79, + -111, -111, -111, -16, -111, -111, 5, -26, 23, 73, + 91, -111, 83, 61, -111, -111, -111, 88, 87, -111, + -111, -111, -111, -111, -111, 29, -111, 66, 39, -111, + 97, 193, -111, -111, -111, -111, 160, 180, 183, -111, + -111, -111, -111, 176, -111, 167, 151, 155, 152, -111, + 148, 187, 195, 197, 199, 201, -111, 186, 92, 194, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, 103, -111, 108, -111, 181, -2, -42, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, 34, -111, -111, -111, -111, -111, 3, + -111, -111, 10, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, 127, -111, 109, 15, + -111, -111, 16, -111, 225, 44, 128, -111, -111, -111, + -111, -111, -111, -111, 25, 157, -111, -111, -111, 26, + -111, -111, 24, -111, -111, -111, -111, -111, -111, -111, + 22, -111, -111, -111, -111, -111, -111, -111, -111, -111, + 179, -111, -111, 45, -111, 46, -111, 107, -111, 48, + -111, 106, 62, -111, -111, 163, -3, -111, -111, -111, + -111, -111, -14, -111, -111, -111, -111, -111, 57, -111, + -111, 224, -111, -111, -111, 227, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, 35, -111, -111, -111, -111, -111, 72, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, 12, 264, -111, 258, 246, 254, 209, -111, + 60, 51, 52, 27, 53, -111, -111, -111, -111, -111, + -111, -111, -111, 244, -111, 255, -111, 203, -111, -111, + 207, -111, 217, -111, -111, 198, -111, 208, -111, 8, + -111, 215, -111, 232, -111, 233, 234, -111, -111, 223, + -111, -111, -111, -111, -111, -111, 230, -111, 95, 113, + -111, -111, 153, -111, 156, -111, 2, -111, 147, -111, + 58, -111, 137, -111, 100, -111, -111, -111, -111, -111, + -111, -111, -111, 135, -111, 41, -111, 54, -111, 117, + 162, -111, -111, 50, 169, -111, 174, -111, -111, 32, + 178, -111, -111, -111, 31, -111, 7, 144, -111, 130, + -111, -111, 142, -111, -111, -111, -111, -111, -111, 11, + -111, -111, -111, -111, -111, -111, 214, -111, -111, -111, + -111, 140, -111, -111, -111, -111, -111, -111, 158, -111, + -111, 149, -111, -111, 47, -111, -111, -111, -111, -111, + -55, -111, 38, -111, -67, -111, -111, -111, -111, 263, + -111, -111, 262, -111, -111, -111, -111, -111, 190, -76, + -111, -111, 30, -111, 19, -111, 14, -111, -111, -111, + -111, 33, -111, 272, -111, 64, -111, 175, -111, -111, + -111, -111, -111, -111, 18, -111, -111, 69, -111, -111, + -111, -111, 114, -111, -111, -111, -111, 20, -111, -111, + 110, -111, -111, 28, -111, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, + 86, -111, -111, -111, -111, -111, 55, -111, -111, -111, + -111, -111, -111, -111, -7, -111, -111, -111, 1, -111, + -111, 329, -111, -111, -111, -111, -111, -111, -111, -111, + -111, -111, -111, 0, -11, -111, -10, -111, -111, -111, + -111, 204, -111, -111, -111, 205, -111, -111, 317, -111, + -111, -111, 311, -111, -111, -111, -111, 370, -111, -111, + -9, -111, -111, -4, -12, -111, 337, -111, -111, -111, + -18, -111, -111, -111, -1, -17, -6, -111, -111, -111, + -111, -111, 466, 78, -111, 82, 307, -13, -111, -111, + -8, -111, 6, -111, 74, 76, -111, -111, 9, -111, + 85, -111, -111, 17, -111, -111, -111, 4, -111, -22, + 84, -111, 67, -111, -111, -111, -111, -111, 49, -111, + -111, 37, 42, 68, 77, -111, -111, -111, -111, -111, + -111, -111, -111, -111, -111, -111, -111, -111, 13, -111, + -111, -111, -111, -111, -111, 36, -111, -111, -111, -111, + -111, -111, -111, -111}; const short QQmlJSGrammar::action_info [] = { - 344, -127, 576, -129, 551, 631, 546, -105, 342, 465, - 448, 461, -132, -106, 245, 481, 558, 558, 398, 573, - 392, 482, 402, 268, 354, -124, 350, 578, 585, -135, - -116, 484, 474, 404, -106, -105, -127, -129, -124, 454, - 438, -135, 245, 558, 448, 424, 448, 448, -132, 456, - 439, 588, 452, 268, 406, 350, 408, -116, 558, 405, - 432, 544, 418, 432, 413, 432, 329, 166, 524, 461, - 428, 421, 465, 172, 283, 143, 420, 143, 241, 166, - 262, 73, 149, 185, 323, 283, 307, 323, 336, 73, - 655, 189, 0, 245, 423, 192, 448, 0, 0, 101, - 240, 0, 451, 346, 243, 303, 424, 315, 181, 143, - 0, 268, 151, 0, 399, 312, 452, 350, 143, 261, - 174, 317, 143, 244, 303, 184, 435, 238, 461, 465, - 442, 143, 103, 143, 143, 305, 143, 64, 143, 175, - 143, 338, 101, 60, 143, 555, 0, 191, 65, 325, - 0, 143, 0, 326, 61, 631, 174, 555, 103, 259, - 258, 501, 143, 259, 258, 590, 589, 252, 251, 60, - 426, 436, 416, 415, 264, 175, 259, 258, 645, 644, - 61, 179, 257, 256, 144, 168, 463, 60, 105, 169, - 467, 60, 352, 626, 339, 87, 321, 88, 61, 651, - 650, 525, 61, 348, 525, 556, 174, 106, 89, 107, - 174, 525, 490, 143, 66, 446, 445, 648, 647, 66, - 580, 87, 549, 88, 87, 175, 88, 411, 87, 175, - 88, 176, 567, 174, 89, 542, 87, 89, 88, 531, - 0, 89, 87, 525, 88, 581, 579, 527, 646, 89, - 527, 66, 175, 592, 411, 89, 0, 527, 526, 67, - 491, 526, 0, 0, 67, 68, 236, 235, 526, 87, - 68, 88, 87, 0, 88, 0, 550, 548, 87, 558, - 88, 527, 89, 267, 265, 89, 568, 566, 87, 527, - 88, 89, 526, 532, 530, 87, 67, 88, 525, 0, - 526, 89, 68, 87, 87, 88, 88, 174, 89, 477, - 0, 266, 0, 285, 286, 641, 89, 89, 75, 76, - 75, 76, 0, 0, 0, -92, 175, 0, 176, 642, - 640, 174, 6, 5, 4, 1, 3, 2, 0, 593, - 287, 288, 290, 291, 527, 77, 78, 77, 78, -92, - 175, 292, 176, 0, 293, 526, 294, 290, 291, 0, - 639, 0, 478, 476, 290, 291, 292, 0, 0, 293, - 0, 294, 0, 292, 290, 291, 293, 0, 294, 0, - 290, 291, 0, 292, 0, 0, 293, 0, 294, 292, - 80, 81, 293, 35, 294, 0, 0, 0, 82, 83, - 80, 81, 84, 35, 85, 0, 285, 286, 82, 83, - 80, 81, 84, 35, 85, 0, 0, 0, 82, 83, - 0, 0, 84, 35, 85, 0, 35, 0, 0, 0, - 49, 52, 50, 287, 288, 0, 0, 0, 0, 0, - 49, 52, 50, 0, 35, 0, 0, 35, 0, 0, - 49, 52, 50, 0, 0, 0, 0, 46, 34, 51, - 49, 52, 50, 49, 52, 50, 0, 46, 34, 51, - 0, 0, 0, 0, 0, 0, 0, 46, 34, 51, - 35, 49, 52, 50, 49, 52, 50, 46, 34, 51, - 46, 34, 51, 80, 81, 35, 0, 0, 35, 0, - 0, 82, 83, 0, 0, 84, 0, 85, 46, 34, - 51, 46, 34, 51, 35, 0, 0, 49, 52, 50, - 0, 184, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 35, 49, 52, 50, 49, 52, 50, 184, 0, - 0, 0, 0, 0, 46, 34, 51, 0, 0, 0, - 0, 49, 52, 50, 35, 0, 0, 0, 0, 46, - 34, 51, 46, 34, 51, 35, 0, 0, 49, 52, - 50, 0, 184, 0, 0, 35, 0, 0, 46, 34, - 51, 0, 0, 0, 35, 0, 255, 254, 0, 0, - 0, 49, 52, 50, 0, 46, 34, 51, 0, 0, - 0, 0, 49, 52, 50, 35, 0, 0, 0, 0, - 0, 0, 49, 52, 50, 0, 255, 254, 46, 34, - 51, 49, 52, 50, 0, 0, 0, 0, 0, 46, - 34, 51, 0, 0, 0, 0, 0, 255, 254, 46, - 34, 51, 49, 52, 50, 0, 0, 0, 46, 34, - 51, 35, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, - 34, 51, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 250, 249, 153, 0, 0, 49, 52, - 50, 0, 0, 0, 0, 154, 0, 0, 0, 155, - 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, - 157, 0, 0, 319, 0, 46, 34, 51, 0, 0, - 0, 158, 0, 159, 64, 0, 0, 153, 0, 0, - 0, 160, 0, 0, 161, 65, 0, 154, 0, 0, - 162, 155, 0, 0, 0, 0, 163, 0, 0, 0, - 156, 0, 157, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 164, 158, 0, 159, 64, 0, 0, 0, - 0, 0, 0, 160, 0, 0, 161, 65, 0, 0, - 0, 0, 162, 0, 0, 0, 0, 0, 163, 0, + 166, 438, 551, 245, 344, 454, 346, 544, 342, 336, + 546, 354, 166, 452, 448, 181, 432, 392, 465, 103, + 420, 461, 421, 448, -138, 101, 423, 73, 408, 663, + 406, -135, 413, 558, 405, 404, 151, 418, 149, -141, + 185, 143, 439, 402, 399, 432, 398, 428, -122, -111, + 101, -133, 424, -112, 268, 432, -130, 350, 73, 268, + -122, 262, -141, 245, 312, -130, 456, 558, 307, 283, + -133, 261, 350, -112, 424, 588, -111, 578, 585, 350, + 576, 465, 243, 461, 305, 448, 103, 424, 524, 143, + 184, 240, 558, 474, 241, 329, 323, 189, 268, 305, + 238, 323, -135, 245, 172, 573, 143, 192, 482, -138, + 0, 448, 555, 303, 143, 174, 174, 448, 465, 461, + 558, 143, 484, 442, 143, 143, 174, 451, 303, 435, + 490, 481, 555, 315, 175, 175, 338, 317, 143, 191, + 244, 452, 143, 0, 143, 175, 143, 662, 661, 143, + 60, 416, 415, 660, 659, 325, 64, 143, 463, 326, + 556, 61, 531, 0, 590, 589, 467, 65, 259, 258, + 654, 653, 143, 501, 436, 60, 525, 426, 491, 0, + 626, 542, 631, 632, 259, 258, 61, 257, 256, 339, + 264, 60, 144, 174, 348, 168, 0, 179, 352, 169, + 252, 251, 61, 283, 259, 258, 631, 632, 60, 321, + 525, 87, 175, 88, 411, 0, 532, 530, 66, 61, + 267, 265, 527, 66, 89, 236, 235, 527, 87, 87, + 88, 88, 87, 526, 88, 66, 549, 87, 526, 88, + 105, 89, 89, 525, 87, 89, 88, 87, 266, 88, + 89, 87, 87, 88, 88, 567, 527, 89, 174, 106, + 89, 107, 477, 67, 89, 89, 525, 526, 67, 68, + 657, 656, 580, 525, 68, 143, 0, 175, 0, 176, + 67, 87, 87, 88, 88, 0, 68, 0, 0, 527, + 550, 548, 174, 0, 89, 89, 0, 581, 579, 0, + 526, 87, 655, 88, 87, 0, 88, 0, 592, 568, + 566, 175, 527, 411, 89, 478, 476, 89, 650, 527, + 75, 76, 0, 526, 75, 76, 285, 286, 446, 445, + 526, 0, 651, 649, 558, 285, 286, 6, 5, 4, + 1, 3, 2, 0, 0, 0, 0, 77, 78, 0, + 0, 77, 78, 287, 288, 0, 290, 291, 0, 0, + 290, 291, 287, 288, 648, 292, 290, 291, 293, 292, + 294, 0, 293, 0, 294, 292, 290, 291, 293, 0, + 294, 35, 290, 291, 35, 292, 0, 0, 293, 0, + 294, 292, 80, 81, 293, 593, 294, 35, 0, 0, + 82, 83, 80, 81, 84, 35, 85, 174, 0, 0, + 82, 83, 0, 0, 84, 35, 85, 0, 49, 52, + 50, 49, 52, 50, 0, -98, 175, 0, 176, 35, + 0, 0, 0, 0, 49, 52, 50, 35, 0, 0, + 0, 0, 49, 52, 50, 0, 46, 34, 51, 46, + 34, 51, 49, 52, 50, 0, 0, 0, 0, 0, + 0, 0, 46, 34, 51, 0, 49, 52, 50, 0, + 46, 34, 51, 0, 49, 52, 50, 35, 0, 0, + 46, 34, 51, 35, 0, 0, 35, 0, 0, 35, + 0, 0, 35, 0, 46, 34, 51, 35, 80, 81, + 35, 0, 46, 34, 51, 0, 82, 83, 0, 0, + 84, 0, 85, 0, 49, 52, 50, 0, 0, 0, + 49, 52, 50, 49, 52, 50, 49, 52, 50, 49, + 52, 50, 0, 35, 49, 52, 50, 49, 52, 50, + 184, 0, 46, 34, 51, 0, 0, 0, 46, 34, + 51, 46, 34, 51, 46, 34, 51, 46, 34, 51, + 0, 0, 46, 34, 51, 46, 34, 51, 35, 0, + 49, 52, 50, 35, 0, 184, 35, 0, 0, 0, + 184, 35, 0, 0, 35, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 46, 34, + 51, 0, 0, 0, 0, 49, 52, 50, 250, 249, + 49, 52, 50, 49, 52, 50, 250, 249, 49, 52, + 50, 49, 52, 50, 0, 0, 0, 35, 0, 0, + 0, 0, 0, 46, 34, 51, 0, 0, 46, 34, + 51, 46, 34, 51, 0, 0, 46, 34, 51, 46, + 34, 51, 0, 0, 0, 0, 0, 0, 35, 250, + 249, 0, 0, 0, 49, 52, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, - 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, - 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, - 36, 37, 0, 38, 0, 0, 0, 0, 0, 0, - 42, 0, 0, 0, 45, 0, 0, 0, 0, 0, + 255, 254, 46, 34, 51, 49, 52, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 53, 49, 52, 50, 0, 54, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 44, 56, - 32, 0, 0, 0, 41, 0, 0, 0, 0, 0, - 46, 34, 51, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 30, 31, 0, 0, 0, 0, 0, 0, - 0, 0, 33, 0, 0, 0, 0, 0, 0, 35, - 0, 0, 0, 36, 37, 0, 38, 0, 0, 0, - 0, 0, 0, 516, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 53, 49, 52, 50, 0, - 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 44, 56, 32, 0, 0, 0, 41, 0, 0, 0, 0, 0, 46, 34, 51, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 515, 0, 30, 31, 0, - 0, 0, 0, 0, 0, 0, 0, 219, 0, 0, - 0, 0, 0, 0, 35, 0, 0, 0, 36, 37, - 0, 38, 0, 0, 0, 0, 0, 0, 516, 0, - 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 30, 31, 153, 0, 0, 0, 0, + 0, 0, 0, 33, 0, 154, 0, 0, 0, 155, + 35, 0, 0, 0, 36, 37, 0, 38, 156, 0, + 157, 0, 0, 0, 516, 0, 0, 0, 45, 0, + 0, 158, 0, 159, 64, 0, 0, 0, 0, 0, + 0, 160, 0, 0, 161, 65, 53, 49, 52, 50, + 162, 54, 0, 0, 0, 0, 163, 0, 0, 0, + 0, 0, 44, 56, 32, 0, 0, 0, 41, 0, + 0, 0, 164, 0, 0, 46, 34, 51, 0, 0, + 0, 0, 0, 0, 0, 30, 31, 0, 0, 0, + 0, 0, 0, 0, 0, 33, 0, 0, 153, 0, + 0, 0, 35, 0, 0, 0, 36, 37, 154, 38, + 0, 0, 155, 0, 0, 0, 516, 0, 0, 0, + 45, 156, 0, 157, 0, 0, 319, 0, 0, 0, + 0, 0, 0, 0, 158, 0, 159, 64, 53, 49, + 52, 50, 0, 54, 160, 0, 0, 161, 65, 0, + 0, 0, 0, 162, 44, 56, 32, 0, 0, 163, + 41, 0, 0, 0, 0, 0, 0, 46, 34, 51, + 0, 0, 0, 0, 0, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 53, 517, 519, 518, 0, 54, 0, 0, 0, 0, - 227, 0, 0, 0, 0, 0, 44, 56, 32, 214, - 0, 0, 41, 0, 0, 0, 0, 0, 46, 34, - 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 515, 0, 30, 31, 0, 0, 0, 0, 0, 0, - 0, 0, 219, 0, 0, 0, 0, 0, 0, 35, - 0, 0, 0, 36, 37, 0, 38, 0, 0, 0, - 0, 0, 0, 516, 0, 0, 0, 45, 0, 0, - 0, 0, 0, 0, 0, 560, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 53, 517, 519, 518, 0, - 54, 0, 0, 0, 0, 227, 0, 0, 0, 0, - 0, 44, 56, 32, 214, 0, 0, 41, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 30, 31, 0, 0, 0, 0, 0, 0, 0, + 0, 33, 0, 0, 0, 0, 0, 0, 35, 0, + 0, 0, 36, 37, 0, 38, 0, 0, 0, 0, + 0, 0, 516, 0, 0, 0, 45, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 53, 49, 52, 50, 0, 54, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 44, 56, 32, 0, 0, 0, 41, 0, 0, 0, + 0, 0, 0, 46, 34, 51, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 30, 31, 0, 0, 0, + 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, + 0, 0, 35, 0, 0, 0, 36, 37, 0, 38, + 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, + 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 53, 49, + 52, 50, 0, 54, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 44, 56, 32, 0, 0, 0, + 41, 0, 0, 0, 0, 0, 0, 46, 34, 51, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 515, + 0, 30, 31, 0, 0, 0, 0, 0, 0, 0, + 0, 219, 0, 0, 0, 0, 0, 0, 35, 0, + 0, 0, 36, 37, 0, 38, 0, 0, 0, 0, + 0, 0, 516, 0, 0, 0, 45, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 53, 517, 519, 518, 0, 54, + 0, 0, 0, 0, 227, 0, 0, 0, 0, 0, + 44, 56, 32, 214, 0, 0, 41, 0, 0, 0, 0, 0, 0, 46, 34, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 515, 0, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 219, 0, 0, @@ -478,84 +484,85 @@ const short QQmlJSGrammar::action_info [] = { 563, 0, 0, 0, 0, 0, 0, 0, 0, 0, 53, 517, 519, 518, 0, 54, 0, 0, 0, 0, 227, 0, 0, 0, 0, 0, 44, 56, 32, 214, - 0, 0, 41, 0, 0, 0, 0, 0, 46, 34, - 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, - 0, 33, 0, 0, 0, 0, 0, 0, 35, 0, - 0, 0, 36, 37, 0, 38, 0, 0, 0, 39, - 0, 40, 42, 43, 0, 0, 45, 0, 0, 0, - 47, 0, 48, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 53, 49, 52, 50, 0, 54, - 0, 55, 0, 57, 0, 58, 0, 0, 0, 0, - 44, 56, 32, 0, 0, 0, 41, 0, 0, 0, - 0, 0, 46, 34, 51, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -125, 0, 0, 0, 29, 30, - 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, - 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, - 36, 37, 0, 38, 0, 0, 0, 39, 0, 40, - 42, 43, 0, 0, 45, 0, 0, 0, 47, 0, - 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 53, 49, 52, 50, 0, 54, 0, 55, - 0, 57, 0, 58, 0, 0, 0, 0, 44, 56, - 32, 0, 0, 0, 41, 0, 0, 0, 0, 0, - 46, 34, 51, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, - 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, + 0, 0, 41, 0, 0, 0, 0, 0, 0, 46, + 34, 51, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 515, 0, 30, 31, 0, 0, 0, 0, 0, + 0, 0, 0, 219, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 36, 37, 0, 38, 0, 0, - 0, 39, 0, 40, 42, 43, 0, 0, 45, 0, - 0, 0, 47, 0, 48, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 53, 49, 52, 50, - 0, 54, 0, 55, 0, 57, 282, 58, 0, 0, - 0, 0, 44, 56, 32, 0, 0, 0, 41, 0, + 0, 0, 0, 0, 516, 0, 0, 0, 45, 0, + 0, 0, 0, 0, 0, 0, 560, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 53, 517, 519, 518, + 0, 54, 0, 0, 0, 0, 227, 0, 0, 0, + 0, 0, 44, 56, 32, 214, 0, 0, 41, 0, + 0, 0, 0, 0, 0, 46, 34, 51, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, + 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, + 0, 0, 0, 0, 0, 35, 0, 0, 0, 36, + 37, 0, 38, 0, 0, 0, 39, 0, 40, 42, + 43, 0, 0, 45, 0, 0, 0, 47, 0, 48, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 53, 49, 52, 50, 0, 54, 0, 55, 0, + 57, 0, 58, 0, 0, 0, 0, 44, 56, 32, + 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, + 46, 34, 51, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -131, 0, 0, 0, 29, 30, 31, 0, + 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, + 0, 0, 0, 0, 35, 0, 0, 0, 36, 37, + 0, 38, 0, 0, 0, 39, 0, 40, 42, 43, + 0, 0, 45, 0, 0, 0, 47, 0, 48, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 53, 49, 52, 50, 0, 54, 0, 55, 0, 57, + 0, 58, 0, 0, 0, 0, 44, 56, 32, 0, + 0, 0, 41, 0, 0, 0, 0, 0, 0, 46, + 34, 51, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, + 0, 0, 33, 0, 0, 0, 0, 0, 0, 35, + 0, 0, 0, 36, 37, 0, 38, 0, 0, 0, + 39, 0, 40, 42, 43, 0, 0, 45, 0, 0, + 0, 47, 0, 48, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 53, 49, 52, 50, 0, + 54, 0, 55, 0, 57, 282, 58, 0, 0, 0, + 0, 44, 56, 32, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 46, 34, 51, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 496, 0, 0, 29, + 0, 0, 0, 0, 0, 0, 488, 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 36, 37, 0, 38, 0, 0, 0, 39, 0, 40, 42, 43, 0, 0, 45, 0, 0, 0, 47, - 0, 48, 0, 0, 499, 0, 0, 0, 0, 0, + 0, 48, 0, 0, 489, 0, 0, 0, 0, 0, 0, 0, 0, 53, 49, 52, 50, 0, 54, 0, 55, 0, 57, 0, 58, 0, 0, 0, 0, 44, 56, 32, 0, 0, 0, 41, 0, 0, 0, 0, - 0, 46, 34, 51, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 496, 0, 0, 29, 30, 31, 0, - 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, - 0, 0, 0, 0, 35, 0, 0, 0, 36, 37, - 0, 38, 0, 0, 0, 39, 0, 40, 42, 43, - 0, 0, 45, 0, 0, 0, 47, 0, 48, 0, - 0, 497, 0, 0, 0, 0, 0, 0, 0, 0, - 53, 49, 52, 50, 0, 54, 0, 55, 0, 57, - 0, 58, 0, 0, 0, 0, 44, 56, 32, 0, - 0, 0, 41, 0, 0, 0, 0, 0, 46, 34, + 0, 0, 46, 34, 51, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 488, 0, 0, 29, 30, 31, + 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, + 0, 0, 0, 0, 0, 35, 0, 0, 0, 36, + 37, 0, 38, 0, 0, 0, 39, 0, 40, 42, + 43, 0, 0, 45, 0, 0, 0, 47, 0, 48, + 0, 0, 494, 0, 0, 0, 0, 0, 0, 0, + 0, 53, 49, 52, 50, 0, 54, 0, 55, 0, + 57, 0, 58, 0, 0, 0, 0, 44, 56, 32, + 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, + 46, 34, 51, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 496, 0, 0, 29, 30, 31, 0, 0, + 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, + 0, 0, 0, 35, 0, 0, 0, 36, 37, 0, + 38, 0, 0, 0, 39, 0, 40, 42, 43, 0, + 0, 45, 0, 0, 0, 47, 0, 48, 0, 0, + 497, 0, 0, 0, 0, 0, 0, 0, 0, 53, + 49, 52, 50, 0, 54, 0, 55, 0, 57, 0, + 58, 0, 0, 0, 0, 44, 56, 32, 0, 0, + 0, 41, 0, 0, 0, 0, 0, 0, 46, 34, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 488, 0, 0, 29, 30, 31, 0, 0, 0, 0, + 496, 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 36, 37, 0, 38, 0, 0, 0, 39, 0, 40, 42, 43, 0, 0, 45, - 0, 0, 0, 47, 0, 48, 0, 0, 489, 0, + 0, 0, 0, 47, 0, 48, 0, 0, 499, 0, 0, 0, 0, 0, 0, 0, 0, 53, 49, 52, 50, 0, 54, 0, 55, 0, 57, 0, 58, 0, 0, 0, 0, 44, 56, 32, 0, 0, 0, 41, - 0, 0, 0, 0, 0, 46, 34, 51, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 488, 0, 0, - 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, - 0, 33, 0, 0, 0, 0, 0, 0, 35, 0, - 0, 0, 36, 37, 0, 38, 0, 0, 0, 39, - 0, 40, 42, 43, 0, 0, 45, 0, 0, 0, - 47, 0, 48, 0, 0, 494, 0, 0, 0, 0, - 0, 0, 0, 0, 53, 49, 52, 50, 0, 54, - 0, 55, 0, 57, 0, 58, 0, 0, 0, 0, - 44, 56, 32, 0, 0, 0, 41, 0, 0, 0, - 0, 0, 46, 34, 51, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 29, 30, 31, 0, 0, 0, - 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, - 0, 0, 35, 220, 0, 0, 221, 37, 0, 38, - 0, 0, 0, 39, 0, 40, 42, 43, 0, 0, - 45, 0, 0, 0, 47, 0, 48, 0, 0, 0, - 0, 0, 0, 0, 223, 0, 0, 0, 53, 49, - 52, 50, 224, 54, 0, 55, 226, 57, 0, 58, - 0, 229, 0, 0, 44, 56, 32, 0, 0, 0, - 41, 0, 0, 0, 0, 0, 46, 34, 51, 0, + 0, 0, 0, 0, 0, 0, 46, 34, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 35, 220, 0, 0, @@ -565,139 +572,150 @@ const short QQmlJSGrammar::action_info [] = { 0, 0, 53, 49, 52, 50, 224, 54, 0, 55, 226, 57, 0, 58, 0, 229, 0, 0, 44, 56, 32, 0, 0, 0, 41, 0, 0, 0, 0, 0, + 0, 46, 34, 51, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 29, 30, 31, 0, 0, 0, 0, + 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, + 0, 35, 220, 0, 0, 221, 37, 0, 38, 0, + 0, 0, 39, 0, 40, 42, 43, 0, 0, 45, + 0, 0, 0, 47, 0, 48, 0, 0, 0, 0, + 0, 0, 0, 223, 0, 0, 0, 53, 49, 52, + 50, 224, 54, 0, 55, 226, 57, 0, 58, 0, + 229, 0, 0, 44, 56, 32, 0, 0, 0, 41, + 0, 0, 0, 0, 0, 0, 46, 34, 51, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 111, 112, + 113, 0, 0, 115, 117, 118, 0, 0, 119, 0, + 120, 0, 0, 0, 122, 123, 124, 0, 0, 0, + 0, 0, 0, 35, 125, 126, 127, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 131, 0, 0, 0, 0, 0, 0, + 49, 52, 50, 132, 133, 134, 0, 136, 137, 138, + 139, 140, 141, 0, 0, 129, 135, 121, 114, 116, + 130, 0, 0, 0, 0, 0, 0, 0, 46, 34, + 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 111, 112, 113, 0, 0, 115, 117, 118, 0, 0, + 119, 0, 120, 0, 0, 0, 122, 123, 124, 0, + 0, 0, 0, 0, 0, 35, 125, 126, 127, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 395, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 131, 0, 0, 0, 0, + 0, 397, 49, 52, 50, 132, 133, 134, 0, 136, + 137, 138, 139, 140, 141, 0, 0, 129, 135, 121, + 114, 116, 130, 0, 0, 0, 0, 0, 0, 0, 46, 34, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, 112, 113, 0, 0, 115, 117, 118, 0, 0, 119, 0, 120, 0, 0, 0, 122, 123, 124, 0, 0, 0, 0, 0, 0, 35, 125, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 128, 0, 0, 0, 395, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 0, 0, - 0, 0, 0, 0, 49, 52, 50, 132, 133, 134, + 0, 0, 0, 397, 49, 52, 50, 132, 133, 134, 0, 136, 137, 138, 139, 140, 141, 0, 0, 129, 135, 121, 114, 116, 130, 0, 0, 0, 0, 0, - 0, 46, 34, 51, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 111, 112, 113, 0, 0, 115, 117, - 118, 0, 0, 119, 0, 120, 0, 0, 0, 122, - 123, 124, 0, 0, 0, 0, 0, 0, 35, 125, - 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 128, 0, 0, 0, 395, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 131, 0, - 0, 0, 0, 0, 397, 49, 52, 50, 132, 133, - 134, 0, 136, 137, 138, 139, 140, 141, 0, 0, - 129, 135, 121, 114, 116, 130, 0, 0, 0, 0, - 0, 0, 46, 34, 51, 0, 0, 0, 0, 0, + 0, 0, 46, 374, 380, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, 112, 113, 0, 0, 115, 117, 118, 0, 0, 119, 0, 120, 0, 0, 0, 122, 123, 124, 0, 0, 0, 0, 0, 0, 35, 125, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 395, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, + 0, 0, 0, 0, 0, 396, 0, 0, 0, 131, 0, 0, 0, 0, 0, 397, 49, 52, 50, 132, 133, 134, 0, 136, 137, 138, 139, 140, 141, 0, 0, 129, 135, 121, 114, 116, 130, 0, 0, 0, - 0, 0, 0, 46, 374, 380, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 111, 112, 113, 0, 0, - 115, 117, 118, 0, 0, 119, 0, 120, 0, 0, - 0, 122, 123, 124, 0, 0, 0, 0, 0, 0, - 35, 125, 126, 127, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 0, 0, 0, 395, 0, - 0, 0, 0, 0, 0, 0, 396, 0, 0, 0, - 131, 0, 0, 0, 0, 0, 397, 49, 52, 50, - 132, 133, 134, 0, 136, 137, 138, 139, 140, 141, - 0, 0, 129, 135, 121, 114, 116, 130, 0, 0, 0, 0, 0, 0, 46, 374, 380, 0, 0, 0, 0, 0, 0, 0, 0, 0, 213, 0, 0, 0, 0, 215, 0, 29, 30, 31, 217, 0, 0, 0, - 0, 0, 0, 218, 33, 0, 0, 0, 0, 0, + 0, 0, 0, 218, 219, 0, 0, 0, 0, 0, 0, 35, 220, 0, 0, 221, 37, 0, 38, 0, 0, 0, 39, 0, 40, 42, 43, 0, 0, 45, 0, 0, 0, 47, 0, 48, 0, 0, 0, 0, 0, 222, 0, 223, 0, 0, 0, 53, 49, 52, 50, 224, 54, 225, 55, 226, 57, 227, 58, 228, 229, 0, 0, 44, 56, 32, 214, 216, 0, 41, - 0, 0, 0, 0, 0, 46, 34, 51, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 213, 0, 0, - 0, 0, 215, 0, 29, 30, 31, 217, 0, 0, - 0, 0, 0, 0, 218, 219, 0, 0, 0, 0, - 0, 0, 35, 220, 0, 0, 221, 37, 0, 38, - 0, 0, 0, 39, 0, 40, 42, 43, 0, 0, - 45, 0, 0, 0, 47, 0, 48, 0, 0, 0, - 0, 0, 222, 0, 223, 0, 0, 0, 53, 49, - 52, 50, 224, 54, 225, 55, 226, 57, 227, 58, - 228, 229, 0, 0, 44, 56, 32, 214, 216, 0, - 41, 0, 0, 0, 0, 0, 46, 34, 51, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 600, 112, - 113, 0, 0, 602, 117, 604, 30, 31, 605, 0, - 120, 0, 0, 0, 122, 607, 608, 0, 0, 0, - 0, 0, 0, 35, 609, 126, 127, 221, 37, 0, - 38, 0, 0, 0, 39, 0, 40, 610, 43, 0, - 0, 612, 0, 0, 0, 47, 0, 48, 0, 0, - 0, 0, 0, 613, 0, 223, 0, 0, 0, 614, - 49, 52, 50, 615, 616, 617, 55, 619, 620, 621, - 622, 623, 624, 0, 0, 611, 618, 606, 601, 603, - 130, 41, 0, 0, 0, 0, 0, 46, 374, 380, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 365, - 112, 113, 0, 0, 367, 117, 369, 30, 31, 370, - 0, 120, 0, 0, 0, 122, 372, 373, 0, 0, - 0, 0, 0, 0, 35, 375, 126, 127, 221, 37, - 0, 38, 0, 0, 0, 39, 0, 40, 376, 43, - 0, 0, 378, 0, 0, 0, 47, 0, 48, 0, - -271, 0, 0, 0, 379, 0, 223, 0, 0, 0, - 381, 49, 52, 50, 382, 383, 384, 55, 386, 387, - 388, 389, 390, 391, 0, 0, 377, 385, 371, 366, - 368, 130, 41, 0, 0, 0, 0, 0, 46, 374, - 380, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 46, 34, 51, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 213, 0, + 0, 0, 0, 215, 0, 29, 30, 31, 217, 0, + 0, 0, 0, 0, 0, 218, 33, 0, 0, 0, + 0, 0, 0, 35, 220, 0, 0, 221, 37, 0, + 38, 0, 0, 0, 39, 0, 40, 42, 43, 0, + 0, 45, 0, 0, 0, 47, 0, 48, 0, 0, + 0, 0, 0, 222, 0, 223, 0, 0, 0, 53, + 49, 52, 50, 224, 54, 225, 55, 226, 57, 227, + 58, 228, 229, 0, 0, 44, 56, 32, 214, 216, + 0, 41, 0, 0, 0, 0, 0, 0, 46, 34, + 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 600, 112, 113, 0, 0, 602, 117, 604, 30, 31, + 605, 0, 120, 0, 0, 0, 122, 607, 608, 0, + 0, 0, 0, 0, 0, 35, 609, 126, 127, 221, + 37, 0, 38, 0, 0, 0, 39, 0, 40, 610, + 43, 0, 0, 612, 0, 0, 0, 47, 0, 48, + 0, 0, 0, 0, 0, 613, 0, 223, 0, 0, + 0, 614, 49, 52, 50, 615, 616, 617, 55, 619, + 620, 621, 622, 623, 624, 0, 0, 611, 618, 606, + 601, 603, 130, 41, 0, 0, 0, 0, 0, 0, + 46, 374, 380, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 365, 112, 113, 0, 0, 367, 117, 369, + 30, 31, 370, 0, 120, 0, 0, 0, 122, 372, + 373, 0, 0, 0, 0, 0, 0, 35, 375, 126, + 127, 221, 37, 0, 38, 0, 0, 0, 39, 0, + 40, 376, 43, 0, 0, 378, 0, 0, 0, 47, + 0, 48, 0, -277, 0, 0, 0, 379, 0, 223, + 0, 0, 0, 381, 49, 52, 50, 382, 383, 384, + 55, 386, 387, 388, 389, 390, 391, 0, 0, 377, + 385, 371, 366, 368, 130, 41, 0, 0, 0, 0, + 0, 0, 46, 374, 380, 0, 0, 0, 0, 0, + 0, 0, 0, 0, - 565, 148, 545, 16, 649, 547, 541, 469, 320, 529, - 528, 630, 183, 248, 263, 500, 485, 447, 629, 183, - 627, 444, 253, 393, 587, 652, 313, 152, 643, 572, - 591, 575, 586, 638, 331, 574, 453, 455, 466, 253, - 437, 178, 433, 253, 0, 248, 584, 458, 248, 313, - 441, 183, 444, 457, 237, 190, 447, 188, 206, 425, - 400, 462, 351, 313, 347, 150, 165, 447, 475, 444, - 183, 145, 393, 260, 0, 409, 173, 409, 260, 362, - 171, 514, 409, 495, 362, 393, 206, 498, 628, 313, - 313, 206, 356, 142, 206, 331, 362, 599, 403, 0, - 345, 62, 62, 62, 182, 62, 299, 182, 295, 206, - 410, 417, 410, 206, 62, 393, 62, 410, 62, 296, - 148, 298, 148, 297, 62, 62, 182, 504, 412, 62, - 180, 502, 511, 206, 512, 62, 108, 460, 188, 62, - 394, 188, 62, 206, 460, 247, 62, 206, 459, 206, - 62, 102, 459, 62, 62, 514, 206, 62, 653, 503, - 407, 343, 341, 62, 313, 110, 419, 167, 188, 187, - 170, 340, 514, 104, 0, 553, 422, 206, 62, 206, - 62, 63, 62, 72, 62, 510, 71, 97, 62, 514, - 70, 62, 557, 69, 355, 62, 239, 62, 493, 318, - 86, 469, 492, 62, 483, 74, 242, 206, 93, 62, - 353, 62, 206, 260, 95, 0, 96, 62, 62, 62, - 322, 62, 94, 206, 100, 98, 206, 99, 62, 247, - 277, 464, 0, 206, 79, 281, 314, 468, 62, 62, - 206, 507, 91, 246, 206, 62, 62, 349, 505, 90, - 206, 62, 62, 460, 459, 62, 206, 506, 62, 401, - 206, 62, 92, 309, 62, 108, 281, 362, 281, 281, - 0, 313, 206, 62, 304, 479, 0, 309, 281, 62, - 206, 327, 281, 0, 281, 337, 300, 309, 324, 0, - 0, 62, 281, 0, 110, 177, 281, 62, 301, 308, - 309, 0, 281, 309, 302, 281, 62, 62, 281, 330, - 62, 281, 281, 289, 514, 281, 0, 0, 306, 284, - 0, 522, 328, 569, 561, 311, 553, 564, 625, 0, - 0, 0, 514, 513, 523, 514, 0, 0, 0, 522, - 0, 0, 522, 316, 0, 0, 0, 0, 0, 485, - 440, 513, 523, 0, 513, 523, 533, 534, 535, 536, - 540, 537, 538, 577, 533, 534, 535, 536, 540, 537, - 538, 594, 0, 0, 0, 0, 362, 0, 597, 598, - 533, 534, 535, 536, 540, 537, 538, 0, 0, 206, + 148, 142, 183, 447, 469, 347, 575, 444, 547, 627, + 248, 320, 587, 572, 584, 586, 485, 591, 565, 529, + 313, 545, 447, 393, 253, 528, 500, 183, 574, 453, + 331, 652, 447, 437, 444, 313, 462, 455, 263, 457, + 237, 441, 206, 188, 190, 150, 16, 178, 433, 630, + 425, 641, 165, 400, 658, 458, 642, 171, 173, 248, + 475, 351, 498, 248, 253, 313, 183, 466, 183, 541, + 495, 629, 253, 512, 511, 188, 145, 206, 260, 645, + 644, 62, 0, 62, 362, 507, 298, 469, 206, 206, + 247, 514, 514, 62, 206, 460, 646, 409, 152, 409, + 599, 628, 355, 239, 206, 62, 62, 62, 362, 260, + 296, 297, 299, 331, 62, 62, 313, 504, 206, 295, + 62, 62, 459, 460, 356, 206, 277, 62, 62, 502, + 182, 281, 206, 62, 410, 182, 410, 401, 62, 353, + 459, 62, 62, 506, 505, 62, 62, 503, 493, 349, + 91, 62, 492, 206, 63, 206, 313, 62, 345, 483, + 393, 479, 62, 62, 260, 206, 444, 206, 510, 102, + 148, 62, 104, 182, 206, 188, 188, 468, 180, 170, + 206, 62, 148, 247, 62, 394, 460, 393, 409, 340, + 412, 341, 362, 206, 422, 167, 393, 206, 62, 108, + 459, 313, 62, 187, 419, 62, 62, 86, 206, 62, + 318, 98, 100, 403, 62, 99, 69, 322, 514, 514, + 313, 62, 417, 553, 557, 410, 206, 79, 110, 246, + 62, 343, 206, 206, 62, 0, 70, 62, 74, 71, + 62, 62, 206, 108, 90, 206, 93, 62, 62, 62, + 72, 62, 92, 62, 94, 62, 95, 309, 96, 407, + 97, 309, 281, 62, 362, 362, 281, 0, 281, 242, + 302, 0, 110, 177, 464, 0, 316, 309, 0, 308, + 206, 206, 281, 311, 309, 0, 62, 62, 309, 281, + 206, 281, 281, 281, 0, 314, 0, 0, 62, 330, + 62, 324, 0, 281, 327, 281, 337, 300, 62, 62, + 328, 304, 62, 281, 281, 301, 564, 281, 62, 289, + 306, 569, 561, 281, 0, 514, 553, 284, 625, 0, + 0, 514, 0, 0, 522, 0, 0, 0, 0, 0, + 522, 0, 0, 0, 0, 0, 513, 523, 0, 485, + 443, 440, 513, 523, 533, 534, 535, 536, 540, 537, + 538, 577, 533, 534, 535, 536, 540, 537, 538, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 514, 569, 0, 0, 0, 0, 0, + 0, 0, 522, 570, 571, 533, 534, 535, 536, 540, + 537, 538, 0, 0, 513, 523, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 443, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 569, 0, 0, 0, 0, 0, 0, 570, - 571, 533, 534, 535, 536, 540, 537, 538, 0, 0, + 594, 0, 0, 0, 0, 0, 0, 0, 0, 597, + 598, 533, 534, 535, 536, 540, 537, 538, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -708,126 +726,128 @@ const short QQmlJSGrammar::action_info [] = { 0, 0, 0, 0, 0, 0, 0}; const short QQmlJSGrammar::action_check [] = { - 60, 7, 7, 7, 34, 91, 24, 7, 61, 36, - 33, 36, 7, 7, 7, 60, 33, 33, 55, 66, - 8, 33, 55, 36, 16, 7, 36, 29, 8, 7, - 7, 55, 17, 36, 7, 7, 7, 7, 7, 36, - 55, 7, 7, 33, 33, 36, 33, 33, 7, 60, - 7, 60, 20, 36, 33, 36, 55, 7, 33, 60, - 5, 37, 36, 5, 60, 5, 7, 2, 66, 36, - 33, 33, 36, 7, 1, 8, 60, 8, 33, 2, - 36, 1, 8, 36, 2, 1, 8, 2, 17, 1, - 0, 8, -1, 7, 55, 33, 33, -1, -1, 48, - 60, -1, 6, 31, 55, 48, 36, 61, 60, 8, - -1, 36, 60, -1, 7, 61, 20, 36, 8, 77, - 15, 60, 8, 55, 48, 36, 10, 36, 36, 36, - 7, 8, 79, 8, 8, 79, 8, 42, 8, 34, - 8, 8, 48, 40, 8, 8, -1, 60, 53, 50, - -1, 8, -1, 54, 51, 91, 15, 8, 79, 61, - 62, 60, 8, 61, 62, 61, 62, 61, 62, 40, - 60, 55, 61, 62, 60, 34, 61, 62, 61, 62, - 51, 56, 61, 62, 56, 50, 60, 40, 15, 54, - 60, 40, 60, 56, 61, 25, 60, 27, 51, 61, - 62, 29, 51, 60, 29, 56, 15, 34, 38, 36, - 15, 29, 8, 8, 12, 61, 62, 61, 62, 12, - 36, 25, 7, 27, 25, 34, 27, 36, 25, 34, - 27, 36, 7, 15, 38, 29, 25, 38, 27, 7, - -1, 38, 25, 29, 27, 61, 62, 75, 92, 38, - 75, 12, 34, 7, 36, 38, -1, 75, 86, 57, - 56, 86, -1, -1, 57, 63, 61, 62, 86, 25, - 63, 27, 25, -1, 27, -1, 61, 62, 25, 33, - 27, 75, 38, 61, 62, 38, 61, 62, 25, 75, - 27, 38, 86, 61, 62, 25, 57, 27, 29, -1, - 86, 38, 63, 25, 25, 27, 27, 15, 38, 8, - -1, 89, -1, 18, 19, 47, 38, 38, 18, 19, - 18, 19, -1, -1, -1, 33, 34, -1, 36, 61, - 62, 15, 97, 98, 99, 100, 101, 102, -1, 93, - 45, 46, 23, 24, 75, 45, 46, 45, 46, 33, - 34, 32, 36, -1, 35, 86, 37, 23, 24, -1, - 92, -1, 61, 62, 23, 24, 32, -1, -1, 35, - -1, 37, -1, 32, 23, 24, 35, -1, 37, -1, - 23, 24, -1, 32, -1, -1, 35, -1, 37, 32, - 23, 24, 35, 29, 37, -1, -1, -1, 31, 32, - 23, 24, 35, 29, 37, -1, 18, 19, 31, 32, - 23, 24, 35, 29, 37, -1, -1, -1, 31, 32, - -1, -1, 35, 29, 37, -1, 29, -1, -1, -1, - 66, 67, 68, 45, 46, -1, -1, -1, -1, -1, - 66, 67, 68, -1, 29, -1, -1, 29, -1, -1, - 66, 67, 68, -1, -1, -1, -1, 93, 94, 95, - 66, 67, 68, 66, 67, 68, -1, 93, 94, 95, - -1, -1, -1, -1, -1, -1, -1, 93, 94, 95, - 29, 66, 67, 68, 66, 67, 68, 93, 94, 95, - 93, 94, 95, 23, 24, 29, -1, -1, 29, -1, - -1, 31, 32, -1, -1, 35, -1, 37, 93, 94, - 95, 93, 94, 95, 29, -1, -1, 66, 67, 68, - -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 29, 66, 67, 68, 66, 67, 68, 36, -1, - -1, -1, -1, -1, 93, 94, 95, -1, -1, -1, - -1, 66, 67, 68, 29, -1, -1, -1, -1, 93, - 94, 95, 93, 94, 95, 29, -1, -1, 66, 67, - 68, -1, 36, -1, -1, 29, -1, -1, 93, 94, - 95, -1, -1, -1, 29, -1, 61, 62, -1, -1, - -1, 66, 67, 68, -1, 93, 94, 95, -1, -1, - -1, -1, 66, 67, 68, 29, -1, -1, -1, -1, - -1, -1, 66, 67, 68, -1, 61, 62, 93, 94, - 95, 66, 67, 68, -1, -1, -1, -1, -1, 93, - 94, 95, -1, -1, -1, -1, -1, 61, 62, 93, - 94, 95, 66, 67, 68, -1, -1, -1, 93, 94, - 95, 29, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 93, - 94, 95, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 61, 62, 3, -1, -1, 66, 67, - 68, -1, -1, -1, -1, 13, -1, -1, -1, 17, - -1, -1, -1, -1, -1, -1, -1, -1, 26, -1, - 28, -1, -1, 31, -1, 93, 94, 95, -1, -1, - -1, 39, -1, 41, 42, -1, -1, 3, -1, -1, - -1, 49, -1, -1, 52, 53, -1, 13, -1, -1, - 58, 17, -1, -1, -1, -1, 64, -1, -1, -1, - 26, -1, 28, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 80, 39, -1, 41, 42, -1, -1, -1, - -1, -1, -1, 49, -1, -1, 52, 53, -1, -1, - -1, -1, 58, -1, -1, -1, -1, -1, 64, -1, + 2, 55, 34, 7, 60, 36, 31, 37, 61, 17, + 24, 16, 2, 20, 33, 60, 5, 8, 36, 79, + 60, 36, 33, 33, 7, 48, 55, 1, 55, 0, + 33, 7, 60, 33, 60, 36, 60, 36, 8, 7, + 36, 8, 7, 55, 7, 5, 55, 33, 7, 7, + 48, 7, 36, 7, 36, 5, 7, 36, 1, 36, + 7, 36, 7, 7, 61, 7, 60, 33, 8, 1, + 7, 77, 36, 7, 36, 60, 7, 29, 8, 36, + 7, 36, 55, 36, 79, 33, 79, 36, 66, 8, + 36, 60, 33, 17, 33, 7, 2, 8, 36, 79, + 36, 2, 7, 7, 7, 66, 8, 33, 33, 7, + -1, 33, 8, 48, 8, 15, 15, 33, 36, 36, + 33, 8, 55, 7, 8, 8, 15, 6, 48, 10, + 8, 60, 8, 61, 34, 34, 8, 60, 8, 60, + 55, 20, 8, -1, 8, 34, 8, 61, 62, 8, + 40, 61, 62, 61, 62, 50, 42, 8, 60, 54, + 56, 51, 7, -1, 61, 62, 60, 53, 61, 62, + 61, 62, 8, 60, 55, 40, 29, 60, 56, -1, + 56, 29, 91, 92, 61, 62, 51, 61, 62, 61, + 60, 40, 56, 15, 60, 50, -1, 56, 60, 54, + 61, 62, 51, 1, 61, 62, 91, 92, 40, 60, + 29, 25, 34, 27, 36, -1, 61, 62, 12, 51, + 61, 62, 75, 12, 38, 61, 62, 75, 25, 25, + 27, 27, 25, 86, 27, 12, 7, 25, 86, 27, + 15, 38, 38, 29, 25, 38, 27, 25, 89, 27, + 38, 25, 25, 27, 27, 7, 75, 38, 15, 34, + 38, 36, 8, 57, 38, 38, 29, 86, 57, 63, + 61, 62, 36, 29, 63, 8, -1, 34, -1, 36, + 57, 25, 25, 27, 27, -1, 63, -1, -1, 75, + 61, 62, 15, -1, 38, 38, -1, 61, 62, -1, + 86, 25, 93, 27, 25, -1, 27, -1, 7, 61, + 62, 34, 75, 36, 38, 61, 62, 38, 47, 75, + 18, 19, -1, 86, 18, 19, 18, 19, 61, 62, + 86, -1, 61, 62, 33, 18, 19, 98, 99, 100, + 101, 102, 103, -1, -1, -1, -1, 45, 46, -1, + -1, 45, 46, 45, 46, -1, 23, 24, -1, -1, + 23, 24, 45, 46, 93, 32, 23, 24, 35, 32, + 37, -1, 35, -1, 37, 32, 23, 24, 35, -1, + 37, 29, 23, 24, 29, 32, -1, -1, 35, -1, + 37, 32, 23, 24, 35, 94, 37, 29, -1, -1, + 31, 32, 23, 24, 35, 29, 37, 15, -1, -1, + 31, 32, -1, -1, 35, 29, 37, -1, 66, 67, + 68, 66, 67, 68, -1, 33, 34, -1, 36, 29, + -1, -1, -1, -1, 66, 67, 68, 29, -1, -1, + -1, -1, 66, 67, 68, -1, 94, 95, 96, 94, + 95, 96, 66, 67, 68, -1, -1, -1, -1, -1, + -1, -1, 94, 95, 96, -1, 66, 67, 68, -1, + 94, 95, 96, -1, 66, 67, 68, 29, -1, -1, + 94, 95, 96, 29, -1, -1, 29, -1, -1, 29, + -1, -1, 29, -1, 94, 95, 96, 29, 23, 24, + 29, -1, 94, 95, 96, -1, 31, 32, -1, -1, + 35, -1, 37, -1, 66, 67, 68, -1, -1, -1, + 66, 67, 68, 66, 67, 68, 66, 67, 68, 66, + 67, 68, -1, 29, 66, 67, 68, 66, 67, 68, + 36, -1, 94, 95, 96, -1, -1, -1, 94, 95, + 96, 94, 95, 96, 94, 95, 96, 94, 95, 96, + -1, -1, 94, 95, 96, 94, 95, 96, 29, -1, + 66, 67, 68, 29, -1, 36, 29, -1, -1, -1, + 36, 29, -1, -1, 29, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 94, 95, + 96, -1, -1, -1, -1, 66, 67, 68, 61, 62, + 66, 67, 68, 66, 67, 68, 61, 62, 66, 67, + 68, 66, 67, 68, -1, -1, -1, 29, -1, -1, + -1, -1, -1, 94, 95, 96, -1, -1, 94, 95, + 96, 94, 95, 96, -1, -1, 94, 95, 96, 94, + 95, 96, -1, -1, -1, -1, -1, -1, 29, 61, + 62, -1, -1, -1, 66, 67, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, - 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, - 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, + 61, 62, 94, 95, 96, 66, 67, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 65, 66, 67, 68, -1, 70, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 81, 82, - 83, -1, -1, -1, 87, -1, -1, -1, -1, -1, - 93, 94, 95, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 12, 13, -1, -1, -1, -1, -1, -1, - -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, - -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, - -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, - 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, - -1, -1, -1, 93, 94, 95, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 10, -1, 12, 13, -1, - -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, - -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, - -1, 36, -1, -1, -1, -1, -1, -1, 43, -1, - -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 94, 95, 96, -1, -1, -1, -1, + -1, -1, -1, 12, 13, 3, -1, -1, -1, -1, + -1, -1, -1, 22, -1, 13, -1, -1, -1, 17, + 29, -1, -1, -1, 33, 34, -1, 36, 26, -1, + 28, -1, -1, -1, 43, -1, -1, -1, 47, -1, + -1, 39, -1, 41, 42, -1, -1, -1, -1, -1, + -1, 49, -1, -1, 52, 53, 65, 66, 67, 68, + 58, 70, -1, -1, -1, -1, 64, -1, -1, -1, + -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, + -1, -1, 80, -1, -1, 94, 95, 96, -1, -1, + -1, -1, -1, -1, -1, 12, 13, -1, -1, -1, + -1, -1, -1, -1, -1, 22, -1, -1, 3, -1, + -1, -1, 29, -1, -1, -1, 33, 34, 13, 36, + -1, -1, 17, -1, -1, -1, 43, -1, -1, -1, + 47, 26, -1, 28, -1, -1, 31, -1, -1, -1, + -1, -1, -1, -1, 39, -1, 41, 42, 65, 66, + 67, 68, -1, 70, 49, -1, -1, 52, 53, -1, + -1, -1, -1, 58, 81, 82, 83, -1, -1, 64, + 87, -1, -1, -1, -1, -1, -1, 94, 95, 96, + -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 65, 66, 67, 68, -1, 70, -1, -1, -1, -1, - 75, -1, -1, -1, -1, -1, 81, 82, 83, 84, - -1, -1, 87, -1, -1, -1, -1, -1, 93, 94, - 95, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 10, -1, 12, 13, -1, -1, -1, -1, -1, -1, - -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, - -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, - -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, - -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, - 70, -1, -1, -1, -1, 75, -1, -1, -1, -1, - -1, 81, 82, 83, 84, -1, -1, 87, -1, -1, - -1, -1, -1, 93, 94, 95, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, + -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, + -1, -1, 33, 34, -1, 36, -1, -1, -1, -1, + -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, + -1, -1, -1, 94, 95, 96, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 12, 13, -1, -1, -1, + -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, + -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, + -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, + 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, + 67, 68, -1, 70, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, + 87, -1, -1, -1, -1, -1, -1, 94, 95, 96, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, + -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, + -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, + -1, -1, 33, 34, -1, 36, -1, -1, -1, -1, + -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, + -1, -1, -1, -1, 75, -1, -1, -1, -1, -1, + 81, 82, 83, 84, -1, -1, 87, -1, -1, -1, + -1, -1, -1, 94, 95, 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, @@ -836,36 +856,46 @@ const short QQmlJSGrammar::action_check [] = { 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, -1, -1, -1, 75, -1, -1, -1, -1, -1, 81, 82, 83, 84, - -1, -1, 87, -1, -1, -1, -1, -1, 93, 94, - 95, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, - -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, - -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, - -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, - 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, - -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, - 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, - -1, -1, 93, 94, 95, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 7, -1, -1, -1, 11, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, - -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, - 83, -1, -1, -1, 87, -1, -1, -1, -1, -1, - 93, 94, 95, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, + -1, -1, 87, -1, -1, -1, -1, -1, -1, 94, + 95, 96, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 10, -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, - -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, - -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, + -1, -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, - -1, 70, -1, 72, -1, 74, 75, 76, -1, -1, - -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, - -1, -1, -1, -1, 93, 94, 95, -1, -1, -1, + -1, 70, -1, -1, -1, -1, 75, -1, -1, -1, + -1, -1, 81, 82, 83, 84, -1, -1, 87, -1, + -1, -1, -1, -1, -1, 94, 95, 96, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 11, 12, 13, + -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, + -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, + 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, + 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, + 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, + -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, + 94, 95, 96, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 7, -1, -1, -1, 11, 12, 13, -1, + -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, + -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, + -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, + -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, + -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, + -1, -1, 87, -1, -1, -1, -1, -1, -1, 94, + 95, 96, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, + -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, + -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, + 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, + -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, + 70, -1, 72, -1, 74, 75, 76, -1, -1, -1, + -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, + -1, -1, -1, -1, 94, 95, 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, @@ -875,17 +905,27 @@ const short QQmlJSGrammar::action_check [] = { -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, - -1, 93, 94, 95, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 8, -1, -1, 11, 12, 13, -1, - -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, - -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, - -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, - -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, - -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, - 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, - -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, - -1, -1, 87, -1, -1, -1, -1, -1, 93, 94, - 95, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 94, 95, 96, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, + -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, + -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, + 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, + 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, + -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, + -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, + 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, + -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, + 94, 95, 96, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, + -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, + -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, + 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, + -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, + 56, -1, -1, -1, -1, -1, -1, -1, -1, 65, + 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, + 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, + -1, 87, -1, -1, -1, -1, -1, -1, 94, 95, + 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, @@ -894,26 +934,7 @@ const short QQmlJSGrammar::action_check [] = { -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, - -1, -1, -1, -1, -1, 93, 94, 95, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, - 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, - -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, - -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, - -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, - 51, -1, 53, -1, -1, 56, -1, -1, -1, -1, - -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, - -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, - 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, - -1, -1, 93, 94, 95, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, - -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, - -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, - -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, - 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, - -1, -1, -1, -1, 61, -1, -1, -1, 65, 66, - 67, 68, 69, 70, -1, 72, 73, 74, -1, 76, - -1, 78, -1, -1, 81, 82, 83, -1, -1, -1, - 87, -1, -1, -1, -1, -1, 93, 94, 95, -1, + -1, -1, -1, -1, -1, -1, 94, 95, 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, @@ -923,47 +944,57 @@ const short QQmlJSGrammar::action_check [] = { -1, -1, 65, 66, 67, 68, 69, 70, -1, 72, 73, 74, -1, 76, -1, 78, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, -1, - 93, 94, 95, -1, -1, -1, -1, -1, -1, -1, + -1, 94, 95, 96, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, + -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, + -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, + -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, + -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, + -1, -1, -1, 61, -1, -1, -1, 65, 66, 67, + 68, 69, 70, -1, 72, 73, 74, -1, 76, -1, + 78, -1, -1, 81, 82, 83, -1, -1, -1, 87, + -1, -1, -1, -1, -1, -1, 94, 95, 96, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, + 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, + 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, + -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, + 66, 67, 68, 69, 70, 71, -1, 73, 74, 75, + 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, + 86, -1, -1, -1, -1, -1, -1, -1, 94, 95, + 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, + 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, + -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, + -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, + -1, 65, 66, 67, 68, 69, 70, 71, -1, 73, + 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, + 84, 85, 86, -1, -1, -1, -1, -1, -1, -1, + 94, 95, 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, - -1, -1, -1, -1, 66, 67, 68, 69, 70, 71, + -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, 86, -1, -1, -1, -1, -1, - -1, 93, 94, 95, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, - 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, - 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, - 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, - -1, -1, -1, -1, 65, 66, 67, 68, 69, 70, - 71, -1, 73, 74, 75, 76, 77, 78, -1, -1, - 81, 82, 83, 84, 85, 86, -1, -1, -1, -1, - -1, -1, 93, 94, 95, -1, -1, -1, -1, -1, + -1, -1, 94, 95, 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, + -1, -1, -1, -1, -1, 55, -1, -1, -1, 59, -1, -1, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, 86, -1, -1, -1, - -1, -1, -1, 93, 94, 95, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, - 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, - -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, - 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, - -1, -1, -1, -1, -1, -1, 55, -1, -1, -1, - 59, -1, -1, -1, -1, -1, 65, 66, 67, 68, - 69, 70, 71, -1, 73, 74, 75, 76, 77, 78, - -1, -1, 81, 82, 83, 84, 85, 86, -1, -1, - -1, -1, -1, -1, 93, 94, 95, -1, -1, -1, + -1, -1, -1, -1, 94, 95, 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, 9, -1, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, 21, 22, -1, -1, -1, -1, -1, @@ -973,89 +1004,90 @@ const short QQmlJSGrammar::action_check [] = { -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, -1, 87, - -1, -1, -1, -1, -1, 93, 94, 95, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, - -1, -1, 9, -1, 11, 12, 13, 14, -1, -1, - -1, -1, -1, -1, 21, 22, -1, -1, -1, -1, - -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, - -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, - 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, - -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, -1, -1, 81, 82, 83, 84, 85, -1, - 87, -1, -1, -1, -1, -1, 93, 94, 95, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, - 6, -1, -1, 9, 10, 11, 12, 13, 14, -1, - 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, - -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, + -1, -1, -1, -1, -1, -1, 94, 95, 96, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, + -1, -1, -1, 9, -1, 11, 12, 13, 14, -1, + -1, -1, -1, -1, -1, 21, 22, -1, -1, -1, + -1, -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, - 86, 87, -1, -1, -1, -1, -1, 93, 94, 95, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, - 5, 6, -1, -1, 9, 10, 11, 12, 13, 14, - -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, - -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, - -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, - -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, - 55, -1, -1, -1, 59, -1, 61, -1, -1, -1, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, - 85, 86, 87, -1, -1, -1, -1, -1, 93, 94, - 95, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 87, -1, -1, -1, -1, -1, -1, 94, 95, + 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 4, 5, 6, -1, -1, 9, 10, 11, 12, 13, + 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, + -1, -1, -1, -1, -1, 29, 30, 31, 32, 33, + 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, + 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, + -1, -1, -1, -1, -1, 59, -1, 61, -1, -1, + -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, + 84, 85, 86, 87, -1, -1, -1, -1, -1, -1, + 94, 95, 96, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, + 12, 13, 14, -1, 16, -1, -1, -1, 20, 21, + 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, + 32, 33, 34, -1, 36, -1, -1, -1, 40, -1, + 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, + -1, 53, -1, 55, -1, -1, -1, 59, -1, 61, + -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, + 82, 83, 84, 85, 86, 87, -1, -1, -1, -1, + -1, -1, 94, 95, 96, -1, -1, -1, -1, -1, + -1, -1, -1, -1, - 15, 39, 29, 3, 15, 15, 13, 15, 3, 15, - 29, 9, 15, 15, 3, 3, 39, 22, 19, 15, - 19, 3, 15, 15, 15, 11, 3, 74, 15, 19, - 15, 15, 29, 13, 15, 29, 102, 15, 3, 15, - 97, 3, 100, 15, -1, 15, 29, 22, 15, 3, - 3, 15, 3, 22, 15, 15, 22, 15, 15, 3, - 39, 3, 3, 3, 3, 39, 39, 22, 39, 3, - 15, 39, 15, 2, -1, 13, 39, 13, 2, 2, - 39, 13, 13, 39, 2, 15, 15, 39, 20, 3, - 3, 15, 15, 3, 15, 15, 2, 15, 41, -1, - 2, 51, 51, 51, 53, 51, 56, 53, 56, 15, - 48, 41, 48, 15, 51, 15, 51, 48, 51, 56, - 39, 56, 39, 56, 51, 51, 53, 53, 47, 51, - 47, 53, 4, 15, 2, 51, 15, 53, 15, 51, - 40, 15, 51, 15, 53, 4, 51, 15, 53, 15, - 51, 63, 53, 51, 51, 13, 15, 51, 16, 53, - 42, 75, 75, 51, 3, 44, 43, 65, 15, 43, - 67, 91, 13, 61, -1, 16, 42, 15, 51, 15, - 51, 54, 51, 54, 51, 106, 53, 56, 51, 13, - 53, 51, 16, 53, 2, 51, 43, 51, 35, 2, - 56, 15, 39, 51, 42, 59, 42, 15, 56, 51, - 2, 51, 15, 2, 56, -1, 56, 51, 51, 51, - 2, 51, 56, 15, 57, 57, 15, 57, 51, 4, - 51, 2, -1, 15, 57, 56, 75, 2, 51, 51, - 15, 53, 55, 2, 15, 51, 51, 2, 53, 55, - 15, 51, 51, 53, 53, 51, 15, 53, 51, 2, - 15, 51, 55, 51, 51, 15, 56, 2, 56, 56, - -1, 3, 15, 51, 64, 89, -1, 51, 56, 51, - 15, 68, 56, -1, 56, 73, 58, 51, 66, -1, - -1, 51, 56, -1, 44, 45, 56, 51, 58, 73, - 51, -1, 56, 51, 58, 56, 51, 51, 56, 73, - 51, 56, 56, 58, 13, 56, -1, -1, 62, 60, - -1, 20, 73, 13, 5, 73, 16, 5, 18, -1, - -1, -1, 13, 32, 33, 13, -1, -1, -1, 20, - -1, -1, 20, 75, -1, -1, -1, -1, -1, 39, - 85, 32, 33, -1, 32, 33, 22, 23, 24, 25, - 26, 27, 28, 21, 22, 23, 24, 25, 26, 27, - 28, 13, -1, -1, -1, -1, 2, -1, 20, 21, - 22, 23, 24, 25, 26, 27, 28, -1, -1, 15, + 42, 3, 18, 25, 18, 3, 18, 3, 18, 22, + 18, 3, 18, 22, 32, 32, 42, 18, 18, 18, + 3, 32, 25, 18, 18, 32, 3, 18, 32, 105, + 18, 18, 25, 100, 3, 3, 3, 18, 3, 25, + 18, 3, 18, 18, 18, 42, 3, 3, 103, 9, + 3, 14, 42, 42, 18, 25, 14, 42, 42, 18, + 42, 3, 42, 18, 18, 3, 18, 3, 18, 14, + 42, 22, 18, 2, 4, 18, 42, 18, 2, 11, + 12, 54, -1, 54, 2, 56, 59, 18, 18, 18, + 4, 14, 14, 54, 18, 56, 19, 14, 77, 14, + 18, 23, 2, 46, 18, 54, 54, 54, 2, 2, + 59, 59, 59, 18, 54, 54, 3, 56, 18, 59, + 54, 54, 56, 56, 18, 18, 54, 54, 54, 56, + 56, 59, 18, 54, 51, 56, 51, 2, 54, 2, + 56, 54, 54, 56, 56, 54, 54, 56, 38, 2, + 58, 54, 42, 18, 57, 18, 3, 54, 2, 45, + 18, 92, 54, 54, 2, 18, 3, 18, 109, 66, + 42, 54, 64, 56, 18, 18, 18, 2, 50, 70, + 18, 54, 42, 4, 54, 43, 56, 18, 14, 94, + 50, 78, 2, 18, 45, 68, 18, 18, 54, 18, + 56, 3, 54, 46, 46, 54, 54, 59, 18, 54, + 2, 60, 60, 44, 54, 60, 56, 2, 14, 14, + 3, 54, 44, 19, 19, 51, 18, 60, 47, 2, + 54, 78, 18, 18, 54, -1, 56, 54, 62, 56, + 54, 54, 18, 18, 58, 18, 59, 54, 54, 54, + 57, 54, 58, 54, 59, 54, 59, 54, 59, 45, + 59, 54, 59, 54, 2, 2, 59, -1, 59, 45, + 61, -1, 47, 48, 2, -1, 78, 54, -1, 76, + 18, 18, 59, 76, 54, -1, 54, 54, 54, 59, + 18, 59, 59, 59, -1, 78, -1, -1, 54, 76, + 54, 69, -1, 59, 71, 59, 76, 61, 54, 54, + 76, 67, 54, 59, 59, 61, 5, 59, 54, 61, + 65, 14, 5, 59, -1, 14, 19, 63, 21, -1, + -1, 14, -1, -1, 23, -1, -1, -1, -1, -1, + 23, -1, -1, -1, -1, -1, 35, 36, -1, 42, + 88, 88, 35, 36, 25, 26, 27, 28, 29, 30, + 31, 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 14, 14, -1, -1, -1, -1, -1, + -1, -1, 23, 23, 24, 25, 26, 27, 28, 29, + 30, 31, -1, -1, 35, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 13, -1, -1, -1, -1, -1, -1, 20, - 21, 22, 23, 24, 25, 26, 27, 28, -1, -1, + 14, -1, -1, -1, -1, -1, -1, -1, -1, 23, + 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, diff --git a/src/tools/qdoc/qmlparser/qqmljsgrammar_p.h b/src/tools/qdoc/qmlparser/qqmljsgrammar_p.h index 9ef4695d69..054b7cc2e0 100644 --- a/src/tools/qdoc/qmlparser/qqmljsgrammar_p.h +++ b/src/tools/qdoc/qmlparser/qqmljsgrammar_p.h @@ -63,12 +63,12 @@ class QQmlJSGrammar public: enum VariousConstants { EOF_SYMBOL = 0, - REDUCE_HERE = 104, - SHIFT_THERE = 103, + REDUCE_HERE = 105, + SHIFT_THERE = 104, T_AND = 1, T_AND_AND = 2, T_AND_EQ = 3, - T_AS = 92, + T_AS = 93, T_AUTOMATIC_SEMICOLON = 62, T_BREAK = 4, T_CASE = 5, @@ -90,19 +90,19 @@ public: T_EQ = 17, T_EQ_EQ = 18, T_EQ_EQ_EQ = 19, - T_ERROR = 96, + T_ERROR = 97, T_FALSE = 83, - T_FEED_JS_EXPRESSION = 100, - T_FEED_JS_PROGRAM = 102, - T_FEED_JS_SOURCE_ELEMENT = 101, - T_FEED_JS_STATEMENT = 99, - T_FEED_UI_OBJECT_MEMBER = 98, - T_FEED_UI_PROGRAM = 97, + T_FEED_JS_EXPRESSION = 101, + T_FEED_JS_PROGRAM = 103, + T_FEED_JS_SOURCE_ELEMENT = 102, + T_FEED_JS_STATEMENT = 100, + T_FEED_UI_OBJECT_MEMBER = 99, + T_FEED_UI_PROGRAM = 98, T_FINALLY = 20, T_FOR = 21, T_FUNCTION = 22, T_GE = 23, - T_GET = 94, + T_GET = 95, T_GT = 24, T_GT_GT = 25, T_GT_GT_EQ = 26, @@ -130,13 +130,14 @@ public: T_NOT_EQ_EQ = 46, T_NULL = 81, T_NUMERIC_LITERAL = 47, - T_ON = 93, + T_ON = 94, T_OR = 48, T_OR_EQ = 49, T_OR_OR = 50, T_PLUS = 51, T_PLUS_EQ = 52, T_PLUS_PLUS = 53, + T_PRAGMA = 92, T_PROPERTY = 66, T_PUBLIC = 90, T_QUESTION = 54, @@ -149,7 +150,7 @@ public: T_RETURN = 59, T_RPAREN = 60, T_SEMICOLON = 61, - T_SET = 95, + T_SET = 96, T_SIGNAL = 67, T_STAR = 63, T_STAR_EQ = 64, @@ -168,15 +169,15 @@ public: T_XOR = 79, T_XOR_EQ = 80, - ACCEPT_STATE = 655, - RULE_COUNT = 351, - STATE_COUNT = 656, - TERMINAL_COUNT = 105, - NON_TERMINAL_COUNT = 108, + ACCEPT_STATE = 663, + RULE_COUNT = 357, + STATE_COUNT = 664, + TERMINAL_COUNT = 106, + NON_TERMINAL_COUNT = 111, - GOTO_INDEX_OFFSET = 656, - GOTO_INFO_OFFSET = 2970, - GOTO_CHECK_OFFSET = 2970 + GOTO_INDEX_OFFSET = 664, + GOTO_INFO_OFFSET = 3104, + GOTO_CHECK_OFFSET = 3104 }; static const char *const spell []; diff --git a/src/tools/qdoc/qmlparser/qqmljskeywords_p.h b/src/tools/qdoc/qmlparser/qqmljskeywords_p.h index 7fcf001303..c6277e0fcc 100644 --- a/src/tools/qdoc/qmlparser/qqmljskeywords_p.h +++ b/src/tools/qdoc/qmlparser/qqmljskeywords_p.h @@ -436,6 +436,17 @@ static inline int classify6(const QChar *s, bool qmlMode) { } } } + else if (s[1].unicode() == 'r') { + if (s[2].unicode() == 'a') { + if (s[3].unicode() == 'g') { + if (s[4].unicode() == 'm') { + if (s[5].unicode() == 'a') { + return qmlMode ? Lexer::T_PRAGMA : Lexer::T_IDENTIFIER; + } + } + } + } + } } else if (s[0].unicode() == 'r') { if (s[1].unicode() == 'e') { diff --git a/src/tools/qdoc/qmlparser/qqmljslexer.cpp b/src/tools/qdoc/qmlparser/qqmljslexer.cpp index edd85ec878..8e8ed954ad 100644 --- a/src/tools/qdoc/qmlparser/qqmljslexer.cpp +++ b/src/tools/qdoc/qmlparser/qqmljslexer.cpp @@ -54,7 +54,7 @@ QT_END_NAMESPACE using namespace QQmlJS; -static int regExpFlagFromChar(const QChar &ch) +static inline int regExpFlagFromChar(const QChar &ch) { switch (ch.unicode()) { case 'g': return Lexer::RegExp_Global; @@ -64,7 +64,7 @@ static int regExpFlagFromChar(const QChar &ch) return 0; } -static unsigned char convertHex(ushort c) +static inline unsigned char convertHex(ushort c) { if (c >= '0' && c <= '9') return (c - '0'); @@ -74,12 +74,12 @@ static unsigned char convertHex(ushort c) return (c - 'A' + 10); } -static QChar convertHex(QChar c1, QChar c2) +static inline QChar convertHex(QChar c1, QChar c2) { return QChar((convertHex(c1.unicode()) << 4) + convertHex(c2.unicode())); } -static QChar convertUnicode(QChar c1, QChar c2, QChar c3, QChar c4) +static inline QChar convertUnicode(QChar c1, QChar c2, QChar c3, QChar c4) { return QChar((convertHex(c3.unicode()) << 4) + convertHex(c4.unicode()), (convertHex(c1.unicode()) << 4) + convertHex(c2.unicode())); @@ -259,6 +259,7 @@ int Lexer::lex() _parenthesesCount = 0; break; + case T_ELSE: case T_DO: _parenthesesState = BalancedParentheses; break; @@ -287,7 +288,8 @@ int Lexer::lex() break; case BalancedParentheses: - _parenthesesState = IgnoreParentheses; + if (_tokenKind != T_DO && _tokenKind != T_ELSE) + _parenthesesState = IgnoreParentheses; break; } // switch @@ -329,6 +331,27 @@ QChar Lexer::decodeUnicodeEscapeCharacter(bool *ok) return QChar(); } +QChar Lexer::decodeHexEscapeCharacter(bool *ok) +{ + if (isHexDigit(_codePtr[0]) && isHexDigit(_codePtr[1])) { + scanChar(); + + const QChar c1 = _char; + scanChar(); + + const QChar c2 = _char; + scanChar(); + + if (ok) + *ok = true; + + return convertHex(c1, c2); + } + + *ok = false; + return QChar(); +} + static inline bool isIdentifierStart(QChar ch) { // fast path for ascii @@ -705,35 +728,29 @@ again: scanChar(); QChar u; - bool ok = false; switch (_char.unicode()) { // unicode escape sequence - case 'u': + case 'u': { + bool ok = false; u = decodeUnicodeEscapeCharacter(&ok); if (! ok) { _errorCode = IllegalUnicodeEscapeSequence; _errorMessage = QCoreApplication::translate("QQmlParser", "Illegal unicode escape sequence"); return T_ERROR; } - break; + } break; // hex escape sequence - case 'x': - if (isHexDigit(_codePtr[0]) && isHexDigit(_codePtr[1])) { - scanChar(); - - const QChar c1 = _char; - scanChar(); - - const QChar c2 = _char; - scanChar(); - - u = convertHex(c1, c2); - } else { - u = _char; + case 'x': { + bool ok = false; + u = decodeHexEscapeCharacter(&ok); + if (!ok) { + _errorCode = IllegalHexadecimalEscapeSequence; + _errorMessage = QCoreApplication::translate("QQmlParser", "Illegal hexadecimal escape sequence"); + return T_ERROR; } - break; + } break; // single character escape sequence case '\\': u = QLatin1Char('\\'); scanChar(); break; @@ -767,22 +784,11 @@ again: return T_ERROR; case '\r': - if (isLineTerminatorSequence() == 2) { - _tokenText += QLatin1Char('\r'); - u = QLatin1Char('\n'); - } else { - u = QLatin1Char('\r'); - } - scanChar(); - break; - case '\n': case 0x2028u: case 0x2029u: - u = _char; scanChar(); - break; - + continue; default: // non escape character @@ -1033,7 +1039,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix) _patternFlags = 0; while (isIdentLetter(_char)) { int flag = regExpFlagFromChar(_char); - if (flag == 0) { + if (flag == 0 || _patternFlags & flag) { _errorMessage = QCoreApplication::translate("QQmlParser", "Invalid regular expression flag '%0'") .arg(QChar(_char)); return false; diff --git a/src/tools/qdoc/qmlparser/qqmljslexer_p.h b/src/tools/qdoc/qmlparser/qqmljslexer_p.h index e1b51da92b..23af61d650 100644 --- a/src/tools/qdoc/qmlparser/qqmljslexer_p.h +++ b/src/tools/qdoc/qmlparser/qqmljslexer_p.h @@ -128,7 +128,8 @@ public: IllegalUnicodeEscapeSequence, UnclosedComment, IllegalExponentIndicator, - IllegalIdentifier + IllegalIdentifier, + IllegalHexadecimalEscapeSequence }; enum RegExpBodyPrefix { @@ -203,6 +204,7 @@ private: void syncProhibitAutomaticSemicolon(); QChar decodeUnicodeEscapeCharacter(bool *ok); + QChar decodeHexEscapeCharacter(bool *ok); private: Engine *_engine; diff --git a/src/tools/qdoc/qmlparser/qqmljsparser.cpp b/src/tools/qdoc/qmlparser/qqmljsparser.cpp index a0fa7a4711..b86b4a987f 100644 --- a/src/tools/qdoc/qmlparser/qqmljsparser.cpp +++ b/src/tools/qdoc/qmlparser/qqmljsparser.cpp @@ -50,6 +50,7 @@ #include + #include "qqmljsparser_p.h" #include @@ -146,6 +147,19 @@ AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr) return 0; } +AST::UiQualifiedPragmaId *Parser::reparseAsQualifiedPragmaId(AST::ExpressionNode *expr) +{ + if (AST::IdentifierExpression *idExpr = AST::cast(expr)) { + AST::UiQualifiedPragmaId *q = new (pool) AST::UiQualifiedPragmaId(idExpr->name); + q->identifierToken = idExpr->identifierToken; + + return q->finish(); + } + + return 0; +} + + bool Parser::parse(int startToken) { Lexer *lexer = driver->lexer(); @@ -232,32 +246,44 @@ case 5: { } break; case 6: { - sym(1).UiProgram = new (pool) AST::UiProgram(sym(1).UiImportList, + sym(1).UiProgram = new (pool) AST::UiProgram(sym(1).UiHeaderItemList, sym(2).UiObjectMemberList->finish()); } break; case 8: { - sym(1).Node = sym(1).UiImportList->finish(); + sym(1).Node = sym(1).UiHeaderItemList->finish(); } break; case 9: { - sym(1).Node = new (pool) AST::UiImportList(sym(1).UiImport); + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiPragma); } break; case 10: { - sym(1).Node = new (pool) AST::UiImportList(sym(1).UiImportList, sym(2).UiImport); + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiImport); } break; -case 13: { +case 11: { + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiPragma); +} break; + +case 12: { + sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiImport); +} break; + +case 16: { + sym(1).UiPragma->semicolonToken = loc(2); +} break; + +case 18: { sym(1).UiImport->semicolonToken = loc(2); } break; -case 15: { +case 20: { sym(1).UiImport->versionToken = loc(2); sym(1).UiImport->semicolonToken = loc(3); } break; -case 17: { +case 22: { sym(1).UiImport->versionToken = loc(2); sym(1).UiImport->asToken = loc(3); sym(1).UiImport->importIdToken = loc(4); @@ -265,14 +291,33 @@ case 17: { sym(1).UiImport->semicolonToken = loc(5); } break; -case 19: { +case 24: { sym(1).UiImport->asToken = loc(2); sym(1).UiImport->importIdToken = loc(3); sym(1).UiImport->importId = stringRef(3); sym(1).UiImport->semicolonToken = loc(4); } break; -case 20: { +case 25: { + AST::UiPragma *node = 0; + + if (AST::UiQualifiedPragmaId *qualifiedId = reparseAsQualifiedPragmaId(sym(2).Expression)) { + node = new (pool) AST::UiPragma(qualifiedId); + } + + sym(1).Node = node; + + if (node) { + node->pragmaToken = loc(1); + } else { + diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1), + QLatin1String("Expected a qualified name id"))); + + return false; // ### remove me + } +} break; + +case 26: { AST::UiImport *node = 0; if (AST::StringLiteral *importIdLiteral = AST::cast(sym(2).Expression)) { @@ -295,56 +340,56 @@ case 20: { } } break; -case 21: { +case 27: { sym(1).Node = 0; } break; -case 22: { +case 28: { sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember); } break; -case 23: { +case 29: { sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember); } break; -case 24: { +case 30: { AST::UiObjectMemberList *node = new (pool) AST:: UiObjectMemberList( sym(1).UiObjectMemberList, sym(2).UiObjectMember); sym(1).Node = node; } break; -case 25: { +case 31: { sym(1).Node = new (pool) AST::UiArrayMemberList(sym(1).UiObjectMember); } break; -case 26: { +case 32: { AST::UiArrayMemberList *node = new (pool) AST::UiArrayMemberList( sym(1).UiArrayMemberList, sym(3).UiObjectMember); node->commaToken = loc(2); sym(1).Node = node; } break; -case 27: { +case 33: { AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer((AST::UiObjectMemberList*)0); node->lbraceToken = loc(1); node->rbraceToken = loc(2); sym(1).Node = node; } break; -case 28: { +case 34: { AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer(sym(2).UiObjectMemberList->finish()); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 29: { +case 35: { AST::UiObjectDefinition *node = new (pool) AST::UiObjectDefinition(sym(1).UiQualifiedId, sym(2).UiObjectInitializer); sym(1).Node = node; } break; -case 31: { +case 37: { AST::UiArrayBinding *node = new (pool) AST::UiArrayBinding( sym(1).UiQualifiedId, sym(4).UiArrayMemberList->finish()); node->colonToken = loc(2); @@ -353,14 +398,14 @@ case 31: { sym(1).Node = node; } break; -case 32: { +case 38: { AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding( sym(1).UiQualifiedId, sym(3).UiQualifiedId, sym(4).UiObjectInitializer); node->colonToken = loc(2); sym(1).Node = node; } break; -case 33: { +case 39: { AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding( sym(3).UiQualifiedId, sym(1).UiQualifiedId, sym(4).UiObjectInitializer); node->colonToken = loc(2); @@ -368,7 +413,7 @@ case 33: { sym(1).Node = node; } break; -case 41: +case 47: { AST::UiScriptBinding *node = new (pool) AST::UiScriptBinding( sym(1).UiQualifiedId, sym(3).Statement); @@ -376,22 +421,22 @@ case 41: sym(1).Node = node; } break; -case 45: { +case 51: { sym(1).Node = 0; } break; -case 46: { +case 52: { sym(1).Node = sym(1).UiParameterList->finish (); } break; -case 47: { +case 53: { AST::UiParameterList *node = new (pool) AST::UiParameterList(stringRef(1), stringRef(2)); node->propertyTypeToken = loc(1); node->identifierToken = loc(2); sym(1).Node = node; } break; -case 48: { +case 54: { AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiParameterList, stringRef(3), stringRef(4)); node->propertyTypeToken = loc(3); node->commaToken = loc(2); @@ -399,7 +444,7 @@ case 48: { sym(1).Node = node; } break; -case 50: { +case 56: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(QStringRef(), stringRef(2)); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); @@ -410,7 +455,7 @@ case 50: { sym(1).Node = node; } break; -case 52: { +case 58: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(QStringRef(), stringRef(2)); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); @@ -420,7 +465,7 @@ case 52: { sym(1).Node = node; } break; -case 54: { +case 60: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(4), stringRef(6)); node->typeModifier = stringRef(2); node->propertyToken = loc(1); @@ -431,7 +476,7 @@ case 54: { sym(1).Node = node; } break; -case 56: { +case 62: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(2), stringRef(3)); node->propertyToken = loc(1); node->typeToken = loc(2); @@ -440,7 +485,7 @@ case 56: { sym(1).Node = node; } break; -case 58: { +case 64: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4)); node->isDefaultMember = true; node->defaultToken = loc(1); @@ -451,7 +496,7 @@ case 58: { sym(1).Node = node; } break; -case 59: { +case 65: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(2), stringRef(3), sym(5).Statement); node->propertyToken = loc(1); @@ -461,7 +506,7 @@ case 59: { sym(1).Node = node; } break; -case 60: { +case 66: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4), sym(6).Statement); node->isReadonlyMember = true; @@ -473,7 +518,7 @@ case 60: { sym(1).Node = node; } break; -case 61: { +case 67: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4), sym(6).Statement); node->isDefaultMember = true; @@ -485,7 +530,7 @@ case 61: { sym(1).Node = node; } break; -case 62: { +case 68: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(4), stringRef(6)); node->typeModifier = stringRef(2); node->propertyToken = loc(1); @@ -509,7 +554,7 @@ case 62: { sym(1).Node = node; } break; -case 63: { +case 69: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(2), stringRef(3)); node->propertyToken = loc(1); node->typeToken = loc(2); @@ -529,57 +574,57 @@ case 63: { sym(1).Node = node; } break; -case 64: { +case 70: { sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node); } break; -case 65: { +case 71: { sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node); } break; -case 73: { +case 79: { AST::ThisExpression *node = new (pool) AST::ThisExpression(); node->thisToken = loc(1); sym(1).Node = node; } break; -case 74: { +case 80: { AST::IdentifierExpression *node = new (pool) AST::IdentifierExpression(stringRef(1)); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 75: { +case 81: { AST::NullExpression *node = new (pool) AST::NullExpression(); node->nullToken = loc(1); sym(1).Node = node; } break; -case 76: { +case 82: { AST::TrueLiteral *node = new (pool) AST::TrueLiteral(); node->trueToken = loc(1); sym(1).Node = node; } break; -case 77: { +case 83: { AST::FalseLiteral *node = new (pool) AST::FalseLiteral(); node->falseToken = loc(1); sym(1).Node = node; } break; -case 78: { +case 84: { AST::NumericLiteral *node = new (pool) AST::NumericLiteral(sym(1).dval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 79: -case 80: { +case 85: +case 86: { AST::StringLiteral *node = new (pool) AST::StringLiteral(stringRef(1)); node->literalToken = loc(1); sym(1).Node = node; } break; -case 81: { +case 87: { bool rx = lexer->scanRegExp(Lexer::NoPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -595,7 +640,7 @@ case 81: { sym(1).Node = node; } break; -case 82: { +case 88: { bool rx = lexer->scanRegExp(Lexer::EqualPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -611,28 +656,28 @@ case 82: { sym(1).Node = node; } break; -case 83: { +case 89: { AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral((AST::Elision *) 0); node->lbracketToken = loc(1); node->rbracketToken = loc(2); sym(1).Node = node; } break; -case 84: { +case 90: { AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).Elision->finish()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 85: { +case 91: { AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish ()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 86: { +case 92: { AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish (), (AST::Elision *) 0); node->lbracketToken = loc(1); @@ -641,7 +686,7 @@ case 86: { sym(1).Node = node; } break; -case 87: { +case 93: { AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish (), sym(4).Elision->finish()); node->lbracketToken = loc(1); @@ -650,7 +695,7 @@ case 87: { sym(1).Node = node; } break; -case 88: { +case 94: { AST::ObjectLiteral *node = 0; if (sym(2).Node) node = new (pool) AST::ObjectLiteral( @@ -662,7 +707,7 @@ case 88: { sym(1).Node = node; } break; -case 89: { +case 95: { AST::ObjectLiteral *node = new (pool) AST::ObjectLiteral( sym(2).PropertyAssignmentList->finish ()); node->lbraceToken = loc(1); @@ -670,14 +715,14 @@ case 89: { sym(1).Node = node; } break; -case 90: { +case 96: { AST::NestedExpression *node = new (pool) AST::NestedExpression(sym(2).Expression); node->lparenToken = loc(1); node->rparenToken = loc(3); sym(1).Node = node; } break; -case 91: { +case 97: { if (AST::ArrayMemberExpression *mem = AST::cast(sym(1).Expression)) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, mem->lbracketToken, QLatin1String("Ignored annotation"))); @@ -697,48 +742,48 @@ case 91: { } } break; -case 92: { +case 98: { sym(1).Node = new (pool) AST::ElementList((AST::Elision *) 0, sym(1).Expression); } break; -case 93: { +case 99: { sym(1).Node = new (pool) AST::ElementList(sym(1).Elision->finish(), sym(2).Expression); } break; -case 94: { +case 100: { AST::ElementList *node = new (pool) AST::ElementList(sym(1).ElementList, (AST::Elision *) 0, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 95: { +case 101: { AST::ElementList *node = new (pool) AST::ElementList(sym(1).ElementList, sym(3).Elision->finish(), sym(4).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 96: { +case 102: { AST::Elision *node = new (pool) AST::Elision(); node->commaToken = loc(1); sym(1).Node = node; } break; -case 97: { +case 103: { AST::Elision *node = new (pool) AST::Elision(sym(1).Elision); node->commaToken = loc(2); sym(1).Node = node; } break; -case 98: { +case 104: { AST::PropertyNameAndValue *node = new (pool) AST::PropertyNameAndValue( sym(1).PropertyName, sym(3).Expression); node->colonToken = loc(2); sym(1).Node = node; } break; -case 99: { +case 105: { AST::PropertyGetterSetter *node = new (pool) AST::PropertyGetterSetter( sym(2).PropertyName, sym(6).FunctionBody); node->getSetToken = loc(1); @@ -749,7 +794,7 @@ case 99: { sym(1).Node = node; } break; -case 100: { +case 106: { AST::PropertyGetterSetter *node = new (pool) AST::PropertyGetterSetter( sym(2).PropertyName, sym(4).FormalParameterList, sym(7).FunctionBody); node->getSetToken = loc(1); @@ -760,56 +805,56 @@ case 100: { sym(1).Node = node; } break; -case 101: { +case 107: { sym(1).Node = new (pool) AST::PropertyAssignmentList(sym(1).PropertyAssignment); } break; -case 102: { +case 108: { AST::PropertyAssignmentList *node = new (pool) AST::PropertyAssignmentList( sym(1).PropertyAssignmentList, sym(3).PropertyAssignment); node->commaToken = loc(2); sym(1).Node = node; } break; -case 103: { +case 109: { AST::IdentifierPropertyName *node = new (pool) AST::IdentifierPropertyName(stringRef(1)); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 104: { +case 110: { AST::StringLiteralPropertyName *node = new (pool) AST::StringLiteralPropertyName(stringRef(1)); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 105: { +case 111: { AST::NumericLiteralPropertyName *node = new (pool) AST::NumericLiteralPropertyName(sym(1).dval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 106: { +case 112: { AST::IdentifierPropertyName *node = new (pool) AST::IdentifierPropertyName(stringRef(1)); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 142: { +case 148: { AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 143: { +case 149: { AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3)); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 144: { +case 150: { AST::NewMemberExpression *node = new (pool) AST::NewMemberExpression(sym(2).Expression, sym(4).ArgumentList); node->newToken = loc(1); node->lparenToken = loc(3); @@ -817,384 +862,384 @@ case 144: { sym(1).Node = node; } break; -case 146: { +case 152: { AST::NewExpression *node = new (pool) AST::NewExpression(sym(2).Expression); node->newToken = loc(1); sym(1).Node = node; } break; -case 147: { +case 153: { AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 148: { +case 154: { AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 149: { +case 155: { AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 150: { +case 156: { AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3)); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 151: { +case 157: { sym(1).Node = 0; } break; -case 152: { +case 158: { sym(1).Node = sym(1).ArgumentList->finish(); } break; -case 153: { +case 159: { sym(1).Node = new (pool) AST::ArgumentList(sym(1).Expression); } break; -case 154: { +case 160: { AST::ArgumentList *node = new (pool) AST::ArgumentList(sym(1).ArgumentList, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 158: { +case 164: { AST::PostIncrementExpression *node = new (pool) AST::PostIncrementExpression(sym(1).Expression); node->incrementToken = loc(2); sym(1).Node = node; } break; -case 159: { +case 165: { AST::PostDecrementExpression *node = new (pool) AST::PostDecrementExpression(sym(1).Expression); node->decrementToken = loc(2); sym(1).Node = node; } break; -case 161: { +case 167: { AST::DeleteExpression *node = new (pool) AST::DeleteExpression(sym(2).Expression); node->deleteToken = loc(1); sym(1).Node = node; } break; -case 162: { +case 168: { AST::VoidExpression *node = new (pool) AST::VoidExpression(sym(2).Expression); node->voidToken = loc(1); sym(1).Node = node; } break; -case 163: { +case 169: { AST::TypeOfExpression *node = new (pool) AST::TypeOfExpression(sym(2).Expression); node->typeofToken = loc(1); sym(1).Node = node; } break; -case 164: { +case 170: { AST::PreIncrementExpression *node = new (pool) AST::PreIncrementExpression(sym(2).Expression); node->incrementToken = loc(1); sym(1).Node = node; } break; -case 165: { +case 171: { AST::PreDecrementExpression *node = new (pool) AST::PreDecrementExpression(sym(2).Expression); node->decrementToken = loc(1); sym(1).Node = node; } break; -case 166: { +case 172: { AST::UnaryPlusExpression *node = new (pool) AST::UnaryPlusExpression(sym(2).Expression); node->plusToken = loc(1); sym(1).Node = node; } break; -case 167: { +case 173: { AST::UnaryMinusExpression *node = new (pool) AST::UnaryMinusExpression(sym(2).Expression); node->minusToken = loc(1); sym(1).Node = node; } break; -case 168: { +case 174: { AST::TildeExpression *node = new (pool) AST::TildeExpression(sym(2).Expression); node->tildeToken = loc(1); sym(1).Node = node; } break; -case 169: { +case 175: { AST::NotExpression *node = new (pool) AST::NotExpression(sym(2).Expression); node->notToken = loc(1); sym(1).Node = node; } break; -case 171: { +case 177: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Mul, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 172: { +case 178: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Div, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 173: { +case 179: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Mod, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 175: { +case 181: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Add, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 176: { +case 182: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Sub, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 178: { +case 184: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::LShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 179: { +case 185: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::RShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 180: { +case 186: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::URShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 182: { +case 188: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 183: { +case 189: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 184: { +case 190: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 185: { +case 191: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 186: { +case 192: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 187: { +case 193: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::In, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 189: { +case 195: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 190: { +case 196: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 191: { +case 197: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 192: { +case 198: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 193: { +case 199: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 195: { +case 201: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 196: { +case 202: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 197: { +case 203: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 198: { +case 204: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 200: { +case 206: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 201: { +case 207: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 202: { +case 208: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 203: { +case 209: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 205: { +case 211: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 207: { +case 213: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 209: { +case 215: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 211: { +case 217: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 213: { +case 219: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 215: { +case 221: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 217: { +case 223: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 219: { +case 225: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 221: { +case 227: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Or, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 223: { +case 229: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Or, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 225: { +case 231: { AST::ConditionalExpression *node = new (pool) AST::ConditionalExpression(sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1202,7 +1247,7 @@ case 225: { sym(1).Node = node; } break; -case 227: { +case 233: { AST::ConditionalExpression *node = new (pool) AST::ConditionalExpression(sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1210,112 +1255,112 @@ case 227: { sym(1).Node = node; } break; -case 229: { +case 235: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 231: { +case 237: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 232: { +case 238: { sym(1).ival = QSOperator::Assign; } break; -case 233: { +case 239: { sym(1).ival = QSOperator::InplaceMul; } break; -case 234: { +case 240: { sym(1).ival = QSOperator::InplaceDiv; } break; -case 235: { +case 241: { sym(1).ival = QSOperator::InplaceMod; } break; -case 236: { +case 242: { sym(1).ival = QSOperator::InplaceAdd; } break; -case 237: { +case 243: { sym(1).ival = QSOperator::InplaceSub; } break; -case 238: { +case 244: { sym(1).ival = QSOperator::InplaceLeftShift; } break; -case 239: { +case 245: { sym(1).ival = QSOperator::InplaceRightShift; } break; -case 240: { +case 246: { sym(1).ival = QSOperator::InplaceURightShift; } break; -case 241: { +case 247: { sym(1).ival = QSOperator::InplaceAnd; } break; -case 242: { +case 248: { sym(1).ival = QSOperator::InplaceXor; } break; -case 243: { +case 249: { sym(1).ival = QSOperator::InplaceOr; } break; -case 245: { +case 251: { AST::Expression *node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 246: { +case 252: { sym(1).Node = 0; } break; -case 249: { +case 255: { AST::Expression *node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 250: { +case 256: { sym(1).Node = 0; } break; -case 267: { +case 273: { AST::Block *node = new (pool) AST::Block(sym(2).StatementList); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 268: { +case 274: { sym(1).Node = new (pool) AST::StatementList(sym(1).Statement); } break; -case 269: { +case 275: { sym(1).Node = new (pool) AST::StatementList(sym(1).StatementList, sym(2).Statement); } break; -case 270: { +case 276: { sym(1).Node = 0; } break; -case 271: { +case 277: { sym(1).Node = sym(1).StatementList->finish (); } break; -case 273: { +case 279: { AST::VariableStatement *node = new (pool) AST::VariableStatement( sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST)); node->declarationKindToken = loc(1); @@ -1323,76 +1368,76 @@ case 273: { sym(1).Node = node; } break; -case 274: { +case 280: { sym(1).ival = T_CONST; } break; -case 275: { +case 281: { sym(1).ival = T_VAR; } break; -case 276: { +case 282: { sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclaration); } break; -case 277: { +case 283: { AST::VariableDeclarationList *node = new (pool) AST::VariableDeclarationList( sym(1).VariableDeclarationList, sym(3).VariableDeclaration); node->commaToken = loc(2); sym(1).Node = node; } break; -case 278: { +case 284: { sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclaration); } break; -case 279: { +case 285: { sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclarationList, sym(3).VariableDeclaration); } break; -case 280: { +case 286: { AST::VariableDeclaration *node = new (pool) AST::VariableDeclaration(stringRef(1), sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 281: { +case 287: { AST::VariableDeclaration *node = new (pool) AST::VariableDeclaration(stringRef(1), sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 282: { +case 288: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 283: { +case 289: { sym(1).Node = 0; } break; -case 285: { +case 291: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 286: { +case 292: { sym(1).Node = 0; } break; -case 288: { +case 294: { AST::EmptyStatement *node = new (pool) AST::EmptyStatement(); node->semicolonToken = loc(1); sym(1).Node = node; } break; -case 290: { +case 296: { AST::ExpressionStatement *node = new (pool) AST::ExpressionStatement(sym(1).Expression); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 291: { +case 297: { AST::IfStatement *node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement, sym(7).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1401,7 +1446,7 @@ case 291: { sym(1).Node = node; } break; -case 292: { +case 298: { AST::IfStatement *node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1409,7 +1454,7 @@ case 292: { sym(1).Node = node; } break; -case 295: { +case 301: { AST::DoWhileStatement *node = new (pool) AST::DoWhileStatement(sym(2).Statement, sym(5).Expression); node->doToken = loc(1); node->whileToken = loc(3); @@ -1419,7 +1464,7 @@ case 295: { sym(1).Node = node; } break; -case 296: { +case 302: { AST::WhileStatement *node = new (pool) AST::WhileStatement(sym(3).Expression, sym(5).Statement); node->whileToken = loc(1); node->lparenToken = loc(2); @@ -1427,7 +1472,7 @@ case 296: { sym(1).Node = node; } break; -case 297: { +case 303: { AST::ForStatement *node = new (pool) AST::ForStatement(sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); node->forToken = loc(1); @@ -1438,7 +1483,7 @@ case 297: { sym(1).Node = node; } break; -case 298: { +case 304: { AST::LocalForStatement *node = new (pool) AST::LocalForStatement( sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression, sym(8).Expression, sym(10).Statement); @@ -1451,7 +1496,7 @@ case 298: { sym(1).Node = node; } break; -case 299: { +case 305: { AST:: ForEachStatement *node = new (pool) AST::ForEachStatement(sym(3).Expression, sym(5).Expression, sym(7).Statement); node->forToken = loc(1); @@ -1461,7 +1506,7 @@ case 299: { sym(1).Node = node; } break; -case 300: { +case 306: { AST::LocalForEachStatement *node = new (pool) AST::LocalForEachStatement( sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); node->forToken = loc(1); @@ -1472,14 +1517,14 @@ case 300: { sym(1).Node = node; } break; -case 302: { +case 308: { AST::ContinueStatement *node = new (pool) AST::ContinueStatement(); node->continueToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 304: { +case 310: { AST::ContinueStatement *node = new (pool) AST::ContinueStatement(stringRef(2)); node->continueToken = loc(1); node->identifierToken = loc(2); @@ -1487,14 +1532,14 @@ case 304: { sym(1).Node = node; } break; -case 306: { +case 312: { AST::BreakStatement *node = new (pool) AST::BreakStatement(QStringRef()); node->breakToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 308: { +case 314: { AST::BreakStatement *node = new (pool) AST::BreakStatement(stringRef(2)); node->breakToken = loc(1); node->identifierToken = loc(2); @@ -1502,14 +1547,14 @@ case 308: { sym(1).Node = node; } break; -case 310: { +case 316: { AST::ReturnStatement *node = new (pool) AST::ReturnStatement(sym(2).Expression); node->returnToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 311: { +case 317: { AST::WithStatement *node = new (pool) AST::WithStatement(sym(3).Expression, sym(5).Statement); node->withToken = loc(1); node->lparenToken = loc(2); @@ -1517,7 +1562,7 @@ case 311: { sym(1).Node = node; } break; -case 312: { +case 318: { AST::SwitchStatement *node = new (pool) AST::SwitchStatement(sym(3).Expression, sym(5).CaseBlock); node->switchToken = loc(1); node->lparenToken = loc(2); @@ -1525,83 +1570,83 @@ case 312: { sym(1).Node = node; } break; -case 313: { +case 319: { AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 314: { +case 320: { AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(5); sym(1).Node = node; } break; -case 315: { +case 321: { sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClause); } break; -case 316: { +case 322: { sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClauses, sym(2).CaseClause); } break; -case 317: { +case 323: { sym(1).Node = 0; } break; -case 318: { +case 324: { sym(1).Node = sym(1).CaseClauses->finish (); } break; -case 319: { +case 325: { AST::CaseClause *node = new (pool) AST::CaseClause(sym(2).Expression, sym(4).StatementList); node->caseToken = loc(1); node->colonToken = loc(3); sym(1).Node = node; } break; -case 320: { +case 326: { AST::DefaultClause *node = new (pool) AST::DefaultClause(sym(3).StatementList); node->defaultToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 321: { +case 327: { AST::LabelledStatement *node = new (pool) AST::LabelledStatement(stringRef(1), sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 323: { +case 329: { AST::ThrowStatement *node = new (pool) AST::ThrowStatement(sym(2).Expression); node->throwToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 324: { +case 330: { AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch); node->tryToken = loc(1); sym(1).Node = node; } break; -case 325: { +case 331: { AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 326: { +case 332: { AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch, sym(4).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 327: { +case 333: { AST::Catch *node = new (pool) AST::Catch(stringRef(3), sym(5).Block); node->catchToken = loc(1); node->lparenToken = loc(2); @@ -1610,20 +1655,20 @@ case 327: { sym(1).Node = node; } break; -case 328: { +case 334: { AST::Finally *node = new (pool) AST::Finally(sym(2).Block); node->finallyToken = loc(1); sym(1).Node = node; } break; -case 330: { +case 336: { AST::DebuggerStatement *node = new (pool) AST::DebuggerStatement(); node->debuggerToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 332: { +case 338: { AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); node->identifierToken = loc(2); @@ -1634,7 +1679,7 @@ case 332: { sym(1).Node = node; } break; -case 333: { +case 339: { AST::FunctionExpression *node = new (pool) AST::FunctionExpression(stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); if (! stringRef(2).isNull()) @@ -1646,7 +1691,7 @@ case 333: { sym(1).Node = node; } break; -case 334: { +case 340: { AST::FunctionExpression *node = new (pool) AST::FunctionExpression(QStringRef(), sym(3).FormalParameterList, sym(6).FunctionBody); node->functionToken = loc(1); node->lparenToken = loc(2); @@ -1656,56 +1701,56 @@ case 334: { sym(1).Node = node; } break; -case 335: { +case 341: { AST::FormalParameterList *node = new (pool) AST::FormalParameterList(stringRef(1)); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 336: { +case 342: { AST::FormalParameterList *node = new (pool) AST::FormalParameterList(sym(1).FormalParameterList, stringRef(3)); node->commaToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 337: { +case 343: { sym(1).Node = 0; } break; -case 338: { +case 344: { sym(1).Node = sym(1).FormalParameterList->finish (); } break; -case 339: { +case 345: { sym(1).Node = 0; } break; -case 341: { +case 347: { sym(1).Node = new (pool) AST::FunctionBody(sym(1).SourceElements->finish ()); } break; -case 343: { +case 349: { sym(1).Node = new (pool) AST::Program(sym(1).SourceElements->finish ()); } break; -case 344: { +case 350: { sym(1).Node = new (pool) AST::SourceElements(sym(1).SourceElement); } break; -case 345: { +case 351: { sym(1).Node = new (pool) AST::SourceElements(sym(1).SourceElements, sym(2).SourceElement); } break; -case 346: { +case 352: { sym(1).Node = new (pool) AST::StatementSourceElement(sym(1).Statement); } break; -case 347: { +case 353: { sym(1).Node = new (pool) AST::FunctionSourceElement(sym(1).FunctionDeclaration); } break; -case 348: { +case 354: { sym(1).Node = 0; } break; diff --git a/src/tools/qdoc/qmlparser/qqmljsparser_p.h b/src/tools/qdoc/qmlparser/qqmljsparser_p.h index 6edfd844d0..bf963718fb 100644 --- a/src/tools/qdoc/qmlparser/qqmljsparser_p.h +++ b/src/tools/qdoc/qmlparser/qqmljsparser_p.h @@ -112,7 +112,8 @@ public: AST::VariableDeclarationList *VariableDeclarationList; AST::UiProgram *UiProgram; - AST::UiImportList *UiImportList; + AST::UiHeaderItemList *UiHeaderItemList; + AST::UiPragma *UiPragma; AST::UiImport *UiImport; AST::UiParameterList *UiParameterList; AST::UiPublicMember *UiPublicMember; @@ -125,6 +126,7 @@ public: AST::UiObjectMemberList *UiObjectMemberList; AST::UiArrayMemberList *UiArrayMemberList; AST::UiQualifiedId *UiQualifiedId; + AST::UiQualifiedPragmaId *UiQualifiedPragmaId; }; public: @@ -206,6 +208,7 @@ protected: { return location_stack [tos + index - 1]; } AST::UiQualifiedId *reparseAsQualifiedId(AST::ExpressionNode *expr); + AST::UiQualifiedPragmaId *reparseAsQualifiedPragmaId(AST::ExpressionNode *expr); protected: Engine *driver; @@ -245,9 +248,9 @@ protected: -#define J_SCRIPT_REGEXPLITERAL_RULE1 81 +#define J_SCRIPT_REGEXPLITERAL_RULE1 87 -#define J_SCRIPT_REGEXPLITERAL_RULE2 82 +#define J_SCRIPT_REGEXPLITERAL_RULE2 88 QT_QML_END_NAMESPACE -- cgit v1.2.3 From 45b10ee02af53b712feacdce1d5c86af5a4079ad Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 30 Oct 2013 11:55:53 +0100 Subject: qdoc: Don't output docs for internal things MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This update to the Generator base class prevents qdoc from writing an html file for anything that is marked \internal if the user has not set the showinternal flag. Task-number: QTBUG-34269 Change-Id: Ia60109d4568447501370bb9d4c1344a48f9b6113 Reviewed-by: Topi Reiniö Reviewed-by: Jerome Pasion Reviewed-by: Nico Vertriest --- src/tools/qdoc/generator.cpp | 4 ++++ src/tools/qdoc/generator.h | 1 + 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index e6c5ae9062..357e013360 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -136,6 +136,7 @@ Generator::Generator() inSectionHeading_(false), inTableHeader_(false), threeColumnEnumValueTable_(true), + showInternal_(false), numTableRows_(0) { qdb_ = QDocDatabase::qdocDB(); @@ -964,6 +965,8 @@ void Generator::generateInnerNode(InnerNode* node) return; if (node->isIndexNode()) return; + if (node->isInternal() && !showInternal_) + return; if (node->type() == Node::Document) { DocNode* docNode = static_cast(node); @@ -1666,6 +1669,7 @@ void Generator::augmentImageDirs(QSet& moreImageDirs) void Generator::initializeGenerator(const Config& config) { config_ = &config; + showInternal_ = config.getBool(CONFIG_SHOWINTERNAL); } bool Generator::matchAhead(const Atom *atom, Atom::Type expectedAtomType) diff --git a/src/tools/qdoc/generator.h b/src/tools/qdoc/generator.h index 52d73e8dea..b464014308 100644 --- a/src/tools/qdoc/generator.h +++ b/src/tools/qdoc/generator.h @@ -239,6 +239,7 @@ private: bool inSectionHeading_; bool inTableHeader_; bool threeColumnEnumValueTable_; + bool showInternal_; int numTableRows_; QString link_; QString sectionNumber_; -- cgit v1.2.3 From 59569fd0202c52a16860fba5634e743286a19fd2 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 31 Oct 2013 16:14:54 +0100 Subject: Android: Differ between ShowMaximized and ShowFullScreen The default is now ShowMaximized which behaves as it did before, i.e. each window will fill the screen but the status bar will be visible. Calling showFullScreen() explicitly will now hide the status bar to maximize the amount of screen real estate occupied by the application. Task-number: QTBUG-33135 Change-Id: If0d0a2ab72f8026e76818290e2b953dbc0dec156 Reviewed-by: BogDan Vatra --- src/gui/kernel/qplatformintegration.cpp | 2 + src/gui/kernel/qplatformintegration.h | 3 +- src/gui/kernel/qwindow.cpp | 2 + src/plugins/platforms/android/opengl/opengl.pro | 6 ++- .../platforms/android/src/androidjnimain.cpp | 34 ++++++++++++ src/plugins/platforms/android/src/androidjnimain.h | 5 +- .../src/opengl/qandroidopenglplatformscreen.cpp | 59 +++++++++++++++++++++ .../src/opengl/qandroidopenglplatformscreen.h | 60 ++++++++++++++++++++++ .../src/opengl/qandroidopenglplatformwindow.cpp | 27 ++++++++++ .../src/opengl/qandroidopenglplatformwindow.h | 3 ++ .../android/src/qandroidplatformintegration.cpp | 14 ++++- .../android/src/qandroidplatformintegration.h | 4 ++ .../android/src/raster/qandroidplatformscreen.cpp | 7 +++ .../android/src/raster/qandroidplatformwindow.cpp | 37 ++++++++++++- .../android/src/raster/qandroidplatformwindow.h | 5 ++ src/plugins/platforms/eglfs/qeglfsintegration.cpp | 7 ++- src/plugins/platforms/eglfs/qeglfsintegration.h | 3 ++ src/plugins/platforms/eglfs/qeglfsscreen.cpp | 17 +++++- src/plugins/platforms/eglfs/qeglfsscreen.h | 1 + src/widgets/kernel/qwidget.cpp | 2 + 20 files changed, 287 insertions(+), 11 deletions(-) create mode 100644 src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp create mode 100644 src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.h (limited to 'src') diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index e583606e41..08a3b63ee4 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -343,6 +343,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragTime); case ShowIsFullScreen: return false; + case ShowIsMaximized: + return false; case PasswordMaskDelay: return QPlatformTheme::defaultThemeHint(QPlatformTheme::PasswordMaskDelay); case PasswordMaskCharacter: diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 4be675a37a..d397270c10 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -147,7 +147,8 @@ public: UseRtlExtensions, SynthesizeMouseFromTouchEvents, PasswordMaskCharacter, - SetFocusOnTouchRelease + SetFocusOnTouchRelease, + ShowIsMaximized }; virtual QVariant styleHint(StyleHint hint) const; diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index a3841d3cfb..e0e1638d75 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1657,6 +1657,8 @@ void QWindow::show() bool isPopup = d_func()->windowFlags & Qt::Popup & ~Qt::Window; if (!isPopup && qApp->styleHints()->showIsFullScreen()) showFullScreen(); + else if (!isPopup && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool()) + showMaximized(); else showNormal(); } diff --git a/src/plugins/platforms/android/opengl/opengl.pro b/src/plugins/platforms/android/opengl/opengl.pro index 301c8e6e4c..ea050ca3a0 100644 --- a/src/plugins/platforms/android/opengl/opengl.pro +++ b/src/plugins/platforms/android/opengl/opengl.pro @@ -20,11 +20,13 @@ INCLUDEPATH += $$PWD/../src/opengl/ HEADERS += \ $$PWD/../src/opengl/qandroidopenglcontext.h \ - $$PWD/../src/opengl/qandroidopenglplatformwindow.h + $$PWD/../src/opengl/qandroidopenglplatformwindow.h \ + $$PWD/../src/opengl/qandroidopenglplatformscreen.h SOURCES += \ $$PWD/../src/opengl/qandroidopenglcontext.cpp \ - $$PWD/../src/opengl/qandroidopenglplatformwindow.cpp + $$PWD/../src/opengl/qandroidopenglplatformwindow.cpp \ + $$PWD/../src/opengl/qandroidopenglplatformscreen.cpp include($$PWD/../../eglfs/eglfs.pri) include($$PWD/../src/src.pri) diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp index 8b29a895b1..9ce79f445a 100644 --- a/src/plugins/platforms/android/src/androidjnimain.cpp +++ b/src/plugins/platforms/android/src/androidjnimain.cpp @@ -97,6 +97,9 @@ static jmethodID m_createBitmapMethodID = 0; static jobject m_ARGB_8888_BitmapConfigValue = 0; static jobject m_RGB_565_BitmapConfigValue = 0; +jmethodID m_setFullScreenMethodID = 0; +static bool m_statusBarShowing = true; + static jclass m_bitmapDrawableClass = 0; static jmethodID m_bitmapDrawableConstructorMethodID = 0; @@ -310,6 +313,36 @@ namespace QtAndroid return m_activityObject; } + void showStatusBar() + { + if (m_statusBarShowing) + return; + + QtAndroid::AttachedJNIEnv env; + if (env.jniEnv == 0) { + qWarning("Failed to get JNI Environment."); + return; + } + + env.jniEnv->CallStaticVoidMethod(m_applicationClass, m_setFullScreenMethodID, false); + m_statusBarShowing = true; + } + + void hideStatusBar() + { + if (!m_statusBarShowing) + return; + + QtAndroid::AttachedJNIEnv env; + if (env.jniEnv == 0) { + qWarning("Failed to get JNI Environment."); + return; + } + + env.jniEnv->CallStaticVoidMethod(m_applicationClass, m_setFullScreenMethodID, true); + m_statusBarShowing = false; + } + void setApplicationActive() { if (m_activityActive) @@ -753,6 +786,7 @@ static int registerNatives(JNIEnv *env) jclass clazz; FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/QtNative"); m_applicationClass = static_cast(env->NewGlobalRef(clazz)); + GET_AND_CHECK_STATIC_METHOD(m_setFullScreenMethodID, m_applicationClass, "setFullScreen", "(Z)V"); if (env->RegisterNatives(m_applicationClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) { __android_log_print(ANDROID_LOG_FATAL,"Qt", "RegisterNatives failed"); diff --git a/src/plugins/platforms/android/src/androidjnimain.h b/src/plugins/platforms/android/src/androidjnimain.h index b530aac884..11d3573404 100644 --- a/src/plugins/platforms/android/src/androidjnimain.h +++ b/src/plugins/platforms/android/src/androidjnimain.h @@ -69,8 +69,6 @@ namespace QtAndroid void setAndroidPlatformIntegration(QAndroidPlatformIntegration *androidPlatformIntegration); void setQtThread(QThread *thread); - void setFullScreen(QWidget *widget); - #ifndef ANDROID_PLUGIN_OPENGL void flushImage(const QPoint &pos, const QImage &image, const QRect &rect); #else @@ -89,6 +87,9 @@ namespace QtAndroid void setApplicationActive(); + void showStatusBar(); + void hideStatusBar(); + jobject createBitmap(QImage img, JNIEnv *env = 0); jobject createBitmapDrawable(jobject bitmap, JNIEnv *env = 0); diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp new file mode 100644 index 0000000000..821fd954df --- /dev/null +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qandroidopenglplatformscreen.h" +#include "qandroidopenglplatformwindow.h" + +QT_BEGIN_NAMESPACE + +QAndroidOpenGLPlatformScreen::QAndroidOpenGLPlatformScreen(EGLDisplay display) + : QEglFSScreen(display) +{ +} + +void QAndroidOpenGLPlatformScreen::topWindowChanged(QPlatformWindow *window) +{ + QAndroidOpenGLPlatformWindow *platformWindow = static_cast(window); + if (platformWindow != 0) + platformWindow->updateStatusBarVisibility(); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.h b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.h new file mode 100644 index 0000000000..e9251592aa --- /dev/null +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QANDROIDOPENGLPLATFORMSCREEN_H +#define QANDROIDOPENGLPLATFORMSCREEN_H + +#include "qeglfsscreen.h" + +QT_BEGIN_NAMESPACE + +class QAndroidOpenGLPlatformScreen : public QEglFSScreen +{ +public: + QAndroidOpenGLPlatformScreen(EGLDisplay display); + +protected: + void topWindowChanged(QPlatformWindow *window); +}; + +QT_END_NAMESPACE + +#endif // QANDROIDOPENGLPLATFORMSCREEN_H diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp index 258a0968e8..6ed805174b 100644 --- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp @@ -53,6 +53,7 @@ QBasicAtomicInt QAndroidOpenGLPlatformWindow::m_referenceCount = Q_BASIC_ATOMIC_ QAndroidOpenGLPlatformWindow::QAndroidOpenGLPlatformWindow(QWindow *window) : QEglFSWindow(window) + , m_state(Qt::WindowNoState) { } @@ -131,12 +132,38 @@ void QAndroidOpenGLPlatformWindow::destroy() } } +void QAndroidOpenGLPlatformWindow::updateStatusBarVisibility() +{ + Qt::WindowFlags flags = window()->flags(); + bool isNonRegularWindow = flags & (Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window; + if (!isNonRegularWindow) { + if (m_state & Qt::WindowFullScreen) + QtAndroid::hideStatusBar(); + else if (m_state & Qt::WindowMaximized) + QtAndroid::showStatusBar(); + } +} + void QAndroidOpenGLPlatformWindow::raise() { + updateStatusBarVisibility(); +} + +void QAndroidOpenGLPlatformWindow::setWindowState(Qt::WindowState state) +{ + if (m_state == state) + return; + + m_state = state; + if (window()->isVisible()) + updateStatusBarVisibility(); } void QAndroidOpenGLPlatformWindow::setVisible(bool visible) { + if (visible) + updateStatusBarVisibility(); + QEglFSWindow::setVisible(visible); // The Android Activity is activated before Qt is initialized, causing the application state to diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h index 9a25957ccd..e4ff0444d4 100644 --- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h @@ -66,16 +66,19 @@ public: void invalidateSurface(); void resetSurface(); + void setWindowState(Qt::WindowState state); void setVisible(bool visible); void destroy(); static void updateStaticNativeWindow(); + void updateStatusBarVisibility(); private: QSize m_scheduledResize; QMutex m_lock; + Qt::WindowState m_state; static QReadWriteLock m_staticSurfaceLock; static EGLSurface m_staticSurface; diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp index e48a3c9ebe..6d0ec306ab 100644 --- a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp @@ -61,6 +61,7 @@ # include "androidjnimenu.h" # include "qandroidopenglcontext.h" # include "qandroidopenglplatformwindow.h" +# include "qandroidopenglplatformscreen.h" # include "qeglfshooks.h" # include #endif @@ -141,7 +142,10 @@ QPlatformBackingStore *QAndroidPlatformIntegration::createPlatformBackingStore(Q QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *window) const { - return new QAndroidPlatformWindow(window); + QAndroidPlatformWindow *platformWindow = new QAndroidPlatformWindow(window); + platformWindow->setWindowState(window->windowState()); + + return platformWindow; } QAbstractEventDispatcher *QAndroidPlatformIntegration::createEventDispatcher() const @@ -154,6 +158,7 @@ QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *wind QAndroidOpenGLPlatformWindow *platformWindow = new QAndroidOpenGLPlatformWindow(window); platformWindow->create(); platformWindow->requestActivateWindow(); + platformWindow->setWindowState(window->windowState()); QtAndroidMenu::setActiveTopLevelWindow(window); return platformWindow; @@ -230,7 +235,7 @@ QPlatformServices *QAndroidPlatformIntegration::services() const QVariant QAndroidPlatformIntegration::styleHint(StyleHint hint) const { switch (hint) { - case ShowIsFullScreen: + case ShowIsMaximized: return true; default: return QPlatformIntegration::styleHint(hint); @@ -307,6 +312,11 @@ void QAndroidPlatformIntegration::setDisplayMetrics(int width, int height) m_defaultPhysicalSizeHeight = height; } +QEglFSScreen *QAndroidPlatformIntegration::createScreen() const +{ + return new QAndroidOpenGLPlatformScreen(display()); +} + #endif void QAndroidPlatformIntegration::pauseApp() diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.h b/src/plugins/platforms/android/src/qandroidplatformintegration.h index 5ebdf9e65c..3b34cdf7df 100644 --- a/src/plugins/platforms/android/src/qandroidplatformintegration.h +++ b/src/plugins/platforms/android/src/qandroidplatformintegration.h @@ -140,6 +140,10 @@ public: QTouchDevice *touchDevice() const { return m_touchDevice; } void setTouchDevice(QTouchDevice *touchDevice) { m_touchDevice = touchDevice; } +#ifdef ANDROID_PLUGIN_OPENGL + QEglFSScreen *createScreen() const; +#endif + private: friend class QEglFSAndroidHooks; diff --git a/src/plugins/platforms/android/src/raster/qandroidplatformscreen.cpp b/src/plugins/platforms/android/src/raster/qandroidplatformscreen.cpp index 0250a6122c..2e59c307c3 100644 --- a/src/plugins/platforms/android/src/raster/qandroidplatformscreen.cpp +++ b/src/plugins/platforms/android/src/raster/qandroidplatformscreen.cpp @@ -43,6 +43,7 @@ #include "qandroidplatformintegration.h" #include "androidjnimain.h" #include "androidjnimenu.h" +#include "qandroidplatformwindow.h" QAndroidPlatformScreen::QAndroidPlatformScreen():QFbScreen() { @@ -57,6 +58,12 @@ QAndroidPlatformScreen::QAndroidPlatformScreen():QFbScreen() void QAndroidPlatformScreen::topWindowChanged(QWindow *w) { QtAndroidMenu::setActiveTopLevelWindow(w); + + if (w != 0) { + QAndroidPlatformWindow *platformWindow = static_cast(w->handle()); + if (platformWindow != 0) + platformWindow->updateStatusBarVisibility(); + } } QRegion QAndroidPlatformScreen::doRedraw() diff --git a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp index f5fce0ae34..2dedc77027 100644 --- a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp +++ b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp @@ -44,7 +44,9 @@ #include "androidjnimain.h" #include -QAndroidPlatformWindow::QAndroidPlatformWindow(QWindow *window) : QFbWindow(window) +QAndroidPlatformWindow::QAndroidPlatformWindow(QWindow *window) + : QFbWindow(window) + , m_state(Qt::WindowNoState) { } @@ -58,8 +60,41 @@ void QAndroidPlatformWindow::propagateSizeHints() //shut up warning from default implementation } +void QAndroidPlatformWindow::updateStatusBarVisibility() +{ + Qt::WindowFlags flags = window()->flags(); + bool isNonRegularWindow = flags & (Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window; + if (!isNonRegularWindow) { + if (m_state & Qt::WindowFullScreen) + QtAndroid::hideStatusBar(); + else if (m_state & Qt::WindowMaximized) + QtAndroid::showStatusBar(); + } +} + +void QAndroidPlatformWindow::raise() +{ + updateStatusBarVisibility(); + QFbWindow::raise(); +} + +void QAndroidPlatformWindow::setWindowState(Qt::WindowState state) +{ + if (m_state == state) + return; + + m_state = state; + if (window()->isVisible()) + updateStatusBarVisibility(); + + QFbWindow::setWindowState(state); +} + void QAndroidPlatformWindow::setVisible(bool visible) { + if (visible) + updateStatusBarVisibility(); + QFbWindow::setVisible(visible); // The Android Activity is activated before Qt is initialized, causing the application state to diff --git a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h index 58e6451ea1..87626b982a 100644 --- a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h +++ b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h @@ -52,11 +52,16 @@ public: void propagateSizeHints(); + void raise(); + void setWindowState(Qt::WindowState state); void setVisible(bool visible); + void updateStatusBarVisibility(); public slots: void setGeometry(const QRect &rect); +private: + Qt::WindowState m_state; }; #endif // ANDROIDPLATFORMWINDOW_H diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 8a526dbff5..9f8c0747df 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -165,7 +165,7 @@ void QEglFSIntegration::initialize() qFatal("EGL error"); } - mScreen = new QEglFSScreen(mDisplay); + mScreen = createScreen(); screenAdded(mScreen); mInputContext = QPlatformInputContextFactory::create(); @@ -173,6 +173,11 @@ void QEglFSIntegration::initialize() createInputHandlers(); } +QEglFSScreen *QEglFSIntegration::createScreen() const +{ + return new QEglFSScreen(mDisplay); +} + QVariant QEglFSIntegration::styleHint(QPlatformIntegration::StyleHint hint) const { switch (hint) diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h index a6fcfc8427..f685eec2d4 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.h +++ b/src/plugins/platforms/eglfs/qeglfsintegration.h @@ -86,6 +86,9 @@ public: QPlatformInputContext *inputContext() const { return mInputContext; } +protected: + virtual QEglFSScreen *createScreen() const; + private: void createInputHandlers(); diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index 3f92d60aa2..758b461b3f 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -126,26 +126,34 @@ void QEglFSScreen::setPrimarySurface(EGLSurface surface) void QEglFSScreen::addWindow(QEglFSWindow *window) { - if (!m_windows.contains(window)) + if (!m_windows.contains(window)) { m_windows.append(window); + topWindowChanged(window); + } } void QEglFSScreen::removeWindow(QEglFSWindow *window) { m_windows.removeOne(window); + if (!m_windows.isEmpty()) + topWindowChanged(m_windows.last()); } void QEglFSScreen::moveToTop(QEglFSWindow *window) { m_windows.removeOne(window); m_windows.append(window); + topWindowChanged(window); } void QEglFSScreen::changeWindowIndex(QEglFSWindow *window, int newIdx) { int idx = m_windows.indexOf(window); - if (idx != -1 && idx != newIdx) + if (idx != -1 && idx != newIdx) { m_windows.move(idx, newIdx); + if (newIdx == m_windows.size() - 1) + topWindowChanged(m_windows.last()); + } } QEglFSWindow *QEglFSScreen::rootWindow() @@ -157,4 +165,9 @@ QEglFSWindow *QEglFSScreen::rootWindow() return 0; } +void QEglFSScreen::topWindowChanged(QPlatformWindow *window) +{ + Q_UNUSED(window); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h index 578a6cf20d..11d66b7e0f 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.h +++ b/src/plugins/platforms/eglfs/qeglfsscreen.h @@ -85,6 +85,7 @@ public: protected: void setPrimarySurface(EGLSurface surface); + virtual void topWindowChanged(QPlatformWindow *window); private: friend class QEglFSWindow; diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index abba2b455a..039a834214 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -7012,6 +7012,8 @@ void QWidget::show() bool isPopup = data->window_flags & Qt::Popup & ~Qt::Window; if (isWindow() && !isPopup && qApp->styleHints()->showIsFullScreen()) showFullScreen(); + else if (isWindow() && !isPopup && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool()) + showMaximized(); else setVisible(true); } -- cgit v1.2.3 From 3b48a65e99839c9427923c03b4e2a87a8465d165 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 14 Oct 2013 16:57:32 +0200 Subject: QBasicAtomicInt: fix wrong comment about non-atomic API The public documentation for load() and store() says it's atomic, and it is: * using _q_value.store(newValue, std::memory_order_relaxed) in the C++11 implementation * using a simple assignment otherwise, which is atomic (and relaxed, no memory barriers) on all the existing C++ ABIs. Change-Id: I40faa47120163225bd11c3a32514ac97ef8bbbd4 Reviewed-by: Thiago Macieira --- src/corelib/thread/qbasicatomic.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h index ddcc25f7b7..782ae90698 100644 --- a/src/corelib/thread/qbasicatomic.h +++ b/src/corelib/thread/qbasicatomic.h @@ -137,12 +137,11 @@ public: typename Ops::Type _q_value; - // Non-atomic API + // Everything below is either implemented in ../arch/qatomic_XXX.h or (as fallback) in qgenericatomic.h + T load() const Q_DECL_NOTHROW { return Ops::load(_q_value); } void store(T newValue) Q_DECL_NOTHROW { Ops::store(_q_value, newValue); } - // Atomic API, implemented in qatomic_XXX.h - T loadAcquire() const Q_DECL_NOTHROW { return Ops::loadAcquire(_q_value); } void storeRelease(T newValue) Q_DECL_NOTHROW { Ops::storeRelease(_q_value, newValue); } -- cgit v1.2.3 From 1f6dfa774959830a915f3e2a7b0561ca29b8c485 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Mon, 28 Oct 2013 09:25:11 +0100 Subject: Add QSQLITE_OPEN_URI database connection flag This flag enables the URI mode for database names in the SQLite backend. Without this flag, it's not possible to use URIs like 'file:somedb?mode=memory&cache=shared' to create shared, in-memory databases. Change-Id: I2938184dad1f27c7af454385ca305bd4f6ed1a5e Reviewed-by: Mark Brand --- src/sql/drivers/sqlite/qsql_sqlite.cpp | 2 ++ src/sql/kernel/qsqldatabase.cpp | 1 + 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index ffeb7921b3..0a8b71aa8a 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -596,6 +596,8 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c } if (option == QLatin1String("QSQLITE_OPEN_READONLY")) openMode = SQLITE_OPEN_READONLY; + if (option == QLatin1String("QSQLITE_OPEN_URI")) + openMode |= SQLITE_OPEN_URI; if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE")) sharedCache = true; } diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index b87a1fe1c5..f8ecabee8f 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -1264,6 +1264,7 @@ QSqlRecord QSqlDatabase::record(const QString& tablename) const \list \li QSQLITE_BUSY_TIMEOUT \li QSQLITE_OPEN_READONLY + \li QSQLITE_OPEN_URI \li QSQLITE_ENABLE_SHARED_CACHE \endlist -- cgit v1.2.3 From 9927c1a2bbb372d0e557c58062e4ecda7a644aa1 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 3 Nov 2013 21:20:35 +0100 Subject: QPrintDialog - Fix Windows Current Page option selection In the Windows print dialog default the print range radio button selection to the QPrinter set value, but only if the option is enabled in the dialog. Task-number: QTBUG-32965 Change-Id: Ic64d86d263a2f8e31c8b32608b569499d0f24d63 Reviewed-by: Friedemann Kleint --- src/printsupport/dialogs/qprintdialog_win.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/printsupport/dialogs/qprintdialog_win.cpp b/src/printsupport/dialogs/qprintdialog_win.cpp index e886abbcf3..96a201ae45 100644 --- a/src/printsupport/dialogs/qprintdialog_win.cpp +++ b/src/printsupport/dialogs/qprintdialog_win.cpp @@ -109,10 +109,12 @@ static void qt_win_setup_PRINTDLGEX(PRINTDLGEX *pd, QWidget *parent, if(!pdlg->isOptionEnabled(QPrintDialog::PrintToFile)) pd->Flags |= PD_DISABLEPRINTTOFILE; - if (pdlg->printRange() == QPrintDialog::Selection) + if (pdlg->isOptionEnabled(QPrintDialog::PrintSelection) && pdlg->printRange() == QPrintDialog::Selection) pd->Flags |= PD_SELECTION; - else if (pdlg->printRange() == QPrintDialog::PageRange) + else if (pdlg->isOptionEnabled(QPrintDialog::PrintPageRange) && pdlg->printRange() == QPrintDialog::PageRange) pd->Flags |= PD_PAGENUMS; + else if (pdlg->isOptionEnabled(QPrintDialog::PrintCurrentPage) && pdlg->printRange() == QPrintDialog::CurrentPage) + pd->Flags |= PD_CURRENTPAGE; else pd->Flags |= PD_ALLPAGES; -- cgit v1.2.3 From 7b2ae0db664a5f3fe9982a409e7e493245dde8ba Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Wed, 30 Oct 2013 12:52:40 +0100 Subject: Better check for host builds for fails on QT_POINTER_SIZE Change-Id: I9949565617cb62e34dd4db93acc4162b24c99ff9 Reviewed-by: Simon Hausmann Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qglobal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 5bb675728a..ea6639be1b 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -197,7 +197,7 @@ typedef quint64 qulonglong; # define QT_POINTER_SIZE 4 # elif defined(Q_OS_ANDROID) # define QT_POINTER_SIZE 4 // ### Add auto-detection to Windows configure -# elif !defined(QT_BUILD_MOC) && !defined(QT_BUILD_QMAKE) && !defined(QT_BUILD_CONFIGURE) +# elif !defined(QT_BOOTSTRAPPED) # error could not determine QT_POINTER_SIZE # endif #endif -- cgit v1.2.3 From a24ec6b273892c41f1c163fd43b568e3e5ff8279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 31 Oct 2013 14:50:19 +0100 Subject: Ensure QLocale's shared C-locale QLocalePrivate is never deleted Other static data such as QTextStream might be initialized before the static C-locale, in which case QLocale would adopt c_private and bump the ref-count to 2, only to see it reset back to 1 when the c_locale's static initialization happened. The result was that at application shutdown the ref-count would fall down to 0, and we tried deleting the static data. This issue was observed with clang in a debug build, where the c_private is initialized at runtime. Change-Id: If05221a5e87886e1805ad3c1b1520483f425c0fb Reviewed-by: Simon Hausmann Reviewed-by: Olivier Goffart --- src/corelib/tools/qlocale.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index fb233c0640..0eb202c5e2 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -531,7 +531,11 @@ static const QLocaleData *default_data = 0; static uint default_number_options = 0; static const QLocaleData *const c_data = locale_data; -static QLocalePrivate c_private = { c_data, Q_BASIC_ATOMIC_INITIALIZER(1), 0 }; +static QLocalePrivate *c_private() +{ + static QLocalePrivate c_locale = { c_data, Q_BASIC_ATOMIC_INITIALIZER(1), 0 }; + return &c_locale; +} #ifndef QT_NO_SYSTEMLOCALE @@ -700,7 +704,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer, defaultLocalePriva static QLocalePrivate *localePrivateByName(const QString &name) { if (name == QLatin1String("C")) - return &c_private; + return c_private(); return QLocalePrivate::create(findLocaleData(name)); } @@ -708,7 +712,7 @@ static QLocalePrivate *findLocalePrivate(QLocale::Language language, QLocale::Sc QLocale::Country country) { if (language == QLocale::C) - return &c_private; + return c_private(); const QLocaleData *data = QLocaleData::findLocaleData(language, script, country); -- cgit v1.2.3 From 00b5dec9e65b3c6fce5559f7181592ff9753ba38 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Fri, 1 Nov 2013 14:15:50 +0100 Subject: qdoc: warn if index file for dependency is not found Output a warning for each doc dependency that qdoc cannot locate an index file for. The index files are loaded for both prepare and generate phases. To avoid duplication, output warnings only when in generate phase. Change-Id: I74f9ba78e4b57cb1a62e0d1c2efda01ecc85c06d Reviewed-by: Martin Smith Reviewed-by: Jerome Pasion --- src/tools/qdoc/main.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp index 4573724137..ffaef904b7 100644 --- a/src/tools/qdoc/main.cpp +++ b/src/tools/qdoc/main.cpp @@ -218,8 +218,15 @@ static void loadIndexFiles(Config& config) else if (foundIndices.size() == 1) { indexToAdd = foundIndices[0].absoluteFilePath(); } - if (!indexToAdd.isEmpty() && !indexFiles.contains(indexToAdd)) - indexFiles << indexToAdd; + if (!indexToAdd.isEmpty()) { + if (!indexFiles.contains(indexToAdd)) + indexFiles << indexToAdd; + } + else if (Generator::runGenerateOnly()) { + qDebug() << "warning:" << config.getString(CONFIG_PROJECT) + << "Cannot locate index file for dependency" + << dependModules[i]; + } } } else { -- cgit v1.2.3 From c8df30682cecc36153b536f52cdfe4d7d789959c Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Wed, 30 Oct 2013 11:03:08 +0100 Subject: Handle keyboard focus change Call QWindowSystemInterface::handleWindowActivated when a SCREEN_EVENT_PROPERTY event for he SCREEN_PROPERTY_KEYBOARD_FOCUS property is received. Change-Id: Ic2b10c5b793dd4451adac68691296f8265a71160 Reviewed-by: Andreas Holzammer Reviewed-by: Frank Osterfeld Reviewed-by: Kevin Krammer Reviewed-by: Thomas McGuire --- .../platforms/qnx/qqnxscreeneventhandler.cpp | 46 ++++++++++++++++++++++ src/plugins/platforms/qnx/qqnxscreeneventhandler.h | 2 + 2 files changed, 48 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index c869d29c99..129f149ca1 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -125,6 +125,10 @@ bool QQnxScreenEventHandler::handleEvent(screen_event_t event, int qnxType) handleDisplayEvent(event); break; + case SCREEN_EVENT_PROPERTY: + handlePropertyEvent(event); + break; + default: // event ignored qScreenEventDebug() << Q_FUNC_INFO << "unknown event" << qnxType; @@ -496,6 +500,48 @@ void QQnxScreenEventHandler::handleDisplayEvent(screen_event_t event) } } +void QQnxScreenEventHandler::handlePropertyEvent(screen_event_t event) +{ + errno = 0; + int objectType; + if (screen_get_event_property_iv(event, SCREEN_PROPERTY_OBJECT_TYPE, &objectType) != 0) + qFatal("QQNX: failed to query object type property, errno=%d", errno); + + if (objectType != SCREEN_OBJECT_TYPE_WINDOW) + return; + + errno = 0; + screen_window_t window = 0; + if (screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, (void**)&window) != 0) + qFatal("QQnx: failed to query window property, errno=%d", errno); + + errno = 0; + int property; + if (screen_get_event_property_iv(event, SCREEN_PROPERTY_NAME, &property) != 0) + qFatal("QQnx: failed to query window property, errno=%d", errno); + + switch (property) { + case SCREEN_PROPERTY_KEYBOARD_FOCUS: + handleKeyboardFocusPropertyEvent(window); + break; + default: + // event ignored + qScreenEventDebug() << Q_FUNC_INFO << "Ignore property event for property: " << property; + } +} + +void QQnxScreenEventHandler::handleKeyboardFocusPropertyEvent(screen_window_t window) +{ + errno = 0; + int focus = 0; + if (window && screen_get_window_property_iv(window, SCREEN_PROPERTY_KEYBOARD_FOCUS, &focus) != 0) + qFatal("QQnx: failed to query keyboard focus property, errno=%d", errno); + + QWindow *w = focus ? QQnxIntegration::window(window) : 0; + + QWindowSystemInterface::handleWindowActivated(w); +} + #include "moc_qqnxscreeneventhandler.cpp" QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h index 7a1af6f343..7ceb32fcec 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h @@ -72,6 +72,8 @@ private: void handleCloseEvent(screen_event_t event); void handleCreateEvent(screen_event_t event); void handleDisplayEvent(screen_event_t event); + void handlePropertyEvent(screen_event_t event); + void handleKeyboardFocusPropertyEvent(screen_window_t window); private: enum { -- cgit v1.2.3 From 84a318c74f11ffb198c394cb07f67d137b44a5df Mon Sep 17 00:00:00 2001 From: Frank Osterfeld Date: Mon, 28 Oct 2013 13:56:35 +0100 Subject: enable PPS keyboard implementation also for plain QNX Integrating with /pps/services/input is also the way to go for QNX. Change-Id: If2498f2c42ed4e6e0d1cadc787cc62e80940043a Reviewed-by: Rafael Roquetto Reviewed-by: Kevin Krammer Reviewed-by: Thomas McGuire --- src/plugins/platforms/qnx/qnx.pro | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index f5a4e0735f..becf5e287e 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -2,21 +2,13 @@ TARGET = qqnx QT += platformsupport-private core-private gui-private +# The PPS based platform integration is currently used for both BB10 and plain QNX +CONFIG += qqnx_pps + # Uncomment this to build with support for IMF once it becomes available in the BBNDK #CONFIG += qqnx_imf -# Uncomment this to build with support for PPS based platform integration -#CONFIG += qqnx_pps - -CONFIG(blackberry) { - CONFIG += qqnx_pps - - # Uncomment following line to enable screen event - # handling through a dedicated thread. - # CONFIG += qqnx_screeneventthread -} else { - CONFIG += qqnx_screeneventthread -} +!blackberry:CONFIG += qqnx_screeneventthread # Uncomment these to enable debugging output for various aspects of the plugin #DEFINES += QQNXBPSEVENTFILTER_DEBUG -- cgit v1.2.3 From c982fa3666385e87d968a9f2cad70cd906a3749d Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Thu, 31 Oct 2013 13:34:57 +0100 Subject: iOS: Prevent calling QWindow methods on native NSViews MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UIViews can return nil when calling qwindow, so we must check before trying to use the QWindow handle. Change-Id: I72e9ddc58ebe10a3e7ea511f2356650402ba23f4 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 5a2a1122ec..0bfda49536 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -455,7 +455,7 @@ void QIOSWindow::raiseOrLower(bool raise) for (int i = int(subviews.count) - 1; i >= 0; --i) { UIView *view = static_cast([subviews objectAtIndex:i]); - if (view.hidden || view == m_view) + if (view.hidden || view == m_view || !view.qwindow) continue; int level = static_cast(view.qwindow->handle())->m_windowLevel; if (m_windowLevel > level || (raise && m_windowLevel == level)) { -- cgit v1.2.3 From d35c8fe52149f0adb7c81da804a5b98cc54a0abe Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 1 Nov 2013 09:40:27 +0100 Subject: CMake: Add the qreal typedef type to the Qt5::Core target. This way, a Qt compiled with qreal=float and one linked with qreal=double can not be linked by a single downstream. That is diagnosed at cmake-time. Change-Id: I9183dbcfef181fadea5321d3154948e8258e4a2a Reviewed-by: Oswald Buddenhagen Reviewed-by: Stephen Kelly --- src/corelib/Qt5CoreConfigExtras.cmake.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index 2d87783107..1e00c74aa6 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -51,8 +51,9 @@ set(Qt5Core_MOC_EXECUTABLE Qt5::moc) set(Qt5Core_RCC_EXECUTABLE Qt5::rcc) set_property(TARGET Qt5::Core PROPERTY INTERFACE_QT_MAJOR_VERSION 5) +set_property(TARGET Qt5::Core PROPERTY INTERFACE_QT_COORD_TYPE $$QT_COORD_TYPE) set_property(TARGET Qt5::Core APPEND PROPERTY - COMPATIBLE_INTERFACE_STRING QT_MAJOR_VERSION + COMPATIBLE_INTERFACE_STRING QT_MAJOR_VERSION QT_COORD_TYPE ) include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5CoreConfigExtrasMkspecDir.cmake\") -- cgit v1.2.3 From 8a1bebb297dc672f8b12039b4b998c3587bc4eb1 Mon Sep 17 00:00:00 2001 From: John Layt Date: Sun, 3 Nov 2013 18:15:31 +0100 Subject: QPdfEngine - Remove Producer copyright notice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the copyright notice from the PDF Producer field which could be misunderstood. Comparison to other PDF Producers shows no other company does this. Task-number: QTBUG-33853 Change-Id: Ie657a356dc7c4b15f04d961978e0c8514c092a31 Reviewed-by: Olivier Goffart Reviewed-by: Jake Petroules Reviewed-by: Thorbjørn Lund Martsum Reviewed-by: Lars Knoll Reviewed-by: Gunnar Sletta --- src/gui/painting/qpdf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 9105e8b396..c05f47c59d 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1651,7 +1651,7 @@ void QPdfEnginePrivate::writeInfo() xprintf("\n/Creator "); printString(creator); xprintf("\n/Producer "); - printString(QString::fromLatin1("Qt " QT_VERSION_STR " (C) 2012 Digia Plc and/or its subsidiary(-ies)")); + printString(QString::fromLatin1("Qt " QT_VERSION_STR)); QDateTime now = QDateTime::currentDateTime().toUTC(); QTime t = now.time(); QDate d = now.date(); -- cgit v1.2.3 From a922b94c2fa273dfc3915c840b4b8518163d06f1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 31 Oct 2013 16:41:19 +0100 Subject: Windows: Do not detect full-screen state for child windows. Introduced by a1db174ea98fab8669da498639895bac4c894baf (Fix window state handling). Task-number: QTBUG-34477 Change-Id: I4c92edddef346f9d7c4741f2f9784e9f686e9cda Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowswindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index d3d381ae28..44fd97e1aa 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1548,7 +1548,7 @@ static const QScreen *effectiveScreen(const QWindow *w) bool QWindowsWindow::isFullScreen_sys() const { - return geometry_sys() == effectiveScreen(window())->geometry(); + return window()->isTopLevel() && geometry_sys() == effectiveScreen(window())->geometry(); } /*! -- cgit v1.2.3 From 8a5657b9f721bb2301358080353e1d6f3fcf2174 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 31 Oct 2013 16:15:51 +0100 Subject: fix warnings about unused variables & parameters Change-Id: Ia5816671267ea21dae0d90560b239c4498f9156c Reviewed-by: Joerg Bornemann --- src/corelib/io/qsettings.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index c78b355ac1..35b3ed4e3d 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -890,7 +890,9 @@ StNormal: ++j; } -#ifndef QT_NO_TEXTCODEC +#ifdef QT_NO_TEXTCODEC + Q_UNUSED(codec) +#else if (codec) { stringResult += codec->toUnicode(str.constData() + i, j - i); } else -- cgit v1.2.3 From c87b27f308eecb2beadc227e107b2df161b3466b Mon Sep 17 00:00:00 2001 From: Marcel Krems Date: Thu, 10 Oct 2013 16:32:31 +0200 Subject: Silence compiler warning warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses] Change-Id: I15e283023918cd4ebc27e91812eadf95ba156d71 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira Reviewed-by: David Faure --- src/corelib/io/qurl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index fe5faa2be7..77aa3c4821 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3586,7 +3586,7 @@ bool QUrl::matches(const QUrl &url, FormattingOptions options) const else if (d->fragment != url.d->fragment) return false; - if (!(d->sectionIsPresent & mask) == (url.d->sectionIsPresent & mask)) + if ((d->sectionIsPresent & mask) != (url.d->sectionIsPresent & mask)) return false; // Compare paths, after applying path-related options -- cgit v1.2.3 From 1d07c724317126c03ddadaed8cda2a0fcf783073 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 1 Nov 2013 14:29:51 +0100 Subject: Fix major performance regression in QGLWidget on texture bind Since Qt 5.1 we have not recognized the GL_EXT_bgra extension on desktop OpenGL, or the GL_EXT_texture_format_BGRA8888 extension on OpenGL ES. This patch matches the GL_EXT_bgra extension on both OpenGL and OpenGL ES and adds discovery of GL_EXT_texture_format_BGRA8888 under OpenGL ES. The old name for GL_EXT_texture_format_BGRA8888, GL_IMG_texture_format_BGRA8888 is also recognized. Change-Id: I2035bfe045aee14e86a1f407f5b8556454f8bb90 Reviewed-by: Gunnar Sletta --- src/gui/opengl/qopenglfunctions.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index a4ed74637c..0e5a1327b0 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -347,6 +347,9 @@ static int qt_gl_resolve_extensions() { int extensions = 0; QOpenGLExtensionMatcher extensionMatcher; + if (extensionMatcher.match("GL_EXT_bgra")) + extensions |= QOpenGLExtensions::BGRATextureFormat; + #if defined(QT_OPENGL_ES) if (extensionMatcher.match("GL_OES_mapbuffer")) extensions |= QOpenGLExtensions::MapBuffer; @@ -356,10 +359,9 @@ static int qt_gl_resolve_extensions() extensions |= QOpenGLExtensions::ElementIndexUint; if (extensionMatcher.match("GL_OES_depth24")) extensions |= QOpenGLExtensions::Depth24; - - if (extensionMatcher.match("GL_EXT_bgra")) + // TODO: Consider matching GL_APPLE_texture_format_BGRA8888 as well, but it needs testing. + if (extensionMatcher.match("GL_IMG_texture_format_BGRA8888") || extensionMatcher.match("GL_EXT_texture_format_BGRA8888")) extensions |= QOpenGLExtensions::BGRATextureFormat; - #else QSurfaceFormat format = QOpenGLContext::currentContext()->format(); extensions |= QOpenGLExtensions::ElementIndexUint | QOpenGLExtensions::MapBuffer; -- cgit v1.2.3 From 0884802bb5a775e30555d21f071e12989fcba8c9 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 4 Nov 2013 16:20:23 +0100 Subject: Revert "QtConcurrent::Median: add some qMove()" This reverts commit 12bd604f241d41d52ab3fde9f4a8f4f5c2f3fa6d. This causes problems in QtCreator without anyone being able to say why. Task-number: QTBUG-34397 Change-Id: I7733c3db7d35bba2734e128476aabcb0152a91e4 Reviewed-by: Simon Hausmann --- src/concurrent/qtconcurrentmedian.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/concurrent/qtconcurrentmedian.h b/src/concurrent/qtconcurrentmedian.h index 29342e6402..b39b3ed32b 100644 --- a/src/concurrent/qtconcurrentmedian.h +++ b/src/concurrent/qtconcurrentmedian.h @@ -90,7 +90,7 @@ public: dirty = true; } - values[currentIndex] = qMove(value); + values[currentIndex] = value; } bool isMedianValid() const @@ -105,7 +105,7 @@ public: QVector copy = values; typename QVector::iterator begin = copy.begin(), mid = copy.begin() + bufferSize/2, end = copy.end(); std::nth_element(begin, mid, end); - currentMedian = qMove(*mid); + currentMedian = *mid; } return currentMedian; } -- cgit v1.2.3 From 770ab026a80a038c77eb8957902208b2f6e76427 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 4 Nov 2013 16:22:10 +0100 Subject: Revert "QTest: use nth_element to calculate the median" This reverts commit 48586b2bac623605e9f300f8e5380e4f4b484dab. This causes problems in QtCreator without anyone being able to say why. Task-number: QTBUG-34397 Change-Id: I9ea5457724d5af8d87e0bc40e6615748daf9c04c Reviewed-by: Simon Hausmann --- src/testlib/qtestcase.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 260ace642e..e170d2a044 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1631,14 +1631,13 @@ QBenchmarkResult qMedian(const QList &container) if (count == 1) return container.front(); - const int middle = count / 2; - QList containerCopy = container; - const QList::iterator begin = containerCopy.begin(), mid = begin + middle, end = containerCopy.end(); - std::nth_element(begin, mid, end); + std::sort(containerCopy.begin(), containerCopy.end()); + + const int middle = count / 2; // ### handle even-sized containers here by doing an aritmetic mean of the two middle items. - return *mid; + return containerCopy.at(middle); } struct QTestDataSetter -- cgit v1.2.3 From 03aea653e2d1808fd6acf5bbe4672fa73e87b78e Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 4 Nov 2013 18:16:23 +0100 Subject: Remove now redundant argb to rgba function Change-Id: I293d71e12398aef91995b68a9ea22cac984917b0 Reviewed-by: Gunnar Sletta --- src/gui/opengl/qopenglgradientcache.cpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/gui/opengl/qopenglgradientcache.cpp b/src/gui/opengl/qopenglgradientcache.cpp index b48e96cd98..9c4fbbe013 100644 --- a/src/gui/opengl/qopenglgradientcache.cpp +++ b/src/gui/opengl/qopenglgradientcache.cpp @@ -152,22 +152,6 @@ GLuint QOpenGL2GradientCache::addCacheElement(quint64 hash_val, const QGradient } -// GL's expects pixels in RGBA (when using GL_RGBA), bin-endian (ABGR on x86). -// Qt always stores in ARGB reguardless of the byte-order the mancine uses. -static inline uint qtToGlColor(uint c) -{ - uint o; -#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN - o = (c & 0xff00ff00) // alpha & green already in the right place - | ((c >> 16) & 0x000000ff) // red - | ((c << 16) & 0x00ff0000); // blue -#else //Q_BIG_ENDIAN - o = (c << 8) - | ((c >> 24) & 0x000000ff); -#endif // Q_BYTE_ORDER - return o; -} - //TODO: Let GL generate the texture using an FBO void QOpenGL2GradientCache::generateGradientColorTable(const QGradient& gradient, uint *colorTable, int size, qreal opacity) const { @@ -184,7 +168,7 @@ void QOpenGL2GradientCache::generateGradientColorTable(const QGradient& gradient uint current_color = ARGB_COMBINE_ALPHA(colors[0], alpha); qreal incr = 1.0 / qreal(size); qreal fpos = 1.5 * incr; - colorTable[pos++] = qtToGlColor(PREMUL(current_color)); + colorTable[pos++] = ARGB2RGBA(PREMUL(current_color)); while (fpos <= s.first().first) { colorTable[pos] = colorTable[pos - 1]; @@ -205,9 +189,9 @@ void QOpenGL2GradientCache::generateGradientColorTable(const QGradient& gradient int dist = int(256 * ((fpos - s[i].first) * delta)); int idist = 256 - dist; if (colorInterpolation) - colorTable[pos] = qtToGlColor(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist)); + colorTable[pos] = ARGB2RGBA(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist)); else - colorTable[pos] = qtToGlColor(PREMUL(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist))); + colorTable[pos] = ARGB2RGBA(PREMUL(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist))); ++pos; fpos += incr; } @@ -216,7 +200,7 @@ void QOpenGL2GradientCache::generateGradientColorTable(const QGradient& gradient Q_ASSERT(s.size() > 0); - uint last_color = qtToGlColor(PREMUL(ARGB_COMBINE_ALPHA(colors[s.size() - 1], alpha))); + uint last_color = ARGB2RGBA(PREMUL(ARGB_COMBINE_ALPHA(colors[s.size() - 1], alpha))); for (;pos < size; ++pos) colorTable[pos] = last_color; -- cgit v1.2.3 From a8351096dbe1b8c02bcae858fb03133a5dacffdd Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 4 Nov 2013 18:19:34 +0100 Subject: Fix ARGB image glyphs on Open GL ES2 or big endian Change Ie891665ad66e31692b69db02d34be8d303a7d631 accidentially removed the condition that would ensure ARGB glyphs would get swizzled on OpenGL ES2. This patch readds a condition to check that, and also fixes the same on big endian hosts by reusing the OpenGL ES2 code path. Change-Id: I55615c498261a43c50e5a6902a7e2e24cddc4f4b Reviewed-by: Gunnar Sletta --- src/gui/opengl/qopengltextureglyphcache.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index 506aec0f43..061e8f4166 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -43,6 +43,8 @@ #include "qopenglpaintengine_p.h" #include "private/qopenglengineshadersource_p.h" #include "qopenglextensions_p.h" +#include +#include QT_BEGIN_NAMESPACE @@ -316,24 +318,27 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed if (mask.format() == QImage::Format_RGB32 // We need to make the alpha component equal to the average of the RGB values. // This is needed when drawing sub-pixel antialiased text on translucent targets. +#if defined(QT_OPENGL_ES_2) || Q_BYTE_ORDER == Q_BIG_ENDIAN + || mask.format() == QImage::Format_ARGB32_Premultiplied +#endif ) { for (int y = 0; y < maskHeight; ++y) { - quint32 *src = (quint32 *) mask.scanLine(y); + QRgb *src = (QRgb *) mask.scanLine(y); for (int x = 0; x < maskWidth; ++x) { - uchar r = src[x] >> 16; - uchar g = src[x] >> 8; - uchar b = src[x]; - quint32 avg; + int r = qRed(src[x]); + int g = qGreen(src[x]); + int b = qBlue(src[x]); + int avg; if (mask.format() == QImage::Format_RGB32) - avg = (quint32(r) + quint32(g) + quint32(b) + 1) / 3; // "+1" for rounding. + avg = (r + g + b + 1) / 3; // "+1" for rounding. else // Format_ARGB_Premultiplied - avg = src[x] >> 24; + avg = qAlpha(src[x]); -#if defined(QT_OPENGL_ES_2) + src[x] = qRgba(r, g, b, avg); +#if defined(QT_OPENGL_ES_2) || Q_BYTE_ORDER == Q_BIG_ENDIAN // swizzle the bits to accommodate for the GL_RGBA upload. - src[x] = (avg << 24) | (quint32(r) << 0) | (quint32(g) << 8) | (quint32(b) << 16); + src[x] = ARGB2RGBA(src[x]); #endif - src[x] = (src[x] & 0x00ffffff) | (avg << 24); } } } @@ -341,7 +346,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); if (mask.depth() == 32) { -#if defined(QT_OPENGL_ES_2) +#if defined(QT_OPENGL_ES_2) || Q_BYTE_ORDER == Q_BIG_ENDIAN glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_RGBA, GL_UNSIGNED_BYTE, mask.bits()); #else glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits()); -- cgit v1.2.3 From 6b8e866391cf933f077756c8ad154683885ea07f Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Sat, 2 Nov 2013 10:13:45 +0800 Subject: Doc: Clean up threading examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Example 3 (Clock) is a collection of anti-patterns. - It implements a slot in a QThread subclass and then forces the new thread to use Qt::DirectConnection to invoke the slot in the "wrong" thread. - It talks about getting away with non-thread-safe usage - It uses a thread as a timer and then admits that it's an over- complicated approach. - Example 4 (Permanent Thread) is over-complicated yet incomplete. A better one exists in the QThread class ref. - Example 1 (Thread Pool) is covered by the QThreadPool class ref. - Example 2 (QtConcurrent::run()) is covered in the "Threading and Concurrent Programming Examples" page and the "QtConcurrentRun" page. - The undocumented "Hello Thread" example is covered in the QThread class ref. - These examples cannot be accessed from Qt Creator's Examples tool. - These examples are neither widget-related nor tutorials, contrary to their source paths. Task-number: QTBUG-33360 Change-Id: Ic79cb764ee925ddbcbeafee8e1d01db7fe0f6cfe Reviewed-by: Topi Reiniö Reviewed-by: Jerome Pasion --- src/corelib/doc/images/thread_clock.png | Bin 5964 -> 0 bytes src/corelib/doc/src/threads-basics.qdoc | 127 +------------------------------- 2 files changed, 3 insertions(+), 124 deletions(-) delete mode 100644 src/corelib/doc/images/thread_clock.png (limited to 'src') diff --git a/src/corelib/doc/images/thread_clock.png b/src/corelib/doc/images/thread_clock.png deleted file mode 100644 index b8a8aa0a39..0000000000 Binary files a/src/corelib/doc/images/thread_clock.png and /dev/null differ diff --git a/src/corelib/doc/src/threads-basics.qdoc b/src/corelib/doc/src/threads-basics.qdoc index 4f381421b4..2206899460 100644 --- a/src/corelib/doc/src/threads-basics.qdoc +++ b/src/corelib/doc/src/threads-basics.qdoc @@ -219,130 +219,9 @@ \section1 Examples - This tutorial comes with examples for Qt's three basic ways of working with - threads. Two more examples show how to communicate with a running thread - and how a QObject can be placed in another thread, providing service to the - main thread. - - \list - \li Using QThread as shown \l{Qt thread basics}{above} - \li \l{Example 1: Using the Thread Pool}{Using the global QThreadPool} - \li \l{Example 2: Using QtConcurrent}{Using QtConcurrent} - \li \l{Example 3: Clock}{Communication with the GUI thread} - \li \l{Example 4: A Permanent Thread}{A permanent QObject in another thread - provides service to the main thread} - \endlist - - The following examples can all be compiled and run independently. The source can - be found in the examples directory: examples/tutorials/threads/ - - \section2 Example 1: Using the Thread Pool - - Creating and destroying threads frequently can be expensive. To avoid the - cost of thread creation, a thread pool can be used. A thread pool is a - place where threads can be parked and fetched. We can write the same - "hello thread" program as \l{Qt Thread Basics}{above} using the global - thread pool. We derive a class from QRunnable. The code we want to run in - another thread needs to be placed in the reimplemented QRunnable::run() - method. - - \snippet ../widgets/tutorials/threads/hellothreadpool/hellothreadpool.cpp 1 - - We instantiate Work in main(), locate the global thread pool and use the - QThreadPool::start() method. Now the thread pool runs our worker in another - thread. Using the thread pool has a performance advantage because threads - are not destroyed after they have finished running. They are kept in a pool - and wait to be used again later. - - \section2 Example 2: Using QtConcurrent - - \snippet ../widgets/tutorials/threads/helloconcurrent/helloconcurrent.cpp 1 - - We write a global function hello() to implement the work. QtConcurrent::run() - is used to run the function in another thread. The result is a QFuture. - QFuture provides a method called \l{QFuture::}{waitForFinished()}, which - blocks until the calculation is completed. The real power of QtConcurrent - becomes visible when data can be made available in a container. QtConcurrent - provides several functions that are able to process itemized data on all - available cores simultaneously. The use of QtConcurrent is very similar to - applying an STL algorithm to an STL container. - \l{examples-threadandconcurrent.html}{QtConcurrent Map} is a very short and - clear example about how a container of images can be scaled on all available - cores. The image scaling example uses the blocking variants of the functions - used. For every blocking function there is also a non-blocking, asynchronous - counterpart. Getting results asynchronously is implemented with QFuture and - QFutureWatcher. - - \section2 Example 3: Clock - - \image thread_clock.png "clock" - - We want to produce a clock application. The application has a GUI and a - worker thread. The worker thread checks every 10 milliseconds what time it - is. If the formatted time has changed, the result will be sent to the GUI - thread where it is displayed. - - Of course, this is an overly complicated way of designing a clock and, - actually, a separate thread is unnecessary. We would be better off placing - the timer in the main thread because the calculation made in the timer slot - is very short-lived. This example is purely for instructional use and shows - how to communicate from a worker thread to a GUI thread. Note that - communication in this direction is easy. We only need to add a signal - to QThread and make a queued signal/slot connection to the main thread. - Communication from the GUI to the worker thread is shown in the next - example. - - \snippet ../widgets/tutorials/threads/clock/main.cpp 1 - - We've connected the \c clockThread with the label. The connection must be a - queued signal-slot connection because we want to put the call in the event - loop. - - \snippet ../widgets/tutorials/threads/clock/clockthread.h 1 - - We have derived a class from QThread and declared the \c sendTime() signal. - - \snippet ../widgets/tutorials/threads/clock/clockthread.cpp 1 - - The trickiest part of this example is that the timer is connected to its - slot via a direct connection. A default connection would produce a queued - signal-slot connection because the connected objects live in different - threads; remember that QThread does not live in the thread it creates. - - Still it is safe to access ClockThread::timerHit() from the worker thread - because ClockThread::timerHit() is private and only touches local variables - and a private member that isn't touched by public methods. - QDateTime::currentDateTime() isn't marked as thread-safe in Qt - documentation, however we can get away with using it in this small - example because we know that the QDateTime::currentDateTime() static - method isn't used in any other threads. - - \section2 Example 4: A Permanent Thread - - This example shows how it is possible to have a QObject in a worker thread - that accepts requests from the GUI thread, does polling using a timer and - continuously reports results back to the GUI thread. The actual work - including the polling must be implemented in a class derived from QObject. - We have called this class \c WorkerObject in the code shown below. The - thread-specific code is hidden in a class called \c Thread, derived from - QThread. - \c Thread has two additional public members. The \c launchWorker() member - takes the worker object and moves it to another thread with a started event - loop. - The call blocks for a very short moment until the thread creation operation - is completed, allowing the worker object to be used again on the next line. - The \c Thread class's code is short but somewhat involved, so we only show - how to use the class. - - \snippet ../widgets/tutorials/threads/movedobject/main.cpp 1 - - QMetaObject::invokeMethod() calls a slot via the event loop. The worker - object's methods should not be called directly after the object has been - moved to another thread. We let the worker thread do some work and polling, - and use a timer to shut the application down after 3 seconds. Shutting the - worker down needs some care. We call \c{Thread::stop()} to exit the event - loop. We wait for the thread to terminate and, after this has occurred, we - delete the worker. + Qt comes with several examples for using threads. See the class references + for QThread and QThreadPool for simple examples. See the \l{Threading and + Concurrent Programming Examples} page for more advanced ones. \section1 Digging Deeper -- cgit v1.2.3 From 16198d963d7a9e5e797a5987140936e5ab913ae5 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Sun, 3 Nov 2013 11:04:18 +0800 Subject: Doc: Fix broken links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-33360 Change-Id: Ic944cb2f575c35ebad64852ef5fc44a50ac03571 Reviewed-by: Jerome Pasion Reviewed-by: Topi Reiniö --- src/corelib/animation/qsequentialanimationgroup.cpp | 2 -- src/corelib/doc/src/custom-types.qdoc | 7 +++---- src/corelib/doc/src/objectmodel/object.qdoc | 3 ++- src/corelib/doc/src/objectmodel/signalsandslots.qdoc | 2 +- src/corelib/doc/src/plugins-howto.qdoc | 2 +- src/corelib/doc/src/threads.qdoc | 4 ++-- src/corelib/kernel/qmath.cpp | 2 -- src/corelib/kernel/qobject.cpp | 4 ++-- src/corelib/tools/qstring.cpp | 8 ++++---- src/corelib/tools/qvector.cpp | 4 ++-- src/gui/image/qimage.cpp | 2 +- src/gui/kernel/qevent.cpp | 15 +++++++-------- src/gui/kernel/qopenglcontext.cpp | 6 +++--- src/gui/kernel/qplatformsystemtrayicon_qpa.cpp | 2 +- src/gui/kernel/qsurfaceformat.cpp | 4 ++-- src/gui/opengl/qopengltexture.cpp | 12 ++++++------ src/gui/painting/qbrush.cpp | 4 ++-- src/gui/painting/qpaintengine_raster.cpp | 16 ++++++---------- src/gui/text/qfontmetrics.cpp | 2 +- src/opengl/qgl.cpp | 2 +- src/sql/models/qsqlrelationaltablemodel.cpp | 2 +- src/widgets/doc/src/widgets-and-layouts/layout.qdoc | 4 ++-- src/widgets/doc/src/widgets-tutorial.qdoc | 2 +- 23 files changed, 51 insertions(+), 60 deletions(-) (limited to 'src') diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp index 42debea782..1c84e3dbc9 100644 --- a/src/corelib/animation/qsequentialanimationgroup.cpp +++ b/src/corelib/animation/qsequentialanimationgroup.cpp @@ -303,8 +303,6 @@ QPauseAnimation *QSequentialAnimationGroup::insertPause(int index, int msecs) /*! \property QSequentialAnimationGroup::currentAnimation Returns the animation in the current time. - - \sa currentAnimationChanged() */ QAbstractAnimation *QSequentialAnimationGroup::currentAnimation() const { diff --git a/src/corelib/doc/src/custom-types.qdoc b/src/corelib/doc/src/custom-types.qdoc index cbf347a2f7..ed846aee83 100644 --- a/src/corelib/doc/src/custom-types.qdoc +++ b/src/corelib/doc/src/custom-types.qdoc @@ -155,10 +155,9 @@ The Q_DECLARE_METATYPE() macro and qRegisterMetaType() function documentation contain more detailed information about their uses and limitations. - The \l{Custom Type Example}{Custom Type}, - \l{Custom Type Sending Example}{Custom Type Sending} - and \l{Queued Custom Type Example}{Queued Custom Type} examples show how to - implement a custom type with the features outlined in this document. + The \l{Custom Type Example}{Custom Type} and \l{Queued Custom Type Example} + {Queued Custom Type} examples show how to implement a custom type with the + features outlined in this document. The \l{Debugging Techniques} document provides an overview of the debugging mechanisms discussed above. diff --git a/src/corelib/doc/src/objectmodel/object.qdoc b/src/corelib/doc/src/objectmodel/object.qdoc index 89a781da39..8d24096b7a 100644 --- a/src/corelib/doc/src/objectmodel/object.qdoc +++ b/src/corelib/doc/src/objectmodel/object.qdoc @@ -46,7 +46,8 @@ \li queryable and designable \l{Qt's Property System}{object properties} \li powerful \l{The Event System}{events and event filters} - \li contextual \l{i18n}{string translation for internationalization} + \li contextual \l{Internationalization with Qt}{string translation for + internationalization} \li sophisticated interval driven \l {Timers}{timers} that make it possible to elegantly integrate many tasks in an event-driven GUI \li hierarchical and queryable \l{Object Trees & Ownership}{object diff --git a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc index dd93b80cae..e894d547d0 100644 --- a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc +++ b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc @@ -275,7 +275,7 @@ and slot members, as well as pointers to these functions. The meta-object contains additional information such as the - object's \l{QObject::className()}{class name}. You can + object's \l{QMetaObject::className()}{class name}. You can also check if an object \l{QObject::inherits()}{inherits} a specific class, for example: diff --git a/src/corelib/doc/src/plugins-howto.qdoc b/src/corelib/doc/src/plugins-howto.qdoc index 2dbf1f8141..fb91e431dd 100644 --- a/src/corelib/doc/src/plugins-howto.qdoc +++ b/src/corelib/doc/src/plugins-howto.qdoc @@ -37,7 +37,7 @@ See the \l{How to Create Qt Plugins} page for more information.. - See also the \l{ActiveQt framework} for Windows. + See also the \l{Active Qt} framework for Windows. */ diff --git a/src/corelib/doc/src/threads.qdoc b/src/corelib/doc/src/threads.qdoc index 25276404b0..efed33106a 100644 --- a/src/corelib/doc/src/threads.qdoc +++ b/src/corelib/doc/src/threads.qdoc @@ -606,7 +606,7 @@ putting time-consuming operations in a separate worker thread and displaying the results on screen in the main thread when the worker thread is finished. This is the approach used for - implementing the \l{threads/mandelbrot}{Mandelbrot} and + implementing the \l{Mandelbrot Example} and the \l{network/blockingfortuneclient}{Blocking Fortune Client} example. @@ -738,7 +738,7 @@ QObject::connect() itself is thread-safe. - The \l{threads/mandelbrot}{Mandelbrot} example uses a queued + The \l{Mandelbrot Example} uses a queued connection to communicate between a worker thread and the main thread. To avoid freezing the main thread's event loop (and, as a consequence, the application's user interface), all the diff --git a/src/corelib/kernel/qmath.cpp b/src/corelib/kernel/qmath.cpp index 8f900e2101..b1860fa24a 100644 --- a/src/corelib/kernel/qmath.cpp +++ b/src/corelib/kernel/qmath.cpp @@ -310,8 +310,6 @@ const qreal qt_sine_table[QT_SINE_TABLE_SIZE] = { \brief The header file includes generic math declarations. - The global declarations include \l{functions}. - These functions are partly convenience definitions for basic operations, for instance not available in the Standard Template Library et al. diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 8ee43f2e97..c19c3fcbb5 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -566,7 +566,7 @@ void QMetaCallEvent::placeMetaCall(QObject *object) \li When a QObject is moved to another thread, all its children will be automatically moved too. \li moveToThread() will fail if the QObject has a parent. - \li If \l{QObject}s are created within QThread::run(), they cannot + \li If QObjects are created within QThread::run(), they cannot become children of the QThread object because the QThread does not live in the thread that calls QThread::run(). \endlist @@ -4622,7 +4622,7 @@ bool QObjectPrivate::disconnect(const QObject *sender, int signal_index, void ** It can be used to disconnect that connection, or check if the connection was successful - \sa QObject::disconnect + \sa QObject::disconnect() */ /*! diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 0e99a5839c..3976f2cb6f 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -455,8 +455,8 @@ const QString::Null QString::null = { }; your applications will be easy to translate if you want to expand your application's market at some point. The two main cases where QByteArray is appropriate are when you need to store raw binary - data, and when memory conservation is critical (e.g., with - \l{Qt for Embedded Linux}). + data, and when memory conservation is critical (like in embedded + systems). \tableofcontents @@ -5039,7 +5039,7 @@ int QString::compare_helper(const QChar *data1, int length1, QLatin1String s2, On Mac OS X since Qt 4.3, this function compares according the "Order for sorted lists" setting in the International preferences panel. - \sa compare(), QTextCodec::locale() + \sa compare(), QLocale */ /*! @@ -8450,7 +8450,7 @@ QStringRef QStringRef::appendTo(QString *string) const On Mac OS X, this function compares according the "Order for sorted lists" setting in the International prefereces panel. - \sa compare(), QTextCodec::locale() + \sa compare(), QLocale */ /*! diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index b9281c6915..f6276711a7 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -572,7 +572,7 @@ Provided for compatibility with QList. - \sa remove(int), QList::removeAt(int) + \sa remove(), QList::removeAt() */ /*! \fn int QVector::length() const @@ -597,7 +597,7 @@ Provided for compatibility with QList. - \sa takeFirst(), takeLast(), QList::takeAt(int) + \sa takeFirst(), takeLast(), QList::takeAt() */ /*! \fn void QVector::removeFirst() diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 69ff27dc73..d602ed4035 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -3989,7 +3989,7 @@ void qGamma_correct_back_to_linear_cs(QImage *image) The specified image conversion \a flags control how the image data is handled during the conversion process. - \sa {QImage#Image Format}{Image Format} + \sa {Image Formats} */ QImage QImage::convertToFormat(Format format, Qt::ImageConversionFlags flags) const { diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 06fa1f3550..28666085a7 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -118,7 +118,7 @@ QInputEvent::~QInputEvent() Returns the keyboard modifier flags that existed immediately before the event occurred. - \sa QApplication::keyboardModifiers() + \sa QGuiApplication::keyboardModifiers() */ /*! \fn void QInputEvent::setModifiers(Qt::KeyboardModifiers modifiers) @@ -313,7 +313,7 @@ QMouseEvent::~QMouseEvent() Returns the position of the mouse cursor as a QPointF, relative to the screen that received the event. - \sa x(), y(), pos(), localPos(), screenPos() + \sa x(), y(), pos(), localPos(), windowPos() */ /*! @@ -1005,7 +1005,7 @@ QKeyEvent::~QKeyEvent() confuse it by pressing both \uicontrol{Shift} keys simultaneously and releasing one of them, for example. - \sa QApplication::keyboardModifiers() + \sa QGuiApplication::keyboardModifiers() */ Qt::KeyboardModifiers QKeyEvent::modifiers() const @@ -1357,7 +1357,7 @@ QResizeEvent::~QResizeEvent() signal when they are deleted. If the last top-level window is closed, the - QApplication::lastWindowClosed() signal is emitted. + QGuiApplication::lastWindowClosed() signal is emitted. The isAccepted() function returns \c true if the event's receiver has agreed to close the widget; call accept() to agree to close the @@ -1366,7 +1366,7 @@ QResizeEvent::~QResizeEvent() \sa QWidget::close(), QWidget::hide(), QObject::destroyed(), QCoreApplication::exec(), QCoreApplication::quit(), - QApplication::lastWindowClosed() + QGuiApplication::lastWindowClosed() */ /*! @@ -2676,9 +2676,8 @@ QDragEnterEvent::~QDragEnterEvent() is within its boundaries, if it accepts \l{QWidget::setAcceptDrops()}{drop events} and \l {QWidget::dragEnterEvent()}{enter events}. The widget should - examine the event to see what kind of data it - \l{QDragMoveEvent::provides()}{provides}, and call the accept() - function to accept the drop if appropriate. + examine the event to see what kind of \l{mimeData()}{data} it + provides, and call the accept() function to accept the drop if appropriate. The rectangle supplied by the answerRect() function can be used to restrict drops to certain parts of the widget. For example, we can check whether the diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index ab782fac34..7b111c73e1 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -274,7 +274,7 @@ QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex; or OpenGL ES 1.x. For more information about the OpenGL API, refer to the official - \l{OpenGL documentation}. + \l{http://www.opengl.org}{OpenGL documentation}. For an example of how to use QOpenGLContext see the \l{OpenGL Window Example}{OpenGL Window} example. @@ -591,6 +591,8 @@ QOpenGLFunctions *QOpenGLContext::functions() const /*! \fn T *QOpenGLContext::versionFunctions() const + \overload versionFunctions() + Returns a pointer to an object that provides access to all functions for the version and profile of this context. Before using any of the functions they must be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions(). @@ -640,8 +642,6 @@ QOpenGLFunctions *QOpenGLContext::functions() const Usually one would use the template version of this function to automatically have the result cast to the correct type. - - \sa T *QOpenGLContext::versionFunctions() */ QAbstractOpenGLFunctions *QOpenGLContext::versionFunctions(const QOpenGLVersionProfile &versionProfile) const { diff --git a/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp b/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp index 5d7ff7864d..c4cec40a10 100644 --- a/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp +++ b/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp @@ -130,7 +130,7 @@ QPlatformSystemTrayIcon::~QPlatformSystemTrayIcon() const QIcon &icon, MessageIcon iconType, int secs) Shows a balloon message for the entry with the given \a title, message \a msg and \a icon for the time specified in \a secs. \a iconType is used as a hint for the implementing platform. - \sa QSystemTrayIcon::showMessage + \sa QSystemTrayIcon::showMessage() */ /*! diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp index 2f1b30ae4a..fe5615d394 100644 --- a/src/gui/kernel/qsurfaceformat.cpp +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -396,7 +396,7 @@ bool QSurfaceFormat::hasAlpha() const /*! Set the preferred stencil buffer size to \a size bits. - \sa stencilBufferSize(), setStencil(), stencil() + \sa stencilBufferSize() */ void QSurfaceFormat::setStencilBufferSize(int size) { @@ -409,7 +409,7 @@ void QSurfaceFormat::setStencilBufferSize(int size) /*! Returns the stencil buffer size in bits. - \sa stencil(), setStencil(), setStencilBufferSize() + \sa setStencilBufferSize() */ int QSurfaceFormat::stencilBufferSize() const { diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index d5a7399c18..5407142b18 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -1825,7 +1825,7 @@ void QOpenGLTexture::setSize(int width, int height, int depth) /*! Returns the width of a 1D, 2D or 3D texture. - \sa height(), depth(), setDimensions() + \sa height(), depth(), setSize() */ int QOpenGLTexture::width() const { @@ -1836,7 +1836,7 @@ int QOpenGLTexture::width() const /*! Returns the height of a 2D or 3D texture. - \sa width(), depth(), setDimensions() + \sa width(), depth(), setSize() */ int QOpenGLTexture::height() const { @@ -1847,7 +1847,7 @@ int QOpenGLTexture::height() const /*! Returns the depth of a 3D texture. - \sa width(), height(), setDimensions() + \sa width(), height(), setSize() */ int QOpenGLTexture::depth() const { @@ -1913,7 +1913,7 @@ int QOpenGLTexture::mipLevels() const Returns the maximum number of mipmap levels that this texture can have given the current dimensions. - \sa setMipLevels(), mipLevels(), setDimensions() + \sa setMipLevels(), mipLevels(), setSize() */ int QOpenGLTexture::maximumMipLevels() const { @@ -2018,7 +2018,7 @@ void QOpenGLTexture::allocateStorage() The texture format, dimensions, mipmap levels and array layers cannot be altered once storage ihas been allocated. - \sa allocateStorage(), setDimensions(), setMipLevels(), setLayers(), setFormat() + \sa allocateStorage(), setSize(), setMipLevels(), setLayers(), setFormat() */ bool QOpenGLTexture::isStorageAllocated() const { @@ -2367,7 +2367,7 @@ void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel) /*! Returns the range of mipmap levels that can be used for texture lookups with this texture. - \sa mipBaseLevel(), mipMaxLevel(), mipLevelRange() + \sa mipBaseLevel(), mipMaxLevel() */ QPair QOpenGLTexture::mipLevelRange() const { diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index d8dfae1e2c..8bbe6b6f42 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -503,7 +503,7 @@ QBrush::QBrush(Qt::GlobalColor color, Qt::BrushStyle style) The style is set to Qt::TexturePattern. The color will only have an effect for QBitmaps. - \sa setColor(), setPixmap() + \sa setColor(), setTexture() */ QBrush::QBrush(const QColor &color, const QPixmap &pixmap) @@ -520,7 +520,7 @@ QBrush::QBrush(const QColor &color, const QPixmap &pixmap) The style is set to Qt::TexturePattern. The color will only have an effect for QBitmaps. - \sa setColor(), setPixmap() + \sa setColor(), setTexture() */ QBrush::QBrush(Qt::GlobalColor color, const QPixmap &pixmap) { diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 4a26da104d..bdd0d9cd4c 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -308,9 +308,9 @@ QRasterPaintEnginePrivate::QRasterPaintEnginePrivate() : of painting operations in Qt for Embedded Linux. Note that this functionality is only available in - \l{Qt for Embedded Linux}. + Qt for Embedded Linux. - In \l{Qt for Embedded Linux}, painting is a pure software + In Qt for Embedded Linux, painting is a pure software implementation. But starting with Qt 4.2, it is possible to add an accelerated graphics driver to take advantage of available hardware resources. @@ -318,19 +318,15 @@ QRasterPaintEnginePrivate::QRasterPaintEnginePrivate() : Hardware acceleration is accomplished by creating a custom screen driver, accelerating the copying from memory to the screen, and implementing a custom paint engine accelerating the various - painting operations. Then a custom paint device (derived from the - QCustomRasterPaintDevice class) and a custom window surface - (derived from QWSWindowSurface) must be implemented to make - \l{Qt for Embedded Linux} aware of the accelerated driver. + painting operations. Then a custom paint device and a custom + window surface must be implemented to make + Qt for Embedded Linux aware of the accelerated driver. \note The QRasterPaintEngine class does not support 8-bit images. Instead, they need to be converted to a supported format, such as QImage::Format_ARGB32_Premultiplied. - See the \l {Adding an Accelerated Graphics Driver to Qt for Embedded Linux} - documentation for details. - - \sa QCustomRasterPaintDevice, QPaintEngine + \sa QPaintEngine */ /*! diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 58c9addec1..1a66657cbd 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -1587,7 +1587,7 @@ QRectF QFontMetricsF::boundingRect(const QRectF &rect, int flags, const QString& \li Qt::TextWordBreak breaks the text to fit the rectangle. \endlist - These flags are defined in \l{Qt::TextFlags}. + These flags are defined in the \l{Qt::TextFlag} enum. If Qt::TextExpandTabs is set in \a flags, the following behavior is used to interpret tab characters in the text: diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 16044df8b1..b1fbe2ac71 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -3041,7 +3041,7 @@ bool QGLContext::areSharing(const QGLContext *context1, const QGLContext *contex If this context is a valid context in an overlay plane, returns the plane's transparent color. Otherwise returns an \l{QColor::isValid()}{invalid} color. - The returned color's \l{QColor::pixel()}{pixel} value is + The returned color's \l{QColormap::pixel()}{pixel} value is the index of the transparent color in the colormap of the overlay plane. (Naturally, the color's RGB values are meaningless.) diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp index 6aeef89483..2214e73658 100644 --- a/src/sql/models/qsqlrelationaltablemodel.cpp +++ b/src/sql/models/qsqlrelationaltablemodel.cpp @@ -671,7 +671,7 @@ void QSqlRelationalTableModel::clear() \value InnerJoin - Inner join mode, return rows when there is at least one match in both tables. \value LeftJoin - Left join mode, returns all rows from the left table (table_name1), even if there are no matches in the right table (table_name2). - \sa QSqlRelationalTableModel::setJoinMode + \sa QSqlRelationalTableModel::setJoinMode() \since 4.8 */ diff --git a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc index f74da2fa0a..99d512b507 100644 --- a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc @@ -32,8 +32,8 @@ \brief A tour of the standard layout managers and an introduction to custom layouts. - \previouspage Widgets and Layouts - \contentspage Widgets and Layouts + \previouspage Qt Widgets + \contentspage Qt Widgets \nextpage {Styles and Style Aware Widgets}{Styles} \ingroup frameworks-technologies diff --git a/src/widgets/doc/src/widgets-tutorial.qdoc b/src/widgets/doc/src/widgets-tutorial.qdoc index 985a430cba..d4cf063231 100644 --- a/src/widgets/doc/src/widgets-tutorial.qdoc +++ b/src/widgets/doc/src/widgets-tutorial.qdoc @@ -89,7 +89,7 @@ \section1 Real world widget examples - In these \l{Widget examples} {more advanced examples}, the code + In these \l{Qt Widgets Examples} {more advanced examples}, the code that creates the widgets and layouts is stored in other files. For example, the GUI for a main window may be created in the constructor of a QMainWindow subclass. -- cgit v1.2.3 From 82fe2c6c1be093b8d1149d38a51bb91e853ff5e6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 4 Nov 2013 18:03:51 -0800 Subject: Add qcollator_p.h to the list of headers. Change-Id: I91963843e10fe0c33e5f13c06562dc5f9fdc2b6d Reviewed-by: Robin Burchell --- src/corelib/tools/tools.pri | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index e043a4cd15..e4a7b02aee 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -14,6 +14,7 @@ HEADERS += \ tools/qcommandlineoption.h \ tools/qcommandlineparser.h \ tools/qcollator.h \ + tools/qcollator_p.h \ tools/qcontainerfwd.h \ tools/qcryptographichash.h \ tools/qdatetime.h \ -- cgit v1.2.3 From 215e525a5cefe18bd8885b56d12ea35eb2cd3b98 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 2 Nov 2013 17:31:44 +0100 Subject: Make error messages a bit better. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I83b5852abfbb3437c03516bc4b36eff385ddb983 Reviewed-by: Friedemann Kleint Reviewed-by: Jørgen Lind --- src/gui/image/qpixmap.cpp | 2 +- src/printsupport/kernel/qprinter.cpp | 2 +- src/widgets/kernel/qwidget.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 5f51358eb2..a620d34553 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE static bool qt_pixmap_thread_test() { if (!QCoreApplication::instance()) { - qFatal("QPixmap: Must construct a QApplication before a QPaintDevice"); + qFatal("QPixmap: Must construct a QGuiApplication before a QPixmap"); return false; } diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index f90fa71b0f..0905cbb59f 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -538,7 +538,7 @@ QPrinter::QPrinter(const QPrinterInfo& printer, PrinterMode mode) void QPrinterPrivate::init(QPrinter::PrinterMode mode) { if (!QCoreApplication::instance()) { - qFatal("QPrinter: Must construct a QApplication before a QPaintDevice"); + qFatal("QPrinter: Must construct a QCoreApplication before a QPrinter"); return; } diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 039a834214..a41d14e7d0 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -289,7 +289,7 @@ QWidgetPrivate::QWidgetPrivate(int version) #endif { if (!qApp) { - qFatal("QWidget: Must construct a QApplication before a QPaintDevice"); + qFatal("QWidget: Must construct a QApplication before a QWidget"); return; } -- cgit v1.2.3 From e9c51a1fdc9092e5589fd6f823ad0e704e293c88 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Mon, 4 Nov 2013 11:49:56 +0100 Subject: BlackBerry: Prevent superfluous removal of socket notifiers File descriptors have always been removed from bps before adding them, which lead to an annoying warning. "QEventDispatcherUNIX::registerSocketNotifier()" needs to be called after "ioEvents()" to prevent this. Task-number: QTBUG-34536 Change-Id: If074ff7a6638fe234abc100c81d094e182de7537 Reviewed-by: Kevin Krammer Reviewed-by: Thomas McGuire --- src/corelib/kernel/qeventdispatcher_blackberry.cpp | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qeventdispatcher_blackberry.cpp b/src/corelib/kernel/qeventdispatcher_blackberry.cpp index b9137ec139..a52cc60eaa 100644 --- a/src/corelib/kernel/qeventdispatcher_blackberry.cpp +++ b/src/corelib/kernel/qeventdispatcher_blackberry.cpp @@ -237,9 +237,6 @@ void QEventDispatcherBlackberry::registerSocketNotifier(QSocketNotifier *notifie return; } - // Call the base Unix implementation. Needed to allow select() to be called correctly - QEventDispatcherUNIX::registerSocketNotifier(notifier); - // Register the fd with bps BpsChannelScopeSwitcher channelSwitcher(d->bps_channel); int io_events = ioEvents(sockfd); @@ -265,6 +262,9 @@ void QEventDispatcherBlackberry::registerSocketNotifier(QSocketNotifier *notifie const int result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data()); if (Q_UNLIKELY(result != BPS_SUCCESS)) qWarning() << "QEventDispatcherBlackberry: bps_add_fd failed"; + + // Call the base Unix implementation. Needed to allow select() to be called correctly + QEventDispatcherUNIX::registerSocketNotifier(notifier); } void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notifier) @@ -280,23 +280,22 @@ void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notif return; } - // Allow the base Unix implementation to unregister the fd too + // Allow the base Unix implementation to unregister the fd too (before call to ioEvents()!) QEventDispatcherUNIX::unregisterSocketNotifier(notifier); // Unregister the fd with bps BpsChannelScopeSwitcher channelSwitcher(d->bps_channel); - const int io_events = ioEvents(sockfd); int result = bps_remove_fd(sockfd); if (Q_UNLIKELY(result != BPS_SUCCESS)) qWarning() << "QEventDispatcherBlackberry: bps_remove_fd failed" << sockfd; - // if no other socket notifier is watching sockfd, our job ends here - if (!io_events) - return; - - result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data()); - if (Q_UNLIKELY(result != BPS_SUCCESS)) - qWarning("QEventDispatcherBlackberry: bps_add_fd error"); + const int io_events = ioEvents(sockfd); + // if other socket notifier is watching sockfd, readd it + if (io_events) { + result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data()); + if (Q_UNLIKELY(result != BPS_SUCCESS)) + qWarning("QEventDispatcherBlackberry: bps_add_fd error"); + } } static inline int timespecToMillisecs(const timespec &tv) -- cgit v1.2.3 From 142c5ef9ddd17e59d8d096ab065aee8cb50f5e8f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 25 Oct 2013 12:37:30 +0200 Subject: QLineEdit: Fix potential crash when removing the clear button. Remove it from the side actions list. Task-number: QTBUG-34315 Change-Id: I70063351193b504f8656e903896d155ac74f73a6 Reviewed-by: Giuseppe D'Angelo --- src/widgets/widgets/qlineedit.cpp | 4 ++-- src/widgets/widgets/qlineedit_p.cpp | 3 +-- src/widgets/widgets/qlineedit_p.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index d3c37ab612..0bc7b7c2e3 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -500,7 +500,7 @@ void QLineEdit::setClearButtonEnabled(bool enable) } else { QAction *clearAction = findChild(QLatin1String(clearButtonActionNameC)); Q_ASSERT(clearAction); - removeAction(clearAction); + d->removeAction(clearAction); delete clearAction; } } @@ -1439,7 +1439,7 @@ bool QLineEdit::event(QEvent * e) d->setCursorVisible(true); } } else if (e->type() == QEvent::ActionRemoved) { - d->removeAction(static_cast(e)); + d->removeAction(static_cast(e)->action()); } else if (e->type() == QEvent::Resize) { d->positionSideWidgets(); } diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 99d6d0b8d9..c066f74c5a 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -445,10 +445,9 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE return w; } -void QLineEditPrivate::removeAction(const QActionEvent *e) +void QLineEditPrivate::removeAction(QAction *action) { Q_Q(QLineEdit); - QAction *action = e->action(); const PositionIndexPair positionIndex = findSideWidget(action); if (positionIndex.second == -1) return; diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index 8fe45972ff..e807c7fc52 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -196,7 +196,7 @@ public: QString placeholderText; QWidget *addAction(QAction *newAction, QAction *before, QLineEdit::ActionPosition, int flags = 0); - void removeAction(const QActionEvent *e); + void removeAction(QAction *action); QSize iconSize() const; QIcon clearButtonIcon() const; void positionSideWidgets(); -- cgit v1.2.3 From 161e8653c342278a4881da952ea723b107df93c0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 1 Nov 2013 09:17:10 +0100 Subject: Disable clear button in read-only QLineEdit. Task-number: QTBUG-34315 Change-Id: I6c318879aee907c080e871a541da4ba5eadd71ed Reviewed-by: Giuseppe D'Angelo --- src/widgets/widgets/qlineedit.cpp | 2 ++ src/widgets/widgets/qlineedit_p.cpp | 10 ++++++++++ src/widgets/widgets/qlineedit_p.h | 1 + 3 files changed, 13 insertions(+) (limited to 'src') diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 0bc7b7c2e3..df5ae0171c 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -495,6 +495,7 @@ void QLineEdit::setClearButtonEnabled(bool enable) return; if (enable) { QAction *clearAction = new QAction(d->clearButtonIcon(), QString(), this); + clearAction->setEnabled(!isReadOnly()); clearAction->setObjectName(QLatin1String(clearButtonActionNameC)); d->addAction(clearAction, 0, QLineEdit::TrailingPosition, QLineEditPrivate::SideWidgetClearButton | QLineEditPrivate::SideWidgetFadeInWithText); } else { @@ -1336,6 +1337,7 @@ void QLineEdit::setReadOnly(bool enable) Q_D(QLineEdit); if (d->control->isReadOnly() != enable) { d->control->setReadOnly(enable); + d->setClearButtonEnabled(!enable); setAttribute(Qt::WA_MacShowFocusRect, !enable); setAttribute(Qt::WA_InputMethodEnabled, d->shouldEnableInputMethod()); #ifndef QT_NO_CURSOR diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index c066f74c5a..891839ed56 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -376,6 +376,16 @@ QIcon QLineEditPrivate::clearButtonIcon() const return QIcon(q->style()->standardPixmap(QStyle::SP_LineEditClearButton, &styleOption, q)); } +void QLineEditPrivate::setClearButtonEnabled(bool enabled) +{ + foreach (const SideWidgetEntry &e, trailingSideWidgets) { + if (e.flags & SideWidgetClearButton) { + e.action->setEnabled(enabled); + break; + } + } +} + void QLineEditPrivate::positionSideWidgets() { Q_Q(QLineEdit); diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index e807c7fc52..181a23449b 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -199,6 +199,7 @@ public: void removeAction(QAction *action); QSize iconSize() const; QIcon clearButtonIcon() const; + void setClearButtonEnabled(bool enabled); void positionSideWidgets(); inline bool hasSideWidgets() const { return !leadingSideWidgets.isEmpty() || !trailingSideWidgets.isEmpty(); } inline const SideWidgetEntryList &leftSideWidgetList() const -- cgit v1.2.3 From 6802f34bedca25e05d1eda962b268b1936dd4d62 Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Tue, 29 Oct 2013 10:10:32 +0100 Subject: Process screen events in the main thread Screen events are still read in the screen event thread but are processed in the main thread to make it possible to support QAbstractNativeEventFilter for screen events later. Implementation is similar to the xcb platform plugin. Change-Id: I7bade3e13e51c6d70bb608727a93bbd3aabc5d47 Reviewed-by: Thomas McGuire --- .../platforms/qnx/qqnxscreeneventhandler.cpp | 39 +++++++++++++++++++++ src/plugins/platforms/qnx/qqnxscreeneventhandler.h | 15 ++++++++ .../platforms/qnx/qqnxscreeneventthread.cpp | 40 +++++++++++++++++----- src/plugins/platforms/qnx/qqnxscreeneventthread.h | 13 +++++++ 4 files changed, 98 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index 129f149ca1..efffd26981 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include "qqnxscreeneventhandler.h" +#if defined(QQNX_SCREENEVENTTHREAD) +#include "qqnxscreeneventthread.h" +#endif #include "qqnxintegration.h" #include "qqnxkeytranslator.h" #include "qqnxscreen.h" @@ -63,6 +66,9 @@ QQnxScreenEventHandler::QQnxScreenEventHandler(QQnxIntegration *integration) , m_lastButtonState(Qt::NoButton) , m_lastMouseWindow(0) , m_touchDevice(0) +#if defined(QQNX_SCREENEVENTTHREAD) + , m_eventThread(0) +#endif { // Create a touch device m_touchDevice = new QTouchDevice; @@ -182,6 +188,39 @@ void QQnxScreenEventHandler::injectKeyboardEvent(int flags, int sym, int modifie } } +#if defined(QQNX_SCREENEVENTTHREAD) +void QQnxScreenEventHandler::setScreenEventThread(QQnxScreenEventThread *eventThread) +{ + m_eventThread = eventThread; +} + +void QQnxScreenEventHandler::processEventsFromScreenThread() +{ + if (!m_eventThread) + return; + + QQnxScreenEventArray *events = m_eventThread->lock(); + + for (int i = 0; i < events->size(); ++i) { + screen_event_t event = events->at(i); + if (!event) + continue; + (*events)[i] = 0; + + m_eventThread->unlock(); + + handleEvent(event); + screen_destroy_event(event); + + m_eventThread->lock(); + } + + events->clear(); + + m_eventThread->unlock(); +} +#endif + void QQnxScreenEventHandler::handleKeyboardEvent(screen_event_t event) { // get flags of key event diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h index 7ceb32fcec..1fdb2c83cd 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h @@ -49,6 +49,9 @@ QT_BEGIN_NAMESPACE class QQnxIntegration; +#if defined(QQNX_SCREENEVENTTHREAD) +class QQnxScreenEventThread; +#endif class QQnxScreenEventHandler : public QObject { @@ -61,10 +64,19 @@ public: static void injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap); +#if defined(QQNX_SCREENEVENTTHREAD) + void setScreenEventThread(QQnxScreenEventThread *eventThread); +#endif + Q_SIGNALS: void newWindowCreated(void *window); void windowClosed(void *window); +#if defined(QQNX_SCREENEVENTTHREAD) +private Q_SLOTS: + void processEventsFromScreenThread(); +#endif + private: void handleKeyboardEvent(screen_event_t event); void handlePointerEvent(screen_event_t event); @@ -87,6 +99,9 @@ private: screen_window_t m_lastMouseWindow; QTouchDevice *m_touchDevice; QWindowSystemInterface::TouchPoint m_touchPoints[MaximumTouchPoints]; +#if defined(QQNX_SCREENEVENTTHREAD) + QQnxScreenEventThread *m_eventThread; +#endif }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp index f3f660bc03..25a597bab9 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp @@ -61,6 +61,9 @@ QQnxScreenEventThread::QQnxScreenEventThread(screen_context_t context, QQnxScree m_screenEventHandler(screenEventHandler), m_quit(false) { + screenEventHandler->setScreenEventThread(this); + connect(this, SIGNAL(eventPending()), screenEventHandler, SLOT(processEventsFromScreenThread()), Qt::QueuedConnection); + connect(this, SIGNAL(finished()), screenEventHandler, SLOT(processEventsFromScreenThread()), Qt::QueuedConnection); } QQnxScreenEventThread::~QQnxScreenEventThread() @@ -74,20 +77,31 @@ void QQnxScreenEventThread::injectKeyboardEvent(int flags, int sym, int mod, int QQnxScreenEventHandler::injectKeyboardEvent(flags, sym, mod, scan, cap); } -void QQnxScreenEventThread::run() +QQnxScreenEventArray *QQnxScreenEventThread::lock() { - screen_event_t event; + m_mutex.lock(); + return &m_events; +} - // create screen event - errno = 0; - int result = screen_create_event(&event); - if (result) - qFatal("QQNX: failed to create screen event, errno=%d", errno); +void QQnxScreenEventThread::unlock() +{ + m_mutex.unlock(); +} +void QQnxScreenEventThread::run() +{ qScreenEventThreadDebug() << Q_FUNC_INFO << "screen event thread started"; // loop indefinitely while (!m_quit) { + screen_event_t event; + + // create screen event + errno = 0; + int result = screen_create_event(&event); + if (result) + qFatal("QQNX: failed to create screen event, errno=%d", errno); + // block until screen event is available errno = 0; @@ -108,14 +122,22 @@ void QQnxScreenEventThread::run() qScreenEventThreadDebug() << Q_FUNC_INFO << "QNX user screen event"; m_quit = true; } else { - m_screenEventHandler->handleEvent(event, qnxType); + m_mutex.lock(); + m_events << event; + m_mutex.unlock(); + emit eventPending(); } } qScreenEventThreadDebug() << Q_FUNC_INFO << "screen event thread stopped"; // cleanup - screen_destroy_event(event); + m_mutex.lock(); + Q_FOREACH (screen_event_t event, m_events) { + screen_destroy_event(event); + } + m_events.clear(); + m_mutex.unlock(); } void QQnxScreenEventThread::shutdown() diff --git a/src/plugins/platforms/qnx/qqnxscreeneventthread.h b/src/plugins/platforms/qnx/qqnxscreeneventthread.h index 5e931819be..cbdb505b3b 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventthread.h +++ b/src/plugins/platforms/qnx/qqnxscreeneventthread.h @@ -43,6 +43,7 @@ #define QQNXSCREENEVENTTHREAD_H #include +#include #include @@ -50,21 +51,33 @@ QT_BEGIN_NAMESPACE class QQnxScreenEventHandler; +typedef QVarLengthArray QQnxScreenEventArray; + class QQnxScreenEventThread : public QThread { + Q_OBJECT + public: QQnxScreenEventThread(screen_context_t context, QQnxScreenEventHandler *screenEventHandler); ~QQnxScreenEventThread(); static void injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap); + QQnxScreenEventArray *lock(); + void unlock(); + protected: void run(); +Q_SIGNALS: + void eventPending(); + private: void shutdown(); screen_context_t m_screenContext; + QMutex m_mutex; + QQnxScreenEventArray m_events; QQnxScreenEventHandler *m_screenEventHandler; bool m_quit; }; -- cgit v1.2.3 From aa6a0cdbf584eacdbf81b28cca97cc40200f6b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 4 Nov 2013 10:48:49 +0100 Subject: Clarify use of Q_INIT_RESOURCE The Q_INIT_RESOURCE macro is needed if a library itself uses resources, in which case the Q_INIT_RESOURCE can and should happen in the library (like we do for eg. widget styles), or if a library exposes resources that are supposed to be used by the library clients, in which case the macro needs to be put in the application code. The distinction between the two, and the fact that resources built as part of the main executable do not need the explicit initialization, were not all that clear. This was evident by the lack of Q_INIT_RESOURCE in our own Qt libraries, and the various Q_INIT_RESOURCE calls in our examples where they are not needed. Change-Id: I40258458e9fdf9ee5502c212971fb3d90b4fc388 Reviewed-by: Simon Hausmann --- .../doc/snippets/code/doc_src_resources.cpp | 15 ++++++++++- src/corelib/doc/src/resource-system.qdoc | 30 ++++++++++++++++++---- src/corelib/io/qdir.cpp | 8 +++--- 3 files changed, 43 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/corelib/doc/snippets/code/doc_src_resources.cpp b/src/corelib/doc/snippets/code/doc_src_resources.cpp index 482c25a222..8ac7b0e970 100644 --- a/src/corelib/doc/snippets/code/doc_src_resources.cpp +++ b/src/corelib/doc/snippets/code/doc_src_resources.cpp @@ -44,11 +44,24 @@ QResource::registerResource("/path/to/myresource.rcc"); //! [5] +MyClass::MyClass() : BaseClass() +{ + Q_INIT_RESOURCE(resources); + + QFile file("qrc:/myfile.dat"); + ... +} +//! [5] + + +//! [6] int main(int argc, char *argv[]) { QApplication app(argc, argv); Q_INIT_RESOURCE(graphlib); + + QFile file("qrc:/graph.png"); ... return app.exec(); } -//! [5] +//! [6] diff --git a/src/corelib/doc/src/resource-system.qdoc b/src/corelib/doc/src/resource-system.qdoc index 5ef6bb285c..4c24320851 100644 --- a/src/corelib/doc/src/resource-system.qdoc +++ b/src/corelib/doc/src/resource-system.qdoc @@ -184,15 +184,35 @@ path list is empty at startup; call QDir::addSearchPath() to add paths to it. - If you have resources in a static library, you might need to - force initialization of your resources by calling \l - Q_INIT_RESOURCE() with the base name of the \c .qrc file. For - example: + \section1 Using Resources in a Library + + If you have resources in a library, you need to force initialization + of your resources by calling \l Q_INIT_RESOURCE() with the base name + of the \c .qrc file. For example: \snippet code/doc_src_resources.cpp 5 + This ensures that the resources are linked into the final application + binary in the case of static linking. You should put the initialization + code close to where the resources are used in your library, so that + clients of your library will only link in the resources if they use + the feature of the library that depends on them. + + If the library includes resources that are not used internally, but + instead exposed to clients of the library, the initialization needs + to happen in the application code. For example: + + \snippet code/doc_src_resources.cpp 6 + + As before, this ensures that the resources are linked into the final + application binary in the case of static linking, but also triggers + loading of the library in the case of dynamic linking, such as plugins. + Similarly, if you must unload a set of resources explicitly (because a plugin is being unloaded or the resources are not valid any longer), you can force removal of your resources by calling - Q_CLEANUP_RESOURCE() with the same base name as above. + \l Q_CLEANUP_RESOURCE() with the same base name as above. + + Note: The use of \l Q_INIT_RESOURCE() and \l Q_CLEANUP_RESOURCE() is + not necessary when the resource is built as part of the application. */ diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 148ae5b202..0c65817557 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -2205,10 +2205,10 @@ QStringList QDir::nameFiltersFromString(const QString &nameFilter) \relates QDir Initializes the resources specified by the \c .qrc file with the - specified base \a name. Normally, Qt resources are loaded - automatically at startup. The Q_INIT_RESOURCE() macro is - necessary on some platforms for resources stored in a static - library. + specified base \a name. Normally, when resources are built as part + of the application, the resources are loaded automatically at + startup. The Q_INIT_RESOURCE() macro is necessary on some platforms + for resources stored in a static library. For example, if your application's resources are listed in a file called \c myapp.qrc, you can ensure that the resources are -- cgit v1.2.3 From 450d3efcb11da21e1c4f206dc57aeaddf10a1e70 Mon Sep 17 00:00:00 2001 From: Maciej Kujalowicz Date: Wed, 30 Oct 2013 13:01:21 +0100 Subject: iOS: Enable threaded OpenGL. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change activates ThreadedOpenGL and ThreadedPixmaps capabilities in the iOS integration. QIOSContext is expanded with a support for a shared context. Change-Id: I56615c870a24e17850ad2748421c54e015de3ab2 Reviewed-by: Ian Dean Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioscontext.h | 4 ++++ src/plugins/platforms/ios/qioscontext.mm | 15 ++++++++++++++- src/plugins/platforms/ios/qiosintegration.mm | 3 +++ 3 files changed, 21 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioscontext.h b/src/plugins/platforms/ios/qioscontext.h index 082ec4794c..961661c5d3 100644 --- a/src/plugins/platforms/ios/qioscontext.h +++ b/src/plugins/platforms/ios/qioscontext.h @@ -66,10 +66,14 @@ public: GLuint defaultFramebufferObject(QPlatformSurface *) const; QFunctionPointer getProcAddress(const QByteArray &procName); + bool isSharing() const Q_DECL_OVERRIDE; + bool isValid() const Q_DECL_OVERRIDE; + private Q_SLOTS: void windowDestroyed(QObject *object); private: + QIOSContext *m_sharedContext; EAGLContext *m_eaglContext; QSurfaceFormat m_format; diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm index 0c4bee1ef0..d7b9314ae0 100644 --- a/src/plugins/platforms/ios/qioscontext.mm +++ b/src/plugins/platforms/ios/qioscontext.mm @@ -51,7 +51,10 @@ QIOSContext::QIOSContext(QOpenGLContext *context) : QPlatformOpenGLContext() - , m_eaglContext([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]) + , m_sharedContext(static_cast(context->shareHandle())) + , m_eaglContext([[EAGLContext alloc] + initWithAPI:kEAGLRenderingAPIOpenGLES2 + sharegroup:m_sharedContext ? [m_sharedContext->m_eaglContext sharegroup] : nil]) , m_format(context->format()) { m_format.setRenderableType(QSurfaceFormat::OpenGLES); @@ -203,5 +206,15 @@ QFunctionPointer QIOSContext::getProcAddress(const QByteArray& functionName) return QFunctionPointer(dlsym(RTLD_DEFAULT, functionName.constData())); } +bool QIOSContext::isValid() const +{ + return m_eaglContext; +} + +bool QIOSContext::isSharing() const +{ + return m_sharedContext; +} + #include "moc_qioscontext.cpp" diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index dcad6121be..393a9f317d 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -102,6 +102,9 @@ bool QIOSIntegration::hasCapability(Capability cap) const { switch (cap) { case OpenGL: + case ThreadedOpenGL: + return true; + case ThreadedPixmaps: return true; case MultipleWindows: return true; -- cgit v1.2.3 From d1870d90365122167d650dada6e21db9e4aca91a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 5 Nov 2013 12:58:31 +0100 Subject: Clean up QWindowsSessionManager. Fix spelling error in method name and inline simple functions. Change-Id: I7f2a67fb1951b58874b09002ee57e15e75561727 Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowscontext.cpp | 8 ++--- .../platforms/windows/qwindowssessionmanager.cpp | 34 ---------------------- .../platforms/windows/qwindowssessionmanager.h | 13 ++++----- 3 files changed, 10 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 174b3312d2..fc2bb303be 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -844,7 +844,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::InputMethodKeyDownEvent: case QtWindows::KeyboardLayoutChangeEvent: #if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) - return platformSessionManager()->isInterractionBlocked() ? true : d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result); + return platformSessionManager()->isInteractionBlocked() ? true : d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result); #else return d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result); #endif @@ -868,7 +868,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::NonClientMouseEvent: if (platformWindow->frameStrutEventsEnabled()) #if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) - return platformSessionManager()->isInterractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); + return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #else return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #endif @@ -888,13 +888,13 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::MouseEvent: case QtWindows::LeaveEvent: #if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) - return platformSessionManager()->isInterractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); + return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #else return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #endif case QtWindows::TouchEvent: #if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) - return platformSessionManager()->isInterractionBlocked() ? true : d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result); + return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result); #else return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result); #endif diff --git a/src/plugins/platforms/windows/qwindowssessionmanager.cpp b/src/plugins/platforms/windows/qwindowssessionmanager.cpp index efdbb6b279..e86722f953 100644 --- a/src/plugins/platforms/windows/qwindowssessionmanager.cpp +++ b/src/plugins/platforms/windows/qwindowssessionmanager.cpp @@ -52,10 +52,6 @@ QWindowsSessionManager::QWindowsSessionManager(const QString &id, const QString { } -QWindowsSessionManager::~QWindowsSessionManager() -{ -} - bool QWindowsSessionManager::allowsInteraction() { m_blockUserInput = false; @@ -68,16 +64,6 @@ bool QWindowsSessionManager::allowsErrorInteraction() return true; } -void QWindowsSessionManager::blocksInteraction() -{ - m_blockUserInput = true; -} - -bool QWindowsSessionManager::isInterractionBlocked() const -{ - return m_blockUserInput; -} - void QWindowsSessionManager::release() { if (m_isActive) @@ -89,24 +75,4 @@ void QWindowsSessionManager::cancel() m_canceled = true; } -void QWindowsSessionManager::clearCancellation() -{ - m_canceled = false; -} - -bool QWindowsSessionManager::wasCanceled() const -{ - return m_canceled; -} - -void QWindowsSessionManager::setActive(bool active) -{ - m_isActive = active; -} - -bool QWindowsSessionManager::isActive() const -{ - return m_isActive; -} - QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowssessionmanager.h b/src/plugins/platforms/windows/qwindowssessionmanager.h index 3e21cbabec..0443635c35 100644 --- a/src/plugins/platforms/windows/qwindowssessionmanager.h +++ b/src/plugins/platforms/windows/qwindowssessionmanager.h @@ -60,22 +60,21 @@ class QWindowsSessionManager : public QPlatformSessionManager { public: explicit QWindowsSessionManager(const QString &id, const QString &key); - virtual ~QWindowsSessionManager(); bool allowsInteraction() Q_DECL_OVERRIDE; bool allowsErrorInteraction() Q_DECL_OVERRIDE; - void blocksInteraction(); - bool isInterractionBlocked() const; + void blocksInteraction() { m_blockUserInput = true; } + bool isInteractionBlocked() const { return m_blockUserInput; } void release() Q_DECL_OVERRIDE; void cancel() Q_DECL_OVERRIDE; - void clearCancellation(); - bool wasCanceled() const; + void clearCancellation() { m_canceled = false; } + bool wasCanceled() const { return m_canceled; } - void setActive(bool active); - bool isActive() const; + void setActive(bool active) { m_isActive = active; } + bool isActive() const { return m_isActive;} private: bool m_isActive; -- cgit v1.2.3 From 2bb6fbbd0fe0fd769a01299b17648ac8fe9e3387 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 4 Nov 2013 14:17:51 +0100 Subject: qdoc: Eliminate qobject_cast() collision Two template functions for qboject_cast() are defined in qwidget.h that confuse qdoc because qdoc doesn't handle template functions correctly. In this case, the documentation for all qobject_cast() functions appears in qobject.cpp where it is declared to be related to QObject. This fix surrounds the template functions in qwidget.h with #ifndef Q_QDOC ... #endif, since qdoc doesn't need to see them. This fix unmasks a linking bug QTBUG-34564, which will be fixed separately. Task-number: QTBUG-34505 Change-Id: I97fd32cc563bfa4a232819c097f41be56adf0114 Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qwidget.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index a9eeaa5470..159011b824 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -733,6 +733,7 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(QWidget::RenderFlags) +#ifndef Q_QDOC template <> inline QWidget *qobject_cast(QObject *o) { if (!o || !o->isWidgetType()) return 0; @@ -743,6 +744,7 @@ template <> inline const QWidget *qobject_cast(const QObject *o) if (!o || !o->isWidgetType()) return 0; return static_cast(o); } +#endif // !Q_QDOC inline QWidget *QWidget::childAt(int ax, int ay) const { return childAt(QPoint(ax, ay)); } -- cgit v1.2.3 From 1b58d9acc493111390b31f0bffd6b2a76baca91b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 4 Nov 2013 10:54:57 +0100 Subject: Remove Q_INIT_RESOURCE_EXTERN It's not providing any convenience over using Q_INIT_RESOURCE, which does its own extern, were never documented, and was added back in 2010 without any commit message justifying its existence. Change-Id: I1ca9a042d3f4fca34007d28b140661c50064f11b Reviewed-by: Simon Hausmann Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qglobal.h | 3 --- src/plugins/platforms/cocoa/qcocoaintegration.mm | 1 - src/widgets/kernel/qapplication.cpp | 3 --- 3 files changed, 7 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index ea6639be1b..1629339fd1 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -326,9 +326,6 @@ typedef double qreal; # define Q_AUTOTEST_EXPORT #endif -#define Q_INIT_RESOURCE_EXTERN(name) \ - extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); - #define Q_INIT_RESOURCE(name) \ do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); \ QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (0) diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 2e42b9acda..0af635be6f 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -63,7 +63,6 @@ static void initResources() { - Q_INIT_RESOURCE_EXTERN(qcocoaresources) Q_INIT_RESOURCE(qcocoaresources); } diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 70c63086a3..4e3ecf144a 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -111,13 +111,10 @@ extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp static void initResources() { #if defined(Q_OS_WINCE) - Q_INIT_RESOURCE_EXTERN(qstyle_wince) Q_INIT_RESOURCE(qstyle_wince); #else - Q_INIT_RESOURCE_EXTERN(qstyle) Q_INIT_RESOURCE(qstyle); #endif - Q_INIT_RESOURCE_EXTERN(qmessagebox) Q_INIT_RESOURCE(qmessagebox); } -- cgit v1.2.3 From 46a8885ae486e238a39efa5119c2714f328b08e4 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 27 Sep 2013 12:32:28 +0200 Subject: Disallow deep or widely nested entity references. Nested references with a depth of 2 or greater will fail. References that partially expand to greater than 1024 characters will also fail. Change-Id: Id4e49d6f7cf51e3a247efdb4c6c7c9bd9b223f6e Reviewed-by: Richard J. Moore Reviewed-by: Lars Knoll --- src/xml/sax/qxml.cpp | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'src') diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index 45c0f3e17b..e6d78d3434 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -424,6 +424,10 @@ private: int stringValueLen; QString emptyStr; + // The limit to the amount of times the DTD parsing functions can be called + // for the DTD currently being parsed. + int dtdRecursionLimit; + const QString &string(); void stringClear(); void stringAddC(QChar); @@ -493,6 +497,8 @@ private: void parseFailed(ParseFunction where, int state); void pushParseState(ParseFunction function, int state); + bool isPartiallyExpandedEntityValueTooLarge(QString *errorMessage); + Q_DECLARE_PUBLIC(QXmlSimpleReader) QXmlSimpleReader *q_ptr; @@ -2757,6 +2763,8 @@ QXmlSimpleReaderPrivate::QXmlSimpleReaderPrivate(QXmlSimpleReader *reader) useNamespacePrefixes = false; reportWhitespaceCharData = true; reportEntities = false; + + dtdRecursionLimit = 2; } QXmlSimpleReaderPrivate::~QXmlSimpleReaderPrivate() @@ -5035,6 +5043,11 @@ bool QXmlSimpleReaderPrivate::parseDoctype() } break; case Mup: + if (dtdRecursionLimit > 0 && parameterEntities.size() > dtdRecursionLimit) { + reportParseError(QString::fromLatin1( + "DTD parsing exceeded recursion limit of %1.").arg(dtdRecursionLimit)); + return false; + } if (!parseMarkupdecl()) { parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state); return false; @@ -6644,6 +6657,37 @@ bool QXmlSimpleReaderPrivate::parseChoiceSeq() return false; } +bool QXmlSimpleReaderPrivate::isPartiallyExpandedEntityValueTooLarge(QString *errorMessage) +{ + const QString value = string(); + QMap referencedEntityCounts; + foreach (QString entityName, entities.keys()) { + for (int i = 0; i < value.size() && i != -1; ) { + i = value.indexOf(entityName, i); + if (i != -1) { + // The entityName we're currently trying to find + // was matched in this string; increase our count. + ++referencedEntityCounts[entityName]; + i += entityName.size(); + } + } + } + + foreach (QString entityName, referencedEntityCounts.keys()) { + const int timesReferenced = referencedEntityCounts[entityName]; + const QString entityValue = entities[entityName]; + if (entityValue.size() * timesReferenced > 1024) { + if (errorMessage) { + *errorMessage = QString::fromLatin1("The XML entity \"%1\"" + "expands too a string that is too large to process when " + "referencing \"%2\" %3 times.").arg(entityName).arg(entityName).arg(timesReferenced); + } + return true; + } + } + return false; +} + /* Parse a EntityDecl [70]. @@ -6738,6 +6782,15 @@ bool QXmlSimpleReaderPrivate::parseEntityDecl() switch (state) { case EValue: if ( !entityExist(name())) { + QString errorMessage; + if (isPartiallyExpandedEntityValueTooLarge(&errorMessage)) { + // The entity at entityName is entityValue.size() characters + // long in its unexpanded form, and was mentioned timesReferenced times, + // resulting in a string that would be greater than 1024 characters. + reportParseError(errorMessage); + return false; + } + entities.insert(name(), string()); if (declHnd) { if (!declHnd->internalEntityDecl(name(), string())) { -- cgit v1.2.3 From 71ce869825a0af3fec66c4cd29083ec5d0d76eda Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 5 Nov 2013 11:22:34 +0100 Subject: Fix placeholder text in QTextBrowser Task-number: QTBUG-34051 Change-Id: Ief55cda861ef293a5fdeb2e5fa287b835c729894 Reviewed-by: Giuseppe D'Angelo --- src/widgets/widgets/qtextedit.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index 0f61eb487f..49e05e8e14 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -1513,6 +1513,14 @@ void QTextEditPrivate::paint(QPainter *p, QPaintEvent *e) if (layout) layout->setViewport(QRect()); + + if (!placeholderText.isEmpty() && doc->isEmpty()) { + QColor col = control->palette().text().color(); + col.setAlpha(128); + p->setPen(col); + const int margin = int(doc->documentMargin()); + p->drawText(viewport->rect().adjusted(margin, margin, -margin, -margin), Qt::AlignTop | Qt::TextWordWrap, placeholderText); + } } /*! \fn void QTextEdit::paintEvent(QPaintEvent *event) @@ -1528,13 +1536,6 @@ void QTextEdit::paintEvent(QPaintEvent *e) Q_D(QTextEdit); QPainter p(d->viewport); d->paint(&p, e); - if (!d->placeholderText.isEmpty() && d->control->document()->isEmpty()) { - QColor col = palette().text().color(); - col.setAlpha(128); - p.setPen(col); - const int margin = int(document()->documentMargin()); - p.drawText(d->viewport->rect().adjusted(margin, margin, -margin, -margin), Qt::AlignTop | Qt::TextWordWrap, d->placeholderText); - } } void QTextEditPrivate::_q_currentCharFormatChanged(const QTextCharFormat &fmt) -- cgit v1.2.3 From f2720a806e399b47bf7575686484eac0a85c6b1b Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Sun, 3 Nov 2013 20:13:35 +0000 Subject: Improve documentation of QImageIOPlugin Expanded the documentation to describe what the code in QImageReader and QImageWriter actually expects from these plugins. Change-Id: I04bb0cbf56d57a56ed246e723e533d73440a4d3a Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Friedemann Kleint Reviewed-by: Leena Miettinen --- src/gui/image/qimageiohandler.cpp | 40 ++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gui/image/qimageiohandler.cpp b/src/gui/image/qimageiohandler.cpp index 04e3213c53..d67b22c31e 100644 --- a/src/gui/image/qimageiohandler.cpp +++ b/src/gui/image/qimageiohandler.cpp @@ -187,11 +187,15 @@ return this handler. The json metadata file for the plugin needs to contain information - about the image formats the plugins supports. For a jpeg plugin, this - could e.g. look as follows: + about the image formats the plugins supports, together with the + corresponding MIME types (one for each format). For a jpeg plugin, this + could, for example, look as follows: \code - { "Keys": [ "jpg", "jpeg" ] } + { + "Keys": [ "jpg", "jpeg" ], + "MimeTypes": [ "image/jpeg", "image/jpeg" ] + } \endcode Different plugins can support different capabilities. For example, @@ -537,23 +541,33 @@ QImageIOPlugin::~QImageIOPlugin() /*! \fn QImageIOPlugin::capabilities(QIODevice *device, const QByteArray &format) const - Returns the capabilities on the plugin, based on the data in \a - device and the format \a format. For example, if the - QImageIOHandler supports the BMP format, and the data in the - device starts with the characters "BM", this function should - return \l CanRead. If \a format is "bmp" and the handler supports - both reading and writing, this function should return \l CanRead | - \l CanWrite. + Returns the capabilities of the plugin, based on the data in \a + device and the format \a format. If \a device is \c 0, it should + simply report whether the format can be read or written. Otherwise, + it should attempt to determine whether the given format (or any + format supported by the plugin if \a format is empty) can be read + from or written to \a device. It should do this without changing + the state of \a device (typically by using QIODevice::peek()). + + For example, if the QImageIOPlugin supports the BMP format, \a format + is either empty or \c "bmp", and the data in the device starts with the + characters \c "BM", this function should return \l CanRead. If \a format + is \c "bmp", \a device is \c 0 and the handler supports both reading and + writing, this function should return \l CanRead | \l CanWrite. + + Format names are always given in lower case. */ /*! \fn QImageIOHandler *QImageIOPlugin::create(QIODevice *device, const QByteArray &format) const Creates and returns a QImageIOHandler subclass, with \a device - and \a format set. The \a format must come from the list returned by keys(). - Format names are case sensitive. + and \a format set. The \a format must come from the values listed + in the \c "Keys" entry in the plugin metadata, or be empty. If it is + empty, the data in \a device must have been recognized by the + capabilities() method (with a likewise empty format). - \sa keys() + Format names are always given in lower case. */ #endif // QT_NO_IMAGEFORMATPLUGIN -- cgit v1.2.3 From a199a87ad5452938482291ba5e2995e220678f7d Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 4 Nov 2013 16:08:08 +0100 Subject: Cocoa: Don't hide views when reparenting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit a2bdda8e3ba32 was meant for creation only. We should not hide views on our own, particularly when Qt had not asked for that. Task-number: QTBUG-33581 Change-Id: Ib35fc78a27be1498f80aabd385e7a2185475b949 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoawindow.mm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 565594a98a..228ef9d484 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -713,7 +713,10 @@ WId QCocoaWindow::winId() const void QCocoaWindow::setParent(const QPlatformWindow *parentWindow) { // recreate the window for compatibility + bool unhideAfterRecreate = parentWindow && !m_contentViewIsToBeEmbedded && ![m_contentView isHidden]; recreateWindow(parentWindow); + if (unhideAfterRecreate) + [m_contentView setHidden:NO]; setCocoaGeometry(geometry()); } -- cgit v1.2.3 From 2eb1e28a90eaf82f4405dc65584021f16415014b Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 4 Nov 2013 16:12:38 +0100 Subject: Cocoa (OpenGL): If no view is attached, makeCurrent() should return false MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie2869fae1549c3b0a8ef78702410e6ca0c980737 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoaglcontext.mm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index 3dee137038..f709c94c6d 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -112,6 +112,8 @@ bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface) QWindow *window = static_cast(surface)->window(); setActiveWindow(window); + if (![m_context view]) + return false; [m_context makeCurrentContext]; update(); return true; -- cgit v1.2.3 From fc26b053df9cbf3886c4c6efc5a678fa1f60b20f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 31 Oct 2013 13:03:24 +0100 Subject: Declare Cocoa conversion funcs in objc-mode only. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In practice, there are several ways to forward-declare objective-c classes. Qt uses "struct objc_object", other projects may use a plain "class". Mismatched forward declarations will lead to compile errors, and this is a form of header pollution. dd5e40d9 added a workaround where Q_FORWARD_DECLARE_OBJC_CLASS can be predefined in order to sync up the declarations. Make forward declaration clashes less likely by forward-declaring in objc-mode only. Change-Id: I9f7a399d64dc88bfe05d5385b3d46b5302112aef Reviewed-by: Tor Arne Vestbø --- src/corelib/io/qurl.h | 6 +++++- src/corelib/tools/qstring.h | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index e7edb4365e..637eac87b6 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -51,8 +51,10 @@ #include #ifdef Q_OS_MAC -Q_FORWARD_DECLARE_OBJC_CLASS(NSURL); Q_FORWARD_DECLARE_CF_TYPE(CFURL); +# ifdef __OBJC__ +Q_FORWARD_DECLARE_OBJC_CLASS(NSURL); +# endif #endif QT_BEGIN_NAMESPACE @@ -265,8 +267,10 @@ public: #if defined(Q_OS_MAC) || defined(Q_QDOC) static QUrl fromCFURL(CFURLRef url); CFURLRef toCFURL() const Q_DECL_CF_RETURNS_RETAINED; +# if defined(__OBJC__) || defined(Q_QDOC) static QUrl fromNSURL(const NSURL *url); NSURL *toNSURL() const Q_DECL_NS_RETURNS_AUTORELEASED; +# endif #endif #if QT_DEPRECATED_SINCE(5,0) diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 2eaed65148..3140af084b 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -65,8 +65,10 @@ namespace std #endif #ifdef Q_OS_MAC -Q_FORWARD_DECLARE_OBJC_CLASS(NSString); Q_FORWARD_DECLARE_CF_TYPE(CFString); +# ifdef __OBJC__ +Q_FORWARD_DECLARE_OBJC_CLASS(NSString); +# endif #endif QT_BEGIN_NAMESPACE @@ -681,8 +683,10 @@ public: #if defined(Q_OS_MAC) || defined(Q_QDOC) static QString fromCFString(CFStringRef string); CFStringRef toCFString() const Q_DECL_CF_RETURNS_RETAINED; +# if defined(__OBJC__) || defined(Q_QDOC) static QString fromNSString(const NSString *string); NSString *toNSString() const Q_DECL_NS_RETURNS_AUTORELEASED; +# endif #endif // compatibility struct Null { }; -- cgit v1.2.3 From 54ed14d5c61b2f65bdcb6a0a5c6fa00a9617555d Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Tue, 29 Oct 2013 10:29:34 +0100 Subject: Support native event filters for screen events Change-Id: If0af4544191c513e64f582cece4a453c1ab5c8e7 Reviewed-by: Andreas Holzammer Reviewed-by: Fabian Bumberger Reviewed-by: Kevin Krammer Reviewed-by: Frank Osterfeld Reviewed-by: Thomas McGuire --- src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index efffd26981..e0dd20c40c 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -209,7 +209,11 @@ void QQnxScreenEventHandler::processEventsFromScreenThread() m_eventThread->unlock(); - handleEvent(event); + long result = 0; + QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance(); + bool handled = dispatcher && dispatcher->filterNativeEvent(QByteArrayLiteral("screen_event_t"), event, &result); + if (!handled) + handleEvent(event); screen_destroy_event(event); m_eventThread->lock(); -- cgit v1.2.3 From 2c11a492fb067cf00ae298a6e2c8af4f10d21e18 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 24 Oct 2013 17:37:27 +0200 Subject: Add better version checks for accessibility We would spam the debug output on devices with api < 16 with some warnings that the super class a11y delegate could not be found and others. Instead check the runtime version before trying to load the JNI code and only load the delegate if api is new enough. Change-Id: I52286cb99924b034b9b58c53566f15030939b0c9 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../src/org/qtproject/qt5/android/QtSurface.java | 32 ++++++++++++---------- .../platforms/android/src/androidjnimain.cpp | 17 +++++++++++- 2 files changed, 33 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java index cd0bddf2c8..c499dc3898 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java @@ -117,21 +117,23 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback // Initialize Accessibility // The accessibility code depends on android API level 16, so dynamically resolve it - try { - final String a11yDelegateClassName = "org.qtproject.qt5.android.accessibility.QtAccessibilityDelegate"; - Class qtDelegateClass = Class.forName(a11yDelegateClassName); - Constructor constructor = qtDelegateClass.getConstructor(Class.forName("android.view.View")); - m_accessibilityDelegate = constructor.newInstance(this); - - Class a11yDelegateClass = Class.forName("android.view.View$AccessibilityDelegate"); - Method setDelegateMethod = this.getClass().getMethod("setAccessibilityDelegate", a11yDelegateClass); - setDelegateMethod.invoke(this, m_accessibilityDelegate); - } catch (ClassNotFoundException e) { - // Class not found is fine since we are compatible with Android API < 16, but the function will - // only be available with that API level. - } catch (Exception e) { - // Unknown exception means something went wrong. - Log.w("Qt A11y", "Unknown exception: " + e.toString()); + if (android.os.Build.VERSION.SDK_INT >= 16) { + try { + final String a11yDelegateClassName = "org.qtproject.qt5.android.accessibility.QtAccessibilityDelegate"; + Class qtDelegateClass = Class.forName(a11yDelegateClassName); + Constructor constructor = qtDelegateClass.getConstructor(Class.forName("android.view.View")); + m_accessibilityDelegate = constructor.newInstance(this); + + Class a11yDelegateClass = Class.forName("android.view.View$AccessibilityDelegate"); + Method setDelegateMethod = this.getClass().getMethod("setAccessibilityDelegate", a11yDelegateClass); + setDelegateMethod.invoke(this, m_accessibilityDelegate); + } catch (ClassNotFoundException e) { + // Class not found is fine since we are compatible with Android API < 16, but the function will + // only be available with that API level. + } catch (Exception e) { + // Unknown exception means something went wrong. + Log.w("Qt A11y", "Unknown exception: " + e.toString()); + } } } diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp index 9ce79f445a..3d599b8f8b 100644 --- a/src/plugins/platforms/android/src/androidjnimain.cpp +++ b/src/plugins/platforms/android/src/androidjnimain.cpp @@ -834,6 +834,15 @@ static int registerNatives(JNIEnv *env) return JNI_TRUE; } +jint androidApiLevel(JNIEnv *env) +{ + jclass clazz; + FIND_AND_CHECK_CLASS("android/os/Build$VERSION"); + jfieldID fieldId; + GET_AND_CHECK_STATIC_FIELD(fieldId, clazz, "SDK_INT", "I"); + return env->GetStaticIntField(clazz, fieldId); +} + Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/) { typedef union { @@ -856,11 +865,17 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/) || !QtAndroidInput::registerNatives(env) || !QtAndroidClipboard::registerNatives(env) || !QtAndroidMenu::registerNatives(env) - || !QtAndroidAccessibility::registerNatives(env)) { + ) { __android_log_print(ANDROID_LOG_FATAL, "Qt", "registerNatives failed"); return -1; } + jint apiLevel = androidApiLevel(env); + if (apiLevel >= 16 && !QtAndroidAccessibility::registerNatives(env)) { + __android_log_print(ANDROID_LOG_FATAL, "Qt A11y", "registerNatives failed"); + return -1; + } + m_javaVM = vm; return JNI_VERSION_1_4; } -- cgit v1.2.3 From 44d48862c0ff4b67a76734deae5e76f926a77bce Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 31 Oct 2013 18:17:44 +0100 Subject: QStandardPaths: add GenericConfigLocation This is what ConfigLocation was meant to be. A directory shared by all applications. Unfortunately when I wrote the fallback on Windows, I picked DataLocation (which is app-specific) instead of GenericDataLocation (which is shared between apps). This makes it impossible to have config files shared between apps, e.g. for libraries. It also makes ConfigLocation quite inconsistent (on Windows one cannot use it to load another app's config file, while it works everywhere else). All this is fixed by GenericConfigLocation, which is shared between apps. Change-Id: I23a755131061d4fea01e13dd1038fbd8ef333a5d Reviewed-by: Alex Richardson Reviewed-by: Thiago Macieira --- src/corelib/io/qstandardpaths.cpp | 7 ++++++- src/corelib/io/qstandardpaths.h | 3 ++- src/corelib/io/qstandardpaths_blackberry.cpp | 1 + src/corelib/io/qstandardpaths_ios.mm | 1 + src/corelib/io/qstandardpaths_mac.cpp | 2 ++ src/corelib/io/qstandardpaths_unix.cpp | 2 ++ src/corelib/io/qstandardpaths_win.cpp | 10 ++++++---- 7 files changed, 20 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp index 186321db6e..2207b8c43e 100644 --- a/src/corelib/io/qstandardpaths.cpp +++ b/src/corelib/io/qstandardpaths.cpp @@ -95,6 +95,9 @@ QT_BEGIN_NAMESPACE files should be written. For instance unix local sockets. \value ConfigLocation Returns a directory location where user-specific configuration files should be written. + \value GenericConfigLocation Returns a directory location where user-specific + configuration files shared between multiple applications should be written. + This is a generic value and the returned path is never empty. \value DownloadLocation Returns a directory for user's downloaded files. @@ -335,6 +338,8 @@ QString QStandardPaths::displayName(StandardLocation type) return QCoreApplication::translate("QStandardPaths", "Runtime"); case ConfigLocation: return QCoreApplication::translate("QStandardPaths", "Configuration"); + case GenericConfigLocation: + return QCoreApplication::translate("QStandardPaths", "Shared Configuration"); case GenericCacheLocation: return QCoreApplication::translate("QStandardPaths", "Shared Cache"); case DownloadLocation: @@ -358,7 +363,7 @@ QString QStandardPaths::displayName(StandardLocation type) or writing to the current user's configuration. This affects the locations into which test programs might write files: - GenericDataLocation, DataLocation, ConfigLocation, + GenericDataLocation, DataLocation, ConfigLocation, GenericConfigLocation, GenericCacheLocation, CacheLocation. Other locations are not affected. diff --git a/src/corelib/io/qstandardpaths.h b/src/corelib/io/qstandardpaths.h index df9089ace7..08d6d7b50c 100644 --- a/src/corelib/io/qstandardpaths.h +++ b/src/corelib/io/qstandardpaths.h @@ -69,7 +69,8 @@ public: RuntimeLocation, ConfigLocation, DownloadLocation, - GenericCacheLocation + GenericCacheLocation, + GenericConfigLocation }; static QString writableLocation(StandardLocation type); diff --git a/src/corelib/io/qstandardpaths_blackberry.cpp b/src/corelib/io/qstandardpaths_blackberry.cpp index a801c2fba3..815756ff9a 100644 --- a/src/corelib/io/qstandardpaths_blackberry.cpp +++ b/src/corelib/io/qstandardpaths_blackberry.cpp @@ -75,6 +75,7 @@ QString QStandardPaths::writableLocation(StandardLocation type) case GenericCacheLocation: return QDir::homePath() + testModeInsert() + QLatin1String("/Cache"); case ConfigLocation: + case GenericConfigLocation: return QDir::homePath() + testModeInsert() + QLatin1String("/Settings"); case GenericDataLocation: return sharedRoot + testModeInsert() + QLatin1String("/misc"); diff --git a/src/corelib/io/qstandardpaths_ios.mm b/src/corelib/io/qstandardpaths_ios.mm index 332400eaf2..e2100045a6 100644 --- a/src/corelib/io/qstandardpaths_ios.mm +++ b/src/corelib/io/qstandardpaths_ios.mm @@ -99,6 +99,7 @@ QString QStandardPaths::writableLocation(StandardLocation type) location = pathForDirectory(NSCachesDirectory); break; case ConfigLocation: + case GenericConfigLocation: location = pathForDirectory(NSDocumentDirectory); break; case DownloadLocation: diff --git a/src/corelib/io/qstandardpaths_mac.cpp b/src/corelib/io/qstandardpaths_mac.cpp index 6744bfeab4..0efdfae253 100644 --- a/src/corelib/io/qstandardpaths_mac.cpp +++ b/src/corelib/io/qstandardpaths_mac.cpp @@ -58,6 +58,7 @@ OSType translateLocation(QStandardPaths::StandardLocation type) { switch (type) { case QStandardPaths::ConfigLocation: + case QStandardPaths::GenericConfigLocation: return kPreferencesFolderType; case QStandardPaths::DesktopLocation: return kDesktopFolderType; @@ -149,6 +150,7 @@ QString QStandardPaths::writableLocation(StandardLocation type) if (type == CacheLocation) appendOrganizationAndApp(path); return path; + case GenericConfigLocation: case ConfigLocation: return qttestDir + QLatin1String("/Preferences"); default: diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp index 61e2e03a3d..1b9078f712 100644 --- a/src/corelib/io/qstandardpaths_unix.cpp +++ b/src/corelib/io/qstandardpaths_unix.cpp @@ -103,6 +103,7 @@ QString QStandardPaths::writableLocation(StandardLocation type) return xdgDataHome; } case ConfigLocation: + case GenericConfigLocation: { // http://standards.freedesktop.org/basedir-spec/latest/ QString xdgConfigHome = QFile::decodeName(qgetenv("XDG_CONFIG_HOME")); @@ -277,6 +278,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) QStringList dirs; switch (type) { case ConfigLocation: + case GenericConfigLocation: { // http://standards.freedesktop.org/basedir-spec/latest/ const QString xdgConfigDirs = QFile::decodeName(qgetenv("XDG_CONFIG_DIRS")); diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp index d4e0779381..6a79c7c00b 100644 --- a/src/corelib/io/qstandardpaths_win.cpp +++ b/src/corelib/io/qstandardpaths_win.cpp @@ -99,7 +99,8 @@ QString QStandardPaths::writableLocation(StandardLocation type) wchar_t path[MAX_PATH]; switch (type) { - case ConfigLocation: // same as DataLocation, on Windows + case ConfigLocation: // same as DataLocation, on Windows (oversight, but too late to fix it) + case GenericConfigLocation: // same as GenericDataLocation, on Windows case DataLocation: case GenericDataLocation: #if defined Q_OS_WINCE @@ -111,7 +112,7 @@ QString QStandardPaths::writableLocation(StandardLocation type) if (isTestModeEnabled()) result += QLatin1String("/qttest"); #ifndef QT_BOOTSTRAPPED - if (type != GenericDataLocation) { + if (type != GenericDataLocation && type != GenericConfigLocation) { if (!QCoreApplication::organizationName().isEmpty()) result += QLatin1Char('/') + QCoreApplication::organizationName(); if (!QCoreApplication::applicationName().isEmpty()) @@ -188,12 +189,13 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) if (SHGetSpecialFolderPath) { wchar_t path[MAX_PATH]; switch (type) { - case ConfigLocation: // same as DataLocation, on Windows + case ConfigLocation: // same as DataLocation, on Windows (oversight, but too late to fix it) + case GenericConfigLocation: // same as GenericDataLocation, on Windows case DataLocation: case GenericDataLocation: if (SHGetSpecialFolderPath(0, path, CSIDL_COMMON_APPDATA, FALSE)) { QString result = convertCharArray(path); - if (type != GenericDataLocation) { + if (type != GenericDataLocation && type != GenericConfigLocation) { #ifndef QT_BOOTSTRAPPED if (!QCoreApplication::organizationName().isEmpty()) result += QLatin1Char('/') + QCoreApplication::organizationName(); -- cgit v1.2.3 From 0c9a5698a1b03778471e5afb5b055f701459798c Mon Sep 17 00:00:00 2001 From: Pekka Vuorela Date: Sat, 2 Nov 2013 16:25:17 +0200 Subject: Add missing \since 5.1 for QVector::takeFirst() and ::takeLast() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic2d7e82187a17e21c2ed0e81318294730c3a0930 Reviewed-by: Thorbjørn Lund Martsum --- src/corelib/tools/qvector.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index f6276711a7..4beb0f939c 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -621,6 +621,7 @@ */ /*! \fn T QVector::takeFirst() + \since 5.1 Removes the first item in the vector and returns it. This function assumes the vector is not empty. To avoid failure, call isEmpty() @@ -630,6 +631,7 @@ */ /*! \fn T QVector::takeLast() + \since 5.1 Removes the last item in the list and returns it. This function assumes the vector is not empty. To avoid failure, call isEmpty() -- cgit v1.2.3 From 0cdf2a8023473e03121fc99194182a3fb86dd6aa Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 5 Nov 2013 20:18:49 +0100 Subject: Revert "Ensure CSS rules are inherited from the parent tags" Since the original change caused a problem with the CSS rules being always inherited where in some cases this should not be happening. This reverts commit 6f6546613774a48fe12f13f796ed7115dfe49a27. Change-Id: I6e9cf163d752b1869b5e967a7ab59963d655ba87 Reviewed-by: Simon Hausmann --- src/gui/text/qtexthtmlparser.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index a131503b85..3cb61b9eae 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -1896,11 +1896,7 @@ QVector QTextHtmlParser::declarationsForNode(int node) const if (nodes.at(node).id == Html_a && nodes.at(node).hasHref) extraPseudo = "link"; decls = selector.declarationsForNode(n, extraPseudo); - n = selector.parentNode(n); - while (!selector.isNullNode(n)) { - decls = selector.declarationsForNode(n, extraPseudo) + decls; - n = selector.parentNode(n); - } + return decls; } -- cgit v1.2.3 From e7fd798af001e2c4e323f5ae90e4e994f12ccf33 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 5 Nov 2013 09:32:35 +0100 Subject: Disable threaded rendering for Intel HD 3000 cards. Task-number: QTBUG-34492 Change-Id: I1848cde3fb9517679fd54a7170ed5bee40880edc Reviewed-by: Giuseppe D'Angelo --- src/plugins/platforms/xcb/qglxintegration.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index 2c418cbebe..4ac4cf21ab 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -411,6 +411,16 @@ bool QGLXContext::isValid() const bool QGLXContext::m_queriedDummyContext = false; bool QGLXContext::m_supportsThreading = true; + +// If this list grows to any significant size, change it a +// proper string table and make the implementation below use +// binary search. +static const char *qglx_threadedgl_blacklist[] = { + "Chromium", // QTBUG-32225 (initialization fails) + "Mesa DRI Intel(R) Sandybridge Mobile", // QTBUG-34492 (flickering in fullscreen) + 0 +}; + void QGLXContext::queryDummyContext() { if (m_queriedDummyContext) @@ -428,10 +438,14 @@ void QGLXContext::queryDummyContext() context.makeCurrent(&surface); const char *renderer = (const char *) glGetString(GL_RENDERER); - if (QByteArray(renderer).contains("Chromium")) - m_supportsThreading = false; - else - m_supportsThreading = true; + + m_supportsThreading = true; + for (int i = 0; qglx_threadedgl_blacklist[i]; ++i) { + if (strstr(renderer, qglx_threadedgl_blacklist[i]) != 0) { + m_supportsThreading = false; + break; + } + } } bool QGLXContext::supportsThreading() -- cgit v1.2.3 From 49a3c87175b0b9261c8c715315f3913b410f248d Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Fri, 4 Oct 2013 00:19:56 +0200 Subject: Remove two unused functions from QAccessibleTabBar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib3296a11b1bb9656f2b0c14106ea09f529311ccf Reviewed-by: Morten Johan Sørvig --- src/plugins/accessible/widgets/complexwidgets.cpp | 35 ----------------------- src/plugins/accessible/widgets/complexwidgets.h | 3 -- 2 files changed, 38 deletions(-) (limited to 'src') diff --git a/src/plugins/accessible/widgets/complexwidgets.cpp b/src/plugins/accessible/widgets/complexwidgets.cpp index c0d62ccc16..b1df6d816a 100644 --- a/src/plugins/accessible/widgets/complexwidgets.cpp +++ b/src/plugins/accessible/widgets/complexwidgets.cpp @@ -221,41 +221,6 @@ QString QAccessibleTabBar::text(QAccessible::Text t) const return QString(); } -/*! - Selects the item with index \a child if \a on is true; otherwise - unselects it. If \a extend is true and the selection mode is not - \c Single and there is an existing selection, the selection is - extended to include all the items from the existing selection up - to and including the item with index \a child. Returns \c true if a - selection was made or extended; otherwise returns \c false. - - \sa selection(), clearSelection() -*/ -bool QAccessibleTabBar::setSelected(int child, bool on, bool extend) -{ - if (!child || !on || extend || child > tabBar()->count()) - return false; - - if (!tabBar()->isTabEnabled(child - 1)) - return false; - tabBar()->setCurrentIndex(child - 1); - return true; -} - -/*! - Returns a (possibly empty) list of indexes of the items selected - in the list box. - - \sa setSelected(), clearSelection() -*/ -QVector QAccessibleTabBar::selection() const -{ - QVector array; - if (tabBar()->currentIndex() != -1) - array +=tabBar()->currentIndex() + 1; - return array; -} - #endif // QT_NO_TABBAR #ifndef QT_NO_COMBOBOX diff --git a/src/plugins/accessible/widgets/complexwidgets.h b/src/plugins/accessible/widgets/complexwidgets.h index 164bc5b6d9..00186282f3 100644 --- a/src/plugins/accessible/widgets/complexwidgets.h +++ b/src/plugins/accessible/widgets/complexwidgets.h @@ -105,9 +105,6 @@ public: int childCount() const Q_DECL_OVERRIDE; QString text(QAccessible::Text t) const Q_DECL_OVERRIDE; - bool setSelected(int child, bool on, bool extend); - QVector selection() const; - QAccessibleInterface* child(int index) const Q_DECL_OVERRIDE; int indexOfChild(const QAccessibleInterface *child) const Q_DECL_OVERRIDE; -- cgit v1.2.3 From 6adfca1acbe226fe49bdd90c91ac6ea74d4d6af9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 30 Oct 2013 10:17:18 -0700 Subject: Doc: Add a little more information about current dirs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-34300 Change-Id: Ib71d6ace77b525942ca40645299cdfd87b753d70 Reviewed-by: Morten Johan Sørvig --- src/corelib/io/qdir.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 0c65817557..db27bed9d6 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1863,9 +1863,12 @@ bool QDir::setCurrent(const QString &path) */ /*! - Returns the absolute path of the application's current directory. + Returns the absolute path of the application's current directory. The + current directory is the last directory set with QDir::setCurrent() or, if + that was never called, the directory at which this application was started + at by the parent process. - \sa current(), setCurrent(), homePath(), rootPath(), tempPath() + \sa current(), setCurrent(), homePath(), rootPath(), tempPath(), QCoreApplication::applicationDirPath() */ QString QDir::currentPath() { -- cgit v1.2.3 From 6381c807e550fa6f1f7425dc800dbf8be121ab82 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 28 Oct 2013 12:48:15 +0100 Subject: Force length fo licensee literals to be computed at runtime Prevent compilers from computing strlen() at compile time by passing a volatile pointer. Task-number: QTBUG-34261 Change-Id: I5e5e80181024d57496907918d2a43d7c83841082 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/global/qlibraryinfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 33d7b71cff..1c3b09f602 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -221,7 +221,7 @@ QLibraryInfo::QLibraryInfo() QString QLibraryInfo::licensee() { - const char *str = QT_CONFIGURE_LICENSEE; + const char * volatile str = QT_CONFIGURE_LICENSEE; return QString::fromLocal8Bit(str); } @@ -234,7 +234,7 @@ QLibraryInfo::licensee() QString QLibraryInfo::licensedProducts() { - const char *str = QT_CONFIGURE_LICENSED_PRODUCTS; + const char * volatile str = QT_CONFIGURE_LICENSED_PRODUCTS; return QString::fromLatin1(str); } -- cgit v1.2.3 From 6d45bf683e17092059a553fd31ad2a89672e3195 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 5 Nov 2013 18:45:44 +0100 Subject: QGlobal: static_assert that sizeof(int) == 4 and UCHAR_MAX == 255 According to Thiago, Qt assumes this in a lot of places, so make it explicit. Change-Id: I3f4a55699379fd9fe4d792061c80b3b589c10c53 Reviewed-by: Olivier Goffart Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index ca780346bc..a874b231cc 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -88,6 +88,14 @@ Q_CORE_EXPORT void *qMemCopy(void *dest, const void *src, size_t n); Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n); #endif +// Statically check assumptions about the environment we're running +// in. The idea here is to error or warn if otherwise implicit Qt +// assumptions are not fulfilled on new hardware or compilers +// (if this list becomes too long, consider factoring into a separate file) +Q_STATIC_ASSERT_X(sizeof(int) == 4, "Qt assumes that int is 32 bits"); +Q_STATIC_ASSERT_X(UCHAR_MAX == 255, "Qt assumes that char is 8 bits"); + + /*! \class QFlag \inmodule QtCore -- cgit v1.2.3 From f78661b03cc1affcdd222be50b35d956edac4711 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 5 Nov 2013 20:20:07 +0100 Subject: Make OpenGL texture glyph cache use the right freetype glyphs The freetype font engine would fall back to rasterizing glyphs via QPainterPath in QFontEngine::alphaMapForGlyph() which has a rather unfortunate implementation. Change-Id: Ic0b4095b6f17ab33f0602139f0a8fb441dfba0ee Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/opengl/qopengltextureglyphcache.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index 061e8f4166..3b62d1d63a 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -303,7 +303,17 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed return; } - QImage mask = textureMapForGlyph(glyph, subPixelPosition); + QImage mask; + + if (m_current_fontengine->hasInternalCaching()) { + QImage *alphaMap = m_current_fontengine->lockedAlphaMapForGlyph(glyph, subPixelPosition, QFontEngine::Format_None); + if (!alphaMap || alphaMap->isNull()) + return; + mask = alphaMap->copy(); + m_current_fontengine->unlockAlphaMapForGlyph(); + } else { + mask = textureMapForGlyph(glyph, subPixelPosition); + } const int maskWidth = mask.width(); const int maskHeight = mask.height(); -- cgit v1.2.3 From 5c389cecd07a4659670e3fefa34d717762dc3af1 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Tue, 5 Nov 2013 13:03:33 +0100 Subject: Doc: Updated url variable in qdocconf files. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In 5.2, the HTML output is in a flatter structure and when they are hosted in qt-project.org/doc, the documentation will be found at http://qt-project.org/doc/qt-$QT_VER The url variable is used by projects outside of Qt 5 which need to link to Qt 5 documentation, such as Qt Creator. Task-number: QTBUG-34584 Change-Id: Ifa55fcd9e402b0e184a41e316340e46aeb7101de Reviewed-by: Topi Reiniö Reviewed-by: Leena Miettinen --- src/concurrent/doc/qtconcurrent.qdocconf | 2 +- src/corelib/doc/qtcore.qdocconf | 2 +- src/gui/doc/qtgui.qdocconf | 2 +- src/network/doc/qtnetwork.qdocconf | 2 +- src/printsupport/doc/qtprintsupport.qdocconf | 2 +- src/sql/doc/qtsql.qdocconf | 2 +- src/testlib/doc/qttestlib.qdocconf | 2 +- src/tools/qdoc/doc/files/qtgui.qdocconf | 2 +- src/widgets/doc/qtwidgets.qdocconf | 2 +- src/xml/doc/qtxml.qdocconf | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/concurrent/doc/qtconcurrent.qdocconf b/src/concurrent/doc/qtconcurrent.qdocconf index 9d89192946..e45047cb51 100644 --- a/src/concurrent/doc/qtconcurrent.qdocconf +++ b/src/concurrent/doc/qtconcurrent.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtConcurrent description = Qt Concurrent Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER/qtconcurrent +url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = qtconcurrent diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf index fdd46995c5..0b1752e496 100644 --- a/src/corelib/doc/qtcore.qdocconf +++ b/src/corelib/doc/qtcore.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtCore description = Qt Core Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER/qtcore +url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = core diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf index ed30172376..a963f55dc8 100644 --- a/src/gui/doc/qtgui.qdocconf +++ b/src/gui/doc/qtgui.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtGui description = Qt GUI Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER/qtgui +url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = gui diff --git a/src/network/doc/qtnetwork.qdocconf b/src/network/doc/qtnetwork.qdocconf index f4779ae8fe..33d6c24461 100644 --- a/src/network/doc/qtnetwork.qdocconf +++ b/src/network/doc/qtnetwork.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtNetwork description = Qt Network Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER/qtnetwork +url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = network diff --git a/src/printsupport/doc/qtprintsupport.qdocconf b/src/printsupport/doc/qtprintsupport.qdocconf index d5015fa46a..4d1f0c39f1 100644 --- a/src/printsupport/doc/qtprintsupport.qdocconf +++ b/src/printsupport/doc/qtprintsupport.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtPrintSupport description = Qt Print Support Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER/qtprintsupport +url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = printsupport diff --git a/src/sql/doc/qtsql.qdocconf b/src/sql/doc/qtsql.qdocconf index a2a05d7c8a..7f37904039 100644 --- a/src/sql/doc/qtsql.qdocconf +++ b/src/sql/doc/qtsql.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtSql description = Qt SQL Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER/qtsql +url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = sql diff --git a/src/testlib/doc/qttestlib.qdocconf b/src/testlib/doc/qttestlib.qdocconf index ab2bdc1948..426236c339 100644 --- a/src/testlib/doc/qttestlib.qdocconf +++ b/src/testlib/doc/qttestlib.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtTestLib description = Qt Test Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER/qttestlib +url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = testlib diff --git a/src/tools/qdoc/doc/files/qtgui.qdocconf b/src/tools/qdoc/doc/files/qtgui.qdocconf index 5073dd7f0f..7f80808bfc 100644 --- a/src/tools/qdoc/doc/files/qtgui.qdocconf +++ b/src/tools/qdoc/doc/files/qtgui.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtGui description = Qt GUI Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER/qtgui +url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = gui diff --git a/src/widgets/doc/qtwidgets.qdocconf b/src/widgets/doc/qtwidgets.qdocconf index d3c7825bc0..b742856892 100644 --- a/src/widgets/doc/qtwidgets.qdocconf +++ b/src/widgets/doc/qtwidgets.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtWidgets description = Qt Widgets Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER/qtwidgets +url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = widgets diff --git a/src/xml/doc/qtxml.qdocconf b/src/xml/doc/qtxml.qdocconf index f9c847e022..19561af57f 100644 --- a/src/xml/doc/qtxml.qdocconf +++ b/src/xml/doc/qtxml.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtXml description = Qt XML Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER/qtxml +url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = xml -- cgit v1.2.3 From efb04c8d7d42a11980718e1e43f7aed5d67f3de2 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Wed, 6 Nov 2013 10:32:04 +0200 Subject: Android: prevent main activity to be recreated. Add more config changes needed for API 13+ API 13+ is mandatory to build any Qt for Android application. Change-Id: I595f7174dd2fc8a0865772f9780ce606e1f1fcf1 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/android/java/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/android/java/AndroidManifest.xml b/src/android/java/AndroidManifest.xml index da34e4efac..c8ef07d58c 100644 --- a/src/android/java/AndroidManifest.xml +++ b/src/android/java/AndroidManifest.xml @@ -1,7 +1,7 @@ - -- cgit v1.2.3 From a805aa384d0cc95ff17e50a475957ee8f685ea18 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 5 Nov 2013 20:26:38 +0100 Subject: Revert "Use Qt's own glyph cache with the freetype engine." This reverts commit 8c58640fdfe5d182cd8ab9ad0598c54c0487eb7c. The intent was to reduce the maintenance of parallel code paths, but this had a negative impact on performance so we need to enable it again. Change-Id: Ic58f7781ff076055e7c48f20fc0e7a8a2c9e51a4 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontengine_ft.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 8c266fe7b6..8c69ca9753 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -631,7 +631,8 @@ QFontEngineFT::QFontEngineFT(const QFontDef &fd) #endif defaultFormat = Format_None; embeddedbitmap = false; - cacheEnabled = qEnvironmentVariableIsSet("QT_USE_FT_CACHE"); + const QByteArray env = qgetenv("QT_NO_FT_CACHE"); + cacheEnabled = env.isEmpty() || env.toInt() == 0; m_subPixelPositionCount = 4; } -- cgit v1.2.3 From 762c3d87de67ec8e8df8b810065ca5fe86db87a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 28 Oct 2013 16:45:40 +0100 Subject: Don't hardcode devicePixelRatio to 1. This code path can and will be hit during app startup, and can result in low-resolution images being used on high-dpi systems. Use qApp->devicePixelRatio() instead, which is more likely to be correct. Change-Id: Ic881cfedd8e962037d2d4af4a1242f590d56c194 Reviewed-by: Gabriel de Dietrich Reviewed-by: Jens Bache-Wiig --- src/gui/kernel/qwindow.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index e0e1638d75..a6223987c2 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -986,8 +986,13 @@ Qt::ScreenOrientation QWindow::contentOrientation() const qreal QWindow::devicePixelRatio() const { Q_D(const QWindow); + + // If there is no platform window, do the second best thing and + // return the app global devicePixelRatio. This is the highest + // devicePixelRatio found on the system screens, and will be + // correct for single-display systems (a very common case). if (!d->platformWindow) - return 1.0; + return qApp->devicePixelRatio(); return d->platformWindow->devicePixelRatio(); } -- cgit v1.2.3 From 8f77f9536fc31fe9e4ac032845ff168c7ca41ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 5 Nov 2013 14:07:43 +0100 Subject: Clarify Q_INIT_RESOURCE in relation to namespaces The constructor functions generated by rcc are put in the global namespace. As there is no way to forward-declare a function in the global namespace from within another namespace, Q_INIT_RESOURCE must always be called from the global namespace. Change-Id: I8b8b9451271cf2f9147164696a6df7615678ab03 Reviewed-by: Jerome Pasion --- src/corelib/doc/src/resource-system.qdoc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/corelib/doc/src/resource-system.qdoc b/src/corelib/doc/src/resource-system.qdoc index 4c24320851..91ce8afcf8 100644 --- a/src/corelib/doc/src/resource-system.qdoc +++ b/src/corelib/doc/src/resource-system.qdoc @@ -198,6 +198,10 @@ clients of your library will only link in the resources if they use the feature of the library that depends on them. + Note: As the resource initializers generated by rcc are declared in the + global namespace, your calls to \l Q_INIT_RESOURCE() also need to be done + outside of any namespace. + If the library includes resources that are not used internally, but instead exposed to clients of the library, the initialization needs to happen in the application code. For example: -- cgit v1.2.3 From 04ad4d7de5816cf96936f0b839f85868dd688256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 5 Nov 2013 18:28:42 +0100 Subject: iOS: Remove unused QIOSWindow methods for getting effective width/height MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ifdfd5881822bf56f2c8ab0742a0e257e2bd61533 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/ios/qioswindow.h | 2 -- src/plugins/platforms/ios/qioswindow.mm | 10 ---------- 2 files changed, 12 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index 20f0aa59b6..0f7a50db04 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -74,8 +74,6 @@ public: void requestActivateWindow(); qreal devicePixelRatio() const; - int effectiveWidth() const; - int effectiveHeight() const; bool setMouseGrabEnabled(bool grab) { return grab; } bool setKeyboardGrabEnabled(bool grab) { return grab; } diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 0bfda49536..25c11a210d 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -505,14 +505,4 @@ qreal QIOSWindow::devicePixelRatio() const return m_devicePixelRatio; } -int QIOSWindow::effectiveWidth() const -{ - return geometry().width() * m_devicePixelRatio; -} - -int QIOSWindow::effectiveHeight() const -{ - return geometry().height() * m_devicePixelRatio; -} - QT_END_NAMESPACE -- cgit v1.2.3 From 417cf3fc535ef18e7895cb863235cc33e36669f9 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Wed, 6 Nov 2013 15:42:16 +0200 Subject: Android: Fix menu on API-11+ On API-11+ if there is no hardware menu button show the action bar. Fix menu when using the opengl android plugin. Task-number: QTBUG-32002 Change-Id: I45bd49107621e4cab85eb6411897229e20bb8281 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: BogDan Vatra --- .../qtproject/qt5/android/QtActivityDelegate.java | 64 ++++++++++++++++++++-- .../qtproject/qt5/android/bindings/QtActivity.java | 15 ++++- .../platforms/android/src/androidjnimenu.cpp | 26 +++++---- .../src/opengl/qandroidopenglplatformscreen.cpp | 2 + .../android/src/qandroidplatformmenubar.cpp | 2 + 5 files changed, 92 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 82533dc9cb..da2f6163ea 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -63,6 +63,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.Surface; import android.view.View; +import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; @@ -406,6 +407,7 @@ public class QtActivityDelegate m_applicationParameters = loaderParams.getString(APPLICATION_PARAMETERS_KEY); else m_applicationParameters = ""; + setActionBarVisibility(false); return true; } @@ -615,7 +617,7 @@ public class QtActivityDelegate m_surface = new QtSurface(m_activity, 0); m_editText = new QtEditText(m_activity, this); m_imm = (InputMethodManager)m_activity.getSystemService(Context.INPUT_METHOD_SERVICE); - m_layout.addView(m_surface,0); + m_layout.addView(m_surface, 0); m_activity.setContentView(m_layout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); @@ -808,7 +810,10 @@ public class QtActivityDelegate public boolean onPrepareOptionsMenu(Menu menu) { m_opionsMenuIsVisible = true; - return QtNative.onPrepareOptionsMenu(menu); + boolean res = QtNative.onPrepareOptionsMenu(menu); + if (!res || menu.size() == 0) + setActionBarVisibility(false); + return res; } public boolean onOptionsItemSelected(MenuItem item) @@ -824,8 +829,17 @@ public class QtActivityDelegate public void resetOptionsMenu() { - if (m_opionsMenuIsVisible) - m_activity.closeOptionsMenu(); + setActionBarVisibility(true); + if (Build.VERSION.SDK_INT > 10) { + try { + Activity.class.getMethod("invalidateOptionsMenu").invoke(m_activity); + } catch (Exception e) { + e.printStackTrace(); + } + } + else + if (m_opionsMenuIsVisible) + m_activity.closeOptionsMenu(); } private boolean m_contextMenuVisible = false; public void onCreateContextMenu(ContextMenu menu, @@ -866,4 +880,46 @@ public class QtActivityDelegate { m_activity.closeContextMenu(); } + + private boolean hasPermanentMenuKey() + { + try { + return Build.VERSION.SDK_INT < 11 || (Build.VERSION.SDK_INT >= 14 && + (Boolean)ViewConfiguration.class.getMethod("hasPermanentMenuKey").invoke(ViewConfiguration.get(m_activity))); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + private Object getActionBar() + { + try { + return Activity.class.getMethod("getActionBar").invoke(m_activity); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + private void setActionBarVisibility(boolean visible) + { + if (hasPermanentMenuKey() || !visible) { + if (Build.VERSION.SDK_INT > 10 && getActionBar() != null) { + try { + Class.forName("android.app.ActionBar").getMethod("hide").invoke(getActionBar()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } else { + if (Build.VERSION.SDK_INT > 10 && getActionBar() != null) + try { + Class.forName("android.app.ActionBar").getMethod("show").invoke(getActionBar()); + } catch (Exception e) { + e.printStackTrace(); + } + } + } } diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java index 4c5d479800..089cf5aa60 100644 --- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java +++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java @@ -80,6 +80,7 @@ import android.view.ActionMode; import android.view.ActionMode.Callback; //@ANDROID-11 + public class QtActivity extends Activity { private final static int MINISTRO_INSTALL_REQUEST_CODE = 0xf3ee; // request code used to know when Ministro instalation is finished @@ -714,13 +715,25 @@ public class QtActivity extends Activity } catch (Exception e) { e.printStackTrace(); } + + if (Build.VERSION.SDK_INT > 10) { + try { + requestWindowFeature(Window.class.getField("FEATURE_ACTION_BAR").getInt(null)); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + requestWindowFeature(Window.FEATURE_NO_TITLE); + } + if (QtApplication.m_delegateObject != null && QtApplication.onCreate != null) { QtApplication.invokeDelegateMethod(QtApplication.onCreate, savedInstanceState); return; } + ENVIRONMENT_VARIABLES += "\tQT_ANDROID_THEME=" + QT_ANDROID_DEFAULT_THEME + "/\tQT_ANDROID_THEME_DISPLAY_DPI=" + getResources().getDisplayMetrics().densityDpi + "\t"; - requestWindowFeature(Window.FEATURE_NO_TITLE); + try { m_activityInfo = getPackageManager().getActivityInfo(getComponentName(), PackageManager.GET_META_DATA); } catch (NameNotFoundException e) { diff --git a/src/plugins/platforms/android/src/androidjnimenu.cpp b/src/plugins/platforms/android/src/androidjnimenu.cpp index 8964995832..866acd3c7e 100644 --- a/src/plugins/platforms/android/src/androidjnimenu.cpp +++ b/src/plugins/platforms/android/src/androidjnimenu.cpp @@ -41,13 +41,14 @@ #include "androidjnimenu.h" #include "androidjnimain.h" -#include -#include -#include -#include #include "qandroidplatformmenubar.h" #include "qandroidplatformmenu.h" -#include +#include "qandroidplatformmenuitem.h" + +#include +#include +#include +#include using namespace QtAndroid; @@ -141,18 +142,17 @@ namespace QtAndroidMenu void setActiveTopLevelWindow(QWindow *window) { + Qt::WindowFlags flags = window->flags(); + bool isNonRegularWindow = flags & (Qt::Desktop | Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window; + if (isNonRegularWindow) + return; + QMutexLocker lock(&menuBarMutex); if (activeTopLevelWindow == window) return; visibleMenuBar = 0; activeTopLevelWindow = window; -#ifdef ANDROID_PLUGIN_OPENGL - //only one toplevel window, so the menu bar always belongs to us - if (menuBars.size() == 1) { - visibleMenuBar = *menuBars.constBegin(); //since QSet doesn't have first() - } else -#endif foreach (QAndroidPlatformMenuBar *menuBar, menuBars) { if (menuBar->parentWindow() == window) { visibleMenuBar = menuBar; @@ -173,8 +173,10 @@ namespace QtAndroidMenu { QMutexLocker lock(&menuBarMutex); menuBars.remove(menuBar); - if (visibleMenuBar == menuBar) + if (visibleMenuBar == menuBar) { + visibleMenuBar = 0; resetMenuBar(); + } } static QString removeAmpersandEscapes(QString s) diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp index 821fd954df..de4075feff 100644 --- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp +++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp @@ -41,6 +41,7 @@ #include "qandroidopenglplatformscreen.h" #include "qandroidopenglplatformwindow.h" +#include "androidjnimenu.h" QT_BEGIN_NAMESPACE @@ -51,6 +52,7 @@ QAndroidOpenGLPlatformScreen::QAndroidOpenGLPlatformScreen(EGLDisplay display) void QAndroidOpenGLPlatformScreen::topWindowChanged(QPlatformWindow *window) { + QtAndroidMenu::setActiveTopLevelWindow(window->window()); QAndroidOpenGLPlatformWindow *platformWindow = static_cast(window); if (platformWindow != 0) platformWindow->updateStatusBarVisibility(); diff --git a/src/plugins/platforms/android/src/qandroidplatformmenubar.cpp b/src/plugins/platforms/android/src/qandroidplatformmenubar.cpp index ef1ac61356..134062fb32 100644 --- a/src/plugins/platforms/android/src/qandroidplatformmenubar.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformmenubar.cpp @@ -79,6 +79,8 @@ void QAndroidPlatformMenuBar::syncMenu(QPlatformMenu *menu) void QAndroidPlatformMenuBar::handleReparent(QWindow *newParentWindow) { + if (m_parentWindow == newParentWindow) + return; m_parentWindow = newParentWindow; QtAndroidMenu::setMenuBar(this, newParentWindow); } -- cgit v1.2.3 From 8ef5e700b8471b865328472b52a790686507bb45 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 2 Nov 2013 17:31:12 +0100 Subject: QMetaType: Fix conversion between module types. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7215b4599c3f0459139b32b6571f0a9e60182ee9 Reviewed-by: Jędrzej Nowacki --- src/corelib/kernel/qvariant.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 5754af42ac..816c34a14d 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2974,7 +2974,8 @@ bool QVariant::convert(int targetTypeId) } bool isOk = true; - if (!handlerManager[d.type]->convert(&oldValue.d, targetTypeId, data(), &isOk)) + int converterType = std::max(oldValue.userType(), targetTypeId); + if (!handlerManager[converterType]->convert(&oldValue.d, targetTypeId, data(), &isOk)) isOk = false; d.is_null = !isOk; return isOk; -- cgit v1.2.3 From 2dd6c23395d0b9476033e3d3e8759487bb15ce91 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Wed, 6 Nov 2013 15:47:58 +0200 Subject: Android: Catch any startActivity exceptions Task-number: QTBUG-34600 Change-Id: I7147f0e6b7788df9e706e70758300d4d786032fc Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/android/jar/src/org/qtproject/qt5/android/QtNative.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java index 67093a007e..b0ce1bb7f2 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -109,9 +109,13 @@ public class QtNative public static void openURL(String url) { - Uri uri = Uri.parse(url); - Intent intent = new Intent(Intent.ACTION_VIEW, uri); - activity().startActivity(intent); + try { + Uri uri = Uri.parse(url); + Intent intent = new Intent(Intent.ACTION_VIEW, uri); + activity().startActivity(intent); + } catch (Exception e) { + e.printStackTrace(); + } } // this method loads full path libs -- cgit v1.2.3 From bc302359caad43919a72c3747f821a21810d200d Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Wed, 6 Nov 2013 16:44:55 +0200 Subject: Android: Fix registerClipboardManager semaphore initialization Task-number: QTBUG-34582 Change-Id: Idc6c821f768f90adf13af2070affe2ccf89a1450 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/android/jar/src/org/qtproject/qt5/android/QtNative.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java index b0ce1bb7f2..57f3642b56 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -452,7 +452,7 @@ public class QtNative private static void registerClipboardManager() { - final Semaphore semaphore = new Semaphore(1); + final Semaphore semaphore = new Semaphore(0); runAction(new Runnable() { @Override public void run() { -- cgit v1.2.3 From d8f7a2ddf4e098786a5dec27e11786f5ff4e0433 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 6 Nov 2013 12:43:51 +0100 Subject: EglFS: make sure resize events are delivered MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure that resize events are delivered when the platform plugin overrides the geometry set in setGeometry(). This fixes a race condition where a widget was resized to its sizeHint() while the window was maximized, and the content was shown scaled on the screen. The problem is that the widget gets the wrong size from QWidget::setWindowState() (which calls adjustSize() in order to support normalGeometry). This size is used to resize the backingStore. When the QWindow is resized, it calls QEglFSWindow::setGeometry() which corrects the size to screen()->availableGeometry(), and triggers a GeometryChangeEvent since the size was corrected. This ends up in QGuiApplicationPrivate::processGeometryChangeEvent() which will not send a resize event, since the size has not changed (it is always availableGeometry()). Therefore the widget is never resized, and the backingStore remains the wrong size. Task-number: QTBUG-34421 Change-Id: Iee49c53cc529de36010db2695d838d8c2284edd4 Reviewed-by: Tor Arne Vestbø Reviewed-by: Laszlo Agocs --- src/gui/kernel/qguiapplication.cpp | 18 +++++++++--------- src/gui/kernel/qwindowsysteminterface.cpp | 7 +++++-- src/gui/kernel/qwindowsysteminterface.h | 2 +- src/gui/kernel/qwindowsysteminterface_p.h | 5 +++-- src/plugins/platforms/eglfs/qeglfswindow.cpp | 6 ++++-- 5 files changed, 22 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 077084b80f..bc4a135e03 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1823,33 +1823,33 @@ void QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePr return; QRect newRect = e->newGeometry; - QRect cr = window->d_func()->geometry; + QRect oldRect = e->oldGeometry.isNull() ? window->d_func()->geometry : e->oldGeometry; - bool isResize = cr.size() != newRect.size(); - bool isMove = cr.topLeft() != newRect.topLeft(); + bool isResize = oldRect.size() != newRect.size(); + bool isMove = oldRect.topLeft() != newRect.topLeft(); window->d_func()->geometry = newRect; if (isResize || window->d_func()->resizeEventPending) { - QResizeEvent e(newRect.size(), cr.size()); + QResizeEvent e(newRect.size(), oldRect.size()); QGuiApplication::sendSpontaneousEvent(window, &e); window->d_func()->resizeEventPending = false; - if (cr.width() != newRect.width()) + if (oldRect.width() != newRect.width()) window->widthChanged(newRect.width()); - if (cr.height() != newRect.height()) + if (oldRect.height() != newRect.height()) window->heightChanged(newRect.height()); } if (isMove) { //### frame geometry - QMoveEvent e(newRect.topLeft(), cr.topLeft()); + QMoveEvent e(newRect.topLeft(), oldRect.topLeft()); QGuiApplication::sendSpontaneousEvent(window, &e); - if (cr.x() != newRect.x()) + if (oldRect.x() != newRect.x()) window->xChanged(newRect.x()); - if (cr.y() != newRect.y()) + if (oldRect.y() != newRect.y()) window->yChanged(newRect.y()); } } diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 902c32419d..8ef275a27c 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -141,9 +141,12 @@ void QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } -void QWindowSystemInterface::handleGeometryChange(QWindow *tlw, const QRect &newRect) +/*! + If \a oldRect is null, Qt will use the previously reported geometry instead. + */ +void QWindowSystemInterface::handleGeometryChange(QWindow *tlw, const QRect &newRect, const QRect &oldRect) { - QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw,newRect); + QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw,newRect, oldRect); QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index d8d0922b96..d1c3c8e249 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -130,7 +130,7 @@ public: static void handleTouchCancelEvent(QWindow *w, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier); static void handleTouchCancelEvent(QWindow *w, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier); - static void handleGeometryChange(QWindow *w, const QRect &newRect); + static void handleGeometryChange(QWindow *w, const QRect &newRect, const QRect &oldRect = QRect()); static void handleCloseEvent(QWindow *w, bool *accepted = 0); static void handleEnterEvent(QWindow *w, const QPointF &local = QPointF(), const QPointF& global = QPointF()); static void handleLeaveEvent(QWindow *w); diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index 03e2d420f0..8cafb8da5c 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -117,11 +117,12 @@ public: class GeometryChangeEvent : public WindowSystemEvent { public: - GeometryChangeEvent(QWindow *tlw, const QRect &newGeometry) - : WindowSystemEvent(GeometryChange), tlw(tlw), newGeometry(newGeometry) + GeometryChangeEvent(QWindow *tlw, const QRect &newGeometry, const QRect &oldGeometry) + : WindowSystemEvent(GeometryChange), tlw(tlw), newGeometry(newGeometry), oldGeometry(oldGeometry) { } QPointer tlw; QRect newGeometry; + QRect oldGeometry; }; class EnterEvent : public WindowSystemEvent { diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index 70f0e437b2..bba00da128 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -210,15 +210,17 @@ void QEglFSWindow::setVisible(bool visible) void QEglFSWindow::setGeometry(const QRect &r) { QRect rect; - if (m_flags.testFlag(HasNativeWindow)) + bool forceFullscreen = m_flags.testFlag(HasNativeWindow); + if (forceFullscreen) rect = screen()->availableGeometry(); else rect = r; QPlatformWindow::setGeometry(rect); + // if we corrected the size, trigger a resize event if (rect != r) - QWindowSystemInterface::handleGeometryChange(window(), rect); + QWindowSystemInterface::handleGeometryChange(window(), rect, r); } QRect QEglFSWindow::geometry() const -- cgit v1.2.3 From 1d54a502dd302da0b3676cfc7f35d2aa92610cf2 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Wed, 6 Nov 2013 22:49:27 +0800 Subject: Doc: Fix cross-module links - Remove Active Qt -- it's not really plugin-related - Add QDoc dependencies - NOTE: Can't add Qt QML because QDoc would get confused between the C++ and QML "Qt" namespaces. Change-Id: I15a76dbd5235f13598a3802a815f7f49b80eac8a Reviewed-by: Jerome Pasion --- src/corelib/doc/qtcore.qdocconf | 2 +- src/corelib/doc/src/plugins-howto.qdoc | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf index 0b1752e496..9ab66c6645 100644 --- a/src/corelib/doc/qtcore.qdocconf +++ b/src/corelib/doc/qtcore.qdocconf @@ -26,7 +26,7 @@ qhp.QtCore.subprojects.classes.sortPages = true tagfile = ../../../doc/qtcore/qtcore.tags -depends += qtgui qtwidgets qtnetwork qtdoc qtquick qtlinguist qtdesigner +depends += qtgui qtwidgets qtnetwork qtdoc qtquick qtlinguist qtdesigner qtconcurrent qtxml headerdirs += .. diff --git a/src/corelib/doc/src/plugins-howto.qdoc b/src/corelib/doc/src/plugins-howto.qdoc index fb91e431dd..7565d610cc 100644 --- a/src/corelib/doc/src/plugins-howto.qdoc +++ b/src/corelib/doc/src/plugins-howto.qdoc @@ -35,10 +35,7 @@ These \l{Qt Core} classes deal with shared libraries, (e.g. .so and DLL files), and with Qt plugins. - See the \l{How to Create Qt Plugins} page for more information.. - - See also the \l{Active Qt} framework for Windows. - + See the \l{How to Create Qt Plugins} page for more information. */ /*! -- cgit v1.2.3 From 6272a816d192b3c9b363164216bfd7a13e7370e9 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 29 Oct 2013 14:11:33 +0100 Subject: iOS: set active window upon calls to requestActiveWindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We did not do this from before. Instead we would activate the window when it's view became first responder. And this would happen when the input panel was told to open. That behavior is a fragile, since other layers higher up (qml) would not open the input panel unless the window was active, which also makes sense. A classic chicken and egg problem. So to play more along with how Qt is expected to work, we change behavior to instead activate the window directly when requested to do so (which also includes when the user touches the window directly). This will also work better for "keyboard" events like Key_VolumeUp, once implemented. The down side is that Qt will give focus to widgets/items (and as such, open the keyboard) whenever you touch the window. But that is easier to fix, and will be dealt with in later patches. Change-Id: I9bbeb0205e7ea3c5079100c07e40ddb1c60b476b Reviewed-by: Tor Arne Vestbø Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/ios/qioswindow.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 25c11a210d..f1189ccd88 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -440,6 +440,7 @@ void QIOSWindow::requestActivateWindow() raise(); QPlatformInputContext *context = QGuiApplicationPrivate::platformIntegration()->inputContext(); static_cast(context)->focusViewChanged(m_view); + QWindowSystemInterface::handleWindowActivated(window()); } void QIOSWindow::raiseOrLower(bool raise) -- cgit v1.2.3 From 1248b1cbe238616ab3a1dd79f65f76f92d256a6e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 16 Sep 2013 22:24:45 +0200 Subject: Q(UrlTwo)Flags: avoid undefined behavior Loading an enum with a value that isn't in the enum is undefined, according to Clang's usan. So when doing logical operations on QFlags, don't go through the QFlags(E) constructor, but via QFlags(QFlag) (=int) instead. Apply the same change to QUrlTwoFlags. Change-Id: I5f27e22c4d831482fcbba88b97cb124fb005e3fd Reviewed-by: Olivier Goffart Reviewed-by: Thiago Macieira --- src/corelib/global/qflags.h | 16 ++++++++-------- src/corelib/io/qurl.h | 26 +++++++++++++------------- 2 files changed, 21 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index 5b7edbafa6..dd4222b89f 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -111,14 +111,14 @@ public: Q_DECL_CONSTEXPR inline operator Int() const { return i; } - Q_DECL_CONSTEXPR inline QFlags operator|(QFlags f) const { return QFlags(Enum(i | f.i)); } - Q_DECL_CONSTEXPR inline QFlags operator|(Enum f) const { return QFlags(Enum(i | Int(f))); } - Q_DECL_CONSTEXPR inline QFlags operator^(QFlags f) const { return QFlags(Enum(i ^ f.i)); } - Q_DECL_CONSTEXPR inline QFlags operator^(Enum f) const { return QFlags(Enum(i ^ Int(f))); } - Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const { return QFlags(Enum(i & mask)); } - Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const { return QFlags(Enum(i & mask)); } - Q_DECL_CONSTEXPR inline QFlags operator&(Enum f) const { return QFlags(Enum(i & Int(f))); } - Q_DECL_CONSTEXPR inline QFlags operator~() const { return QFlags(Enum(~i)); } + Q_DECL_CONSTEXPR inline QFlags operator|(QFlags f) const { return QFlags(QFlag(i | f.i)); } + Q_DECL_CONSTEXPR inline QFlags operator|(Enum f) const { return QFlags(QFlag(i | Int(f))); } + Q_DECL_CONSTEXPR inline QFlags operator^(QFlags f) const { return QFlags(QFlag(i ^ f.i)); } + Q_DECL_CONSTEXPR inline QFlags operator^(Enum f) const { return QFlags(QFlag(i ^ Int(f))); } + Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const { return QFlags(QFlag(i & mask)); } + Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const { return QFlags(QFlag(i & mask)); } + Q_DECL_CONSTEXPR inline QFlags operator&(Enum f) const { return QFlags(QFlag(i & Int(f))); } + Q_DECL_CONSTEXPR inline QFlags operator~() const { return QFlags(QFlag(~i)); } Q_DECL_CONSTEXPR inline bool operator!() const { return !i; } diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index 637eac87b6..76e3c0f8ca 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -86,33 +86,33 @@ public: inline QUrlTwoFlags &operator^=(E1 f) { i ^= f; return *this; } inline QUrlTwoFlags &operator^=(E2 f) { i ^= f; return *this; } - Q_DECL_CONSTEXPR inline operator QFlags() const { return E1(i); } - Q_DECL_CONSTEXPR inline operator QFlags() const { return E2(i); } + Q_DECL_CONSTEXPR inline operator QFlags() const { return QFlag(i); } + Q_DECL_CONSTEXPR inline operator QFlags() const { return QFlag(i); } Q_DECL_CONSTEXPR inline operator int() const { return i; } Q_DECL_CONSTEXPR inline bool operator!() const { return !i; } Q_DECL_CONSTEXPR inline QUrlTwoFlags operator|(QUrlTwoFlags f) const - { return QUrlTwoFlags(E1(i | f.i)); } + { return QUrlTwoFlags(QFlag(i | f.i)); } Q_DECL_CONSTEXPR inline QUrlTwoFlags operator|(E1 f) const - { return QUrlTwoFlags(E1(i | f)); } + { return QUrlTwoFlags(QFlag(i | f)); } Q_DECL_CONSTEXPR inline QUrlTwoFlags operator|(E2 f) const - { return QUrlTwoFlags(E2(i | f)); } + { return QUrlTwoFlags(QFlag(i | f)); } Q_DECL_CONSTEXPR inline QUrlTwoFlags operator^(QUrlTwoFlags f) const - { return QUrlTwoFlags(E1(i ^ f.i)); } + { return QUrlTwoFlags(QFlag(i ^ f.i)); } Q_DECL_CONSTEXPR inline QUrlTwoFlags operator^(E1 f) const - { return QUrlTwoFlags(E1(i ^ f)); } + { return QUrlTwoFlags(QFlag(i ^ f)); } Q_DECL_CONSTEXPR inline QUrlTwoFlags operator^(E2 f) const - { return QUrlTwoFlags(E2(i ^ f)); } + { return QUrlTwoFlags(QFlag(i ^ f)); } Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(int mask) const - { return QUrlTwoFlags(E1(i & mask)); } + { return QUrlTwoFlags(QFlag(i & mask)); } Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(uint mask) const - { return QUrlTwoFlags(E1(i & mask)); } + { return QUrlTwoFlags(QFlag(i & mask)); } Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(E1 f) const - { return QUrlTwoFlags(E1(i & f)); } + { return QUrlTwoFlags(QFlag(i & f)); } Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(E2 f) const - { return QUrlTwoFlags(E2(i & f)); } + { return QUrlTwoFlags(QFlag(i & f)); } Q_DECL_CONSTEXPR inline QUrlTwoFlags operator~() const - { return QUrlTwoFlags(E1(~i)); } + { return QUrlTwoFlags(QFlag(~i)); } inline bool testFlag(E1 f) const { return (i & f) == f && (f != 0 || i == int(f)); } inline bool testFlag(E2 f) const { return (i & f) == f && (f != 0 || i == int(f)); } -- cgit v1.2.3 From 6aff0c4e48d312e827412d2c922afe983081092e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 6 Nov 2013 17:02:34 +0100 Subject: QUrlTwoFlag: add two missing constexpr The other member functions that can be constexpr already are, only these were missing. Change-Id: I717c74b210b45cfb8af9168d61e27e3ff2f6a9c9 Reviewed-by: Olivier Goffart Reviewed-by: Thiago Macieira --- src/corelib/io/qurl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index 76e3c0f8ca..602e91ce30 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -114,8 +114,8 @@ public: Q_DECL_CONSTEXPR inline QUrlTwoFlags operator~() const { return QUrlTwoFlags(QFlag(~i)); } - inline bool testFlag(E1 f) const { return (i & f) == f && (f != 0 || i == int(f)); } - inline bool testFlag(E2 f) const { return (i & f) == f && (f != 0 || i == int(f)); } + Q_DECL_CONSTEXPR inline bool testFlag(E1 f) const { return (i & f) == f && (f != 0 || i == int(f)); } + Q_DECL_CONSTEXPR inline bool testFlag(E2 f) const { return (i & f) == f && (f != 0 || i == int(f)); } }; template -- cgit v1.2.3 From aa9ca5749f53b4aa3df93beaa05f16676941f4ce Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 6 Nov 2013 17:07:48 +0100 Subject: Android: allow installing apps to SD card by default Task-number: QTBUG-34423 Change-Id: I3b2c8a12b113a35f8b8454191d8ba8832d9fd995 Reviewed-by: BogDan Vatra --- src/android/java/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/android/java/AndroidManifest.xml b/src/android/java/AndroidManifest.xml index c8ef07d58c..95811c65e0 100644 --- a/src/android/java/AndroidManifest.xml +++ b/src/android/java/AndroidManifest.xml @@ -1,5 +1,5 @@ - + Date: Mon, 4 Nov 2013 13:39:11 +0100 Subject: Add missing Q_INIT_RESOURCE The library needs to do Q_INIT_RESOURCE for all resources it uses internally, otherwise static linking will fail, and the user has no idea how to rectify it as the name of the missing resource is not known. The Q_INIT_RESOURCE needs to happen outside of any namespace, hence the use of static initResources() functions. Change-Id: I8f7d36b440b05809d97dd489cf8789f345633cec Reviewed-by: Thiago Macieira --- src/corelib/mimetypes/qmimeprovider.cpp | 6 ++++++ src/plugins/platforms/eglfs/qeglfsintegration.cpp | 6 ++++++ src/printsupport/dialogs/qprintdialog_unix.cpp | 6 ++++++ 3 files changed, 18 insertions(+) (limited to 'src') diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp index aa03395f94..bdea75a3b9 100644 --- a/src/corelib/mimetypes/qmimeprovider.cpp +++ b/src/corelib/mimetypes/qmimeprovider.cpp @@ -53,6 +53,11 @@ #include #include +static void initResources() +{ + Q_INIT_RESOURCE(mimetypes); +} + QT_BEGIN_NAMESPACE static QString fallbackParent(const QString &mimeTypeName) @@ -704,6 +709,7 @@ void QMimeBinaryProvider::loadGenericIcon(QMimeTypePrivate &data) QMimeXMLProvider::QMimeXMLProvider(QMimeDatabasePrivate *db) : QMimeProviderBase(db), m_loaded(false) { + initResources(); } bool QMimeXMLProvider::isValid() diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 9f8c0747df..55a822b887 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -74,6 +74,11 @@ #include +static void initResources() +{ + Q_INIT_RESOURCE(cursor); +} + QT_BEGIN_NAMESPACE QEglFSIntegration::QEglFSIntegration() @@ -82,6 +87,7 @@ QEglFSIntegration::QEglFSIntegration() , mScreen(0) , mInputContext(0) { + initResources(); } QEglFSIntegration::~QEglFSIntegration() diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index 0214c97e24..fe7e43814c 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -103,6 +103,11 @@ Print dialog class declarations Layout in qprintpropertieswidget.ui */ +static void initResources() +{ + Q_INIT_RESOURCE(qprintdialog); +} + QT_BEGIN_NAMESPACE class QOptionTreeItem; @@ -306,6 +311,7 @@ void QPrintPropertiesDialog::showEvent(QShowEvent* event) QPrintDialogPrivate::QPrintDialogPrivate() : top(0), bottom(0), buttons(0), collapseButton(0) { + initResources(); } QPrintDialogPrivate::~QPrintDialogPrivate() -- cgit v1.2.3 From a94f61063a031444849fb0873f9b267a4f828597 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Tue, 5 Nov 2013 11:47:31 +0100 Subject: QNX: Fixed "normalPosition" of touch events Pixel positions have to be set in relation to screen size in pixels, not the physical size to calculate the normal position in the range 0..1. Change-Id: I6880fb64b7c3049d657fd081b564b945399b5865 Reviewed-by: Frank Osterfeld Reviewed-by: Kevin Krammer Reviewed-by: Thomas McGuire --- src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index e0dd20c40c..9db62865bb 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -432,10 +432,12 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType) if (w) { // get size of screen which contains window QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(w); - QSizeF screenSize = platformScreen->physicalSize(); + QSizeF screenSize = platformScreen->geometry().size(); // update cached position of current touch point - m_touchPoints[touchId].normalPosition = QPointF( static_cast(pos[0]) / screenSize.width(), static_cast(pos[1]) / screenSize.height() ); + m_touchPoints[touchId].normalPosition = + QPointF(static_cast(pos[0]) / screenSize.width(), + static_cast(pos[1]) / screenSize.height()); m_touchPoints[touchId].area = QRectF( pos[0], pos[1], 0.0, 0.0 ); // determine event type and update state of current touch point -- cgit v1.2.3 From 170da92d02f2e81bafc9efdf76b2c4facf6486d0 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 5 Nov 2013 11:59:02 +0100 Subject: qdoc: Fix output file name generation for examples When generating output file names for examples, qdoc prepends a module-specific prefix. Unless already defined, it defaults to the project name defined in .qdocconf file. This leads to wrong prefix being used in some cases - specifically, on pages in qtdoc module listing examples in other modules. This change takes the modulename prefix from the node, and only uses the project name as a fallback. Task-number: QTBUG-34581 Change-Id: Ia0a940cbc05ed819ff36c328cf9c1e30e2c65b5e Reviewed-by: Martin Smith Reviewed-by: Jerome Pasion --- src/tools/qdoc/generator.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 357e013360..97a980a3fa 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -351,7 +351,11 @@ QString Generator::fileBase(const Node *node) const base.append("-module"); } if (node->isExample() || node->isExampleFile()) { - base.prepend(project.toLower() + QLatin1Char('-')); + QString modPrefix(node->moduleName()); + if (modPrefix.isEmpty()) { + modPrefix = project; + } + base.prepend(modPrefix.toLower() + QLatin1Char('-')); } if (node->isExample()) { base.append(QLatin1String("-example")); -- cgit v1.2.3 From 0491a7a2984393266e3be48f09b20a8deab9f4c8 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 1 Nov 2013 15:13:12 +0100 Subject: qdoc: Don't include internal QML types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QML types marked \internal were appearing in the "All QML Types" list. These links were dead because the pages for these internal types were not being created, which was correct. Now these internal QML types no longer appear in the list. Task-number: QTBUG-34506 Change-Id: I1d005459e84ed9a2afae94b797b9d39aa3e517f3 Reviewed-by: Topi Reiniö Reviewed-by: Jerome Pasion --- src/tools/qdoc/main.cpp | 2 +- src/tools/qdoc/qdocdatabase.cpp | 4 ++-- src/tools/qdoc/qdocdatabase.h | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp index ffaef904b7..398d188464 100644 --- a/src/tools/qdoc/main.cpp +++ b/src/tools/qdoc/main.cpp @@ -362,7 +362,7 @@ static void processQdocconfFile(const QString &fileName) */ QDocDatabase* qdb = QDocDatabase::qdocDB(); qdb->setVersion(config.getString(CONFIG_VERSION)); - + qdb->setShowInternal(config.getBool(CONFIG_SHOWINTERNAL)); /* By default, the only output format is HTML. */ diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index f2ecb02a2f..1011a3ac97 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -62,7 +62,7 @@ QDocDatabase* QDocDatabase::qdocDB_ = NULL; It constructs a singleton Tree object with this qdoc database pointer. */ -QDocDatabase::QDocDatabase() +QDocDatabase::QDocDatabase() : showInternal_(false) { tree_ = new Tree(this); } @@ -423,7 +423,7 @@ void QDocDatabase::findAllClasses(const InnerNode* node) { NodeList::const_iterator c = node->childNodes().constBegin(); while (c != node->childNodes().constEnd()) { - if ((*c)->access() != Node::Private) { + if ((*c)->access() != Node::Private && (!(*c)->isInternal() || showInternal_)) { if ((*c)->type() == Node::Class && !(*c)->doc().isEmpty()) { QString className = (*c)->name(); if ((*c)->parent() && diff --git a/src/tools/qdoc/qdocdatabase.h b/src/tools/qdoc/qdocdatabase.h index 5786fa0664..4decba5f79 100644 --- a/src/tools/qdoc/qdocdatabase.h +++ b/src/tools/qdoc/qdocdatabase.h @@ -200,6 +200,7 @@ class QDocDatabase void insertOpenNamespace(const QString& path) { openNamespaces_.insert(path); } FunctionNode* findNodeInOpenNamespace(const QStringList& parentPath, const FunctionNode* clone); Node* findNodeInOpenNamespace(QStringList& path, Node::Type type, Node::SubType subtype); + void setShowInternal(bool value) { showInternal_ = value; } /* debugging functions */ void printModules() const; @@ -220,6 +221,7 @@ class QDocDatabase private: static QDocDatabase* qdocDB_; + bool showInternal_; QString version_; QDocMultiMap masterMap_; Tree* tree_; -- cgit v1.2.3 From 79b975756a100cc46182c2949e71a683a656bd12 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 4 Nov 2013 16:12:32 +0100 Subject: Revert "Add tracing to logging framework" The tracing API still misses some real-world exposure. Let's re-do this in dev to have more time. This reverts parts of following commits: 466e0dff4bb686e51d0ab3f905631fcb7dd8bfef 7a47aebe9ed41d6cd9c9bcd45758d4d553668e99 a652bab6a7ebf78b029fea95c2801deb6f4f524a 8f0654ceb878b6c8a08c7f5b790027c26e007c13 4162522edd9d31bd2798ab37f083adff818d886e 32f27b4367c4e042a3f0cda671579494e31c1d69 9ff81bdc1ab4e3d14914192cd63ae625a507fe90 Change-Id: If97340c37b8b3363f597683336a8390d5ff386f1 Reviewed-by: hjk Reviewed-by: Robin Burchell --- src/corelib/doc/snippets/qtracer/ftracer.cpp | 180 --------------- src/corelib/doc/snippets/qtracer/main.cpp | 59 ----- src/corelib/doc/snippets/qtracer/qtracer.pro | 2 - src/corelib/global/qglobal.cpp | 4 - src/corelib/global/qlogging.cpp | 2 - src/corelib/global/qlogging.h | 2 +- src/corelib/io/qloggingcategory.cpp | 320 +-------------------------- src/corelib/io/qloggingcategory.h | 74 +------ src/corelib/io/qloggingregistry.cpp | 8 - src/testlib/qtestlog.cpp | 1 - 10 files changed, 9 insertions(+), 643 deletions(-) delete mode 100644 src/corelib/doc/snippets/qtracer/ftracer.cpp delete mode 100644 src/corelib/doc/snippets/qtracer/main.cpp delete mode 100644 src/corelib/doc/snippets/qtracer/qtracer.pro (limited to 'src') diff --git a/src/corelib/doc/snippets/qtracer/ftracer.cpp b/src/corelib/doc/snippets/qtracer/ftracer.cpp deleted file mode 100644 index b12e3ed9c3..0000000000 --- a/src/corelib/doc/snippets/qtracer/ftracer.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc 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 -#include -#include -#include -#include - -#include -#include - - -//![1] -QLoggingCategory theFooArea("foo"); -QLoggingCategory theBarArea("bar"); -QLoggingCategory theBazArea("baz"); -//![1] - -// Note: These locations are Ubuntu specific. - -// Note: To make the example work with user permissions, make sure -// the files are user-writable and the path leading there accessible. - -const char traceSwitch[] = "/sys/kernel/debug/tracing/tracing_on"; -const char traceSink[] = "/sys/kernel/debug/tracing/trace_marker"; - -// The base class only serves as a facility to share code -// between the "single line" data logging aspect and the -// scoped "measuring" aspect. - -// Both aspects and the base class could be combined into -// a single tracer serving both purposes, but are split -// here for clarity. - -// Error handling is left as an exercise. - -//![2] -class MyTracerBase : public QTracer -{ -public: - MyTracerBase() { - enable = ::open(traceSwitch, O_WRONLY); - marker = ::open(traceSink, O_WRONLY); - } - - ~MyTracerBase() { - ::close(enable); - ::close(marker); - } - -protected: - int enable; - int marker; -}; -//![2] - - -//![2] -class MyTracer : public MyTracerBase -{ -public: - void start() { ::write(marker, "B", 1); } - void end() { ::write(marker, "E", 1); } -}; -//![2] - - -//![3] -class MyDataLogger : public MyTracerBase -{ -public: - MyDataLogger() { - buf[0] = 0; - pos = 0; - } - - void record(int i) { pos += sprintf(buf + pos, "%d", i); } - void record(const char *msg) { pos += sprintf(buf + pos, "%s", msg); } - void end() { ::write(marker, buf, pos); pos = 0; } - -private: - char buf[100]; - int pos; -}; -//![3] - -// Simplest possible example for "measuring". -//![4] -int foo(int i) -{ - qCTraceGuard(theFooArea); - // Here could be some lengthy code. - return i * i; -} -//![4] - -// We can switch on/off tracing dynamically. -// The tracer will be temporarily switched off at the third call -// and re-enabled at the eighth. -//![5] -int bar(int i) -{ - static int n = 0; - ++n; - if (n == 3) - theBarArea.setEnabled(QtTraceMsg, false); - if (n == 8) - theBarArea.setEnabled(QtTraceMsg, true); - - qCTraceGuard(theBarArea); - return i * i; -} -//![5] - -// An example to create "complex" log messages. -//![6] -int baz(int i) -{ - qCTrace(theBazArea) << 32 << "some stuff"; - - return i * i; -} -//![6] - - - -//![7] -namespace { -static struct Init -{ - Init() { - tracer.addToCategory(theFooArea); - tracer.addToCategory(theBarArea); - logger.addToCategory(theBazArea); - } - - MyTracer tracer; - MyDataLogger logger; - -} initializer; -} -//![7] diff --git a/src/corelib/doc/snippets/qtracer/main.cpp b/src/corelib/doc/snippets/qtracer/main.cpp deleted file mode 100644 index 758a2bbdb8..0000000000 --- a/src/corelib/doc/snippets/qtracer/main.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc 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$ -** -****************************************************************************/ - -int foo(int i); -int bar(int i); -int baz(int i); - -int main() -{ - int s = 0; - for (int i = 0; i != 10; ++i) - s += foo(i); - - for (int i = 0; i != 10; ++i) - s += bar(i); - - for (int i = 0; i != 10; ++i) - s += baz(i); - - return s; -} - diff --git a/src/corelib/doc/snippets/qtracer/qtracer.pro b/src/corelib/doc/snippets/qtracer/qtracer.pro deleted file mode 100644 index 254e22be76..0000000000 --- a/src/corelib/doc/snippets/qtracer/qtracer.pro +++ /dev/null @@ -1,2 +0,0 @@ - -SOURCES += ftracer.cpp main.cpp diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index a874b231cc..b27d0bf53f 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -729,10 +729,6 @@ Q_STATIC_ASSERT_X(UCHAR_MAX == 255, "Qt assumes that char is 8 bits"); A message generated by the qCritical() function. \value QtFatalMsg A message generated by the qFatal() function. - \value QtTraceMsg - Used by the qCTrace() macro. Trace events are usually passed only - to dedicated \a QTracer objects, and do not appear in the installed - message handler. \value QtSystemMsg diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 0a261acc77..cc20891c76 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -816,7 +816,6 @@ Q_CORE_EXPORT QString qMessageFormatString(QtMsgType type, const QMessageLogCont case QtWarningMsg: message.append(QLatin1String("warning")); break; case QtCriticalMsg:message.append(QLatin1String("critical")); break; case QtFatalMsg: message.append(QLatin1String("fatal")); break; - case QtTraceMsg: message.append(QLatin1String("trace")); break; } } else if (token == fileTokenC) { if (context.file) @@ -874,7 +873,6 @@ static void android_default_message_handler(QtMsgType type, { android_LogPriority priority; switch (type) { - case QtTraceMsg: case QtDebugMsg: priority = ANDROID_LOG_DEBUG; break; case QtWarningMsg: priority = ANDROID_LOG_WARN; break; case QtCriticalMsg: priority = ANDROID_LOG_ERROR; break; diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h index 68a24d0397..2b798f9ea0 100644 --- a/src/corelib/global/qlogging.h +++ b/src/corelib/global/qlogging.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE class QDebug; class QNoDebug; -enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtTraceMsg, QtSystemMsg = QtCriticalMsg }; +enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg = QtCriticalMsg }; class QMessageLogContext { diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index 8d337ec630..10f7a9bbeb 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -75,10 +75,9 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory, \l isCriticalEnabled(), \l isTraceEnabled(), as well as \l isEnabled() to check whether messages for the given message type should be logged. - \note The qCDebug(), qCWarning(), qCCritical(), qCTrace() and - qCTraceGuard() macros prevent arguments from being evaluated if the - respective message types are not enabled for the category, so explicit - checking is not needed: + \note The qCDebug(), qCWarning(), qCCritical() macros prevent arguments + from being evaluated if the respective message types are not enabled for the + category, so explicit checking is not needed: \snippet qloggingcategory/main.cpp 4 @@ -103,14 +102,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory, \snippet qloggingcategory/main.cpp 3 */ -typedef QVector Tracers; - -class QLoggingCategoryPrivate -{ -public: - Tracers tracers; -}; - /*! Constructs a QLoggingCategory object with the provided \a category name. The object becomes the local identifier for the category. @@ -118,15 +109,11 @@ public: If \a category is \c{0}, the category name is changed to \c "default". */ QLoggingCategory::QLoggingCategory(const char *category) - : d(new QLoggingCategoryPrivate), + : d(0), name(0), enabledDebug(false), enabledWarning(true), - enabledCritical(true), - enabledTrace(false), - placeholder1(false), - placeholder2(false), - placeholder3(false) + enabledCritical(true) { bool isDefaultCategory = (category == 0) || (strcmp(category, qtDefaultCategoryName) == 0); @@ -151,7 +138,6 @@ QLoggingCategory::~QLoggingCategory() { if (QLoggingRegistry *reg = QLoggingRegistry::instance()) reg->unregisterCategory(this); - delete d; } /*! @@ -193,18 +179,6 @@ QLoggingCategory::~QLoggingCategory() expensive generation of data that is only used for debug output. */ -/*! - \fn bool QLoggingCategory::isTraceEnabled() const - - Returns \c true if the tracers associated with this category should - receive messages. Returns \c false otherwise. - - \note The \l qCTrace() and \l qCTraceGuard() macros already do this check - before executing any - code. However, calling this method may be useful to avoid - expensive generation of data that is only used for debug output. -*/ - /*! Returns \c true if a message of type \a msgtype for the category should be shown. Returns \c false otherwise. @@ -215,7 +189,6 @@ bool QLoggingCategory::isEnabled(QtMsgType msgtype) const case QtDebugMsg: return enabledDebug; case QtWarningMsg: return enabledWarning; case QtCriticalMsg: return enabledCritical; - case QtTraceMsg: return enabledTrace; case QtFatalMsg: return true; } return false; @@ -237,7 +210,6 @@ void QLoggingCategory::setEnabled(QtMsgType type, bool enable) case QtDebugMsg: enabledDebug = enable; break; case QtWarningMsg: enabledWarning = enable; break; case QtCriticalMsg: enabledCritical = enable; break; - case QtTraceMsg: enabledTrace = enable; break; case QtFatalMsg: break; } } @@ -313,7 +285,7 @@ QLoggingCategory::installFilter(QLoggingCategory::CategoryFilter filter) where \c is the name of the category, potentially with \c{*} as a wildcard symbol at the start and/or the end. The optional \c must - be either \c debug, \c warning, \c critical, or \c trace. + be either \c debug, \c warning, or \c critical. Example: @@ -394,56 +366,6 @@ void QLoggingCategory::setFilterRules(const QString &rules) \sa qCritical() */ -/*! - \relates QLoggingCategory - \macro qCTrace(category) - \since 5.2 - - Returns an output stream for trace messages in the logging category - \a category. - - The macro expands to code that checks whether - \l QLoggingCategory::isTraceEnabled() evaluates to \c true. - If so, the stream arguments are processed and sent to the \l QTracer objects - registered with the category. - - \note Arguments are not processed if trace output for the category is not - enabled, so do not rely on any side effects. - - Example: - - \snippet qtracer/ftracer.cpp 6 - - \sa qCTraceGuard() QTraceGuard -*/ - -/*! - \relates QLoggingCategory - \macro qCTraceGuard(category) - \since 5.2 - - The macro expands to code that creates a guard object with automatic - storage. The guard constructor checks whether - \l QLoggingCategory::isTraceEnabled() evaluates to \c true. - If so, the stream arguments are processed and the \c{start()} - functions of the \l QTracer objects registered with the \a category are - called. - - The guard destructor also checks whether the category is enabled for - tracing and if so, the \c{end()} - functions of the \l QTracer objects registered with the \a category are called. - - \note Arguments are always processed, even if trace output for the - category is disabled. They will, however, in that case not be passed - to the \c{record()} functions of the registered tracers. - - Example: - - \snippet qtracer/ftracer.cpp 4 - - \sa qCTrace() QTracer -*/ - /*! \macro Q_DECLARE_LOGGING_CATEGORY(name) \relates QLoggingCategory @@ -469,234 +391,4 @@ void QLoggingCategory::setFilterRules(const QString &rules) This macro must be used outside of a class or method. */ - -/*! - \class QTracer - \inmodule QtCore - \since 5.2 - - \brief The QTracer class provides an interface for handling - trace events associated with a logging category. - - \c QTracer objects are registered with logging categories. - Multiple \c QTracer objects - can be registered with the same category, and the same - \c QTracer object can be registered with different categories. - - If code containing \c qCTrace is executed, and the associated - logging category is enabled for tracing, all \c QTracer objects - that are registered with the category are notified. - - \c QTracer objects -*/ - -/*! - \fn QTracer::QTracer() - - Constructs a tracer object. - - Example: - - \snippet qtracer/ftracer.cpp 2 -*/ - -/*! - \fn QTracer::~QTracer() - - Destroys the tracer object. -*/ - -/*! - Registers this tracer for the \a category. - - The tracer will later be notified of messages of type - \c QtTraceMsg, as long as that message type - is enabled in the category. - - Example: - - \snippet qtracer/ftracer.cpp 1 - \codeline - \snippet qtracer/ftracer.cpp 7 -*/ - -void QTracer::addToCategory(QLoggingCategory &category) -{ - category.d->tracers.append(this); -} - -/*! - \fn void QTracer::start() - - This function is invoked when a tracing activity starts, - typically from the constructor of a \c QTraceGuard object - defined by \c qCTrace() or \c qCTraceGuard(). - - The base implementation does nothing. \c QTracer subclasses - are advised to override it if needed. - - \sa qCTrace(), qCTraceGuard() -*/ - -/*! - \fn void QTracer::end() - - This function is invoked when a tracing activity ends, - typically from the destructor of a \c QTraceGuard object - defined by \c qCTrace() or \c qCTraceGuard(). - - The base implementation does nothing. It is common for - \c QTracer subclasses to override it to perform flushing - of collected data. - - \sa qCTrace(), qCTraceGuard() -*/ - -/*! - \fn void QTracer::record(int data) - - This function is invoked during a tracing activity to - pass integer \a data to the \c QTracer object. - - Example: - - \snippet qtracer/ftracer.cpp 3 -*/ - -/*! - \fn void QTracer::record(const char *data) - - This function is invoked during a tracing activity to - pass string \a data to the \c QTracer object. -*/ - -/*! - \fn void QTracer::record(const QVariant &data) - - This function is invoked during a tracing activity to - pass abitrary (non-integer, non-string) \a data to - the \c QTracer object. -*/ - -/*! - \class QTraceGuard - \since 5.2 - \inmodule QtCore - - \brief The QTraceGuard class facilitates notifications to - \c QTracer objects. - - \c QTraceGuard objects are typically implicitly created on the - stack when using the \c qCTrace or \c qCTraceGuard macros and - are associated to a \c QLoggingCategory. - - The constructor of a \c QTraceGuard objects checks whether - its associated category is enabled, and if so, informs all - \c QTracer objects registered with the category that a - tracing activity starts. - - The destructor of a \c QTraceGuard objects checks whether - its associated category is enabled, and if so, informs all - \c QTracer objects registered with the category that a - tracing activity ended. - - A \c QTraceGuard object created by \c qCTrace will be destroyed - at the end of the full expression, a guard created by - \c qCTraceGuard at the end of the block containing the macro. - - During the lifetime of a QTraceGuard object, its \c operator<<() - can be used to pass additional data to the active tracers. - The fast path handles only \c int and \c{const char *} data, - but it is possible to use arbitrary values wrapped in \c QVariants. - - \sa QTracer -*/ - -/*! - \fn QTraceGuard::QTraceGuard(QLoggingCategory &category) - \internal - - Constructs a trace guard object relaying to \a category. -*/ - -/*! - \fn QTraceGuard::~QTraceGuard() - \internal - - Destroys the trace guard object. -*/ - -/*! - \internal - - Calls \c start() on all registered tracers. -*/ - -void QTraceGuard::start() -{ - const Tracers &tracers = target->d->tracers; - for (int i = tracers.size(); --i >= 0; ) - tracers.at(i)->start(); -} - -/*! - \internal - - Calls \c end() on all registered tracers. -*/ - -void QTraceGuard::end() -{ - const Tracers &tracers = target->d->tracers; - for (int i = tracers.size(); --i >= 0; ) - tracers.at(i)->end(); -} - - -/*! - \internal - - This function is called for int parameters passed to the - qCTrace stream. -*/ - -QTraceGuard &QTraceGuard::operator<<(int msg) -{ - const Tracers &tracers = target->d->tracers; - for (int i = tracers.size(); --i >= 0; ) - tracers.at(i)->record(msg); - return *this; -} - -/*! - \internal - - This function is called for string parameters passed to the - qCTrace stream. -*/ - -QTraceGuard &QTraceGuard::operator<<(const char *msg) -{ - const Tracers &tracers = target->d->tracers; - for (int i = tracers.size(); --i >= 0; ) - tracers.at(i)->record(msg); - return *this; -} - - -/*! - \internal - - This function is called for QVariant parameters passed to the - qCTrace stream. -*/ - -QTraceGuard &QTraceGuard::operator<<(const QVariant &msg) -{ - const Tracers &tracers = target->d->tracers; - for (int i = tracers.size(); --i >= 0; ) - tracers.at(i)->record(msg); - return *this; -} - QT_END_NAMESPACE diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h index da96dee12e..15c0519827 100644 --- a/src/corelib/io/qloggingcategory.h +++ b/src/corelib/io/qloggingcategory.h @@ -44,14 +44,9 @@ #include #include -#include QT_BEGIN_NAMESPACE -class QTracer; -class QTraceGuard; -class QLoggingCategoryPrivate; - class Q_CORE_EXPORT QLoggingCategory { Q_DISABLE_COPY(QLoggingCategory) @@ -65,7 +60,6 @@ public: bool isDebugEnabled() const { return enabledDebug; } bool isWarningEnabled() const { return enabledWarning; } bool isCriticalEnabled() const { return enabledCritical; } - bool isTraceEnabled() const { return enabledTrace; } const char *categoryName() const { return name; } @@ -80,66 +74,13 @@ public: static void setFilterRules(const QString &rules); private: - friend class QLoggingCategoryPrivate; - friend class QLoggingRegistry; - friend class QTraceGuard; - friend class QTracer; - - QLoggingCategoryPrivate *d; + void *d; // reserved for future use const char *name; bool enabledDebug; bool enabledWarning; bool enabledCritical; - bool enabledTrace; - // reserve space for future use - bool placeholder1; - bool placeholder2; - bool placeholder3; -}; - -class Q_CORE_EXPORT QTracer -{ - Q_DISABLE_COPY(QTracer) -public: - QTracer() {} - virtual ~QTracer() {} - - void addToCategory(QLoggingCategory &category); - - virtual void start() {} - virtual void end() {} - virtual void record(int) {} - virtual void record(const char *) {} - virtual void record(const QVariant &) {} -}; - -class Q_CORE_EXPORT QTraceGuard -{ - Q_DISABLE_COPY(QTraceGuard) -public: - QTraceGuard(QLoggingCategory &category) - { - target = category.isTraceEnabled() ? &category : 0; - if (target) - start(); - } - - ~QTraceGuard() - { - if (target) - end(); - } - - QTraceGuard &operator<<(int msg); - QTraceGuard &operator<<(const char *msg); - QTraceGuard &operator<<(const QVariant &msg); - -private: - void start(); - void end(); - - QLoggingCategory *target; + bool placeholder[5]; // reserve for future use }; #define Q_DECLARE_LOGGING_CATEGORY(name) \ @@ -162,17 +103,6 @@ private: #define qCCritical(category) \ for (bool enabled = category().isCriticalEnabled(); enabled; enabled = false) \ QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical() -#define qCTrace(category) \ - for (bool enabled = category.isTraceEnabled(); Q_UNLIKELY(enabled); enabled = false) \ - QTraceGuard(category) - - -#define Q_TRACE_GUARD_NAME_HELPER(line) qTraceGuard ## line -#define Q_TRACE_GUARD_NAME(line) Q_TRACE_GUARD_NAME_HELPER(line) - -#define qCTraceGuard(category) \ - QTraceGuard Q_TRACE_GUARD_NAME(__LINE__)(category); - #if defined(QT_NO_DEBUG_OUTPUT) # undef qCDebug diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index 885b51709d..a82e6f65f4 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -86,9 +86,6 @@ int QLoggingRule::pass(const QString &categoryName, QtMsgType msgType) const case QtCriticalMsg: fullCategory += QLatin1String(".critical"); break; - case QtTraceMsg: - fullCategory += QLatin1String(".trace"); - break; default: break; } @@ -291,7 +288,6 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat) bool debug = (cat->categoryName() == qtDefaultCategoryName); bool warning = true; bool critical = true; - bool trace = true; QString categoryName = QLatin1String(cat->categoryName()); QLoggingRegistry *reg = QLoggingRegistry::instance(); @@ -305,15 +301,11 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat) filterpass = item.pass(categoryName, QtCriticalMsg); if (filterpass != 0) critical = (filterpass > 0); - filterpass = item.pass(categoryName, QtTraceMsg); - if (filterpass != 0) - trace = (filterpass > 0); } cat->setEnabled(QtDebugMsg, debug); cat->setEnabled(QtWarningMsg, warning); cat->setEnabled(QtCriticalMsg, critical); - cat->setEnabled(QtTraceMsg, trace); } diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 5b6cbe658c..60f3630709 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -257,7 +257,6 @@ namespace QTest { } switch (type) { - case QtTraceMsg: case QtDebugMsg: QTest::TestLoggers::addMessage(QAbstractTestLogger::QDebug, msg); break; -- cgit v1.2.3 From f48bc3ef40ec0176497896071c487b5326cd66c1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 7 Nov 2013 10:38:56 +0100 Subject: Add a warning message when a WM_DESTROY not triggered by Qt is received. Task-number: QTBUG-34503 Change-Id: I7a1e06b34deaf8e595f4986114701480bdcf219c Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowscontext.cpp | 10 ++++++++-- src/plugins/platforms/windows/qwindowswindow.cpp | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index fc2bb303be..77cac647ba 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -783,9 +783,15 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::InputMethodCloseCandidateWindowEvent: // TODO: Release/regrab mouse if a popup has mouse grab. return false; - case QtWindows::ClipboardEvent: case QtWindows::DestroyEvent: - + if (!platformWindow->testFlag(QWindowsWindow::WithinDestroy)) { + qWarning() << "External WM_DESTROY received for " << platformWindow->window() + << ", parent: " << platformWindow->window()->parent() + << ", transient parent: " << platformWindow->window()->transientParent(); + } + return false; + case QtWindows::ClipboardEvent: + return false; case QtWindows::UnknownEvent: return false; case QtWindows::AccessibleObjectFromWindowRequest: diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 44fd97e1aa..2ea02cd4d4 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -929,6 +929,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : QWindowsWindow::~QWindowsWindow() { + setFlag(WithinDestroy); #ifndef Q_OS_WINCE if (testFlag(TouchRegistered)) QWindowsContext::user32dll.unregisterTouchWindow(m_data.hwnd); -- cgit v1.2.3 From 6ff08b7db3d4f93b38ae769413d3f3377b3d272b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 7 Nov 2013 10:53:42 +0100 Subject: Windows: Do not set transient parent on popups. Analoguous to Window creation code. Task-number: QTBUG-34503 Change-Id: I3cf7d58999bff5b106ca9d2e2c6f550e35f9db9a Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowswindow.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 2ea02cd4d4..d2fb481824 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1123,6 +1123,8 @@ QPoint QWindowsWindow::mapFromGlobal(const QPoint &pos) const void QWindowsWindow::updateTransientParent() const { #ifndef Q_OS_WINCE + if (window()->type() == Qt::Popup) + return; // QTBUG-34503, // a popup stays on top, no parent, see also WindowCreationData::fromWindow(). // Update transient parent. const HWND oldTransientParent = GetAncestor(m_data.hwnd, GA_PARENT) == GetDesktopWindow() ? GetAncestor(m_data.hwnd, GA_ROOTOWNER) : HWND(0); -- cgit v1.2.3 From b953e2f53ff1a9c40c46ad6e7d406d368083b235 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Wed, 6 Nov 2013 17:17:49 +0200 Subject: add/remove window only when the window is shown/hidden Task-number: QTBUG-34469 Change-Id: Id77cf738f96bb94582833f6734a2a491b01e1666 Reviewed-by: Laszlo Agocs --- src/platformsupport/fbconvenience/qfbwindow.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/platformsupport/fbconvenience/qfbwindow.cpp b/src/platformsupport/fbconvenience/qfbwindow.cpp index 8b6186db79..b489ed351c 100644 --- a/src/platformsupport/fbconvenience/qfbwindow.cpp +++ b/src/platformsupport/fbconvenience/qfbwindow.cpp @@ -52,13 +52,10 @@ QFbWindow::QFbWindow(QWindow *window) { static QAtomicInt winIdGenerator(1); mWindowId = winIdGenerator.fetchAndAddRelaxed(1); - - platformScreen()->addWindow(this); } QFbWindow::~QFbWindow() { - platformScreen()->removeWindow(this); } QFbScreen *QFbWindow::platformScreen() const @@ -86,6 +83,11 @@ void QFbWindow::setVisible(bool visible) setGeometry(platformScreen()->availableGeometry()); } QPlatformWindow::setVisible(visible); + + if (visible) + platformScreen()->addWindow(this); + else + platformScreen()->removeWindow(this); } -- cgit v1.2.3 From 42670c7c45db8032a15607124d177c8f454d6f5a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 7 Nov 2013 13:36:31 +0100 Subject: Android: Allow modules to specify permissions/features Some modules, such as Qt Multimedia, needs special permissions to avoid getting exceptions at run-time. We should apply these by default to the AndroidManifest.xml so that an application using e.g. the camera will work out of the box. Task-number: QTBUG-33953 Change-Id: Ibc1f086d249197b63e7ed1075ae7d54bdd1212f2 Reviewed-by: Paul Olav Tvete Reviewed-by: Christian Stromme --- src/android/java/AndroidManifest.xml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/android/java/AndroidManifest.xml b/src/android/java/AndroidManifest.xml index 95811c65e0..cfad4553ee 100644 --- a/src/android/java/AndroidManifest.xml +++ b/src/android/java/AndroidManifest.xml @@ -36,6 +36,8 @@ + + -- cgit v1.2.3 From 8aab8ccc0ffba504078deb7b4371d2f98c834df3 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 7 Nov 2013 13:43:02 +0100 Subject: Dialogs: provide the StandardButton->ButtonRole mapping in QPA As the QPlatformMessageDialogHelper will be implemented repeatedly, it's useful to have this mapping in one place for reuse. Also, since we do not guarantee that either accepted() or rejected() will be emitted for every possible button on a QtQuick MessageDialog, it's useful for the QtQuick.Dialogs module to have access to this mapping to interpret individual button presses and emit the role-specific signals such as yes(), apply(), help(), etc. Change-Id: I7be753080794adabb784df9b95ac04aa1c29151c Reviewed-by: BogDan Vatra --- src/gui/kernel/qplatformdialoghelper.cpp | 42 +++++++++++++++++++++++++++++++ src/gui/kernel/qplatformdialoghelper.h | 20 ++++++++++++++- src/widgets/widgets/qdialogbuttonbox.cpp | 43 +++----------------------------- 3 files changed, 64 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index fe5db27117..5ddd718e69 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -693,6 +693,48 @@ QMessageDialogOptions::StandardButtons QMessageDialogOptions::standardButtons() return d->buttons; } +QMessageDialogOptions::ButtonRole QMessageDialogOptions::buttonRole(QMessageDialogOptions::StandardButton button) +{ + switch (button) { + case Ok: + case Save: + case Open: + case SaveAll: + case Retry: + case Ignore: + return AcceptRole; + + case Cancel: + case Close: + case Abort: + return RejectRole; + + case Discard: + return DestructiveRole; + + case Help: + return HelpRole; + + case Apply: + return ApplyRole; + + case Yes: + case YesToAll: + return YesRole; + + case No: + case NoToAll: + return NoRole; + + case RestoreDefaults: + case Reset: + return ResetRole; + + default: + break; + } + return InvalidRole; +} /*! \class QPlatformMessageDialogHelper diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h index ad818c8644..eb461e3ab3 100644 --- a/src/gui/kernel/qplatformdialoghelper.h +++ b/src/gui/kernel/qplatformdialoghelper.h @@ -361,6 +361,21 @@ public: Q_DECLARE_FLAGS(StandardButtons, StandardButton) + enum ButtonRole { + InvalidRole = -1, + AcceptRole, + RejectRole, + DestructiveRole, + ActionRole, + HelpRole, + YesRole, + NoRole, + ResetRole, + ApplyRole, + + NRoles + }; + QMessageDialogOptions(); QMessageDialogOptions(const QMessageDialogOptions &rhs); QMessageDialogOptions &operator=(const QMessageDialogOptions &rhs); @@ -386,6 +401,8 @@ public: void setStandardButtons(StandardButtons buttons); StandardButtons standardButtons() const; + static ButtonRole buttonRole(StandardButton button); + private: QSharedDataPointer d; }; @@ -400,7 +417,8 @@ public: void setOptions(const QSharedPointer &options); Q_SIGNALS: - void clicked(QMessageDialogOptions::StandardButton button); + void clicked(QMessageDialogOptions::StandardButton button); // TODO remove before 5.2 + void clicked(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole role); private: QSharedPointer m_options; diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index 9789c453f3..6b183d3759 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include "qdialogbuttonbox.h" @@ -166,46 +167,8 @@ enum { static QDialogButtonBox::ButtonRole roleFor(QDialogButtonBox::StandardButton button) { - switch (button) { - case QDialogButtonBox::Ok: - case QDialogButtonBox::Save: - case QDialogButtonBox::Open: - case QDialogButtonBox::SaveAll: - case QDialogButtonBox::Retry: - case QDialogButtonBox::Ignore: - return QDialogButtonBox::AcceptRole; - - case QDialogButtonBox::Cancel: - case QDialogButtonBox::Close: - case QDialogButtonBox::Abort: - return QDialogButtonBox::RejectRole; - - case QDialogButtonBox::Discard: - return QDialogButtonBox::DestructiveRole; - - case QDialogButtonBox::Help: - return QDialogButtonBox::HelpRole; - - case QDialogButtonBox::Apply: - return QDialogButtonBox::ApplyRole; - - case QDialogButtonBox::Yes: - case QDialogButtonBox::YesToAll: - return QDialogButtonBox::YesRole; - - case QDialogButtonBox::No: - case QDialogButtonBox::NoToAll: - return QDialogButtonBox::NoRole; - - case QDialogButtonBox::RestoreDefaults: - case QDialogButtonBox::Reset: - return QDialogButtonBox::ResetRole; - - case QDialogButtonBox::NoButton: // NoButton means zero buttons, not "No" button - ; - } - - return QDialogButtonBox::InvalidRole; + return static_cast(QMessageDialogOptions::buttonRole( + static_cast(button))); } static const uint layouts[2][5][14] = -- cgit v1.2.3 From 8db127b0b50b1d62940500b9c6a9f9794201e2b3 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Mon, 4 Nov 2013 15:19:55 +0100 Subject: qfeatures.txt: add section about XML schema ... so the XML schema part can be disabled in the xmlpatterns module, while still using other functionality (e.g. XPath). Change-Id: I3599ea8f915d34e0b1ba5d6a30f3f6269a4c992e Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qfeatures.txt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index ce0076bce5..3e9fc88eba 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -935,3 +935,10 @@ Section: D-Bus Requires: PROPERTIES XMLSTREAMREADER Name: Qt D-Bus module +# XML Patterns + +Feature: XMLSCHEMA +Description: Provides XML schema validation. +Section: Xml Patterns +Requires: +Name: XML Schema APIs -- cgit v1.2.3 From b2f26362176b77b812de5cfbaca5d70d3d786218 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 7 Nov 2013 16:16:25 +0100 Subject: Cocoa: fix a crash in QCocoaFileDialogHelper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current directory can't be nil. Task-number: QTBUG-34561 Change-Id: I58c84da4928bd9081c916b6e5541bb86cf75ed47 Reviewed-by: Morten Johan Sørvig Reviewed-by: Shawn Rutledge --- src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index b3bc4a8ebf..bbf5227a6c 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -461,7 +461,7 @@ static QString strippedText(QString s) Q_UNUSED(sender); if (!mHelper) return; - if ([path isEqualToString:mCurrentDir]) + if (!(path && path.length) || [path isEqualToString:mCurrentDir]) return; [mCurrentDir release]; -- cgit v1.2.3 From a301e868f7a24a7b98b22623b01be92488527c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 6 Nov 2013 15:36:30 +0100 Subject: iOS: Rename m_requestedGeometry to m_normalGeometry Matches the wording using in QWidget. Change-Id: Ifbb4e5ffa90b47a7c179cf9ec52cb46126d7bccc Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioswindow.h | 2 +- src/plugins/platforms/ios/qioswindow.mm | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index 0f7a50db04..7f4badfb68 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -83,7 +83,7 @@ public: private: UIView *m_view; - QRect m_requestedGeometry; + QRect m_normalGeometry; int m_windowLevel; qreal m_devicePixelRatio; diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index f1189ccd88..9eba049f95 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -317,7 +317,7 @@ QT_BEGIN_NAMESPACE QIOSWindow::QIOSWindow(QWindow *window) : QPlatformWindow(window) , m_view([[EAGLView alloc] initWithQIOSWindow:this]) - , m_requestedGeometry(QPlatformWindow::geometry()) + , m_normalGeometry(QPlatformWindow::geometry()) , m_windowLevel(0) , m_devicePixelRatio(1.0) { @@ -386,7 +386,7 @@ void QIOSWindow::setGeometry(const QRect &rect) { // If the window is in fullscreen, just bookkeep the requested // geometry in case the window goes into Qt::WindowNoState later: - m_requestedGeometry = rect; + m_normalGeometry = rect; if (window()->windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen)) return; @@ -413,7 +413,7 @@ void QIOSWindow::setWindowState(Qt::WindowState state) m_view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; break; } default: - m_view.frame = toCGRect(m_requestedGeometry); + m_view.frame = toCGRect(m_normalGeometry); m_view.autoresizingMask = UIViewAutoresizingNone; break; } -- cgit v1.2.3 From 24d1f584146c487c1bc16a8191c2c472da6c6f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 7 Nov 2013 12:20:28 +0100 Subject: iOS: Rename QIOSWindow's backing view from EAGLView to QUIView Matches the cocoa QNSView and highlights the relation to UIView. Change-Id: Idcdb17bff994c1e0aef099400c21915a7041e44c Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioswindow.h | 4 +++- src/plugins/platforms/ios/qioswindow.mm | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index 7f4badfb68..b60290e479 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -56,6 +56,8 @@ class QIOSWindow; QT_BEGIN_NAMESPACE +@class QUIView; + class QIOSWindow : public QPlatformWindow { public: @@ -81,7 +83,7 @@ public: WId winId() const { return WId(m_view); }; private: - UIView *m_view; + QUIView *m_view; QRect m_normalGeometry; int m_windowLevel; diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 9eba049f95..2cb3fe86e1 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -58,7 +58,7 @@ #include -@interface EAGLView : UIView +@interface QUIView : UIView { @public UITextAutocapitalizationType autocapitalizationType; @@ -83,7 +83,7 @@ @end -@implementation EAGLView +@implementation QUIView + (Class)layerClass { @@ -305,8 +305,8 @@ - (QWindow *)qwindow { - if ([self isKindOfClass:[EAGLView class]]) - return static_cast(self)->m_qioswindow->window(); + if ([self isKindOfClass:[QUIView class]]) + return static_cast(self)->m_qioswindow->window(); return nil; } @@ -316,7 +316,7 @@ QT_BEGIN_NAMESPACE QIOSWindow::QIOSWindow(QWindow *window) : QPlatformWindow(window) - , m_view([[EAGLView alloc] initWithQIOSWindow:this]) + , m_view([[QUIView alloc] initWithQIOSWindow:this]) , m_normalGeometry(QPlatformWindow::geometry()) , m_windowLevel(0) , m_devicePixelRatio(1.0) @@ -392,7 +392,7 @@ void QIOSWindow::setGeometry(const QRect &rect) // Since we don't support transformations on the UIView, we can set the frame // directly and let UIKit deal with translating that into bounds and center. - // Changing the size of the view will end up in a call to -[EAGLView layoutSubviews] + // Changing the size of the view will end up in a call to -[QUIView layoutSubviews] // which will update QWindowSystemInterface with the new size. m_view.frame = toCGRect(rect); } -- cgit v1.2.3 From 59be0509e087a5d4a8884a56e14a2ddbf5735ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 7 Nov 2013 13:15:31 +0100 Subject: iOS: Detect/handle cancellation of subset of touch points Change-Id: I0d345d07fe62a8c7844333bf1eed9be6d6fa432f Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioswindow.mm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 2cb3fe86e1..70f4cc4267 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -226,10 +226,16 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { - Q_UNUSED(touches) // ### can a subset of the active touches be cancelled? + if (!touches) { + m_activeTouches.clear(); + } else { + for (UITouch *touch in touches) + m_activeTouches.remove(touch); + + Q_ASSERT_X(m_activeTouches.isEmpty(), Q_FUNC_INFO, + "Subset of active touches cancelled by UIKit"); + } - // Clear current touch points - m_activeTouches.clear(); m_nextTouchId = 0; // Send cancel touch event synchronously -- cgit v1.2.3 From ac7823129a529a71d2725fdeadc5eff7a2b0788a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 7 Nov 2013 13:16:48 +0100 Subject: iOS: Cancel any active touches when destroying a QIOSWindow Keeps the internal state of QtGui sane when it comes to which buttons are active, etc. Change-Id: Ic63e74d2546469e085ec46b74f4cf159dd409b07 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioswindow.mm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 70f4cc4267..fa0519a37c 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -226,6 +226,9 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { + if (!touches && m_activeTouches.isEmpty()) + return; + if (!touches) { m_activeTouches.clear(); } else { @@ -238,9 +241,11 @@ m_nextTouchId = 0; + NSTimeInterval timestamp = event ? event.timestamp : [[NSProcessInfo processInfo] systemUptime]; + // Send cancel touch event synchronously QIOSIntegration *iosIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); - QWindowSystemInterface::handleTouchCancelEvent(m_qioswindow->window(), ulong(event.timestamp * 1000), iosIntegration->touchDevice()); + QWindowSystemInterface::handleTouchCancelEvent(m_qioswindow->window(), ulong(timestamp * 1000), iosIntegration->touchDevice()); QWindowSystemInterface::flushWindowSystemEvents(); } @@ -342,6 +347,13 @@ QIOSWindow::QIOSWindow(QWindow *window) QIOSWindow::~QIOSWindow() { + // According to the UIResponder documentation, Cocoa Touch should react to system interruptions + // that "might cause the view to be removed from the window" by sending touchesCancelled, but in + // practice this doesn't seem to happen when removing the view from its superview. To ensure that + // Qt's internal state for touch and mouse handling is kept consistent, we therefor have to force + // cancellation of all touch events. + [m_view touchesCancelled:0 withEvent:0]; + [m_view removeFromSuperview]; [m_view release]; } -- cgit v1.2.3 From 7a6bb4d9c9eee46e5f2e0aee9a93d38fd6b91c46 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 8 Nov 2013 09:12:06 +0100 Subject: Fix potential BC break in QTabBar. Move code from mouseDoubleClickEvent() to event(). Introduced by 252bad7c589e03d3e12df02354b00a84d8e3159a . Task-number: QTBUG-34670 Change-Id: I98ed24f26977220cf03524cfe001524364473982 Reviewed-by: Marc Mutz --- src/widgets/widgets/qtabbar.cpp | 23 ++++++----------------- src/widgets/widgets/qtabbar.h | 1 - 2 files changed, 6 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 094e9af0de..dfd1f1022c 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -1496,6 +1496,12 @@ bool QTabBar::event(QEvent *event) } } #endif + } else if (event->type() == QEvent::MouseButtonDblClick) { // ### fixme Qt 6: move to mouseDoubleClickEvent(), here for BC reasons. + const QPoint pos = static_cast(event)->pos(); + const bool isEventInCornerButtons = (!d->leftB->isHidden() && d->leftB->geometry().contains(pos)) + || (!d->rightB->isHidden() && d->rightB->geometry().contains(pos)); + if (!isEventInCornerButtons) + emit tabBarDoubleClicked(tabAt(pos)); } return QWidget::event(event); } @@ -1723,23 +1729,6 @@ void QTabBarPrivate::moveTab(int index, int offset) q_func()->update(); } - -/*! - \reimp -*/ -void QTabBar::mouseDoubleClickEvent(QMouseEvent *event) -{ - Q_D(QTabBar); - - const QPoint pos = event->pos(); - const bool isEventInCornerButtons = (!d->leftB->isHidden() && d->leftB->geometry().contains(pos)) - || (!d->rightB->isHidden() && d->rightB->geometry().contains(pos)); - if (!isEventInCornerButtons) { - const int index = tabAt(pos); - emit tabBarDoubleClicked(index); - } -} - /*!\reimp */ void QTabBar::mousePressEvent(QMouseEvent *event) diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h index 1f7b8f6b03..a0e52c2f86 100644 --- a/src/widgets/widgets/qtabbar.h +++ b/src/widgets/widgets/qtabbar.h @@ -188,7 +188,6 @@ protected: void showEvent(QShowEvent *); void hideEvent(QHideEvent *); void paintEvent(QPaintEvent *); - void mouseDoubleClickEvent(QMouseEvent *); void mousePressEvent (QMouseEvent *); void mouseMoveEvent (QMouseEvent *); void mouseReleaseEvent (QMouseEvent *); -- cgit v1.2.3 From 7a3c82077f909e314cbc685e7ecfc70d08cc42d6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 7 Nov 2013 16:38:31 +0100 Subject: Fix potential BC break in QColorDialog. Replace newly reimplemented virtuals in d928dbbc919f5f39af9ce5c69eb8e9ffa9da71d3 . Task-number: QTBUG-34663 Task-number: QTBUG-14332 Change-Id: Idb2cc2ec237c96f7157470728bb79ff3efc504d0 Reviewed-by: Marc Mutz --- src/widgets/dialogs/qcolordialog.cpp | 100 ++++++++++++++++++++--------------- src/widgets/dialogs/qcolordialog.h | 3 -- src/widgets/dialogs/qcolordialog_p.h | 5 ++ 3 files changed, 61 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index d20725fc89..2e6518dd17 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -427,6 +427,30 @@ void QWellArray::keyPressEvent(QKeyEvent* e) //////////// QWellArray END +// Event filter to be installed on the dialog while in color-picking mode. +class QColorPickingEventFilter : public QObject { +public: + explicit QColorPickingEventFilter(QColorDialogPrivate *dp, QObject *parent = 0) : QObject(parent), m_dp(dp) {} + + bool eventFilter(QObject *, QEvent *event) Q_DECL_OVERRIDE + { + switch (event->type()) { + case QEvent::MouseMove: + return m_dp->handleColorPickingMouseMove(static_cast(event)); + case QEvent::MouseButtonRelease: + return m_dp->handleColorPickingMouseButtonRelease(static_cast(event)); + case QEvent::KeyPress: + return m_dp->handleColorPickingKeyPress(static_cast(event)); + default: + break; + } + return false; + } + +private: + QColorDialogPrivate *m_dp; +}; + /*! Returns the number of custom colors supported by QColorDialog. All color dialogs share the same custom colors. @@ -1520,7 +1544,9 @@ void QColorDialogPrivate::_q_newStandard(int r, int c) void QColorDialogPrivate::_q_pickScreenColor() { Q_Q(QColorDialog); - screenColorPicking = true; + if (!colorPickingEventFilter) + colorPickingEventFilter = new QColorPickingEventFilter(this); + q->installEventFilter(colorPickingEventFilter); // If user pushes Escape, the last color before picking will be restored. beforeScreenColorPicking = cs->currentColor(); /*For some reason, q->grabMouse(Qt::CrossCursor) doesn't change @@ -1550,7 +1576,7 @@ void QColorDialogPrivate::_q_pickScreenColor() void QColorDialogPrivate::releaseColorPicking() { Q_Q(QColorDialog); - screenColorPicking = false; + q->removeEventFilter(colorPickingEventFilter); q->releaseMouse(); q->releaseKeyboard(); #ifndef QT_NO_CURSOR @@ -1572,7 +1598,7 @@ void QColorDialogPrivate::init(const QColor &initial) // default: use the native dialog if possible. Can be overridden in setOptions() nativeDialogInUse = (platformColorDialogHelper() != 0); - screenColorPicking = false; + colorPickingEventFilter = 0; nextCust = 0; if (!nativeDialogInUse) @@ -2123,55 +2149,41 @@ void QColorDialog::changeEvent(QEvent *e) QDialog::changeEvent(e); } -/*! - \reimp -*/ -void QColorDialog::mouseMoveEvent(QMouseEvent *e) +bool QColorDialogPrivate::handleColorPickingMouseMove(QMouseEvent *e) { - Q_D(QColorDialog); - if (d->screenColorPicking) { - setCurrentColor(d->grabScreenColor(e->globalPos())); - d->lblScreenColorInfo->setText(QColorDialog::tr("Cursor at %1, %2, color: %3\nPress ESC to cancel") - .arg(e->globalPos().x()) - .arg(e->globalPos().y()) - .arg(currentColor().name())); - return; - } - QDialog::mouseMoveEvent(e); + Q_Q(QColorDialog); + const QPoint globalPos = e->globalPos(); + const QColor color = grabScreenColor(globalPos); + q->setCurrentColor(color); + lblScreenColorInfo->setText(QColorDialog::tr("Cursor at %1, %2, color: %3\nPress ESC to cancel") + .arg(globalPos.x()).arg(globalPos.y()).arg(color.name())); + return true; } -/*! - \reimp -*/ -void QColorDialog::mouseReleaseEvent(QMouseEvent *e) +bool QColorDialogPrivate::handleColorPickingMouseButtonRelease(QMouseEvent *e) { - Q_D(QColorDialog); - if (d->screenColorPicking) { - setCurrentColor(d->grabScreenColor(e->globalPos())); - d->releaseColorPicking(); - return; - } - QDialog::mouseReleaseEvent(e); + Q_Q(QColorDialog); + q->setCurrentColor(grabScreenColor(e->globalPos())); + releaseColorPicking(); + return true; } -/*! - \reimp -*/ -void QColorDialog::keyPressEvent(QKeyEvent *e) +bool QColorDialogPrivate::handleColorPickingKeyPress(QKeyEvent *e) { - Q_D(QColorDialog); - if (d->screenColorPicking) { - if (e->key() == Qt::Key_Escape) { - d->releaseColorPicking(); - d->setCurrentColor(d->beforeScreenColorPicking); - } else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) { - setCurrentColor(d->grabScreenColor(QCursor::pos())); - d->releaseColorPicking(); - } - e->accept(); - return; + Q_Q(QColorDialog); + switch (e->key()) { + case Qt::Key_Escape: + releaseColorPicking(); + q->setCurrentColor(beforeScreenColorPicking); + break; + case Qt::Key_Return: + case Qt::Key_Enter: + q->setCurrentColor(grabScreenColor(QCursor::pos())); + releaseColorPicking(); + break; } - QDialog::keyPressEvent(e); + e->accept(); + return true; } /*! diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h index c7a1d6f400..c74ee6720a 100644 --- a/src/widgets/dialogs/qcolordialog.h +++ b/src/widgets/dialogs/qcolordialog.h @@ -112,9 +112,6 @@ Q_SIGNALS: protected: void changeEvent(QEvent *event); - virtual void mouseMoveEvent(QMouseEvent *); - virtual void mouseReleaseEvent(QMouseEvent *); - virtual void keyPressEvent(QKeyEvent *); void done(int result); private: diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h index 08199cc7c1..f58a9200db 100644 --- a/src/widgets/dialogs/qcolordialog_p.h +++ b/src/widgets/dialogs/qcolordialog_p.h @@ -70,6 +70,7 @@ class QLabel; class QVBoxLayout; class QPushButton; class QWellArray; +class QColorPickingEventFilter; class QColorDialogPrivate : public QDialogPrivate { @@ -105,6 +106,9 @@ public: void _q_newStandard(int, int); void _q_pickScreenColor(); void releaseColorPicking(); + bool handleColorPickingMouseMove(QMouseEvent *e); + bool handleColorPickingMouseButtonRelease(QMouseEvent *e); + bool handleColorPickingKeyPress(QKeyEvent *e); QWellArray *custom; QWellArray *standard; @@ -125,6 +129,7 @@ public: int nextCust; bool smallDisplay; bool screenColorPicking; + QColorPickingEventFilter *colorPickingEventFilter; QRgb beforeScreenColorPicking; QSharedPointer options; -- cgit v1.2.3 From c934ea341e0749aef9c927ca3def68976bdc976f Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 5 Nov 2013 13:16:59 +0100 Subject: Cocoa File Dialog: Remove sandbox-ufriendly file system watcher MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QFileSystemWatcher causes sandboxing errors since its backend uses POSIX API in a relatively liberal way. Also, Cocoa already acts as a file system watcher, and calls -[QNSOpenSavePanelDelegate panel:shouldShowFilename:] on each file. From a logical point of view, caching the directory content can be replaced by testing the current file against the filter setting. We expect Cocoa to cache results, and by using NSFileManager things should remain relatively fast. Task-number: QTBUG-34107 Change-Id: Ia872b9b1244f7b390d173a498011379b9309b3c6 Reviewed-by: Cyril Oblikov Reviewed-by: Morten Johan Sørvig --- .../platforms/cocoa/qcocoafiledialoghelper.mm | 93 ++++++++++++---------- 1 file changed, 49 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index bbf5227a6c..1ad833ee44 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -61,12 +61,12 @@ #include #include #include "qcocoaautoreleasepool.h" -#include #include #include #import +#import QT_FORWARD_DECLARE_CLASS(QString) QT_FORWARD_DECLARE_CLASS(QStringList) @@ -74,30 +74,6 @@ QT_FORWARD_DECLARE_CLASS(QFileInfo) QT_FORWARD_DECLARE_CLASS(QWindow) QT_USE_NAMESPACE -class CachedEntries: public QObject { -public: - CachedEntries(QDir::Filters filters) : mFilters(filters) { - QObject::connect(&mFSWatcher, &QFileSystemWatcher::directoryChanged, this, &CachedEntries::updateDirCache); - } - QString directory() const { - const QStringList &dirs = mFSWatcher.directories(); - return (dirs.count() ? dirs[0] : QString()); - } - QStringList entries() const { - return mQDirFilterEntryList; - } - void updateDirCache(const QString &path) { - mFSWatcher.removePaths(mFSWatcher.directories()); - mFSWatcher.addPath(path); - mQDirFilterEntryList = QDir(path).entryList(mFilters); - } - -private: - QFileSystemWatcher mFSWatcher; - QStringList mQDirFilterEntryList; - QDir::Filters mFilters; -}; - typedef QSharedPointer SharedPointerFileDialogOptions; @class QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate); @@ -117,7 +93,6 @@ typedef QSharedPointer SharedPointerFileDialogOptions; int mReturnCode; SharedPointerFileDialogOptions mOptions; - CachedEntries *mCachedEntries; QString *mCurrentSelection; QStringList *mNameFilterDropDownList; QStringList *mSelectedNameFilter; @@ -164,7 +139,6 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate); [mSavePanel setDelegate:self]; mReturnCode = -1; mHelper = helper; - mCachedEntries = new CachedEntries(mOptions->filter()); mNameFilterDropDownList = new QStringList(mOptions->nameFilters()); QString selectedVisualNameFilter = mOptions->initiallySelectedNameFilter(); mSelectedNameFilter = new QStringList([self findStrippedFilterWithVisualFilterName:selectedVisualNameFilter]); @@ -197,7 +171,6 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate); - (void)dealloc { - delete mCachedEntries; delete mNameFilterDropDownList; delete mSelectedNameFilter; delete mCurrentSelection; @@ -308,6 +281,22 @@ static QString strippedText(QString s) }]; } +- (BOOL)isHiddenFile:(NSString *)filename isDir:(BOOL)isDir +{ + CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)filename, kCFURLPOSIXPathStyle, isDir); + CFBooleanRef isHidden; + Boolean errorOrHidden = false; + if (!CFURLCopyResourcePropertyForKey(url, kCFURLIsHiddenKey, &isHidden, NULL)) { + errorOrHidden = true; + } else { + if (CFBooleanGetValue(isHidden)) + errorOrHidden = true; + CFRelease(isHidden); + } + CFRelease(url); + return errorOrHidden; +} + - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename { Q_UNUSED(sender); @@ -316,8 +305,13 @@ static QString strippedText(QString s) return NO; // Always accept directories regardless of their names (unless it is a bundle): - BOOL isDir; - if ([[NSFileManager defaultManager] fileExistsAtPath:filename isDirectory:&isDir] && isDir) { + NSFileManager *fm = [NSFileManager defaultManager]; + NSDictionary *fileAttrs = [fm attributesOfItemAtPath:filename error:nil]; + if (!fileAttrs) + return NO; // Error accessing the file means 'no'. + NSString *fileType = [fileAttrs fileType]; + bool isDir = [fileType isEqualToString:NSFileTypeDirectory]; + if (isDir) { if ([mSavePanel treatsFilePackagesAsDirectories] == NO) { if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename] == NO) return YES; @@ -325,24 +319,35 @@ static QString strippedText(QString s) } QString qtFileName = QCFString::toQString(filename); - QFileInfo info(qtFileName.normalized(QString::NormalizationForm_C)); - QString path = info.absolutePath(); - if (mCachedEntries->directory() != path) { - mCachedEntries->updateDirCache(path); - } - // Check if the QDir filter accepts the file: - if (!mCachedEntries->entries().contains(info.fileName())) - return NO; - // No filter means accept everything - if (mSelectedNameFilter->isEmpty()) - return YES; + bool nameMatches = mSelectedNameFilter->isEmpty(); // Check if the current file name filter accepts the file: - for (int i=0; isize(); ++i) { + for (int i = 0; !nameMatches && i < mSelectedNameFilter->size(); ++i) { if (QDir::match(mSelectedNameFilter->at(i), qtFileName)) - return YES; + nameMatches = true; + } + if (!nameMatches) + return NO; + + QDir::Filters filter = mOptions->filter(); + if ((!(filter & (QDir::Dirs | QDir::AllDirs)) && isDir) + || (!(filter & QDir::Files) && [fileType isEqualToString:NSFileTypeRegular]) + || ((filter & QDir::NoSymLinks) && [fileType isEqualToString:NSFileTypeSymbolicLink])) + return NO; + + bool filterPermissions = ((filter & QDir::PermissionMask) + && (filter & QDir::PermissionMask) != QDir::PermissionMask); + if (filterPermissions) { + if ((!(filter & QDir::Readable) && [fm isReadableFileAtPath:filename]) + || (!(filter & QDir::Writable) && [fm isWritableFileAtPath:filename]) + || (!(filter & QDir::Executable) && [fm isExecutableFileAtPath:filename])) + return NO; } - return NO; + if (!(filter & QDir::Hidden) + && (qtFileName.startsWith(QLatin1Char('.')) || [self isHiddenFile:filename isDir:isDir])) + return NO; + + return YES; } - (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirmed:(BOOL)okFlag -- cgit v1.2.3 From 2d1bb6d61d5c26a11b65eda5f9625894b794391f Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 8 Nov 2013 13:03:22 +0100 Subject: Prevent a crash in QLayout::replaceWidget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Item might be null. Change-Id: Ia432a35cb1a6bb02ee056ff8ad44a9f35bdbc146 Reviewed-by: Thorbjørn Lund Martsum Reviewed-by: Marc Mutz --- src/widgets/kernel/qlayout.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index cd2891d829..f17a6caa3c 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -1133,11 +1133,15 @@ QLayoutItem* QLayout::replaceWidget(QWidget *from, QWidget *to, bool recursive) QLayoutItem *item = 0; for (int u = 0; u < count(); ++u) { item = itemAt(u); + if (!item) + continue; + if (item->widget() == from) { index = u; break; } - if (item && item->layout() && recursive) { + + if (item->layout() && recursive) { QLayoutItem *r = item->layout()->replaceWidget(from, to, true); if (r) return r; -- cgit v1.2.3 From fbcad545ce857923c709785cbb44f50c0a4f034c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Sat, 26 Oct 2013 13:51:17 +0200 Subject: NSUrlConnection backend for QNetworkAccessManager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for QNetworkAccessManager https REST on iOS, without adding a dependency on OpenSSL. The current limitations are: - Overriding server certificate trust issues (for example expired certificates) is not supported. - Usage on non-gui threads is not supported. NSurlConnection needs a CoreFoundation-based event loop, which Qt currently only provides when using QGuiApplication on the main thread. Change-Id: Ic6f74591d40c3b2248ab81db12647e432377cd4f Reviewed-by: Tor Arne Vestbø --- src/network/access/access.pri | 12 +- src/network/access/qnetworkaccessmanager.cpp | 10 + .../access/qnetworkreplynsurlconnectionimpl.mm | 449 +++++++++++++++++++++ .../access/qnetworkreplynsurlconnectionimpl_p.h | 89 ++++ 4 files changed, 558 insertions(+), 2 deletions(-) create mode 100644 src/network/access/qnetworkreplynsurlconnectionimpl.mm create mode 100644 src/network/access/qnetworkreplynsurlconnectionimpl_p.h (limited to 'src') diff --git a/src/network/access/access.pri b/src/network/access/access.pri index 590a37bf15..aaaf05b551 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -64,6 +64,14 @@ SOURCES += \ access/qhttpthreaddelegate.cpp \ access/qhttpmultipart.cpp -include($$PWD/../../3rdparty/zlib_dependency.pri) +mac: LIBS_PRIVATE += -framework Security + +ios { + HEADERS += \ + access/qnetworkreplynsurlconnectionimpl_p.h -mac:LIBS_PRIVATE += -framework Security + OBJECTIVE_SOURCES += \ + access/qnetworkreplynsurlconnectionimpl.mm +} + +include($$PWD/../../3rdparty/zlib_dependency.pri) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 101e1a8c25..980b19b7e4 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -58,6 +58,10 @@ #include "qnetworkreplydataimpl_p.h" #include "qnetworkreplyfileimpl_p.h" +#if defined(Q_OS_IOS) && defined(QT_NO_SSL) +#include "qnetworkreplynsurlconnectionimpl_p.h" +#endif + #include "QtCore/qbuffer.h" #include "QtCore/qurl.h" #include "QtCore/qvector.h" @@ -1159,6 +1163,12 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera } } +// Use NSURLConnection for https on iOS when OpenSSL is disabled. +#if defined(Q_OS_IOS) && defined(QT_NO_SSL) + if (scheme == QLatin1String("https")) + return new QNetworkReplyNSURLConnectionImpl(this, request, op, outgoingData); +#endif + #ifndef QT_NO_HTTP // Since Qt 5 we use the new QNetworkReplyHttpImpl if (scheme == QLatin1String("http") || scheme == QLatin1String("preconnect-http") diff --git a/src/network/access/qnetworkreplynsurlconnectionimpl.mm b/src/network/access/qnetworkreplynsurlconnectionimpl.mm new file mode 100644 index 0000000000..293a505912 --- /dev/null +++ b/src/network/access/qnetworkreplynsurlconnectionimpl.mm @@ -0,0 +1,449 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qnetworkreplynsurlconnectionimpl_p.h" + +#include "QtCore/qdatetime.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +// Network reply implementation using NSUrlConnection. +// +// Class/object structure: +// +// QNetworkReplyNSURLConnectionImpl +// |- QNetworkReplyNSURLConnectionImplPrivate +// |- (bytes read) +// |- (QIODevice and CFStream for async POST data transfer) +// |- NSURLConnection +// |- QtNSURLConnectionDelegate +// |- NSURLResponse/NSHTTPURLResponse +// |- (response data) +// +// The main entry point is the QNetworkReplyNSURLConnectionImpl constructor, which +// receives a network request from QNetworkAccessManager. The constructor +// creates a NSURLRequest and initiates a NSURLConnection with a QtNSURLConnectionDelegate. +// The delegate callbacks are then called asynchronously as the request completes. +// + +@class QtNSURLConnectionDelegate; +class QNetworkReplyNSURLConnectionImplPrivate: public QNetworkReplyPrivate +{ +public: + QNetworkReplyNSURLConnectionImplPrivate(); + virtual ~QNetworkReplyNSURLConnectionImplPrivate(); + + Q_DECLARE_PUBLIC(QNetworkReplyNSURLConnectionImpl) + NSURLConnection * urlConnection; + QtNSURLConnectionDelegate *urlConnectionDelegate; + qint64 bytesRead; + + // Sequental outgiong data streaming + QIODevice *outgoingData; + CFReadStreamRef readStream; + CFWriteStreamRef writeStream; + CFIndex transferBufferSize; + + // Forwarding functions to the public class. + void setFinished(); + void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value); + void setRawHeader(const QByteArray &headerName, const QByteArray &value); + void setError(QNetworkReply::NetworkError errorCode, const QString &errorString); +}; + +@interface QtNSURLConnectionDelegate : NSObject +{ + NSURLResponse *response; + NSMutableData *responseData; + QNetworkReplyNSURLConnectionImplPrivate * replyprivate; +} + +- (id)initWithQNetworkReplyNSURLConnectionImplPrivate:(QNetworkReplyNSURLConnectionImplPrivate *)a_replyPrivate ; +#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_3_0) +- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; +#endif +- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError*)error; +- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse*)response; +- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData*)data; +- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten + totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite; +- (NSCachedURLResponse*)connection:(NSURLConnection*)connection willCacheResponse:(NSCachedURLResponse*)cachedResponse; +- (NSURLRequest*)connection:(NSURLConnection*)connection willSendRequest:(NSURLRequest*)request redirectResponse:(NSURLResponse*)redirectResponse; +- (void)connectionDidFinishLoading:(NSURLConnection*)connection; +- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection*)connection; + +@end + +QNetworkReplyNSURLConnectionImplPrivate::QNetworkReplyNSURLConnectionImplPrivate() + : QNetworkReplyPrivate() + , urlConnection(0) + , urlConnectionDelegate(0) + , bytesRead(0) + , readStream(0) + , writeStream(0) + , transferBufferSize(4096) +{ +} + +QNetworkReplyNSURLConnectionImplPrivate::~QNetworkReplyNSURLConnectionImplPrivate() +{ + [urlConnection release]; + [urlConnectionDelegate release]; + if (readStream) + CFRelease(readStream); + if (writeStream) + CFRelease(writeStream); +} + +void QNetworkReplyNSURLConnectionImplPrivate::setFinished() +{ + q_func()->setFinished(true); +} + +void QNetworkReplyNSURLConnectionImplPrivate::setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value) +{ + q_func()->setHeader(header, value); +} + +void QNetworkReplyNSURLConnectionImplPrivate::setRawHeader(const QByteArray &headerName, const QByteArray &value) +{ + q_func()->setRawHeader(headerName, value); +} + +void QNetworkReplyNSURLConnectionImplPrivate::setError(QNetworkReply::NetworkError errorCode, const QString &errorString) +{ + q_func()->setError(errorCode, errorString); +} + +void QNetworkReplyNSURLConnectionImpl::readyReadOutgoingData() +{ + Q_D(QNetworkReplyNSURLConnectionImpl); + int bytesRead = 0; + do { + char data[d->transferBufferSize]; + bytesRead = d->outgoingData->read(data, d->transferBufferSize); + if (bytesRead <= 0) + break; + CFIndex bytesWritten = CFWriteStreamWrite(d->writeStream, reinterpret_cast(data), bytesRead); + if (bytesWritten != bytesRead) { + CFErrorRef err = CFWriteStreamCopyError(d->writeStream); + qWarning() << "QNetworkReplyNSURLConnectionImpl: CFWriteStreamWrite error" + << (err ? QString::number(CFErrorGetCode(err)) : QStringLiteral("")); + } + } while (bytesRead > 0); + + if (d->outgoingData->atEnd()) + CFWriteStreamClose(d->writeStream); +} + +@interface QtNSURLConnectionDelegate () + +@property (nonatomic, retain) NSURLResponse* response; +@property (nonatomic, retain) NSMutableData* responseData; + +@end + +@implementation QtNSURLConnectionDelegate + +@synthesize response; +@synthesize responseData; + +- (id)initWithQNetworkReplyNSURLConnectionImplPrivate:(QNetworkReplyNSURLConnectionImplPrivate *)a_replyPrivate +{ + if (self = [super init]) + replyprivate = a_replyPrivate; + return self; +} + +- (void)dealloc +{ + [response release]; + [responseData release]; + [super dealloc]; +} + +#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_3_0) +- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge +{ + Q_UNUSED(connection) + Q_UNUSED(challenge) + + if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { + SecTrustRef serverTrust = challenge.protectionSpace.serverTrust; + SecTrustResultType resultType; + SecTrustEvaluate(serverTrust, &resultType); + if (resultType == kSecTrustResultUnspecified) { + // All good + [challenge.sender performDefaultHandlingForAuthenticationChallenge:challenge]; + } else if (resultType == kSecTrustResultRecoverableTrustFailure) { + // Certificate verification error, ask user + // ### TODO actually ask user + // (test site: https://testssl-expire.disig.sk/index.en.html) + qWarning() << "QNetworkReplyNSURLConnection: Certificate verification error handlig is" + << "not implemented. Connection will time out."; + } else { + // other error, which the default handler will handle + [challenge.sender performDefaultHandlingForAuthenticationChallenge:challenge]; + } + } + + [challenge.sender performDefaultHandlingForAuthenticationChallenge:challenge]; +} +#endif + +- (void)connection:(NSURLConnection*)connection didFailWithError:(NSError*)error +{ + Q_UNUSED(connection) + + QNetworkReply::NetworkError qtError = QNetworkReply::UnknownNetworkError; + if ([error domain] == NSURLErrorDomain) { + switch ([error code]) { + case NSURLErrorTimedOut: qtError = QNetworkReply::TimeoutError; break; + case NSURLErrorUnsupportedURL: qtError = QNetworkReply::ProtocolUnknownError; break; + case NSURLErrorCannotFindHost: qtError = QNetworkReply::HostNotFoundError; break; + case NSURLErrorCannotConnectToHost: qtError = QNetworkReply::ConnectionRefusedError; break; + case NSURLErrorNetworkConnectionLost: qtError = QNetworkReply::NetworkSessionFailedError; break; + case NSURLErrorDNSLookupFailed: qtError = QNetworkReply::HostNotFoundError; break; + case NSURLErrorNotConnectedToInternet: qtError = QNetworkReply::NetworkSessionFailedError; break; + case NSURLErrorUserAuthenticationRequired: qtError = QNetworkReply::AuthenticationRequiredError; break; + default: break; + } + } + + replyprivate->setError(qtError, QString::fromNSString([error localizedDescription])); +} + +- (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)aResponse +{ + Q_UNUSED(connection) + self.response = aResponse; + self.responseData = [NSMutableData data]; + + // copy headers + if ([aResponse isKindOfClass:[NSHTTPURLResponse class]]) { + NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)aResponse; + NSDictionary *headers = [httpResponse allHeaderFields]; + for (NSString *key in headers) { + NSString *value = [headers objectForKey:key]; + replyprivate->setRawHeader(QString::fromNSString(key).toUtf8(), QString::fromNSString(value).toUtf8()); + } + } else { + if ([aResponse expectedContentLength] != NSURLResponseUnknownLength) + replyprivate->setHeader(QNetworkRequest::ContentLengthHeader, [aResponse expectedContentLength]); + } + + QMetaObject::invokeMethod(replyprivate->q_func(), "metaDataChanged", Qt::QueuedConnection); +} + +- (void)connection:(NSURLConnection*)connection didReceiveData:(NSData*)data +{ + Q_UNUSED(connection) + [responseData appendData:data]; + + if ([response expectedContentLength] != NSURLResponseUnknownLength) { + QMetaObject::invokeMethod(replyprivate->q_func(), "downloadProgress", Qt::QueuedConnection, + Q_ARG(qint64, qint64([responseData length])), + Q_ARG(qint64, qint64([response expectedContentLength]))); + } + + QMetaObject::invokeMethod(replyprivate->q_func(), "readyRead", Qt::QueuedConnection); +} + +- (void)connection:(NSURLConnection*)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten + totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite +{ + Q_UNUSED(connection) + Q_UNUSED(bytesWritten) + QMetaObject::invokeMethod(replyprivate->q_func(), "uploadProgress", Qt::QueuedConnection, + Q_ARG(qint64, qint64(totalBytesWritten)), + Q_ARG(qint64, qint64(totalBytesExpectedToWrite))); +} + +- (NSCachedURLResponse*)connection:(NSURLConnection*)connection willCacheResponse:(NSCachedURLResponse*)cachedResponse +{ + Q_UNUSED(connection) + return cachedResponse; +} + +- (NSURLRequest*)connection:(NSURLConnection*)connection willSendRequest:(NSURLRequest*)request redirectResponse:(NSURLResponse*)redirectResponse +{ + Q_UNUSED(connection) + Q_UNUSED(redirectResponse) + return request; +} + +- (void)connectionDidFinishLoading:(NSURLConnection*)connection +{ + Q_UNUSED(connection) + replyprivate->setFinished(); + QMetaObject::invokeMethod(replyprivate->q_func(), "finished", Qt::QueuedConnection); +} + +- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection*)connection +{ + Q_UNUSED(connection) + return YES; +} + +@end + +QNetworkReplyNSURLConnectionImpl::~QNetworkReplyNSURLConnectionImpl() +{ +} + +QNetworkReplyNSURLConnectionImpl::QNetworkReplyNSURLConnectionImpl(QObject *parent, + const QNetworkRequest &request, const QNetworkAccessManager::Operation operation, QIODevice* outgoingData) + : QNetworkReply(*new QNetworkReplyNSURLConnectionImplPrivate(), parent) +{ + setRequest(request); + setUrl(request.url()); + setOperation(operation); + QNetworkReply::open(QIODevice::ReadOnly); + + QNetworkReplyNSURLConnectionImplPrivate *d = (QNetworkReplyNSURLConnectionImplPrivate*) d_func(); + + QUrl url = request.url(); + if (url.host() == QLatin1String("localhost")) + url.setHost(QString()); + + if (url.path().isEmpty()) + url.setPath(QLatin1String("/")); + setUrl(url); + + // Create a NSMutableURLRequest from QNetworkRequest + NSMutableURLRequest *nsRequest = [NSMutableURLRequest requestWithURL:request.url().toNSURL() + cachePolicy:NSURLRequestUseProtocolCachePolicy + timeoutInterval:60.0]; + // copy headers + foreach (const QByteArray &header, request.rawHeaderList()) { + QByteArray headerValue = request.rawHeader(header); + [nsRequest addValue:QString::fromUtf8(headerValue).toNSString() + forHTTPHeaderField:QString::fromUtf8(header).toNSString()]; + } + + if (operation == QNetworkAccessManager::GetOperation) + [nsRequest setHTTPMethod:@"GET"]; + else if (operation == QNetworkAccessManager::PostOperation) + [nsRequest setHTTPMethod:@"POST"]; + else if (operation == QNetworkAccessManager::PutOperation) + [nsRequest setHTTPMethod:@"PUT"]; + else if (operation == QNetworkAccessManager::DeleteOperation) + [nsRequest setHTTPMethod:@"DELETE"]; + else + qWarning() << "QNetworkReplyNSURLConnection: Unsupported netork operation" << operation; + + if (outgoingData) { + d->outgoingData = outgoingData; + if (outgoingData->isSequential()) { + // set up streaming from outgoingData iodevice to request + CFStreamCreateBoundPair(kCFAllocatorDefault, &d->readStream, &d->writeStream, d->transferBufferSize); + CFWriteStreamOpen(d->writeStream); + [nsRequest setHTTPBodyStream:reinterpret_cast(d->readStream)]; + connect(outgoingData, SIGNAL(readyRead()), this, SLOT(readyReadOutgoingData())); + readyReadOutgoingData(); + } else { + // move all data at once + QByteArray data = outgoingData->readAll(); + [nsRequest setHTTPBody:[NSData dataWithBytes:data.constData() length:data.length()]]; + } + } + + // Create connection + d->urlConnectionDelegate = [[QtNSURLConnectionDelegate alloc] initWithQNetworkReplyNSURLConnectionImplPrivate:d]; + d->urlConnection = [[NSURLConnection alloc] initWithRequest:nsRequest delegate:d->urlConnectionDelegate]; + if (!d->urlConnection) { + // ### what type of error is an initWithRequest fail? + setError(QNetworkReply::ProtocolUnknownError, QStringLiteral("QNetworkReplyNSURLConnection internal error")); + } +} + +void QNetworkReplyNSURLConnectionImpl::close() +{ + // No-op? Network ops should continue (especially POSTs) + QNetworkReply::close(); +} + +void QNetworkReplyNSURLConnectionImpl::abort() +{ + Q_D(QNetworkReplyNSURLConnectionImpl); + [d->urlConnection cancel]; + QNetworkReply::close(); +} + +qint64 QNetworkReplyNSURLConnectionImpl::bytesAvailable() const +{ + Q_D(const QNetworkReplyNSURLConnectionImpl); + qint64 available = QNetworkReply::bytesAvailable() + + [[d->urlConnectionDelegate responseData] length] - + d->bytesRead; + + return available; +} + +bool QNetworkReplyNSURLConnectionImpl::isSequential() const +{ + return true; +} + +qint64 QNetworkReplyNSURLConnectionImpl::size() const +{ + Q_D(const QNetworkReplyNSURLConnectionImpl); + return [[d->urlConnectionDelegate responseData] length]; +} + +/*! + \internal +*/ +qint64 QNetworkReplyNSURLConnectionImpl::readData(char *data, qint64 maxlen) +{ + Q_D(QNetworkReplyNSURLConnectionImpl); + qint64 dataSize = [[d->urlConnectionDelegate responseData] length]; + qint64 canRead = qMin(maxlen, dataSize - d->bytesRead); + const char *sourceBase = static_cast([[d->urlConnectionDelegate responseData] bytes]); + memcpy(data, sourceBase + d->bytesRead, canRead); + d->bytesRead += canRead; + return canRead; +} + +QT_END_NAMESPACE diff --git a/src/network/access/qnetworkreplynsurlconnectionimpl_p.h b/src/network/access/qnetworkreplynsurlconnectionimpl_p.h new file mode 100644 index 0000000000..967eb13246 --- /dev/null +++ b/src/network/access/qnetworkreplynsurlconnectionimpl_p.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNETWORKREPLYNSURLCONNECTIONIMPL_H +#define QNETWORKREPLYNSURLCONNECTIONIMPL_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the Network Access API. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include "qnetworkreply.h" +#include "qnetworkreply_p.h" +#include "qnetworkaccessmanager.h" +#include +#include + +QT_BEGIN_NAMESPACE + + +class QNetworkReplyNSURLConnectionImplPrivate; +class QNetworkReplyNSURLConnectionImpl: public QNetworkReply +{ + Q_OBJECT +public: + QNetworkReplyNSURLConnectionImpl(QObject *parent, const QNetworkRequest &req, const QNetworkAccessManager::Operation op, QIODevice* outgoingData); + virtual ~QNetworkReplyNSURLConnectionImpl(); + virtual void abort(); + + // reimplemented from QNetworkReply + virtual void close(); + virtual qint64 bytesAvailable() const; + virtual bool isSequential () const; + qint64 size() const; + + virtual qint64 readData(char *data, qint64 maxlen); +public Q_SLOTS: + void readyReadOutgoingData(); + + Q_DECLARE_PRIVATE(QNetworkReplyNSURLConnectionImpl) +}; + +QT_END_NAMESPACE + +#endif // QNetworkReplyNSURLConnectionImpl_H -- cgit v1.2.3 From dd262dc7f5c02ffaaa965815a9ccc8978efdbabf Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 8 Nov 2013 11:27:15 +0100 Subject: Revert "Fix setVisible() of QWidget has no effect in QTreeWidgetItem" It introduces QTBUG-34653 (Qt Designer widget box no longer repainted after collapsing items or using the filter). This reverts commit 04de24c6449422d29a0d4760375aa94f59222fa3. Task-number: QTBUG-13522 Task-number: QTBUG-34653 Change-Id: Ieb9766e7f15acea901fce4ad7142aa72557b9957 Reviewed-by: Giuseppe D'Angelo --- src/widgets/itemviews/qabstractitemview.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index ef7207229c..fd704e479b 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -2637,8 +2637,7 @@ void QAbstractItemView::updateEditorGeometries() if (index.isValid() && editor) { option.rect = visualRect(index); if (option.rect.isValid()) { - if (!editor->isHidden()) - editor->show(); + editor->show(); QAbstractItemDelegate *delegate = d->delegateForIndex(index); if (delegate) delegate->updateEditorGeometry(editor, option, index); -- cgit v1.2.3 From 2ee97f505b29a8539685885a239477d4417cc76a Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 3 Nov 2013 13:59:36 +0100 Subject: Fix QVariant::canConvert with longlong MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add few cases where conversion to or from LongLong was missing We need to make it work if we want to use variant.canConvert [ChangeLog][QtCore][QVariant] Fixed QVariant::canConvert with longlong Change-Id: I0f65073802b62d99250601dd90a8cd2e4d934b60 Reviewed-by: Jędrzej Nowacki --- src/corelib/kernel/qvariant.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 816c34a14d..21743f99d4 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2888,6 +2888,8 @@ bool QVariant::canConvert(int targetTypeId) const return true; // fall through case QVariant::UInt: + case QVariant::LongLong: + case QVariant::ULongLong: return currentType == QMetaType::ULong || currentType == QMetaType::Long || currentType == QMetaType::UShort -- cgit v1.2.3 From 34d21610ba72ea775d47619c08086f8bb0e7160b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 3 Nov 2013 14:17:15 +0100 Subject: QVariant: Convert automatically from enum types to integral types. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ChangeLog][QtCore][QVariant] Variant containing enum types can now be converted to integer Change-Id: Ibbbc9ae29ab45d67c582fa2d406afc19c5dc41ce Reviewed-by: Thiago Macieira Reviewed-by: Jędrzej Nowacki --- src/corelib/kernel/qvariant.cpp | 57 ++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 21743f99d4..69cfa7888f 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2013 Olivier Goffart ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -221,6 +222,19 @@ static qlonglong qConvertToNumber(const QVariant::Private *d, bool *ok) return qlonglong(qMetaTypeUNumber(d)); } + if (QMetaType::typeFlags(d->type) & QMetaType::IsEnumeration) { + switch (QMetaType::sizeOf(d->type)) { + case 1: + return d->is_shared ? *reinterpret_cast(d->data.shared->ptr) : d->data.sc; + case 2: + return d->is_shared ? *reinterpret_cast(d->data.shared->ptr) : d->data.s; + case 4: + return d->is_shared ? *reinterpret_cast(d->data.shared->ptr) : d->data.i; + case 8: + return d->is_shared ? *reinterpret_cast(d->data.shared->ptr) : d->data.ll; + } + } + *ok = false; return Q_INT64_C(0); } @@ -256,6 +270,19 @@ static qulonglong qConvertToUnsignedNumber(const QVariant::Private *d, bool *ok) return qMetaTypeUNumber(d); } + if (QMetaType::typeFlags(d->type) & QMetaType::IsEnumeration) { + switch (QMetaType::sizeOf(d->type)) { + case 1: + return d->is_shared ? *reinterpret_cast(d->data.shared->ptr) : d->data.uc; + case 2: + return d->is_shared ? *reinterpret_cast(d->data.shared->ptr) : d->data.us; + case 4: + return d->is_shared ? *reinterpret_cast(d->data.shared->ptr) : d->data.u; + case 8: + return d->is_shared ? *reinterpret_cast(d->data.shared->ptr) : d->data.ull; + } + } + *ok = false; return Q_UINT64_C(0); } @@ -888,15 +915,13 @@ static bool customCompare(const QVariant::Private *a, const QVariant::Private *b static bool customConvert(const QVariant::Private *d, int t, void *result, bool *ok) { if (d->type >= QMetaType::User || t >= QMetaType::User) { - const bool isOk = QMetaType::convert(constData(*d), d->type, result, t); - if (ok) - *ok = isOk; - return isOk; + if (QMetaType::convert(constData(*d), d->type, result, t)) { + if (ok) + *ok = true; + return true; + } } - - if (ok) - *ok = false; - return false; + return convert(d, t, result, ok); } #if !defined(QT_NO_DEBUG_STREAM) @@ -2854,8 +2879,13 @@ bool QVariant::canConvert(int targetTypeId) const if (targetTypeId < 0) return false; - if (targetTypeId >= QMetaType::User) - return canConvertMetaObject(currentType, targetTypeId, d.data.o); + if (targetTypeId >= QMetaType::User) { + if (QMetaType::typeFlags(targetTypeId) & QMetaType::IsEnumeration) { + targetTypeId = QMetaType::Int; + } else { + return canConvertMetaObject(currentType, targetTypeId, d.data.o); + } + } if (currentType == QMetaType::QJsonValue) { switch (targetTypeId) { @@ -2896,7 +2926,8 @@ bool QVariant::canConvert(int targetTypeId) const || currentType == QMetaType::UChar || currentType == QMetaType::Char || currentType == QMetaType::SChar - || currentType == QMetaType::Short; + || currentType == QMetaType::Short + || QMetaType::typeFlags(currentType) & QMetaType::IsEnumeration; case QVariant::Image: return currentType == QVariant::Pixmap || currentType == QVariant::Bitmap; case QVariant::Pixmap: @@ -2925,7 +2956,9 @@ bool QVariant::canConvert(int targetTypeId) const case QMetaType::ULong: case QMetaType::Short: case QMetaType::UShort: - return qCanConvertMatrix[QVariant::Int] & (1 << currentType) || currentType == QVariant::Int; + return qCanConvertMatrix[QVariant::Int] & (1 << currentType) + || currentType == QVariant::Int + || QMetaType::typeFlags(currentType) & QMetaType::IsEnumeration; case QMetaType::QObjectStar: return canConvertMetaObject(currentType, targetTypeId, d.data.o); default: -- cgit v1.2.3 From 7a78a22e651453e9204438fb2f202321797ca7bd Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 8 Nov 2013 14:44:46 +0100 Subject: Prevent clang from warning about unused variables Fixes a compiler warning introduced by 79b975756a100cc46182 Change-Id: Ie9bc677d061f0bb0530eae88715069042b2ab440 Reviewed-by: hjk Reviewed-by: Shawn Rutledge --- src/corelib/io/qloggingcategory.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index 10f7a9bbeb..93a98b1835 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -115,6 +115,9 @@ QLoggingCategory::QLoggingCategory(const char *category) enabledWarning(true), enabledCritical(true) { + Q_UNUSED(d); + Q_UNUSED(placeholder); + bool isDefaultCategory = (category == 0) || (strcmp(category, qtDefaultCategoryName) == 0); -- cgit v1.2.3 From 706eeadf3aa226ea02496c352006b26abe791f07 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Thu, 7 Nov 2013 00:24:20 +0800 Subject: Doc: Move threading overviews from qtbase.git to qtdoc.git - This topic is relevant to multiple modules, as illustrated by the "Thread-Support in Qt Modules" page. Multithreading can be done in both C++ and QML. - Moving also fixes links to QML-related pages. - Snippets are copied, not moved. QThreadStorage docs need them. - QDoc: "DEPENDS += qtdoc" added to keep the "\reentrant" command working. It creates a link to the "reentrant" keyword. Change-Id: I2cdf6139e62d66911561c30fcca7aab160a694b1 Reviewed-by: Jerome Pasion --- src/corelib/doc/images/threadsandobjects.png | Bin 66096 -> 0 bytes src/corelib/doc/images/threadvisual-example.png | Bin 16823 -> 0 bytes src/corelib/doc/src/threads-basics.qdoc | 244 ------- src/corelib/doc/src/threads.qdoc | 828 ------------------------ src/xml/doc/qtxml.qdocconf | 2 +- 5 files changed, 1 insertion(+), 1073 deletions(-) delete mode 100644 src/corelib/doc/images/threadsandobjects.png delete mode 100644 src/corelib/doc/images/threadvisual-example.png delete mode 100644 src/corelib/doc/src/threads-basics.qdoc delete mode 100644 src/corelib/doc/src/threads.qdoc (limited to 'src') diff --git a/src/corelib/doc/images/threadsandobjects.png b/src/corelib/doc/images/threadsandobjects.png deleted file mode 100644 index 8357d2532a..0000000000 Binary files a/src/corelib/doc/images/threadsandobjects.png and /dev/null differ diff --git a/src/corelib/doc/images/threadvisual-example.png b/src/corelib/doc/images/threadvisual-example.png deleted file mode 100644 index 2a49874719..0000000000 Binary files a/src/corelib/doc/images/threadvisual-example.png and /dev/null differ diff --git a/src/corelib/doc/src/threads-basics.qdoc b/src/corelib/doc/src/threads-basics.qdoc deleted file mode 100644 index 2206899460..0000000000 --- a/src/corelib/doc/src/threads-basics.qdoc +++ /dev/null @@ -1,244 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** 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. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page thread-basics.html - \ingroup tutorials - \startpage {index.html}{Qt Reference Documentation} - - \title Threading Basics - \brief An introduction to threads - - \section1 What Are Threads? - - Threads are about doing things in parallel, just like processes. So how do - threads differ from processes? While you are making calculations on a - spreadsheet, there may also be a media player running on the same desktop - playing your favorite song. Here is an example of two processes working in - parallel: one running the spreadsheet program; one running a media player. - Multitasking is a well known term for this. A closer look at the media - player reveals that there are again things going on in parallel within one - single process. While the media player is sending music to the audio driver, - the user interface with all its bells and whistles is being constantly - updated. This is what threads are for -- concurrency within one single - process. - - So how is concurrency implemented? Parallel work on single core CPUs is an - illusion which is somewhat similar to the illusion of moving images in - cinema. - For processes, the illusion is produced by interrupting the processor's - work on one process after a very short time. Then the processor moves on to - the next process. In order to switch between processes, the current program - counter is saved and the next processor's program counter is loaded. This - is not sufficient because the same needs to be done with registers and - certain architecture and OS specific data. - - Just as one CPU can power two or more processes, it is also possible to let - the CPU run on two different code segments of one single process. When a - process starts, it always executes one code segment and therefore the - process is said to have one thread. However, the program may decide to - start a second thread. Then, two different code sequences are processed - simultaneously inside one process. Concurrency is achieved on single core - CPUs by repeatedly saving program counters and registers then loading the - next thread's program counters and registers. No cooperation from the - program is required to cycle between the active threads. A thread may be in - any state when the switch to the next thread occurs. - - The current trend in CPU design is to have several cores. A typical - single-threaded application can make use of only one core. However, a - program with multiple threads can be assigned to multiple cores, making - things happen in a truly concurrent way. As a result, distributing work - to more than one thread can make a program run much faster on multicore - CPUs because additional cores can be used. - - \section2 GUI Thread and Worker Thread - - As mentioned, each program has one thread when it is started. This thread - is called the "main thread" (also known as the "GUI thread" in Qt - applications). The Qt GUI must run in this thread. All widgets and several - related classes, for example QPixmap, don't work in secondary threads. - A secondary thread is commonly referred to as a "worker thread" because it - is used to offload processing work from the main thread. - - \section2 Simultaneous Access to Data - - Each thread has its own stack, which means each thread has its own call - history and local variables. Unlike processes, threads share the same - address space. The following diagram shows how the building blocks of - threads are located in memory. Program counter and registers of inactive - threads are typically kept in kernel space. There is a shared copy of the - code and a separate stack for each thread. - - \image threadvisual-example.png "Thread visualization" - - If two threads have a pointer to the same object, it is possible that both - threads will access that object at the same time and this can potentially - destroy the object's integrity. It's easy to imagine the many things that - can go wrong when two methods of the same object are executed - simultaneously. - - Sometimes it is necessary to access one object from different threads; - for example, when objects living in different threads need to communicate. - Since threads use the same address space, it is easier and faster for - threads to exchange data than it is for processes. Data does not have to be - serialized and copied. Passing pointers is possible, but there must be a - strict coordination of what thread touches which object. Simultaneous - execution of operations on one object must be prevented. There are several - ways of achieving this and some of them are described below. - - So what can be done safely? All objects created in a thread can be used - safely within that thread provided that other threads don't have references - to them and objects don't have implicit coupling with other threads. Such - implicit coupling may happen when data is shared between instances as with - static members, singletons or global data. Familiarize yourself with the - concept of \l{Reentrancy and Thread-Safety}{thread safe and reentrant} - classes and functions. - - \section1 Using Threads - - There are basically two use cases for threads: - - \list - \li Make processing faster by making use of multicore processors. - \li Keep the GUI thread or other time critical threads responsive by - offloading long lasting processing or blocking calls to other threads. - \endlist - - \section2 When to Use Alternatives to Threads - - Developers need to be very careful with threads. It is easy to start other - threads, but very hard to ensure that all shared data remains consistent. - Problems are often hard to find because they may only show up once in a - while or only on specific hardware configurations. Before creating threads - to solve certain problems, possible alternatives should be considered. - - \table - \header - \li Alternative - \li Comment - \row - \li QEventLoop::processEvents() - \li Calling QEventLoop::processEvents() repeatedly during a - time-consuming calculation prevents GUI blocking. However, this - solution doesn't scale well because the call to processEvents() may - occur too often, or not often enough, depending on hardware. - \row - \li QTimer - \li Background processing can sometimes be done conveniently using a - timer to schedule execution of a slot at some point in the future. - A timer with an interval of 0 will time out as soon as there are no - more events to process. - \row - \li QSocketNotifier QNetworkAccessManager QIODevice::readyRead() - \li This is an alternative to having one or multiple threads, each with - a blocking read on a slow network connection. As long as the - calculation in response to a chunk of network data can be executed - quickly, this reactive design is better than synchronous waiting in - threads. Reactive design is less error prone and energy efficient - than threading. In many cases there are also performance benefits. - \endtable - - In general, it is recommended to only use safe and tested paths and to - avoid introducing ad-hoc threading concepts. The QtConcurrent module provides an easy - interface for distributing work to all of the processor's cores. The - threading code is completely hidden in the QtConcurrent framework, so you - don't have to take care of the details. However, QtConcurrent can't be used - when communication with the running thread is needed, and it shouldn't be - used to handle blocking operations. - - \section2 Which Qt Thread Technology Should You Use? - - See the \l{Multithreading Technologies in Qt} page for an introduction to the - different approaches to multithreading to Qt, and for guidelines on how to - choose among them. - - - \section1 Qt Thread Basics - - The following sections describe how QObjects interact with threads, how - programs can safely access data from multiple threads, and how asynchronous - execution produces results without blocking a thread. - - \section2 QObject and Threads - - As mentioned above, developers must always be careful when calling objects' - methods from other threads. \l{QObject#Thread Affinity}{Thread affinity} - does not change this situation. - Qt documentation marks several methods as thread-safe. - \l{QCoreApplication::}{postEvent()} is a noteworthy example. A thread-safe - method may be called from different threads simultaneously. - - In cases where there is usually no concurrent access to methods, calling - non-thread-safe methods of objects in other threads may work thousands - of times before a concurrent access occurs, causing unexpected behavior. - Writing test code does not entirely ensure thread correctness, but it is - still important. - On Linux, Valgrind and Helgrind can help detect threading errors. - - \section2 Protecting the Integrity of Data - - When writing a multithread application, extra care must be taken to avoid - data corruption. See \l{Synchronizing Threads} for a discussion on how to - use threads safely. - - \section2 Dealing with Asynchronous Execution - - One way to obtain a worker thread's result is by waiting for the thread - to terminate. In many cases, however, a blocking wait isn't acceptable. The - alternative to a blocking wait are asynchronous result deliveries with - either posted events or queued signals and slots. This generates a certain - overhead because an operation's result does not appear on the next source - line, but in a slot located somewhere else in the source file. Qt - developers are used to working with this kind of asynchronous behavior - because it is much similar to the kind of event-driven programming used in - GUI applications. - - \section1 Examples - - Qt comes with several examples for using threads. See the class references - for QThread and QThreadPool for simple examples. See the \l{Threading and - Concurrent Programming Examples} page for more advanced ones. - - \section1 Digging Deeper - - Threading is a very complicated subject. Qt offers more classes for - threading than we have presented in this tutorial. The following materials - can help you go into the subject in more depth: - - \list - \li Good video tutorials about threads with Qt can be found in the material - from the \l{Training Day at Qt Developer Days 2009}. - \li The \l{Thread Support in Qt} document is a good starting point into - the reference documentation. - \li Qt comes with several additional examples for - \l{Threading and Concurrent Programming Examples}{QThread and QtConcurrent}. - \li Several good books describe how to work with Qt threads. The most - extensive coverage can be found in \e{Advanced Qt Programming} by Mark - Summerfield, Prentice Hall - roughly 70 of 500 pages cover QThread and - QtConcurrent. - \endlist -*/ diff --git a/src/corelib/doc/src/threads.qdoc b/src/corelib/doc/src/threads.qdoc deleted file mode 100644 index efed33106a..0000000000 --- a/src/corelib/doc/src/threads.qdoc +++ /dev/null @@ -1,828 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** 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. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \group thread - \title Threading Classes - - These \l{Qt Core} classes provide threading support to applications. - The \l{Thread Support in Qt} page covers how to use these classes. -*/ - -/*! - \page threads.html - \title Thread Support in Qt - \ingroup qt-basic-concepts - \brief A detailed discussion of thread handling in Qt. - - \ingroup frameworks-technologies - - \nextpage Multithreading Technologies in Qt - - Qt provides thread support in the form of platform-independent - threading classes, a thread-safe way of posting events, and - signal-slot connections across threads. This makes it easy to - develop portable multithreaded Qt applications and take advantage - of multiprocessor machines. Multithreaded programming is also a - useful paradigm for performing time-consuming operations without - freezing the user interface of an application. - - Earlier versions of Qt offered an option to build the library - without thread support. Since Qt 4.0, threads are always enabled. - - \section1 Topics: - - \list - \li \l{Recommended Reading} - \li \l{The Threading Classes} - \li \l{Multithreading Technologies in Qt} - \li \l{Synchronizing Threads} - \li \l{Reentrancy and Thread-Safety} - \li \l{Threads and QObjects} - \li \l{Thread-Support in Qt Modules} - \endlist - - \section1 Recommended Reading - - This document is intended for an audience that has knowledge of, - and experience with, multithreaded applications. If you are new - to threading see our Recommended Reading list: - - \list - \li \l {http://www.amazon.com/Threads-Primer-Guide-Multithreaded-Programming/dp/0134436989}{Threads Primer: A Guide to Multithreaded Programming} - \li \l {http://www.amazon.com/Thread-Time-MultiThreaded-Programming-Guide/dp/0131900676}{Thread Time: The Multithreaded Programming Guide} - \li \l {http://www.amazon.com/Pthreads-Programming-Standard-Multiprocessing-Nutshell/dp/1565921151a}{Pthreads Programming: A POSIX Standard for Better Multiprocessing} - \li \l {http://www.amazon.com/WIN32-Multithreaded-Programming-Aaron-Cohen/dp/1565922964}{Win32 Multithreaded Programming} - \endlist - - \section1 The Threading Classes - - These classes are relevant to threaded applications. - - \annotatedlist thread - -\omit - \list - \li QThread provides the means to start a new thread. - \li QThreadStorage provides per-thread data storage. - \li QThreadPool manages a pool of threads that run QRunnable objects. - \li QRunnable is an abstract class representing a runnable object. - \li QMutex provides a mutual exclusion lock, or mutex. - \li QMutexLocker is a convenience class that automatically locks - and unlocks a QMutex. - \li QReadWriteLock provides a lock that allows simultaneous read access. - \li QReadLocker and QWriteLocker are convenience classes that automatically - lock and unlock a QReadWriteLock. - \li QSemaphore provides an integer semaphore (a generalization of a mutex). - \li QWaitCondition provides a way for threads to go to sleep until - woken up by another thread. - \li QAtomicInt provides atomic operations on integers. - \li QAtomicPointer provides atomic operations on pointers. - \endlist -\endomit - - \note Qt's threading classes are implemented with native threading APIs; - e.g., Win32 and pthreads. Therefore, they can be used with threads of the - same native API. -*/ - -/*! - \page threads-technologies.html - \title Multithreading Technologies in Qt - \ingroup qt-basic-concepts - \brief An overview and comparison of different ways to use threads in Qt. - - \ingroup frameworks-technologies - - \contentspage Thread Support in Qt - \previouspage Thread Support in Qt - \nextpage Synchronizing Threads - - Qt offers many classes and functions for working with threads. Below are - four different approaches that Qt programmers can use to implement - multithreaded applications. - - - \section1 QThread: Low-Level API with Optional Event Loops - - QThread is the foundation of all thread control in Qt. Each QThread - instance represents and controls one thread. - - QThread can either be instantiated directly or subclassed. Instantiating a - QThread provides a parallel event loop, allowing QObject slots to be invoked - in a secondary thread. Subclassing a QThread allows the application to initialize - the new thread before starting its event loop, or to run parallel code - without an event loop. - - See the \l{QThread}{QThread class reference} and the \l{Threading and - Concurrent Programming Examples}{threading examples} for demonstrations on - how to use QThread. - - - \section1 QThreadPool and QRunnable: Reusing Threads - - Creating and destroying threads frequently can be expensive. To reduce this - overhead, existing threads can be reused for new tasks. QThreadPool is a - collection of reuseable QThreads. - - To run code in one of a QThreadPool's threads, reimplement QRunnable::run() - and instantiate the subclassed QRunnable. Use QThreadPool::start() to put - the QRunnable in the QThreadPool's run queue. When a thread becomes available, - the code within QRunnable::run() will execute in that thread. - - Each Qt application has a global thread pool, which is accessible through - QThreadPool::globalInstance(). This global thread pool automatically maintains - an optimal number of threads based on the number of cores in the CPU. However, - a separate QThreadPool can be created and managed explicitly. - - - \section1 Qt Concurrent: Using a High-level API - - The \l{Qt Concurrent} module provides high-level functions that deal with some - common parallel computation patterns: map, filter, and reduce. Unlike using - QThread and QRunnable, these functions never require the use of \l{Synchronizing - Threads#Low-Level Synchronization Primitives}{low-level threading primitives} - such as mutexes or semaphores. Instead, they return a QFuture object which can - be used to retrieve the functions' results when they are ready. QFuture can - also be used to query computation progress and to pause/resume/cancel the - computation. For convenience, QFutureWatcher enables interactions with - \l{QFuture}s via signals and slots. - - \l{Qt Concurrent}'s map, filter and reduce algorithms automatically distribute - computation across all available processor cores, so applications written today - will continue to scale when deployed later on a system with more cores. - - This module also provides the QtConcurrent::run() function, which can run any - function in another thread. However, QtConcurrent::run() only supports a subset - of features available to the map, filter and reduce functions. The QFuture - can be used to retrieve the function's return value and to check if the thread - is running. However, a call to QtConcurrent::run() uses one thread only, cannot - be paused/resumed/canceled, and cannot be queried for progress. - - See the \l{Qt Concurrent} module documentation for details on the individual functions. - - - \section1 WorkerScript: Threading in QML - - The WorkerScript QML type lets JavaScript code run in parallel with the GUI - thread. - - Each WorkerScript instance can have one \c{.js} script attached to it. When - WorkerScript::sendMessage() is called, the script will run in a separate thread - (and a separate \l{QQmlContext}{QML context}). When the script finishes - running, it can send a reply back to the GUI thread which will invoke the - WorkerScript::onMessage() signal handler. - - Using a WorkerScript is similar to using a worker QObject that has been moved - to another thread. Data is transferred between threads via signals. - - See the WorkerScript documentation for details on how to implement the script, - and for a list of data types that can be passed between threads. - - - \section1 Choosing an Appropriate Approach - - As demonstrated above, Qt provides different solutions for developing threaded - applications. The right solution for a given application depends on the purpose - of the new thread and the thread's lifetime. Below is a comparison of Qt's - threading technologies, followed by recommended solutions for some example use cases. - - \section2 Comparison of Solutions - - \table - \header - \li Feature - \li QThread - \li QRunnable and QThreadPool - \li QtConcurrent::run() - \li Qt Concurrent (Map, Filter, Reduce) - \li WorkerScript - \row - \li API - \li C++ - \li C++ - \li C++ - \li C++ - \li QML - \row - \li Thread priority can be specified - \li Yes - \li Yes - \li - \li - \li - \row - \li Thread can run an event loop - \li Yes - \li - \li - \li - \li - \row - \li Thread can receive data updates through signals - \li Yes (received by a worker QObject) - \li - \li - \li - \li Yes (received by WorkerScript) - \row - \li Thread can be controlled using signals - \li Yes (received by QThread) - \li - \li - \li Yes (received by QFutureWatcher) - \li - \row - \li Thread can be monitored through a QFuture - \li - \li - \li Partially - \li Yes - \li - \row - \li Built-in ability to pause/resume/cancel - \li - \li - \li - \li Yes - \li - \endtable - - - \section2 Example Use Cases - - \table - \header - \li Lifetime of thread - \li Operation - \li Solution - \row - \li One call - \li Run a new linear function within another thread, optionally with progress - updates during the run. - \li Qt provides different solutions: - \list - \li Place the function in a reimplementation of QThread::run() and - start the QThread. Emit signals to update progress. OR - \li Place the function in a reimplementation of QRunnable::run() and - add the QRunnable to a QThreadPool. Write to a \l{Synchronizing - Threads}{thread-safe variable} to update progress. OR - \li Run the function using QtConcurrent::run(). Write to a \l{Synchronizing - Threads}{thread-safe variable} to update progress. - \endlist - \row - \li One call - \li Run an existing function within another thread and get its return value. - \li Run the function using QtConcurrent::run(). Have a QFutureWatcher emit - the \l{QFutureWatcher::}{finished()} signal when the function has - returned, and call QFutureWatcher::result() to get the function's return - value. - \row - \li One call - \li Perform an operation on all items of a container, using all available - cores. For example, producing thumbnails from a list of images. - \li Use Qt Concurrent's \l{QtConcurrent::}{filter()} function to select - container elements, and the \l{QtConcurrent::}{map()} function to apply - an operation to each element. To fold the output into a single result, - use \l{QtConcurrent::}{filteredReduced()} and - \l{QtConcurrent::}{mappedReduced()} instead. - \row - \li One call/Permanent - \li Perfrom a long computation in a pure QML application, and update the GUI - when the results are ready. - \li Place the computation code in a \c{.js} script and attach it to a - WorkerScript instance. Call \l{WorkerScript::}{sendMessage()} to start the - computation in a new thread. Let the script call WorkerScript::sendMessage() - too, to pass the result back to the GUI thread. Handle the result in - \l{WorkerScript::}{onMessage} and update the GUI there. - \row - \li Permanent - \li Have an object living in another thread that can perform different - tasks upon request and/or can receive new data to work with. - \li Subclass a QObject to create a worker. Instantiate this worker object - and a QThread. Move the worker to the new thread. Send commands or - data to the worker object over queued signal-slot connections. - \row - \li Permanent - \li Repeatedly perform an expensive operation in another thread, where the - thread does not need to receive any signals or events. - \li Write the infinite loop directly within a reimplementation of QThread::run(). - Start the thread without an event loop. Let the thread emit signals to - send data back to the GUI thread. - \endtable -*/ - -/*! - \page threads-synchronizing.html - \title Synchronizing Threads - - \previouspage Multithreading Technologies in Qt - \contentspage Thread Support in Qt - \nextpage Reentrancy and Thread-Safety - - While the purpose of threads is to allow code to run in parallel, - there are times where threads must stop and wait for other - threads. For example, if two threads try to write to the same - variable simultaneously, the result is undefined. The principle of - forcing threads to wait for one another is called \e{mutual exclusion}. - It is a common technique for protecting shared resources such as data. - - Qt provides low-level primitives as well as high-level mechanisms - for synchronizing threads. - - \section1 Low-Level Synchronization Primitives - - QMutex is the basic class for enforcing mutual exclusion. A thread - locks a mutex in order to gain access to a shared resource. If a second - thread tries to lock the mutex while it is already locked, the second - thread will be put to sleep until the first thread completes its task - and unlocks the mutex. - - QReadWriteLock is similar to QMutex, except that it distinguishes - between "read" and "write" access. When a piece of data is not being - written to, it is safe for multiple threads to read from it simultaneously. - A QMutex forces multiple readers to take turns to read shared data, but a - QReadWriteLock allows simultaneous reading, thus improving parallelism. - - QSemaphore is a generalization of QMutex that protects a certain - number of identical resources. In contrast, a QMutex protects - exactly one resource. The \l{Semaphores Example} shows a typical application - of semaphores: synchronizing access to a circular buffer between a producer - and a consumer. - - QWaitCondition synchronizes threads not by enforcing mutual exclusion but by - providing a \e{condition variable}. While the other primitives make threads - wait until a resource is unlocked, QWaitCondition makes threads wait until a - particular condition has been met. To allow the waiting threads to proceed, - call \l{QWaitCondition::wakeOne()}{wakeOne()} to wake one randomly - selected thread or \l{QWaitCondition::wakeAll()}{wakeAll()} to wake them all - simultaneously. The \l{Wait Conditions Example} shows how to solve the - producer-consumer problem using QWaitCondition instead of QSemaphore. - - \note Qt's synchronization classes rely on the use of properly - aligned pointers. For instance, you cannot use packed classes with - MSVC. - - These synchronization classes can be used to make a method thread safe. - However, doing so incurs a performance penalty, which is why most Qt methods - are not made thread safe. - - \section2 Risks - - If a thread locks a resource but does not unlock it, the application may - freeze because the resource will become permanently unavailable to other threads. - This can happen, for example, if an exception is thrown and forces the current - function to return without releasing its lock. - - Another similar scenario is a \e{deadlock}. For example, suppose that - thread A is waiting for thread B to unlock a resource. If thread B is also - waiting for thread A to unlock a different resource, then both threads will - end up waiting forever, so the application will freeze. - - \section2 Convenience classes - - QMutexLocker, QReadLocker and QWriteLocker are convenience classes that make it - easier to use QMutex and QReadWriteLock. They lock a resource when they are - constructed, and automatically unlock it when they are destroyed. They are - designed to simplify code that use QMutex and QReadWriteLock, thus reducing - the chances that a resource becomes permanently locked by accident. - - \section1 High-Level Event Queues - - Qt's \l{The Event System}{event system} is very useful for inter-thread - communication. Every thread may have its own event loop. To call a slot (or - any \l{Q_INVOKABLE}{invokable} method) in another thread, place that call in - the target thread's event loop. This lets the target thread finish its current - task before the slot starts running, while the original thread continues - running in parallel. - - To place an invocation in an event loop, make a queued \l{Signals & Slots} - {signal-slot} connection. Whenever the signal is emitted, its arguments will - be recorded by the event system. The thread that the signal receiver - \l{QObject#Thread Affinity}{lives in} will then run the slot. Alternatively, - call QMetaObject::invokeMethod() to achieve the same effect without signals. - In both cases, a \l{Qt::QueuedConnection}{queued connection} must be used - because a \l{Qt::DirectConnection}{direct connection} bypasses the event - system and runs the method immediately in the current thread. - - There is no risk of deadlocks when using the event system for thread - synchronization, unlike using low-level primitives. However, the event system - does not enforce mutual exclusion. If invokable methods access shared data, - they must still be protected with low-level primitives. - - Having said that, Qt's event system, along with \l{Implicit Sharing}{implicitly - shared} data structures, offers an alternative to traditional thread locking. - If signals and slots are used exclusively and no variables are shared between - threads, a multithreaded program can do without low-level primitives altogether. - - \sa QThread::exec(), {Threads and QObjects} -*/ - -/*! - \page threads-reentrancy.html - \title Reentrancy and Thread-Safety - - \keyword reentrant - \keyword thread-safe - - \previouspage Synchronizing Threads - \contentspage Thread Support in Qt - \nextpage Threads and QObjects - - Throughout the documentation, the terms \e{reentrant} and - \e{thread-safe} are used to mark classes and functions to indicate - how they can be used in multithread applications: - - \list - \li A \e thread-safe function can be called simultaneously from - multiple threads, even when the invocations use shared data, - because all references to the shared data are serialized. - \li A \e reentrant function can also be called simultaneously from - multiple threads, but only if each invocation uses its own data. - \endlist - - Hence, a \e{thread-safe} function is always \e{reentrant}, but a - \e{reentrant} function is not always \e{thread-safe}. - - By extension, a class is said to be \e{reentrant} if its member - functions can be called safely from multiple threads, as long as - each thread uses a \e{different} instance of the class. The class - is \e{thread-safe} if its member functions can be called safely - from multiple threads, even if all the threads use the \e{same} - instance of the class. - - \note Qt classes are only documented as \e{thread-safe} if they - are intended to be used by multiple threads. If a function is not - marked as thread-safe or reentrant, it should not be used from - different threads. If a class is not marked as thread-safe or - reentrant then a specific instance of that class should not be - accessed from different threads. - - \section1 Reentrancy - - C++ classes are often reentrant, simply because they only access - their own member data. Any thread can call a member function on an - instance of a reentrant class, as long as no other thread can call - a member function on the \e{same} instance of the class at the - same time. For example, the \c Counter class below is reentrant: - - \snippet threads/threads.cpp 3 - \snippet threads/threads.cpp 4 - - The class isn't thread-safe, because if multiple threads try to - modify the data member \c n, the result is undefined. This is - because the \c ++ and \c -- operators aren't always atomic. - Indeed, they usually expand to three machine instructions: - - \list 1 - \li Load the variable's value in a register. - \li Increment or decrement the register's value. - \li Store the register's value back into main memory. - \endlist - - If thread A and thread B load the variable's old value - simultaneously, increment their register, and store it back, they - end up overwriting each other, and the variable is incremented - only once! - - \section1 Thread-Safety - - Clearly, the access must be serialized: Thread A must perform - steps 1, 2, 3 without interruption (atomically) before thread B - can perform the same steps; or vice versa. An easy way to make - the class thread-safe is to protect all access to the data - members with a QMutex: - - \snippet threads/threads.cpp 5 - \snippet threads/threads.cpp 6 - - The QMutexLocker class automatically locks the mutex in its - constructor and unlocks it when the destructor is invoked, at the - end of the function. Locking the mutex ensures that access from - different threads will be serialized. The \c mutex data member is - declared with the \c mutable qualifier because we need to lock - and unlock the mutex in \c value(), which is a const function. - - \section1 Notes on Qt Classes - - Many Qt classes are \e{reentrant}, but they are not made - \e{thread-safe}, because making them thread-safe would incur the - extra overhead of repeatedly locking and unlocking a QMutex. For - example, QString is reentrant but not thread-safe. You can safely - access \e{different} instances of QString from multiple threads - simultaneously, but you can't safely access the \e{same} instance - of QString from multiple threads simultaneously (unless you - protect the accesses yourself with a QMutex). - - Some Qt classes and functions are thread-safe. These are mainly - the thread-related classes (e.g. QMutex) and fundamental functions - (e.g. QCoreApplication::postEvent()). - - \note Terminology in the multithreading domain isn't entirely - standardized. POSIX uses definitions of reentrant and thread-safe - that are somewhat different for its C APIs. When using other - object-oriented C++ class libraries with Qt, be sure the - definitions are understood. -*/ - -/*! - \page threads-qobject.html - \title Threads and QObjects - - \previouspage Reentrancy and Thread Safety - \contentspage Thread Support in Qt - \nextpage Thread-Support in Qt Modules - - QThread inherits QObject. It emits signals to indicate that the - thread started or finished executing, and provides a few slots as - well. - - More interesting is that \l{QObject}s can be used in multiple - threads, emit signals that invoke slots in other threads, and - post events to objects that "live" in other threads. This is - possible because each thread is allowed to have its own event - loop. - - \section1 QObject Reentrancy - - QObject is reentrant. Most of its non-GUI subclasses, such as - QTimer, QTcpSocket, QUdpSocket and QProcess, are also - reentrant, making it possible to use these classes from multiple - threads simultaneously. Note that these classes are designed to be - created and used from within a single thread; creating an object - in one thread and calling its functions from another thread is not - guaranteed to work. There are three constraints to be aware of: - - \list - \li \e{The child of a QObject must always be created in the thread - where the parent was created.} This implies, among other - things, that you should never pass the QThread object (\c - this) as the parent of an object created in the thread (since - the QThread object itself was created in another thread). - - \li \e{Event driven objects may only be used in a single thread.} - Specifically, this applies to the \l{timers.html}{timer - mechanism} and the \l{QtNetwork}{network module}. For example, - you cannot start a timer or connect a socket in a thread that - is not the \l{QObject::thread()}{object's thread}. - - \li \e{You must ensure that all objects created in a thread are - deleted before you delete the QThread.} This can be done - easily by creating the objects on the stack in your - \l{QThread::run()}{run()} implementation. - \endlist - - Although QObject is reentrant, the GUI classes, notably QWidget - and all its subclasses, are not reentrant. They can only be used - from the main thread. As noted earlier, QCoreApplication::exec() - must also be called from that thread. - - In practice, the impossibility of using GUI classes in other - threads than the main thread can easily be worked around by - putting time-consuming operations in a separate worker thread and - displaying the results on screen in the main thread when the - worker thread is finished. This is the approach used for - implementing the \l{Mandelbrot Example} and - the \l{network/blockingfortuneclient}{Blocking Fortune Client} - example. - - \section1 Per-Thread Event Loop - - Each thread can have its own event loop. The initial thread - starts its event loops using QCoreApplication::exec(); other - threads can start an event loop using QThread::exec(). Like - QCoreApplication, QThread provides an - \l{QThread::exit()}{exit(int)} function and a - \l{QThread::quit()}{quit()} slot. - - An event loop in a thread makes it possible for the thread to use - certain non-GUI Qt classes that require the presence of an event - loop (such as QTimer, QTcpSocket, and QProcess). It also makes it - possible to connect signals from any threads to slots of a - specific thread. This is explained in more detail in the - \l{Signals and Slots Across Threads} section below. - - \image threadsandobjects.png Threads, objects, and event loops - - A QObject instance is said to \e live in the thread in which it - is created. Events to that object are dispatched by that thread's - event loop. The thread in which a QObject lives is available using - QObject::thread(). - - Note that for QObjects that are created before QApplication, - QObject::thread() returns zero. This means that the main thread - will only handle posted events for these objects; other event - processing is not done at all for objects with no thread. Use the - QObject::moveToThread() function to change the thread affinity for - an object and its children (the object cannot be moved if it has a - parent). - - Calling \c delete on a QObject from a thread other than the one - that \e owns the object (or accessing the object in other ways) is - unsafe, unless you guarantee that the object isn't processing - events at that moment. Use QObject::deleteLater() instead, and a - \l{QEvent::DeferredDelete}{DeferredDelete} event will be posted, - which the event loop of the object's thread will eventually pick - up. By default, the thread that \e owns a QObject is the thread - that \e creates the QObject, but not after QObject::moveToThread() - has been called. - - If no event loop is running, events won't be delivered to the - object. For example, if you create a QTimer object in a thread but - never call \l{QThread::exec()}{exec()}, the QTimer will never emit - its \l{QTimer::timeout()}{timeout()} signal. Calling - \l{QObject::deleteLater()}{deleteLater()} won't work - either. (These restrictions apply to the main thread as well.) - - You can manually post events to any object in any thread at any - time using the thread-safe function - QCoreApplication::postEvent(). The events will automatically be - dispatched by the event loop of the thread where the object was - created. - - Event filters are supported in all threads, with the restriction - that the monitoring object must live in the same thread as the - monitored object. Similarly, QCoreApplication::sendEvent() - (unlike \l{QCoreApplication::postEvent()}{postEvent()}) can only - be used to dispatch events to objects living in the thread from - which the function is called. - - \section1 Accessing QObject Subclasses from Other Threads - - QObject and all of its subclasses are not thread-safe. This - includes the entire event delivery system. It is important to keep - in mind that the event loop may be delivering events to your - QObject subclass while you are accessing the object from another - thread. - - If you are calling a function on an QObject subclass that doesn't - live in the current thread and the object might receive events, - you must protect all access to your QObject subclass's internal - data with a mutex; otherwise, you may experience crashes or other - undesired behavior. - - Like other objects, QThread objects live in the thread where the - object was created -- \e not in the thread that is created when - QThread::run() is called. It is generally unsafe to provide slots - in your QThread subclass, unless you protect the member variables - with a mutex. - - On the other hand, you can safely emit signals from your - QThread::run() implementation, because signal emission is - thread-safe. - - \section1 Signals and Slots Across Threads - - Qt supports these signal-slot connection types: - - \list - - \li \l{Qt::AutoConnection}{Auto Connection} (default) If the signal is - emitted in the thread which the receiving object has affinity then - the behavior is the same as the Direct Connection. Otherwise, - the behavior is the same as the Queued Connection." - - \li \l{Qt::DirectConnection}{Direct Connection} The slot is invoked - immediately, when the signal is emitted. The slot is executed - in the emitter's thread, which is not necessarily the - receiver's thread. - - \li \l{Qt::QueuedConnection}{Queued Connection} The slot is invoked - when control returns to the event loop of the receiver's - thread. The slot is executed in the receiver's thread. - - \li \l{Qt::BlockingQueuedConnection}{Blocking Queued Connection} - The slot is invoked as for the Queued Connection, except the - current thread blocks until the slot returns. \note Using this - type to connect objects in the same thread will cause deadlock. - - \li \l{Qt::UniqueConnection}{Unique Connection} The behavior is the - same as the Auto Connection, but the connection is made only if - it does not duplicate an existing connection. i.e., if the same - signal is already connected to the same slot for the same pair - of objects, then the connection is not made and connect() - returns \c false. - - \endlist - - The connection type can be specified by passing an additional - argument to \l{QObject::connect()}{connect()}. Be aware that - using direct connections when the sender and receiver live in - different threads is unsafe if an event loop is running in the - receiver's thread, for the same reason that calling any function - on an object living in another thread is unsafe. - - QObject::connect() itself is thread-safe. - - The \l{Mandelbrot Example} uses a queued - connection to communicate between a worker thread and the main - thread. To avoid freezing the main thread's event loop (and, as a - consequence, the application's user interface), all the - Mandelbrot fractal computation is done in a separate worker - thread. The thread emits a signal when it is done rendering the - fractal. - - Similarly, the \l{network/blockingfortuneclient}{Blocking Fortune - Client} example uses a separate thread for communicating with - a TCP server asynchronously. -*/ - -/*! - \page threads-modules.html - \title Thread-Support in Qt Modules - - \previouspage Threads and QObjects - \contentspage Thread Support in Qt - - \section1 Threads and the SQL Module - - A connection can only be used from within the thread that created it. - Moving connections between threads or creating queries from a different - thread is not supported. - - In addition, the third party libraries used by the QSqlDrivers can impose - further restrictions on using the SQL Module in a multithreaded program. - Consult the manual of your database client for more information - - \section1 Painting in Threads - - QPainter can be used in a thread to paint onto QImage, QPrinter, and - QPicture paint devices. Painting onto QPixmaps and QWidgets is \e not - supported. On Mac OS X the automatic progress dialog will not be - displayed if you are printing from outside the GUI thread. - - Any number of threads can paint at any given time, however only - one thread at a time can paint on a given paint device. In other - words, two threads can paint at the same time if each paints onto - separate QImages, but the two threads cannot paint onto the same - QImage at the same time. - - \section1 Threads and Rich Text Processing - - The QTextDocument, QTextCursor, and \l{richtext.html}{all related classes} are reentrant. - - Note that a QTextDocument instance created in the GUI thread may - contain QPixmap image resources. Use QTextDocument::clone() to - create a copy of the document, and pass the copy to another thread for - further processing (such as printing). - - \section1 Threads and the SVG module - - The QSvgGenerator and QSvgRenderer classes in the QtSvg module - are reentrant. - - \section1 Threads and Implicitly Shared Classes - - Qt uses an optimization called \l{implicit sharing} for many of - its value class, notably QImage and QString. Beginning with Qt 4, - implicit shared classes can safely be copied across threads, like - any other value classes. They are fully - \l{Reentrancy and Thread-Safety}{reentrant}. The implicit sharing - is really \e implicit. - - In many people's minds, implicit sharing and multithreading are - incompatible concepts, because of the way the reference counting - is typically done. Qt, however, uses atomic reference counting to - ensure the integrity of the shared data, avoiding potential - corruption of the reference counter. - - Note that atomic reference counting does not guarantee - \l{Reentrancy and Thread-Safety}{thread-safety}. Proper locking should be used - when sharing an instance of an implicitly shared class between - threads. This is the same requirement placed on all - \l{Reentrancy and Thread-Safety}{reentrant} classes, shared or not. Atomic reference - counting does, however, guarantee that a thread working on its - own, local instance of an implicitly shared class is safe. We - recommend using \l{Signals and Slots Across Threads}{signals and - slots} to pass data between threads, as this can be done without - the need for any explicit locking. - - To sum it up, implicitly shared classes in Qt 4 are really \e - implicitly shared. Even in multithreaded applications, you can - safely use them as if they were plain, non-shared, reentrant - value-based classes. -*/ diff --git a/src/xml/doc/qtxml.qdocconf b/src/xml/doc/qtxml.qdocconf index 19561af57f..7f8fddfd11 100644 --- a/src/xml/doc/qtxml.qdocconf +++ b/src/xml/doc/qtxml.qdocconf @@ -27,7 +27,7 @@ qhp.QtXml.subprojects.classes.sortPages = true tagfile = ../../../doc/qtxml/qtxml.tags -depends += qtcore qtnetwork +depends += qtcore qtnetwork qtdoc headerdirs += .. -- cgit v1.2.3 From 7e5452a23f02c87f73f729cf6eab0ffe1ffa440c Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 30 Oct 2013 15:14:16 +0100 Subject: Fix QFileDialog::getSaveFilename() with a given default name The QFileDialogOptions::initiallySelectedFiles were overridden, and the given filename was also not properly converted to a local file URL. Task-number: QTBUG-34408 Task-number: QTBUG-34446 Change-Id: I51d05b954a5393d10db9232945ba05bda7068e73 Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qfiledialog.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 22d467661e..cfdc303f21 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -628,7 +628,8 @@ void QFileDialogPrivate::helperPrepareShow(QPlatformDialogHelper *) QUrl::fromLocalFile(directory.absolutePath()) : QUrl()); options->setInitiallySelectedNameFilter(q->selectedNameFilter()); - options->setInitiallySelectedFiles(userSelectedFiles()); + if (options->initiallySelectedFiles().isEmpty()) + options->setInitiallySelectedFiles(userSelectedFiles()); } void QFileDialogPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHelper *) @@ -1053,10 +1054,13 @@ void QFileDialog::selectFile(const QString &filename) return; if (!d->usingWidgets()) { - d->selectFile_sys(QUrl::fromLocalFile(filename)); - QList i; - i << QUrl(filename); - d->options->setInitiallySelectedFiles(i); + QUrl url = QUrl::fromLocalFile(filename); + if (QFileInfo(filename).isRelative()) { + QDir dir(d->options->initialDirectory().toLocalFile()); + url = QUrl::fromLocalFile(dir.absoluteFilePath(filename)); + } + d->selectFile_sys(url); + d->options->setInitiallySelectedFiles(QList() << url); return; } @@ -1683,11 +1687,8 @@ void QFileDialog::setAcceptMode(QFileDialog::AcceptMode mode) d->options->setAcceptMode(static_cast(mode)); // clear WA_DontShowOnScreen so that d->canBeNativeDialog() doesn't return false incorrectly setAttribute(Qt::WA_DontShowOnScreen, false); - if (!d->usingWidgets()) { - // we need to recreate the native dialog when changing the AcceptMode - d->deletePlatformHelper(); + if (!d->usingWidgets()) return; - } QDialogButtonBox::StandardButton button = (mode == AcceptOpen ? QDialogButtonBox::Open : QDialogButtonBox::Save); d->qFileDialogUi->buttonBox->setStandardButtons(button | QDialogButtonBox::Cancel); d->qFileDialogUi->buttonBox->button(button)->setEnabled(false); -- cgit v1.2.3 From d60e0c3bc197e2b8fed5245bf3f56e63c571283d Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 8 Nov 2013 07:27:29 +0100 Subject: Remove disused version of QPlatformMessageDialogHelper::clicked signal It has been replaced with a version that sends both the button and the role. Change-Id: I47156288bf2039cfdfd4cf09f75563347bfb4141 Reviewed-by: BogDan Vatra --- src/gui/kernel/qplatformdialoghelper.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h index eb461e3ab3..9eeb0a6da4 100644 --- a/src/gui/kernel/qplatformdialoghelper.h +++ b/src/gui/kernel/qplatformdialoghelper.h @@ -417,7 +417,6 @@ public: void setOptions(const QSharedPointer &options); Q_SIGNALS: - void clicked(QMessageDialogOptions::StandardButton button); // TODO remove before 5.2 void clicked(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole role); private: -- cgit v1.2.3 From f45e12f91aa9a230e78f939d2a86398ed90d370d Mon Sep 17 00:00:00 2001 From: Maciej Kujalowicz Date: Mon, 4 Nov 2013 18:55:02 +0100 Subject: iOS: Send expose event when a window changes the geometry. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the EAGLView view changes its layout, it must send the expose event along with the geometry change. It is important to notify the render loop of the scene graph that the windows's geometry has changed. The render loop is waiting for the WM_Expose event and updates the scene's window size accordingly. See QSGRenderThread::event for reference. Without this notification, the geometry of window is updated, but the scene is rendered incorrectly, for example when the orientation of screen changes. Change-Id: If102014313de455cb1f44d772b478d2feae6dacf Reviewed-by: Morten Johan Sørvig Reviewed-by: Richard Moe Gustavsen Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index fa0519a37c..f46616db1d 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -142,6 +142,7 @@ QRect geometry = fromCGRect(self.frame); m_qioswindow->QPlatformWindow::setGeometry(geometry); QWindowSystemInterface::handleGeometryChange(m_qioswindow->window(), geometry); + QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), geometry); // If we have a new size here we need to resize the FBO's corresponding buffers, // but we defer that to when the application calls makeCurrent. -- cgit v1.2.3 From becdfa6fabb80d35e430a13835f01a6ff3f6cc73 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 6 Nov 2013 22:44:38 +0100 Subject: QSslConfiguration: rename [get]session() to [get]sessionTicket() to reflect the fact that this returns and sets the whole session ticket, and not just the session ID. Change-Id: I00fe2bc4197dbcd7a02b3ae4f2f84e3a2a7edad0 Reviewed-by: Richard J. Moore --- src/network/ssl/qssl.cpp | 2 +- src/network/ssl/qsslconfiguration.cpp | 24 ++++++++++++------------ src/network/ssl/qsslconfiguration.h | 4 ++-- src/network/ssl/qsslcontext.cpp | 4 ++-- src/network/ssl/qsslsocket.cpp | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/network/ssl/qssl.cpp b/src/network/ssl/qssl.cpp index ec771e1f49..5b7274e3e6 100644 --- a/src/network/ssl/qssl.cpp +++ b/src/network/ssl/qssl.cpp @@ -164,7 +164,7 @@ QT_BEGIN_NAMESPACE \value SslOptionDisableSessionSharing Disables SSL session sharing via the session ID handshake attribute. \value SslOptionDisableSessionPersistence Disables storing the SSL session - in ASN.1 format as returned by QSslConfiguration::session(). Enabling + in ASN.1 format as returned by QSslConfiguration::sessionTicket(). Enabling this feature adds memory overhead of approximately 1K per used session ticket. diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp index 8979c48d5d..4aad7c04c5 100644 --- a/src/network/ssl/qsslconfiguration.cpp +++ b/src/network/ssl/qsslconfiguration.cpp @@ -602,19 +602,19 @@ bool QSslConfiguration::testSslOption(QSsl::SslOption option) const \since 5.2 If QSsl::SslOptionDisableSessionPersistence was turned off, this - function returns the session used in the SSL handshake in ASN.1 - format, suitable to e.g. be persisted to disk. If no session was + function returns the session ticket used in the SSL handshake in ASN.1 + format, suitable to e.g. be persisted to disk. If no session ticket was used or QSsl::SslOptionDisableSessionPersistence was not turned off, this function returns an empty QByteArray. - \b{Note:} When persisting the session to disk or similar, be + \b{Note:} When persisting the session ticket to disk or similar, be careful not to expose the session to a potential attacker, as knowledge of the session allows for eavesdropping on data encrypted with the session parameters. - \sa setSession(), QSsl::SslOptionDisableSessionPersistence, setSslOption() + \sa setSessionTicket(), QSsl::SslOptionDisableSessionPersistence, setSslOption() */ -QByteArray QSslConfiguration::session() const +QByteArray QSslConfiguration::sessionTicket() const { return d->sslSession; } @@ -622,16 +622,16 @@ QByteArray QSslConfiguration::session() const /*! \since 5.2 - Sets the session to be used in an SSL handshake. + Sets the session ticket to be used in an SSL handshake. QSsl::SslOptionDisableSessionPersistence must be turned off - for this to work, and \a session must be in ASN.1 format - as returned by session(). + for this to work, and \a sessionTicket must be in ASN.1 format + as returned by sessionTicket(). - \sa session(), QSsl::SslOptionDisableSessionPersistence, setSslOption() + \sa sessionTicket(), QSsl::SslOptionDisableSessionPersistence, setSslOption() */ -void QSslConfiguration::setSession(const QByteArray &session) +void QSslConfiguration::setSessionTicket(const QByteArray &sessionTicket) { - d->sslSession = session; + d->sslSession = sessionTicket; } /*! @@ -645,7 +645,7 @@ void QSslConfiguration::setSession(const QByteArray &session) QSsl::SslOptionDisableSessionPersistence was not turned off, this function returns -1. - \sa session(), QSsl::SslOptionDisableSessionPersistence, setSslOption() + \sa sessionTicket(), QSsl::SslOptionDisableSessionPersistence, setSslOption() */ int QSslConfiguration::sessionTicketLifeTimeHint() const { diff --git a/src/network/ssl/qsslconfiguration.h b/src/network/ssl/qsslconfiguration.h index 949ce70d4c..a48eceb63e 100644 --- a/src/network/ssl/qsslconfiguration.h +++ b/src/network/ssl/qsslconfiguration.h @@ -124,8 +124,8 @@ public: void setSslOption(QSsl::SslOption option, bool on); bool testSslOption(QSsl::SslOption option) const; - QByteArray session() const; - void setSession(const QByteArray &session); + QByteArray sessionTicket() const; + void setSessionTicket(const QByteArray &sessionTicket); int sessionTicketLifeTimeHint() const; static QSslConfiguration defaultConfiguration(); diff --git a/src/network/ssl/qsslcontext.cpp b/src/network/ssl/qsslcontext.cpp index 6d281c390d..037ee8c672 100644 --- a/src/network/ssl/qsslcontext.cpp +++ b/src/network/ssl/qsslcontext.cpp @@ -260,8 +260,8 @@ init_context: q_SSL_CTX_set_verify_depth(sslContext->ctx, sslContext->sslConfiguration.peerVerifyDepth()); // set persisted session if the user set it - if (!configuration.session().isEmpty()) - sslContext->setSessionASN1(configuration.session()); + if (!configuration.sessionTicket().isEmpty()) + sslContext->setSessionASN1(configuration.sessionTicket()); return sslContext; } diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 24843e9f92..38b493a769 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -903,7 +903,7 @@ void QSslSocket::setSslConfiguration(const QSslConfiguration &configuration) d->configuration.peerVerifyMode = configuration.peerVerifyMode(); d->configuration.protocol = configuration.protocol(); d->configuration.sslOptions = configuration.d->sslOptions; - d->configuration.sslSession = configuration.session(); + d->configuration.sslSession = configuration.sessionTicket(); d->configuration.sslSessionTicketLifeTimeHint = configuration.sessionTicketLifeTimeHint(); // if the CA certificates were set explicitly (either via -- cgit v1.2.3 From 5f5c8798329041db7c02d2cd0610bfe4f3b22c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Martsum?= Date: Thu, 7 Nov 2013 18:58:15 +0100 Subject: QHeaderView - remove confusing bool It is probably better not to have a default boolean in QHeaderView::setResizeContentsPrecision Task-number: QTBUG-34665 Change-Id: I0bb2c35abc1d5713bb3ee65df3af86c04f175a38 Reviewed-by: Giuseppe D'Angelo --- src/widgets/itemviews/qheaderview.cpp | 7 +------ src/widgets/itemviews/qheaderview.h | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 1131ef030e..c2bcc1585f 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -1337,18 +1337,13 @@ QHeaderView::ResizeMode QHeaderView::sectionResizeMode(int logicalIndex) const and QTreeView::sizeHintForColumn(). Reimplementing these functions can make this function not having an effect. - If \a resizeSectionsNow is set to true (default) it will do adjustment of sections by calling - resizeSections(). (regardless if the precision was changed). - \sa resizeContentsPrecision(), setSectionResizeMode(), resizeSections(), QTableView::sizeHintForColumn(), QTableView::sizeHintForRow(), QTreeView::sizeHintForColumn() */ -void QHeaderView::setResizeContentsPrecision(int precision, bool resizeSectionsNow) +void QHeaderView::setResizeContentsPrecision(int precision) { Q_D(QHeaderView); d->resizeContentsPrecision = precision; - if (resizeSectionsNow) - resizeSections(); } /*! diff --git a/src/widgets/itemviews/qheaderview.h b/src/widgets/itemviews/qheaderview.h index b3ed666aa6..bfe36e9b19 100644 --- a/src/widgets/itemviews/qheaderview.h +++ b/src/widgets/itemviews/qheaderview.h @@ -135,7 +135,7 @@ public: void setSectionResizeMode(ResizeMode mode); void setSectionResizeMode(int logicalIndex, ResizeMode mode); - void setResizeContentsPrecision(int precision, bool resizeNow = true); + void setResizeContentsPrecision(int precision); int resizeContentsPrecision() const; #if QT_DEPRECATED_SINCE(5, 0) -- cgit v1.2.3 From 5dc8ab409faaf9bd5f0a75f0ac760cbd91fd7774 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 8 Nov 2013 12:41:20 +0100 Subject: Move QTreeView::accessibleTree2Index to the private class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's not needed to expose that symbol. Change-Id: I65b752a41d80eb0779969fa3887c081b4c2c88db Reviewed-by: Jan Arve Sæther --- src/widgets/itemviews/qtreeview.cpp | 25 +++++++++++++++---------- src/widgets/itemviews/qtreeview.h | 1 - src/widgets/itemviews/qtreeview_p.h | 2 ++ 3 files changed, 17 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 792b75ac69..fc0d639483 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -3888,6 +3888,14 @@ void QTreeViewPrivate::_q_sortIndicatorChanged(int column, Qt::SortOrder order) model->sort(column, order); } +int QTreeViewPrivate::accessibleTree2Index(const QModelIndex &index) const +{ + Q_Q(const QTreeView); + + // Note that this will include the header, even if its hidden. + return (q->visualIndex(index) + (q->header() ? 1 : 0)) * index.model()->columnCount() + index.column(); +} + /*! \reimp */ @@ -3911,8 +3919,10 @@ void QTreeView::currentChanged(const QModelIndex ¤t, const QModelIndex &pr } #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive() && current.isValid()) { + Q_D(QTreeView); + QAccessibleEvent event(this, QAccessible::Focus); - event.setChild(accessibleTree2Index(current)); + event.setChild(d->accessibleTree2Index(current)); QAccessible::updateAccessibility(&event); } #endif @@ -3927,10 +3937,12 @@ void QTreeView::selectionChanged(const QItemSelection &selected, QAbstractItemView::selectionChanged(selected, deselected); #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { + Q_D(QTreeView); + // ### does not work properly for selection ranges. QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { - int entry = accessibleTree2Index(sel); + int entry = d->accessibleTree2Index(sel); Q_ASSERT(entry >= 0); QAccessibleEvent event(this, QAccessible::Selection); event.setChild(entry); @@ -3938,7 +3950,7 @@ void QTreeView::selectionChanged(const QItemSelection &selected, } QModelIndex desel = deselected.indexes().value(0); if (desel.isValid()) { - int entry = accessibleTree2Index(desel); + int entry = d->accessibleTree2Index(desel); Q_ASSERT(entry >= 0); QAccessibleEvent event(this, QAccessible::SelectionRemove); event.setChild(entry); @@ -3955,13 +3967,6 @@ int QTreeView::visualIndex(const QModelIndex &index) const return d->viewIndex(index); } -int QTreeView::accessibleTree2Index(const QModelIndex &index) const -{ - // Note that this will include the header, even if its hidden. - return (visualIndex(index) + (header() ? 1 : 0)) * index.model()->columnCount() + index.column(); -} - - QT_END_NAMESPACE #include "moc_qtreeview.cpp" diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h index a29e9b64b0..d9c6cd9269 100644 --- a/src/widgets/itemviews/qtreeview.h +++ b/src/widgets/itemviews/qtreeview.h @@ -224,7 +224,6 @@ private: friend class QAccessibleTree; friend class QAccessibleTableCell; int visualIndex(const QModelIndex &index) const; - int accessibleTree2Index(const QModelIndex &index) const; Q_DECLARE_PRIVATE(QTreeView) Q_DISABLE_COPY(QTreeView) diff --git a/src/widgets/itemviews/qtreeview_p.h b/src/widgets/itemviews/qtreeview_p.h index 89de435606..5d6333e856 100644 --- a/src/widgets/itemviews/qtreeview_p.h +++ b/src/widgets/itemviews/qtreeview_p.h @@ -239,6 +239,8 @@ public: return (viewIndex(index) + (header ? 1 : 0)) * model->columnCount()+index.column(); } + int accessibleTree2Index(const QModelIndex &index) const; + // used for spanning rows QVector spanningIndexes; -- cgit v1.2.3 From 9b7e6cb83d99642977ef88a1426d3f79751c6869 Mon Sep 17 00:00:00 2001 From: John Layt Date: Thu, 31 Oct 2013 21:39:59 +0100 Subject: QTimeZone - Fix Mac Transistions Fix nextTransitions() where there are no next transitions and improve performance of previousTransition() and data(). Change-Id: I5d44525554243d139ba8d5f86e41bdfc0f7bfc25 Reviewed-by: Thiago Macieira --- src/corelib/tools/qtimezoneprivate_mac.mm | 57 ++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qtimezoneprivate_mac.mm b/src/corelib/tools/qtimezoneprivate_mac.mm index 8d319aebbd..69d2c42d27 100644 --- a/src/corelib/tools/qtimezoneprivate_mac.mm +++ b/src/corelib/tools/qtimezoneprivate_mac.mm @@ -185,15 +185,14 @@ bool QMacTimeZonePrivate::isDaylightTime(qint64 atMSecsSinceEpoch) const QTimeZonePrivate::Data QMacTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const { const NSTimeInterval seconds = forMSecsSinceEpoch / 1000.0; + NSDate *date = [NSDate dateWithTimeIntervalSince1970:seconds]; Data data; data.atMSecsSinceEpoch = forMSecsSinceEpoch; - data.offsetFromUtc = [m_nstz secondsFromGMTForDate: - [NSDate dateWithTimeIntervalSince1970:seconds]]; - data.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate: - [NSDate dateWithTimeIntervalSince1970:seconds]]; + data.offsetFromUtc = [m_nstz secondsFromGMTForDate:date]; + data.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:date]; data.standardTimeOffset = data.offsetFromUtc - data.daylightTimeOffset; - data.abbreviation = QCFString::toQString([m_nstz abbreviationForDate: - [NSDate dateWithTimeIntervalSince1970:seconds]]); + data.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:date]); + [date release]; return data; } @@ -213,26 +212,46 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::nextTransition(qint64 afterMSecsSinc { QTimeZonePrivate::Data tran; const NSTimeInterval seconds = afterMSecsSinceEpoch / 1000.0; - NSDate *date = [NSDate dateWithTimeIntervalSince1970:seconds]; - const NSDate *next = [m_nstz nextDaylightSavingTimeTransitionAfterDate:date]; - const NSTimeInterval nextSecs = [next timeIntervalSince1970]; + NSDate *nextDate = [NSDate dateWithTimeIntervalSince1970:seconds]; + nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate]; + const NSTimeInterval nextSecs = [nextDate timeIntervalSince1970]; + if (nextDate == nil || nextSecs <= seconds) { + [nextDate release]; + return invalidData(); + } tran.atMSecsSinceEpoch = nextSecs * 1000; - tran.offsetFromUtc = [m_nstz secondsFromGMTForDate: - [NSDate dateWithTimeIntervalSince1970:nextSecs]]; - tran.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate: - [NSDate dateWithTimeIntervalSince1970:nextSecs]]; + tran.offsetFromUtc = [m_nstz secondsFromGMTForDate:nextDate]; + tran.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:nextDate]; tran.standardTimeOffset = tran.offsetFromUtc - tran.daylightTimeOffset; - tran.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:date]); - [next release]; - [date release]; + tran.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:nextDate]); + [nextDate release]; return tran; } QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSecsSinceEpoch) const { - // TODO No direct Mac API, so get all transitions since epoch and return the last one - // Probably slow, need to optimize - return transitions(0, beforeMSecsSinceEpoch - 1).last(); + // No direct Mac API, so get all transitions since epoch and return the last one + QList secsList; + if (beforeMSecsSinceEpoch > 0) { + const int endSecs = beforeMSecsSinceEpoch / 1000.0; + NSTimeInterval prevSecs = 0; + NSTimeInterval nextSecs = 0; + NSDate *nextDate = [NSDate dateWithTimeIntervalSince1970:nextSecs]; + // If invalid may return a nil date or an Epoch date + nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate]; + nextSecs = [nextDate timeIntervalSince1970]; + while (nextDate != nil && nextSecs > prevSecs && nextSecs < endSecs) { + secsList.append(nextSecs); + prevSecs = nextSecs; + nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate]; + nextSecs = [nextDate timeIntervalSince1970]; + } + [nextDate release]; + } + if (secsList.size() >= 1) + return data(qint64(secsList.last()) * 1000); + else + return invalidData(); } QByteArray QMacTimeZonePrivate::systemTimeZoneId() const -- cgit v1.2.3 From f767d3a1b20b16c5e19456d3839651ffe14dd442 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Oct 2013 11:07:47 +0100 Subject: QTimeZone - Fix Windows Transitions The Windows tz transition routines were not checking for a number of invalid scenarios, in particular where there are no next transitions able to be calcualted, leading to infinite loops. Change-Id: I262b4321a95be1df4228774ada3908f8d3ed6c1a Reviewed-by: Mitch Curtis Reviewed-by: Thiago Macieira --- src/corelib/tools/qtimezoneprivate_win.cpp | 152 +++++++++++++++++------------ 1 file changed, 89 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qtimezoneprivate_win.cpp b/src/corelib/tools/qtimezoneprivate_win.cpp index efdd6676fb..f411d35b3d 100644 --- a/src/corelib/tools/qtimezoneprivate_win.cpp +++ b/src/corelib/tools/qtimezoneprivate_win.cpp @@ -254,6 +254,10 @@ static QByteArray windowsSystemZoneId() static QDate calculateTransitionLocalDate(const SYSTEMTIME &rule, int year) { + // If month is 0 then there is no date + if (rule.wMonth == 0) + return QDate(); + SYSTEMTIME time = rule; // If the year isn't set, then the rule date is relative if (time.wYear == 0) { @@ -269,9 +273,10 @@ static QDate calculateTransitionLocalDate(const SYSTEMTIME &rule, int year) while (date.month() != time.wMonth) date = date.addDays(-7); return date; - } else { - return QDate(time.wYear, time.wMonth, time.wDay); } + + // If the year is set then is an absolute date + return QDate(time.wYear, time.wMonth, time.wDay); } // Converts a date/time value into msecs @@ -285,19 +290,25 @@ static void calculateTransitionsForYear(const QWinTimeZonePrivate::QWinTransitio qint64 *stdMSecs, qint64 *dstMSecs) { // TODO Consider caching the calculated values - - // The local time in Daylight Time when switches to Standard TIme + // The local time in Daylight Time when switches to Standard Time QDate standardDate = calculateTransitionLocalDate(rule.standardTimeRule, year); QTime standardTime = QTime(rule.standardTimeRule.wHour, rule.standardTimeRule.wMinute, rule.standardTimeRule.wSecond); - // The local time in Standard Time when switches to Daylight TIme + if (standardDate.isValid() && standardTime.isValid()) { + *stdMSecs = timeToMSecs(standardDate, standardTime) + + ((rule.standardTimeBias + rule.daylightTimeBias) * 60000); + } else { + *stdMSecs = QTimeZonePrivate::invalidMSecs(); + } + + // The local time in Standard Time when switches to Daylight Time QDate daylightDate = calculateTransitionLocalDate(rule.daylightTimeRule, year); QTime daylightTime = QTime(rule.daylightTimeRule.wHour, rule.daylightTimeRule.wMinute, rule.daylightTimeRule.wSecond); - - *stdMSecs = timeToMSecs(standardDate, standardTime) - + ((rule.standardTimeBias + rule.daylightTimeBias) * 60000); - *dstMSecs = timeToMSecs(daylightDate, daylightTime) + (rule.standardTimeBias * 60000); + if (standardDate.isValid() && standardTime.isValid()) + *dstMSecs = timeToMSecs(daylightDate, daylightTime) + (rule.standardTimeBias * 60000); + else + *dstMSecs = QTimeZonePrivate::invalidMSecs(); } static QLocale::Country userCountry() @@ -465,15 +476,8 @@ bool QWinTimeZonePrivate::isDaylightTime(qint64 atMSecsSinceEpoch) const QTimeZonePrivate::Data QWinTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const { - // Convert MSecs to year to get transitions for, but around 31 Dec/1 Jan may not be right year - // So get the year after we think we want transitions for, to be safe - QDate date = msecsToDate(forMSecsSinceEpoch); - int year; - int month; - int day; - date.getDate(&year, &month, &day); - if ((month == 12 && day == 31) || (month == 1 && day == 1)) - ++year; + // Convert MSecs to year to get transitions for, assumes no transitions around 31 Dec/1 Jan + int year = msecsToDate(forMSecsSinceEpoch).year(); qint64 first; qint64 second; @@ -485,20 +489,22 @@ QTimeZonePrivate::Data QWinTimeZonePrivate::data(qint64 forMSecsSinceEpoch) cons // Convert the transition rules into msecs for the year we want to try rule = ruleForYear(year); calculateTransitionsForYear(rule, year, &stdMSecs, &dstMSecs); - first = qMin(stdMSecs, dstMSecs); - second = qMax(stdMSecs, dstMSecs); - if (forMSecsSinceEpoch >= second) + if (stdMSecs < dstMSecs) { + first = stdMSecs; + second = dstMSecs; + } else { + first = dstMSecs; + second = stdMSecs; + } + if (forMSecsSinceEpoch >= second && second != invalidMSecs()) next = second; - else if (forMSecsSinceEpoch >= first) + else if (forMSecsSinceEpoch >= first && first != invalidMSecs()) next = first; // If didn't fall in this year, try the previous --year; - } while (forMSecsSinceEpoch < first && year >= MIN_YEAR); + } while (next == maxMSecs() && year >= MIN_YEAR); - if (next == dstMSecs) - return ruleToData(rule, forMSecsSinceEpoch, QTimeZone::DaylightTime); - else - return ruleToData(rule, forMSecsSinceEpoch, QTimeZone::StandardTime); + return ruleToData(rule, forMSecsSinceEpoch, (next == dstMSecs) ? QTimeZone::DaylightTime : QTimeZone::StandardTime); } bool QWinTimeZonePrivate::hasTransitions() const @@ -512,79 +518,99 @@ bool QWinTimeZonePrivate::hasTransitions() const QTimeZonePrivate::Data QWinTimeZonePrivate::nextTransition(qint64 afterMSecsSinceEpoch) const { - // Convert MSecs to year to get transitions for, but around 31 Dec/1 Jan may not be right year - // Get the year before we think we want transitions for, to be safe - QDate date = msecsToDate(afterMSecsSinceEpoch); - int year; - int month; - int day; - date.getDate(&year, &month, &day); - if ((month == 12 && day == 31) || (month == 1 && day == 1)) - --year; + // Convert MSecs to year to get transitions for, assumes no transitions around 31 Dec/1 Jan + int year = msecsToDate(afterMSecsSinceEpoch).year(); + + QWinTransitionRule rule; + // If the required year falls after the last rule start year and the last rule has no + // valid future transition calculations then there is no next transition + if (year > m_tranRules.last().startYear) { + rule = ruleForYear(year); + // If the rules have either a fixed year, or no month, then no future trans + if (rule.standardTimeRule.wYear != 0 || rule.daylightTimeRule.wYear != 0 + || rule.standardTimeRule.wMonth == 0 || rule.daylightTimeRule.wMonth == 0) { + return invalidData(); + } + } + // Otherwise we have a valid rule for the required year that can be used + // to calculate this year or next qint64 first; qint64 second; qint64 next = minMSecs(); qint64 stdMSecs; qint64 dstMSecs; - QWinTransitionRule rule; do { // Convert the transition rules into msecs for the year we want to try rule = ruleForYear(year); calculateTransitionsForYear(rule, year, &stdMSecs, &dstMSecs); // Find the first and second transition for the year - first = qMin(stdMSecs, dstMSecs); - second = qMax(stdMSecs, dstMSecs); + if (stdMSecs < dstMSecs) { + first = stdMSecs; + second = dstMSecs; + } else { + first = dstMSecs; + second = stdMSecs; + } if (afterMSecsSinceEpoch < first) next = first; else if (afterMSecsSinceEpoch < second) next = second; // If didn't fall in this year, try the next ++year; - } while (afterMSecsSinceEpoch >= second && year <= MAX_YEAR); + } while (next == minMSecs() && year <= MAX_YEAR); - if (next == dstMSecs) - return ruleToData(rule, next, QTimeZone::DaylightTime); - else - return ruleToData(rule, next, QTimeZone::StandardTime); + if (next == minMSecs() || next == invalidMSecs()) + return invalidData(); + + return ruleToData(rule, next, (next == dstMSecs) ? QTimeZone::DaylightTime : QTimeZone::StandardTime); } QTimeZonePrivate::Data QWinTimeZonePrivate::previousTransition(qint64 beforeMSecsSinceEpoch) const { - // Convert MSecs to year to get transitions for, but around 31 Dec/1 Jan may not be right year - // So get the year after we think we want transitions for, to be safe - QDate date = msecsToDate(beforeMSecsSinceEpoch); - int year; - int month; - int day; - date.getDate(&year, &month, &day); - if ((month == 12 && day == 31) || (month == 1 && day == 1)) - ++year; + // Convert MSecs to year to get transitions for, assumes no transitions around 31 Dec/1 Jan + int year = msecsToDate(beforeMSecsSinceEpoch).year(); + + QWinTransitionRule rule; + // If the required year falls before the first rule start year and the first rule has no + // valid transition calculations then there is no previous transition + if (year < m_tranRules.first().startYear) { + rule = ruleForYear(year); + // If the rules have either a fixed year, or no month, then no previous trans + if (rule.standardTimeRule.wYear != 0 || rule.daylightTimeRule.wYear != 0 + || rule.standardTimeRule.wMonth == 0 || rule.daylightTimeRule.wMonth == 0) { + return invalidData(); + } + } qint64 first; qint64 second; qint64 next = maxMSecs(); qint64 stdMSecs; qint64 dstMSecs; - QWinTransitionRule rule; do { // Convert the transition rules into msecs for the year we want to try rule = ruleForYear(year); calculateTransitionsForYear(rule, year, &stdMSecs, &dstMSecs); - first = qMin(stdMSecs, dstMSecs); - second = qMax(stdMSecs, dstMSecs); - if (beforeMSecsSinceEpoch > second) + if (stdMSecs < dstMSecs) { + first = stdMSecs; + second = dstMSecs; + } else { + first = dstMSecs; + second = stdMSecs; + } + if (beforeMSecsSinceEpoch > second && second != invalidMSecs()) next = second; - else if (beforeMSecsSinceEpoch > first) + else if (beforeMSecsSinceEpoch > first && first != invalidMSecs()) next = first; // If didn't fall in this year, try the previous --year; - } while (beforeMSecsSinceEpoch < first && year >= MIN_YEAR); + } while (next == maxMSecs() && year >= MIN_YEAR); - if (next == dstMSecs) - return ruleToData(rule, next, QTimeZone::DaylightTime); - else - return ruleToData(rule, next, QTimeZone::StandardTime); + if (next == maxMSecs()) + return invalidData(); + + return ruleToData(rule, next, (next == dstMSecs) ? QTimeZone::DaylightTime : QTimeZone::StandardTime); } QByteArray QWinTimeZonePrivate::systemTimeZoneId() const -- cgit v1.2.3 From 315ba388f32ad7943c226f2faba4e9b35e899dc9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 8 Nov 2013 08:32:34 -0800 Subject: Avoid signed integer overflow by making an addition a subtraction The task has a very good explanation. The use-case was ba.remove(n, INT_MAX); since you can't pass -1 to the length, and that results in overflow when you add n+INT_MAX. Task-number: QTBUG-34694 Change-Id: I365eb86b2d0dabbe0bde67e4e7f33d64fd5793af Reviewed-by: Olivier Goffart --- src/corelib/tools/qbytearray.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index eb06bd4713..03b10903ab 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -1854,7 +1854,7 @@ QByteArray &QByteArray::remove(int pos, int len) if (len <= 0 || uint(pos) >= uint(d->size)) return *this; detach(); - if (pos + len >= d->size) { + if (len >= d->size - pos) { resize(pos); } else { memmove(d->data() + pos, d->data() + pos + len, d->size - pos - len); -- cgit v1.2.3 From ef6544ee27aeab20a64b4df4bd50401cefa405ef Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Sat, 9 Nov 2013 09:21:02 +0200 Subject: Android native message dialog Change-Id: Ief8c3ce3b8683c6960f046245844c1835a327d51 Reviewed-by: Shawn Rutledge --- src/android/jar/jar.pri | 1 + .../qt5/android/QtMessageDialogHelper.java | 425 +++++++++++++++++++++ .../qtproject/qt5/android/bindings/QtActivity.java | 6 +- .../platforms/android/src/androidjnimain.cpp | 4 +- .../android/src/qandroidplatformdialoghelpers.cpp | 223 +++++++++++ .../android/src/qandroidplatformdialoghelpers.h | 77 ++++ .../android/src/qandroidplatformtheme.cpp | 18 + .../platforms/android/src/qandroidplatformtheme.h | 3 + src/plugins/platforms/android/src/src.pri | 2 + src/widgets/dialogs/qdialog.cpp | 24 ++ src/widgets/dialogs/qdialog_p.h | 3 +- src/widgets/dialogs/qfiledialog.cpp | 4 +- src/widgets/dialogs/qfiledialog_p.h | 2 +- src/widgets/dialogs/qmessagebox.cpp | 66 +++- src/widgets/dialogs/qmessagebox.h | 1 + 15 files changed, 848 insertions(+), 11 deletions(-) create mode 100644 src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java create mode 100644 src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp create mode 100644 src/plugins/platforms/android/src/qandroidplatformdialoghelpers.h (limited to 'src') diff --git a/src/android/jar/jar.pri b/src/android/jar/jar.pri index 19501d7b29..5906231c73 100644 --- a/src/android/jar/jar.pri +++ b/src/android/jar/jar.pri @@ -9,6 +9,7 @@ JAVASOURCES += \ $$PATHPREFIX/QtEditText.java \ $$PATHPREFIX/QtInputConnection.java \ $$PATHPREFIX/QtLayout.java \ + $$PATHPREFIX/QtMessageDialogHelper.java \ $$PATHPREFIX/QtNative.java \ $$PATHPREFIX/QtNativeLibrariesDir.java \ $$PATHPREFIX/QtSurface.java diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java b/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java new file mode 100644 index 0000000000..6ee1304c12 --- /dev/null +++ b/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java @@ -0,0 +1,425 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 BogDan Vatra + ** Contact: http://www.qt-project.org/legal + ** + ** This file is part of the Android port of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** Commercial License Usage + ** Licensees holding valid commercial Qt licenses may use this file in + ** accordance with the commercial license agreement provided with the + ** Software or, alternatively, in accordance with the terms contained in + ** a written agreement between you and Digia. For licensing terms and + ** conditions see http://qt.digia.com/licensing. For further information + ** use the contact form at http://qt.digia.com/contact-us. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 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, Digia gives you certain additional + ** rights. These rights are described in the Digia 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. + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + + +package org.qtproject.qt5.android; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.graphics.drawable.Drawable; +import android.os.Build; +import android.text.ClipboardManager; +import android.util.TypedValue; +import android.view.View; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import android.widget.Toast; + +import java.util.ArrayList; + +class QtNativeDialogHelper +{ + static native void dialogResult(long handler, int buttonID); +} + +class ButtonStruct implements View.OnClickListener +{ + ButtonStruct(QtMessageDialogHelper dialog, int id, String text) + { + m_dialog = dialog; + m_id = id; + m_text = text; + } + QtMessageDialogHelper m_dialog; + private int m_id; + String m_text; + + @Override + public void onClick(View view) { + QtNativeDialogHelper.dialogResult(m_dialog.handler(), m_id); + } +} + +public class QtMessageDialogHelper +{ + + public QtMessageDialogHelper(Activity activity) + { + m_activity = activity; + } + + + public void setIcon(int icon) + { + m_icon = icon; + + } + + private Drawable getIconDrawable() + { + if (m_icon == 0) + return null; + + if (Build.VERSION.SDK_INT > 10) { + try { + TypedValue typedValue = new TypedValue(); + m_theme.resolveAttribute(Class.forName("android.R$attr").getDeclaredField("alertDialogIcon").getInt(null), typedValue, true); + return m_activity.getResources().getDrawable(typedValue.resourceId); + } catch (Exception e) { + e.printStackTrace(); + } + } + + // Information, Warning, Critical, Question + switch (m_icon) + { + case 1: // Information + try { + return m_activity.getResources().getDrawable(Class.forName("android.R$drawable").getDeclaredField("ic_dialog_info").getInt(null)); + } catch (Exception e) { + e.printStackTrace(); + } + break; + case 2: // Warning +// try { +// return Class.forName("android.R$drawable").getDeclaredField("stat_sys_warning").getInt(null); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// break; + case 3: // Critical + try { + return m_activity.getResources().getDrawable(Class.forName("android.R$drawable").getDeclaredField("ic_dialog_alert").getInt(null)); + } catch (Exception e) { + e.printStackTrace(); + } + break; + case 4: // Question + try { + return m_activity.getResources().getDrawable(Class.forName("android.R$drawable").getDeclaredField("ic_menu_help").getInt(null)); + } catch (Exception e) { + e.printStackTrace(); + } + break; + } + return null; + } + + public void setTile(String title) + { + m_title = title; + } + + public void setText(String text) + { + m_text = text; + } + + public void setInformativeText(String informativeText) + { + m_informativeText = informativeText; + } + + public void setDetailedText(String text) + { + m_detailedText = text; + } + + public void addButton(int id, String text) + { + if (m_buttonsList == null) + m_buttonsList = new ArrayList(); + m_buttonsList.add(new ButtonStruct(this, id, text)); + } + + private void setTextAppearance(TextView view, String attr, String style) + { + try { + int[] attrs = (int[]) Class.forName("android.R$styleable").getDeclaredField("TextAppearance").get(null); + final TypedArray a = m_theme.obtainStyledAttributes(null, + attrs, + Class.forName("android.R$attr").getDeclaredField(attr).getInt(null), + Class.forName("android.R$style").getDeclaredField(style).getInt(null)); + final int textSize = a.getDimensionPixelSize( + Class.forName("android.R$styleable").getDeclaredField("TextAppearance_textSize").getInt(null), 0); + if (textSize != 0) + view.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); + + final int textColor = a.getColor( + Class.forName("android.R$styleable").getDeclaredField("TextAppearance_textColor").getInt(null), 0x3138); + if (textColor != 0x3138) + view.setTextColor(textColor); + + a.recycle(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private Drawable getStyledDrawable(String drawable) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException + { + int[] attrs = {Class.forName("android.R$attr").getDeclaredField(drawable).getInt(null)}; + final TypedArray a = m_theme.obtainStyledAttributes(attrs); + Drawable d = a.getDrawable(0); + a.recycle(); + return d; + } + + + public void show(long handler) + { + m_handler = handler; + m_activity.runOnUiThread( new Runnable() { + @Override + public void run() { + if (m_dialog != null && m_dialog.isShowing()) + m_dialog.dismiss(); + + m_dialog = new AlertDialog.Builder(m_activity).create(); + m_theme = m_dialog.getWindow().getContext().getTheme(); + + if (m_title != null) + m_dialog.setTitle(m_title); + m_dialog.setOnCancelListener( new DialogInterface.OnCancelListener() { + @Override + public void onCancel(DialogInterface dialogInterface) { + QtNativeDialogHelper.dialogResult(handler(), -1); + } + }); + m_dialog.setCancelable(m_buttonsList == null); + m_dialog.setCanceledOnTouchOutside(m_buttonsList == null); + m_dialog.setIcon(getIconDrawable()); + ScrollView scrollView = new ScrollView(m_activity); + RelativeLayout dialogLayout = new RelativeLayout(m_activity); + int id = 1; + View lastView = null; + View.OnLongClickListener copyText = new View.OnLongClickListener() { + @Override + public boolean onLongClick(View view) { + TextView tv = (TextView)view; + if (tv != null) { + ClipboardManager cm = (android.text.ClipboardManager) m_activity.getSystemService(Context.CLIPBOARD_SERVICE); + cm.setText(tv.getText()); + } + return true; + } + }; + if (m_text != null) + { + TextView view = new TextView(m_activity); + view.setId(id++); + view.setOnLongClickListener(copyText); + view.setLongClickable(true); + + view.setText(m_text); + setTextAppearance(view, "textAppearanceMedium", "TextAppearance_Medium"); + + RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); + layout.setMargins(16, 8, 16, 8); + layout.addRule(RelativeLayout.ALIGN_PARENT_TOP); + dialogLayout.addView(view, layout); + lastView = view; + } + + if (m_informativeText != null) + { + TextView view= new TextView(m_activity); + view.setId(id++); + view.setOnLongClickListener(copyText); + view.setLongClickable(true); + + view.setText(m_informativeText); + setTextAppearance(view, "textAppearanceMedium", "TextAppearance_Medium"); + + RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); + layout.setMargins(16, 8, 16, 8); + if (lastView != null) + layout.addRule(RelativeLayout.BELOW, lastView.getId()); + else + layout.addRule(RelativeLayout.ALIGN_PARENT_TOP); + dialogLayout.addView(view, layout); + lastView = view; + } + + if (m_detailedText != null) + { + TextView view= new TextView(m_activity); + view.setId(id++); + view.setOnLongClickListener(copyText); + view.setLongClickable(true); + + view.setText(m_detailedText); + setTextAppearance(view, "textAppearanceSmall", "TextAppearance_Small"); + + RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); + layout.setMargins(16, 8, 16, 8); + if (lastView != null) + layout.addRule(RelativeLayout.BELOW, lastView.getId()); + else + layout.addRule(RelativeLayout.ALIGN_PARENT_TOP); + dialogLayout.addView(view, layout); + lastView = view; + } + + if (m_buttonsList != null) + { + LinearLayout buttonsLayout = new LinearLayout(m_activity); + buttonsLayout.setOrientation(LinearLayout.HORIZONTAL); + buttonsLayout.setId(id++); + boolean firstButton = true; + for (ButtonStruct button: m_buttonsList) + { + Button bv; + if (Build.VERSION.SDK_INT > 10) { + try { + bv = new Button(m_activity, null, Class.forName("android.R$attr").getDeclaredField("borderlessButtonStyle").getInt(null)); + } catch (Exception e) { + bv = new Button(m_activity); + e.printStackTrace(); + } + } else { + bv = new Button(m_activity); + } + + bv.setText(button.m_text); + bv.setOnClickListener(button); + if (!firstButton) // first button + { + LinearLayout.LayoutParams layout = null; + View spacer = new View(m_activity); + if (Build.VERSION.SDK_INT > 10) { + try { + layout = new LinearLayout.LayoutParams(1, RelativeLayout.LayoutParams.MATCH_PARENT); + spacer.setBackgroundDrawable(getStyledDrawable("dividerVertical")); + buttonsLayout.addView(spacer, layout); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + LinearLayout.LayoutParams layout = null; + layout = new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT, 1.0f); + buttonsLayout.addView(bv, layout); + firstButton = false; + } + + if (Build.VERSION.SDK_INT > 10) { + try { + View horizontalDevider = new View(m_activity); + horizontalDevider.setId(id++); + horizontalDevider.setBackgroundDrawable(getStyledDrawable("dividerHorizontal")); + RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, 1); + relativeParams.setMargins(0, 10, 0, 0); + if (lastView != null) { + relativeParams.addRule(RelativeLayout.BELOW, lastView.getId()); + } + else + relativeParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); + dialogLayout.addView(horizontalDevider, relativeParams); + lastView = horizontalDevider; + } catch (Exception e) { + e.printStackTrace(); + } + } + RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); + if (lastView != null) { + relativeParams.addRule(RelativeLayout.BELOW, lastView.getId()); + } + else + relativeParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); + if (Build.VERSION.SDK_INT < 11) + relativeParams.setMargins(2, 12, 2, 4); + else + relativeParams.setMargins(2, 0, 2, 0); + dialogLayout.addView(buttonsLayout, relativeParams); + } + scrollView.addView(dialogLayout); + m_dialog.setView(scrollView); + m_dialog.show(); + } + }); + } + + public void hide() + { + m_activity.runOnUiThread( new Runnable() { + @Override + public void run() { + if (m_dialog != null && m_dialog.isShowing()) + m_dialog.dismiss(); + reset(); + } + }); + } + + public long handler() + { + return m_handler; + } + + public void reset() + { + m_icon = 0; + m_title = null; + m_text = null; + m_informativeText = null; + m_detailedText = null; + m_buttonsList = null; + m_dialog = null; + m_handler = 0; + } + + private Activity m_activity; + private int m_icon = 0; + private String m_title, m_text, m_informativeText, m_detailedText; + private ArrayList m_buttonsList; + private AlertDialog m_dialog; + private long m_handler = 0; + private Resources.Theme m_theme; +} diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java index 089cf5aa60..7c741edfda 100644 --- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java +++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java @@ -123,13 +123,13 @@ public class QtActivity extends Activity // and must be separated with "\t" // e.g "-param1\t-param2=value2\t-param3\tvalue3" - public String ENVIRONMENT_VARIABLES = "QT_USE_ANDROID_NATIVE_STYLE=1\t"; + public String ENVIRONMENT_VARIABLES = "QT_USE_ANDROID_NATIVE_STYLE=1\tQT_USE_ANDROID_NATIVE_DIALOGS=1\t"; // use this variable to add any environment variables to your application. // the env vars must be separated with "\t" // e.g. "ENV_VAR1=1\tENV_VAR2=2\t" // Currently the following vars are used by the android plugin: - // * QT_USE_ANDROID_NATIVE_STYLE - 1 to use the android widget style if available, - // note that the android style plugin in Qt 5.1 is not fully functional. + // * QT_USE_ANDROID_NATIVE_STYLE - 1 to use the android widget style if available. + // * QT_USE_ANDROID_NATIVE_DIALOGS -1 to use the android native dialogs. public String[] QT_ANDROID_THEMES = null; // A list with all themes that your application want to use. // The name of the theme must be the same with any theme from diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp index 3d599b8f8b..3ab4eedb26 100644 --- a/src/plugins/platforms/android/src/androidjnimain.cpp +++ b/src/plugins/platforms/android/src/androidjnimain.cpp @@ -59,6 +59,7 @@ #include "androidjniinput.h" #include "androidjniclipboard.h" #include "androidjnimenu.h" +#include "qandroidplatformdialoghelpers.h" #include "qandroidplatformintegration.h" #include @@ -865,7 +866,8 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/) || !QtAndroidInput::registerNatives(env) || !QtAndroidClipboard::registerNatives(env) || !QtAndroidMenu::registerNatives(env) - ) { + || !QtAndroidAccessibility::registerNatives(env) + || !QtAndroidDialogHelpers::registerNatives(env)) { __android_log_print(ANDROID_LOG_FATAL, "Qt", "registerNatives failed"); return -1; } diff --git a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp new file mode 100644 index 0000000000..f9eb34751e --- /dev/null +++ b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp @@ -0,0 +1,223 @@ +/**************************************************************************** +** +** Copyright (C) 2013 BogDan Vatra +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include "qandroidplatformdialoghelpers.h" +#include "androidjnimain.h" + +namespace QtAndroidDialogHelpers { +static jclass g_messageDialogHelperClass = 0; + +QAndroidPlatformMessageDialogHelper::QAndroidPlatformMessageDialogHelper() + :m_buttonId(-1) + ,m_javaMessageDialog(g_messageDialogHelperClass, "(Landroid/app/Activity;)V", QtAndroid::activity()) + ,m_shown(false) +{ +} + +void QAndroidPlatformMessageDialogHelper::exec() +{ + if (!m_shown) + show(Qt::Dialog, Qt::ApplicationModal, 0); + m_loop.exec(); +} + +static QString standardButtonText(int sbutton) +{ + QString buttonText = 0; + switch (sbutton) { + case QMessageDialogOptions::Ok: + buttonText = QObject::tr("OK"); + break; + case QMessageDialogOptions::Save: + buttonText = QObject::tr("Save"); + break; + case QMessageDialogOptions::Open: + buttonText = QObject::tr("Open"); + break; + case QMessageDialogOptions::Cancel: + buttonText = QObject::tr("Cancel"); + break; + case QMessageDialogOptions::Close: + buttonText = QObject::tr("Close"); + break; + case QMessageDialogOptions::Apply: + buttonText = QObject::tr("Apply"); + break; + case QMessageDialogOptions::Reset: + buttonText = QObject::tr("Reset"); + break; + case QMessageDialogOptions::Help: + buttonText = QObject::tr("Help"); + break; + case QMessageDialogOptions::Discard: + buttonText = QObject::tr("Discard"); + break; + case QMessageDialogOptions::Yes: + buttonText = QObject::tr("Yes"); + break; + case QMessageDialogOptions::YesToAll: + buttonText = QObject::tr("Yes to All"); + break; + case QMessageDialogOptions::No: + buttonText = QObject::tr("No"); + break; + case QMessageDialogOptions::NoToAll: + buttonText = QObject::tr("No to All"); + break; + case QMessageDialogOptions::SaveAll: + buttonText = QObject::tr("Save All"); + break; + case QMessageDialogOptions::Abort: + buttonText = QObject::tr("Abort"); + break; + case QMessageDialogOptions::Retry: + buttonText = QObject::tr("Retry"); + break; + case QMessageDialogOptions::Ignore: + buttonText = QObject::tr("Ignore"); + break; + case QMessageDialogOptions::RestoreDefaults: + buttonText = QObject::tr("Restore Defaults"); + break; + } // switch + return buttonText; +} + +bool QAndroidPlatformMessageDialogHelper::show(Qt::WindowFlags windowFlags + , Qt::WindowModality windowModality + , QWindow *parent) +{ + Q_UNUSED(windowFlags) + Q_UNUSED(windowModality) + Q_UNUSED(parent) + QSharedPointer opt = options(); + if (!opt.data()) + return false; + + m_javaMessageDialog.callMethod("setIcon", "(I)V", opt->icon()); + + QString str = opt->windowTitle(); + if (!str.isEmpty()) + m_javaMessageDialog.callMethod("setTile", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object()); + + str = opt->text(); + if (!str.isEmpty()) + m_javaMessageDialog.callMethod("setText", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object()); + + str = opt->informativeText(); + if (!str.isEmpty()) + m_javaMessageDialog.callMethod("setInformativeText", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object()); + + str = opt->detailedText(); + if (!str.isEmpty()) + m_javaMessageDialog.callMethod("setDetailedText", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object()); + + for (int i = QMessageDialogOptions::FirstButton; i < QMessageDialogOptions::LastButton; i<<=1) { + if ( opt->standardButtons() & i ) + m_javaMessageDialog.callMethod("addButton", "(ILjava/lang/String;)V", i, QJNIObjectPrivate::fromString(standardButtonText(i)).object()); + } + + m_javaMessageDialog.callMethod("show", "(J)V", jlong(static_cast(this))); + m_shown = true; + return true; +} + +void QAndroidPlatformMessageDialogHelper::hide() +{ + m_javaMessageDialog.callMethod("hide", "()V"); + m_shown = false; +} + +void QAndroidPlatformMessageDialogHelper::dialogResult(int buttonID) +{ + m_buttonId = buttonID; + if (m_loop.isRunning()) + m_loop.exit(); + if (m_buttonId < 0) { + emit reject(); + return; + } + + QMessageDialogOptions::StandardButton standardButton = static_cast(buttonID); + QMessageDialogOptions::ButtonRole role = QMessageDialogOptions::buttonRole(standardButton); + emit clicked(standardButton, role); +} + +static void dialogResult(JNIEnv * /*env*/, jobject /*thiz*/, jlong handler, int buttonID) +{ + QObject *object = reinterpret_cast(handler); + QMetaObject::invokeMethod(object, "dialogResult", Qt::QueuedConnection, Q_ARG(int, buttonID)); +} + +static JNINativeMethod methods[] = { + {"dialogResult", "(JI)V", (void *)dialogResult} +}; + + +#define FIND_AND_CHECK_CLASS(CLASS_NAME) \ + clazz = env->FindClass(CLASS_NAME); \ + if (!clazz) { \ + __android_log_print(ANDROID_LOG_FATAL, QtAndroid::qtTagText(), QtAndroid::classErrorMsgFmt(), CLASS_NAME); \ + return false; \ + } + +bool registerNatives(JNIEnv *env) +{ + jclass clazz = QtAndroid::findClass("org/qtproject/qt5/android/QtMessageDialogHelper", env); + if (!clazz) { + __android_log_print(ANDROID_LOG_FATAL, QtAndroid::qtTagText(), QtAndroid::classErrorMsgFmt() + , "org/qtproject/qt5/android/QtMessageDialogHelper"); + return false; + } + g_messageDialogHelperClass = static_cast(env->NewGlobalRef(clazz)); + FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/QtNativeDialogHelper"); + jclass appClass = static_cast(env->NewGlobalRef(clazz)); + + if (env->RegisterNatives(appClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) { + __android_log_print(ANDROID_LOG_FATAL, "Qt", "RegisterNatives failed"); + return false; + } + + return true; +} +} diff --git a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.h b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.h new file mode 100644 index 0000000000..88ec91d936 --- /dev/null +++ b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2013 BogDan Vatra +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QANDROIDPLATFORMDIALOGHELPERS_H +#define QANDROIDPLATFORMDIALOGHELPERS_H +#include +#include +#include +#include + +namespace QtAndroidDialogHelpers { + +class QAndroidPlatformMessageDialogHelper: public QPlatformMessageDialogHelper +{ + Q_OBJECT +public: + QAndroidPlatformMessageDialogHelper(); + void exec(); + bool show(Qt::WindowFlags windowFlags, + Qt::WindowModality windowModality, + QWindow *parent); + void hide(); + +public slots: + void dialogResult(int buttonID); + +private: + int m_buttonId; + QEventLoop m_loop; + QJNIObjectPrivate m_javaMessageDialog; + bool m_shown; +}; + + +bool registerNatives(JNIEnv *env); + +} + +#endif // QANDROIDPLATFORMDIALOGHELPERS_H diff --git a/src/plugins/platforms/android/src/qandroidplatformtheme.cpp b/src/plugins/platforms/android/src/qandroidplatformtheme.cpp index 79fbc440fc..0ceac97e35 100644 --- a/src/plugins/platforms/android/src/qandroidplatformtheme.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformtheme.cpp @@ -43,6 +43,7 @@ #include "qandroidplatformmenubar.h" #include "qandroidplatformmenu.h" #include "qandroidplatformmenuitem.h" +#include "qandroidplatformdialoghelpers.h" #include #include #include @@ -150,3 +151,20 @@ QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const return QPlatformTheme::themeHint(hint); } } + +bool QAndroidPlatformTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const +{ + if (type == MessageDialog) + return qgetenv("QT_USE_ANDROID_NATIVE_DIALOGS").toInt() == 1; + return false; +} + +QPlatformDialogHelper *QAndroidPlatformTheme::createPlatformDialogHelper(QPlatformTheme::DialogType type) const +{ + switch (type) { + case MessageDialog: + return new QtAndroidDialogHelpers::QAndroidPlatformMessageDialogHelper; + default: + return 0; + } +} diff --git a/src/plugins/platforms/android/src/qandroidplatformtheme.h b/src/plugins/platforms/android/src/qandroidplatformtheme.h index 15d2cb2000..ec259a9b0a 100644 --- a/src/plugins/platforms/android/src/qandroidplatformtheme.h +++ b/src/plugins/platforms/android/src/qandroidplatformtheme.h @@ -54,6 +54,9 @@ public: virtual const QPalette *palette(Palette type = SystemPalette) const; virtual const QFont *font(Font type = SystemFont) const; virtual QVariant themeHint(ThemeHint hint) const; + virtual bool usePlatformNativeDialog(DialogType type) const; + virtual QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const; + private: QAndroidPlatformNativeInterface * m_androidPlatformNativeInterface; diff --git a/src/plugins/platforms/android/src/src.pri b/src/plugins/platforms/android/src/src.pri index 6cc41c3e68..9b64e846f7 100644 --- a/src/plugins/platforms/android/src/src.pri +++ b/src/plugins/platforms/android/src/src.pri @@ -21,6 +21,7 @@ SOURCES += $$PWD/androidplatformplugin.cpp \ $$PWD/qandroidinputcontext.cpp \ $$PWD/qandroidplatformaccessibility.cpp \ $$PWD/qandroidplatformfontdatabase.cpp \ + $$PWD/qandroidplatformdialoghelpers.cpp \ $$PWD/qandroidplatformclipboard.cpp \ $$PWD/qandroidplatformtheme.cpp \ $$PWD/qandroidplatformmenubar.cpp \ @@ -41,6 +42,7 @@ HEADERS += $$PWD/qandroidplatformintegration.h \ $$PWD/qandroidplatformaccessibility.h \ $$PWD/qandroidplatformfontdatabase.h \ $$PWD/qandroidplatformclipboard.h \ + $$PWD/qandroidplatformdialoghelpers.h \ $$PWD/qandroidplatformtheme.h \ $$PWD/qandroidplatformmenubar.h \ $$PWD/qandroidplatformmenu.h \ diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index af352e45c6..d498b077fc 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -52,6 +52,8 @@ #include "qwhatsthis.h" #include "qmenu.h" #include "qcursor.h" +#include "qmessagebox.h" +#include "qerrormessage.h" #include #include "private/qdialog_p.h" #include "private/qguiapplication_p.h" @@ -74,6 +76,14 @@ static inline int themeDialogType(const QDialog *dialog) #ifndef QT_NO_FONTDIALOG if (qobject_cast(dialog)) return QPlatformTheme::FontDialog; +#endif +#ifndef QT_NO_MESSAGEBOX + if (qobject_cast(dialog)) + return QPlatformTheme::MessageDialog; +#endif +#ifndef QT_NO_ERRORMESSAGE + if (qobject_cast(dialog)) + return QPlatformTheme::MessageDialog; #endif return -1; } @@ -100,6 +110,17 @@ QPlatformDialogHelper *QDialogPrivate::platformHelper() const return m_platformHelper; } +bool QDialogPrivate::canBeNativeDialog() const +{ + QDialogPrivate *ncThis = const_cast(this); + QDialog *dialog = ncThis->q_func(); + const int type = themeDialogType(dialog); + if (type >= 0) + return QGuiApplicationPrivate::platformTheme() + ->usePlatformNativeDialog(static_cast(type)); + return false; +} + QWindow *QDialogPrivate::parentWindow() const { if (const QWidget *parent = q_func()->nativeParentWidget()) @@ -697,6 +718,9 @@ void QDialog::closeEvent(QCloseEvent *e) void QDialog::setVisible(bool visible) { Q_D(QDialog); + if (!testAttribute(Qt::WA_DontShowOnScreen) && d->canBeNativeDialog() && d->setNativeDialogVisible(visible)) + return; + if (visible) { if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden)) return; diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h index 5064efa35d..8db1b2a27c 100644 --- a/src/widgets/dialogs/qdialog_p.h +++ b/src/widgets/dialogs/qdialog_p.h @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE class QSizeGrip; -class QDialogPrivate : public QWidgetPrivate +class Q_WIDGETS_EXPORT QDialogPrivate : public QWidgetPrivate { Q_DECLARE_PUBLIC(QDialog) public: @@ -113,6 +113,7 @@ public: bool nativeDialogInUse; QPlatformDialogHelper *platformHelper() const; + virtual bool canBeNativeDialog() const; private: virtual void initHelper(QPlatformDialogHelper *) {} diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index cfdc303f21..da026d23a6 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -764,9 +764,9 @@ void QFileDialogPrivate::emitFilesSelected(const QStringList &files) emit q->fileSelected(files.first()); } -bool QFileDialogPrivate::canBeNativeDialog() +bool QFileDialogPrivate::canBeNativeDialog() const { - Q_Q(QFileDialog); + Q_Q(const QFileDialog); if (nativeDialogInUse) return true; if (q->testAttribute(Qt::WA_DontShowOnScreen)) diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index 36336bdbf6..faa721572c 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -251,7 +251,7 @@ public: // setVisible_sys returns true if it ends up showing a native // dialog. Returning false means that a non-native dialog must be // used instead. - bool canBeNativeDialog(); + bool canBeNativeDialog() const; inline bool usingWidgets() const; void setDirectory_sys(const QUrl &directory); diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 9101c568e0..ee2ef409d8 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -193,7 +193,6 @@ public: } }; - class QMessageBoxPrivate : public QDialogPrivate { Q_DECLARE_PUBLIC(QMessageBox) @@ -204,11 +203,13 @@ public: detailsText(0), #endif compatMode(false), autoAddOkButton(true), - detectedEscapeButton(0), informativeLabel(0) { } + detectedEscapeButton(0), informativeLabel(0), + options(new QMessageDialogOptions) { } void init(const QString &title = QString(), const QString &text = QString()); void setupLayout(); void _q_buttonClicked(QAbstractButton *); + void _q_clicked(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole role); QAbstractButton *findButton(int button0, int button1, int button2, int flags); void addOldButtons(int button0, int button1, int button2); @@ -224,7 +225,6 @@ public: #ifdef Q_OS_WINCE void hideSpecial(); #endif - static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, int button0, int button1, int button2); @@ -262,6 +262,11 @@ public: QPointer receiverToDisconnectOnClose; QByteArray memberToDisconnectOnClose; QByteArray signalToDisconnectOnClose; + QSharedPointer options; +private: + void initHelper(QPlatformDialogHelper *); + void helperPrepareShow(QPlatformDialogHelper *); + void helperDone(QDialog::DialogCode, QPlatformDialogHelper *); }; void QMessageBoxPrivate::init(const QString &title, const QString &text) @@ -519,6 +524,13 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button) } } +void QMessageBoxPrivate::_q_clicked(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole role) +{ + Q_UNUSED(role); + Q_Q(QMessageBox); + q->done(button); +} + /*! \class QMessageBox @@ -2682,6 +2694,54 @@ QPixmap QMessageBoxPrivate::standardIcon(QMessageBox::Icon icon, QMessageBox *mb return QPixmap(); } +void QMessageBoxPrivate::initHelper(QPlatformDialogHelper *h) +{ + Q_Q(QMessageBox); + QObject::connect(h, SIGNAL(clicked(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole)), + q, SLOT(_q_clicked(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole))); + static_cast(h)->setOptions(options); +} + +static QMessageDialogOptions::Icon helperIcon(QMessageBox::Icon i) +{ + switch (i) { + case QMessageBox::NoIcon: + return QMessageDialogOptions::NoIcon; + case QMessageBox::Information: + return QMessageDialogOptions::Information; + case QMessageBox::Warning: + return QMessageDialogOptions::Warning; + case QMessageBox::Critical: + return QMessageDialogOptions::Critical; + case QMessageBox::Question: + return QMessageDialogOptions::Question; + } + return QMessageDialogOptions::NoIcon; +} + +static QMessageDialogOptions::StandardButtons helperStandardButtons(QMessageBox * q) +{ + QMessageDialogOptions::StandardButtons buttons(int(q->standardButtons())); + return buttons; +} + +void QMessageBoxPrivate::helperPrepareShow(QPlatformDialogHelper *) +{ + Q_Q(QMessageBox); + options->setWindowTitle(q->windowTitle()); + options->setText(q->text()); + options->setInformativeText(q->informativeText()); + options->setDetailedText(q->detailedText()); + options->setIcon(helperIcon(q->icon())); + options->setStandardButtons(helperStandardButtons(q)); +} + +void QMessageBoxPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHelper *) +{ + Q_Q(QMessageBox); + clickedButton = q->button(QMessageBox::StandardButton(code)); +} + /*! \obsolete diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h index 58be13426c..c5598a8f1d 100644 --- a/src/widgets/dialogs/qmessagebox.h +++ b/src/widgets/dialogs/qmessagebox.h @@ -309,6 +309,7 @@ protected: private: Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked(QAbstractButton *)) + Q_PRIVATE_SLOT(d_func(), void _q_clicked(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole)) Q_DISABLE_COPY(QMessageBox) Q_DECLARE_PRIVATE(QMessageBox) -- cgit v1.2.3 From c819a8926959ecadfe2e588e28918ed6fb90ce5d Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 8 Nov 2013 13:53:26 +0100 Subject: Document the BC break of viewportSizeHint() in itemviews Since users were not supposed to use this feature at all, just live with the BC break, but document it. In order to prevent possible problems in the future, introduce dummy overrides in QAbstractItemView and QListView as well. Also, fix the visibility of the overrides (it's protected, not public). Task-number: QTBUG-34667 Change-Id: Ib4554ae5e1e7d3ce4ea8e8703e1fea9e2231edb0 Reviewed-by: Marc Mutz --- src/widgets/itemviews/qabstractitemview.cpp | 9 +++++++++ src/widgets/itemviews/qabstractitemview.h | 2 ++ src/widgets/itemviews/qlistview.cpp | 10 ++++++++++ src/widgets/itemviews/qlistview.h | 2 ++ src/widgets/itemviews/qtableview.h | 4 ++-- src/widgets/itemviews/qtreeview.h | 4 ++-- src/widgets/widgets/qscrollarea.h | 3 ++- 7 files changed, 29 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index fd704e479b..7edad74f54 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -1390,6 +1390,15 @@ bool QAbstractItemView::showDropIndicator() const return d->showDropIndicator; } +/*! + \since 5.2 + \reimp +*/ +QSize QAbstractItemView::viewportSizeHint() const +{ + return QAbstractScrollArea::viewportSizeHint(); +} + /*! \property QAbstractItemView::dragEnabled \brief whether the view supports dragging of its own items diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h index 96428515ae..4f9cd7b1c6 100644 --- a/src/widgets/itemviews/qabstractitemview.h +++ b/src/widgets/itemviews/qabstractitemview.h @@ -346,6 +346,8 @@ protected: DropIndicatorPosition dropIndicatorPosition() const; #endif + QSize viewportSizeHint() const Q_DECL_OVERRIDE; + private: Q_DECLARE_PRIVATE(QAbstractItemView) Q_DISABLE_COPY(QAbstractItemView) diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 616a832b88..0cca52daa2 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -3200,6 +3200,16 @@ int QListView::visualIndex(const QModelIndex &index) const return visualIndex; } + +/*! + \since 5.2 + \reimp +*/ +QSize QListView::viewportSizeHint() const +{ + return QAbstractItemView::viewportSizeHint(); +} + QT_END_NAMESPACE #endif // QT_NO_LISTVIEW diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h index e4ae2d03fd..a973dfb221 100644 --- a/src/widgets/itemviews/qlistview.h +++ b/src/widgets/itemviews/qlistview.h @@ -180,6 +180,8 @@ protected: void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); + QSize viewportSizeHint() const Q_DECL_OVERRIDE; + private: int visualIndex(const QModelIndex &index) const; diff --git a/src/widgets/itemviews/qtableview.h b/src/widgets/itemviews/qtableview.h index db956480d6..387d24c608 100644 --- a/src/widgets/itemviews/qtableview.h +++ b/src/widgets/itemviews/qtableview.h @@ -118,8 +118,6 @@ public: void sortByColumn(int column, Qt::SortOrder order); - QSize viewportSizeHint() const; - public Q_SLOTS: void selectRow(int row); void selectColumn(int column); @@ -161,6 +159,8 @@ protected: void updateGeometries(); + QSize viewportSizeHint() const Q_DECL_OVERRIDE; + int sizeHintForRow(int row) const; int sizeHintForColumn(int column) const; diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h index d9c6cd9269..429b9d3add 100644 --- a/src/widgets/itemviews/qtreeview.h +++ b/src/widgets/itemviews/qtreeview.h @@ -147,8 +147,6 @@ public: void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles = QVector()); void selectAll(); - QSize viewportSizeHint() const; - Q_SIGNALS: void expanded(const QModelIndex &index); void collapsed(const QModelIndex &index); @@ -208,6 +206,8 @@ protected: void updateGeometries(); + QSize viewportSizeHint() const Q_DECL_OVERRIDE; + int sizeHintForColumn(int column) const; int indexRowSizeHint(const QModelIndex &index) const; int rowHeight(const QModelIndex &index) const; diff --git a/src/widgets/widgets/qscrollarea.h b/src/widgets/widgets/qscrollarea.h index 70af5fbbd7..db1083f122 100644 --- a/src/widgets/widgets/qscrollarea.h +++ b/src/widgets/widgets/qscrollarea.h @@ -69,7 +69,6 @@ public: void setWidgetResizable(bool resizable); QSize sizeHint() const; - QSize viewportSizeHint() const; bool focusNextPrevChild(bool next); @@ -86,6 +85,8 @@ protected: void resizeEvent(QResizeEvent *); void scrollContentsBy(int dx, int dy); + QSize viewportSizeHint() const Q_DECL_OVERRIDE; + private: Q_DECLARE_PRIVATE(QScrollArea) Q_DISABLE_COPY(QScrollArea) -- cgit v1.2.3 From 944fe9b8bc38c412a8d6823c100cb2d44d44118e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 9 Nov 2013 17:01:07 +0100 Subject: QKeySequenceEdit: make setKeySequence a slot There's a signal keySequenceChanged(QKeySequence), so the setter should be a slot, too. Change-Id: I6591bad071444ffa252a2fdb9ccaf28e8629f59c Reviewed-by: J-P Nurmi Reviewed-by: Konstantin Ritt --- src/widgets/widgets/qkeysequenceedit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/widgets/qkeysequenceedit.h b/src/widgets/widgets/qkeysequenceedit.h index 9312e98d0e..5d827a3be8 100644 --- a/src/widgets/widgets/qkeysequenceedit.h +++ b/src/widgets/widgets/qkeysequenceedit.h @@ -61,9 +61,9 @@ public: ~QKeySequenceEdit(); QKeySequence keySequence() const; - void setKeySequence(const QKeySequence &keySequence); public Q_SLOTS: + void setKeySequence(const QKeySequence &keySequence); void clear(); Q_SIGNALS: -- cgit v1.2.3 From 9af6fd5d8a2d142742ad690286f50c7aac34908c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 9 Nov 2013 17:31:32 +0100 Subject: QKeySequenceEdit: give nested line edit an objectName People request this, and other widgets do this, too (say, QSpinBox). Change-Id: I275537fb82b805b0dcb8edba87b8e234985f8d1f Reviewed-by: J-P Nurmi --- src/widgets/widgets/qkeysequenceedit.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/widgets/widgets/qkeysequenceedit.cpp b/src/widgets/widgets/qkeysequenceedit.cpp index a1915e41ef..db39ceb08a 100644 --- a/src/widgets/widgets/qkeysequenceedit.cpp +++ b/src/widgets/widgets/qkeysequenceedit.cpp @@ -55,6 +55,7 @@ void QKeySequenceEditPrivate::init() Q_Q(QKeySequenceEdit); lineEdit = new QLineEdit(q); + lineEdit->setObjectName(QStringLiteral("qt_keysequenceedit_lineedit")); keyNum = 0; prevKey = -1; releaseTimer = 0; -- cgit v1.2.3 From 8462a6933c843eeed2d94d83d4b10f7c946a5475 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 8 Nov 2013 13:22:36 +0100 Subject: Remove a boolean trap in QLayout::replaceWidget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use some flags instead. Task-number: QTBUG-34668 Change-Id: I9a75253c8eb98164c594bb6bb06c1a16c9609537 Reviewed-by: Thorbjørn Lund Martsum Reviewed-by: J-P Nurmi Reviewed-by: Marc Mutz --- src/widgets/kernel/qlayout.cpp | 24 ++++++++++++++++-------- src/widgets/kernel/qlayout.h | 4 +++- 2 files changed, 19 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index f17a6caa3c..eb21a580b1 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -1112,18 +1112,26 @@ bool QLayout::activate() \since 5.2 Searches for widget \a from and replaces it with widget \a to if found. - Returns the layout item that contains the widget \a from on success. Otherwise \c 0 is returned. - If \a recursive is \c true, sub-layouts are searched for doing the replacement. Notice that the returned item therefore might not belong to this layout, but to a sub-layout. + Returns the layout item that contains the widget \a from on success. + Otherwise \c 0 is returned. If \a options contains \c Qt::FindChildrenRecursively + (the default), sub-layouts are searched for doing the replacement. + Any other flag in \a options is ignored. - The returned layout item is no longer owned by the layout and should be either deleted or inserted to another layout. The widget \a from is no longer managed by the layout and may need to be deleted or hidden. The parent of widget \a from is left unchanged. + Notice that the returned item therefore might not belong to this layout, + but to a sub-layout. - This function works for the built-in Qt layouts, but might not work for custom layouts. + The returned layout item is no longer owned by the layout and should be + either deleted or inserted to another layout. The widget \a from is no + longer managed by the layout and may need to be deleted or hidden. The + parent of widget \a from is left unchanged. + + This function works for the built-in Qt layouts, but might not work for + custom layouts. \sa indexOf() */ -//### Qt 6 make this function virtual -QLayoutItem* QLayout::replaceWidget(QWidget *from, QWidget *to, bool recursive) +QLayoutItem *QLayout::replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOptions options) { Q_D(QLayout); if (!from || !to) @@ -1141,8 +1149,8 @@ QLayoutItem* QLayout::replaceWidget(QWidget *from, QWidget *to, bool recursive) break; } - if (item->layout() && recursive) { - QLayoutItem *r = item->layout()->replaceWidget(from, to, true); + if (item->layout() && (options & Qt::FindChildrenRecursively)) { + QLayoutItem *r = item->layout()->replaceWidget(from, to, options); if (r) return r; } diff --git a/src/widgets/kernel/qlayout.h b/src/widgets/kernel/qlayout.h index ca5f6d42ea..27d9d34b9c 100644 --- a/src/widgets/kernel/qlayout.h +++ b/src/widgets/kernel/qlayout.h @@ -130,7 +130,9 @@ public: virtual int count() const = 0; bool isEmpty() const; QSizePolicy::ControlTypes controlTypes() const; - QLayoutItem* replaceWidget(QWidget *from, QWidget *to, bool recursive = true); + + // ### Qt 6 make this function virtual + QLayoutItem *replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOptions options = Qt::FindChildrenRecursively); int totalHeightForWidth(int w) const; QSize totalMinimumSize() const; -- cgit v1.2.3 From f9399d69add411adf757e3390488ff57655833b7 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 8 Nov 2013 12:28:23 +0100 Subject: Force FT font engine to load the right glyph metrics Change-Id: If027ea4c1a3b2ca8f972592abe3534165f62cf4e Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/painting/qtextureglyphcache.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 2166ae7975..b953f8d81f 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -152,6 +152,18 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const continue; if (listItemCoordinates.contains(GlyphAndSubPixelPosition(glyph, subPixelPosition))) continue; + + // This is a rather crude hack, but it works. + // The FreeType font engine is not capable of getting precise metrics for the alphamap + // without first rasterizing the glyph. If we force the glyph to be rasterized before + // we ask for the alphaMapBoundingBox(), the glyph will be loaded, rasterized and its + // proper metrics will be cached and used later. + if (fontEngine->hasInternalCaching()) { + QImage *locked = fontEngine->lockedAlphaMapForGlyph(glyph, subPixelPosition, format); + if (locked) + fontEngine->unlockAlphaMapForGlyph(); + } + glyph_metrics_t metrics = fontEngine->alphaMapBoundingBox(glyph, subPixelPosition, m_transform, format); #ifdef CACHE_DEBUG -- cgit v1.2.3 From d4ade9d4ef785a96f0bd1a89acfdba8ec09324f6 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 8 Nov 2013 12:31:14 +0100 Subject: Request the glyph at the right subpixel offset Change-Id: Iace18740565862f1c66e2d654a1a2e7bc1a16fc7 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontengine_ft.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 8c69ca9753..5f53a36629 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1742,7 +1742,7 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe glyphSet = &defaultGlyphSet; } } - Glyph * g = glyphSet ? glyphSet->getGlyph(glyph) : 0; + Glyph * g = glyphSet ? glyphSet->getGlyph(glyph, subPixelPosition) : 0; if (!g || g->format != format) { face = lockFace(); FT_Matrix m = this->matrix; -- cgit v1.2.3 From fd619946be51784dc709363324897be6af144c52 Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Thu, 22 Aug 2013 17:02:05 +0200 Subject: Refactor QQnxWindow This patch does following things: * Remove the root window: First window which is created will serve as a root window * Allow creation of more than one application window (with every app window having an own window group) on one screen * Fixes a bug when reparanting an EGL window Change-Id: I1afd64a813bc084c0893b958aa191d4a25c32b9d Reviewed-by: Matt Hoosier Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qnx.pro | 3 - src/plugins/platforms/qnx/qqnxeglwindow.cpp | 17 +- src/plugins/platforms/qnx/qqnxeglwindow.h | 6 +- src/plugins/platforms/qnx/qqnxintegration.cpp | 21 +- src/plugins/platforms/qnx/qqnxintegration.h | 5 +- src/plugins/platforms/qnx/qqnxrasterwindow.cpp | 16 +- src/plugins/platforms/qnx/qqnxrasterwindow.h | 7 +- src/plugins/platforms/qnx/qqnxrootwindow.cpp | 268 ------------------------- src/plugins/platforms/qnx/qqnxrootwindow.h | 85 -------- src/plugins/platforms/qnx/qqnxscreen.cpp | 74 +++---- src/plugins/platforms/qnx/qqnxscreen.h | 9 +- src/plugins/platforms/qnx/qqnxwindow.cpp | 143 +++++++------ src/plugins/platforms/qnx/qqnxwindow.h | 22 +- 13 files changed, 191 insertions(+), 485 deletions(-) delete mode 100644 src/plugins/platforms/qnx/qqnxrootwindow.cpp delete mode 100644 src/plugins/platforms/qnx/qqnxrootwindow.h (limited to 'src') diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index becf5e287e..aeacbeef69 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -25,7 +25,6 @@ CONFIG += qqnx_pps #DEFINES += QQNXNAVIGATOREVENTNOTIFIER_DEBUG #DEFINES += QQNXNAVIGATOR_DEBUG #DEFINES += QQNXRASTERBACKINGSTORE_DEBUG -#DEFINES += QQNXROOTWINDOW_DEBUG #DEFINES += QQNXSCREENEVENTTHREAD_DEBUG #DEFINES += QQNXSCREENEVENT_DEBUG #DEFINES += QQNXSCREEN_DEBUG @@ -42,7 +41,6 @@ SOURCES = main.cpp \ qqnxscreen.cpp \ qqnxwindow.cpp \ qqnxrasterbackingstore.cpp \ - qqnxrootwindow.cpp \ qqnxscreeneventhandler.cpp \ qqnxnativeinterface.cpp \ qqnxnavigatoreventhandler.cpp \ @@ -59,7 +57,6 @@ HEADERS = main.h \ qqnxscreen.h \ qqnxwindow.h \ qqnxrasterbackingstore.h \ - qqnxrootwindow.h \ qqnxscreeneventhandler.h \ qqnxnativeinterface.h \ qqnxnavigatoreventhandler.h \ diff --git a/src/plugins/platforms/qnx/qqnxeglwindow.cpp b/src/plugins/platforms/qnx/qqnxeglwindow.cpp index e8fcdd692b..6afc3cad21 100644 --- a/src/plugins/platforms/qnx/qqnxeglwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxeglwindow.cpp @@ -42,6 +42,7 @@ #include "qqnxeglwindow.h" #include "qqnxscreen.h" +#include "qqnxglcontext.h" #include @@ -55,8 +56,8 @@ QT_BEGIN_NAMESPACE -QQnxEglWindow::QQnxEglWindow(QWindow *window, screen_context_t context) : - QQnxWindow(window, context), +QQnxEglWindow::QQnxEglWindow(QWindow *window, screen_context_t context, bool needRootWindow) : + QQnxWindow(window, context, needRootWindow), m_requestedBufferSize(window->geometry().size()), m_platformOpenGLContext(0), m_newSurfaceRequested(true), @@ -98,8 +99,6 @@ void QQnxEglWindow::createEGLSurface() QQnxGLContext::checkEGLError("eglCreateWindowSurface"); qFatal("QQNX: failed to create EGL surface, err=%d", eglGetError()); } - - screen()->onWindowPost(0); } void QQnxEglWindow::destroyEGLSurface() @@ -166,6 +165,13 @@ QSize QQnxEglWindow::requestedBufferSize() const return m_requestedBufferSize; } +void QQnxEglWindow::adjustBufferSize() +{ + const QSize windowSize = window()->size(); + if (windowSize != bufferSize()) + setBufferSize(windowSize); +} + void QQnxEglWindow::setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext) { // This function does not take ownership of the platform gl context. @@ -175,6 +181,9 @@ void QQnxEglWindow::setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContex int QQnxEglWindow::pixelFormat() const { + if (!m_platformOpenGLContext) //The platform GL context was not set yet + return -1; + const QSurfaceFormat format = m_platformOpenGLContext->format(); // Extract size of color channels from window format const int redSize = format.redBufferSize(); diff --git a/src/plugins/platforms/qnx/qqnxeglwindow.h b/src/plugins/platforms/qnx/qqnxeglwindow.h index e7dae6a458..fc53afcd7a 100644 --- a/src/plugins/platforms/qnx/qqnxeglwindow.h +++ b/src/plugins/platforms/qnx/qqnxeglwindow.h @@ -43,8 +43,6 @@ #define QQNXEGLWINDOW_H #include "qqnxwindow.h" -#include "qqnxglcontext.h" - #include QT_BEGIN_NAMESPACE @@ -54,7 +52,7 @@ class QQnxGLContext; class QQnxEglWindow : public QQnxWindow { public: - QQnxEglWindow(QWindow *window, screen_context_t context); + QQnxEglWindow(QWindow *window, screen_context_t context, bool needRootWindow); ~QQnxEglWindow(); void createEGLSurface(); @@ -70,7 +68,7 @@ public: // Called by QQnxGLContext::createSurface() QSize requestedBufferSize() const; - WindowType windowType() const Q_DECL_OVERRIDE { return EGL; } + void adjustBufferSize(); protected: int pixelFormat() const; diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 36a2194b56..52f836abbe 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -1,6 +1,6 @@ /*************************************************************************** ** -** Copyright (C) 2011 - 2012 Research In Motion +** Copyright (C) 2011 - 2013 BlackBerry Limited. All rights reserved. ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. @@ -122,6 +122,17 @@ static inline QQnxIntegration::Options parseOptions(const QStringList ¶mList if (!paramList.contains(QLatin1String("no-fullscreen"))) { options |= QQnxIntegration::FullScreenApplication; } + +// On Blackberry the first window is treated as a root window +#ifdef Q_OS_BLACKBERRY + if (!paramList.contains(QLatin1String("no-rootwindow"))) { + options |= QQnxIntegration::RootWindow; + } +#else + if (paramList.contains(QLatin1String("rootwindow"))) { + options |= QQnxIntegration::RootWindow; + } +#endif return options; } @@ -323,9 +334,10 @@ bool QQnxIntegration::hasCapability(QPlatformIntegration::Capability cap) const { qIntegrationDebug() << Q_FUNC_INFO; switch (cap) { + case MultipleWindows: case ThreadedPixmaps: return true; -#if defined(QT_OPENGL_ES) +#if !defined(QT_NO_OPENGL) case OpenGL: case ThreadedOpenGL: case BufferQueueingOpenGL: @@ -340,12 +352,13 @@ QPlatformWindow *QQnxIntegration::createPlatformWindow(QWindow *window) const { qIntegrationDebug() << Q_FUNC_INFO; QSurface::SurfaceType surfaceType = window->surfaceType(); + const bool needRootWindow = options() & RootWindow; switch (surfaceType) { case QSurface::RasterSurface: - return new QQnxRasterWindow(window, m_screenContext); + return new QQnxRasterWindow(window, m_screenContext, needRootWindow); #if !defined(QT_NO_OPENGL) case QSurface::OpenGLSurface: - return new QQnxEglWindow(window, m_screenContext); + return new QQnxEglWindow(window, m_screenContext, needRootWindow); #endif default: qFatal("QQnxWindow: unsupported window API"); diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h index ab0d6a3156..8b5614fe4f 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.h +++ b/src/plugins/platforms/qnx/qqnxintegration.h @@ -1,6 +1,6 @@ /*************************************************************************** ** -** Copyright (C) 2011 - 2012 Research In Motion +** Copyright (C) 2011 - 2013 BlackBerry Limited. All rights reserved. ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. @@ -84,7 +84,8 @@ class QQnxIntegration : public QPlatformIntegration public: enum Option { // Options to be passed on command line. NoOptions = 0x0, - FullScreenApplication = 0x1 + FullScreenApplication = 0x1, + RootWindow = 0x2 }; Q_DECLARE_FLAGS(Options, Option) explicit QQnxIntegration(const QStringList ¶mList); diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp index 16ff9d7519..1f974b268d 100644 --- a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp @@ -54,8 +54,8 @@ QT_BEGIN_NAMESPACE -QQnxRasterWindow::QQnxRasterWindow(QWindow *window, screen_context_t context) : - QQnxWindow(window, context), +QQnxRasterWindow::QQnxRasterWindow(QWindow *window, screen_context_t context, bool needRootWindow) : + QQnxWindow(window, context, needRootWindow), m_currentBufferIndex(-1), m_previousBufferIndex(-1) { @@ -115,9 +115,6 @@ void QQnxRasterWindow::post(const QRegion &dirty) // Save modified region and clear scrolled region m_previousDirty = dirty; m_scrolled = QRegion(); - // Notify screen that window posted - if (screen() != 0) - screen()->onWindowPost(this); if (m_cover) m_cover->updateCover(); @@ -169,6 +166,15 @@ QQnxBuffer &QQnxRasterWindow::renderBuffer() return m_buffers[m_currentBufferIndex]; } +void QQnxRasterWindow::adjustBufferSize() +{ + // When having a raster window we don't need any buffers, since + // Qt will draw to the parent TLW backing store. + const QSize windowSize = m_parentWindow ? QSize(1,1) : window()->size(); + if (windowSize != bufferSize()) + setBufferSize(windowSize); +} + int QQnxRasterWindow::pixelFormat() const { return screen()->nativeFormat(); diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.h b/src/plugins/platforms/qnx/qqnxrasterwindow.h index 8bd42bc320..ad34b3ccf2 100644 --- a/src/plugins/platforms/qnx/qqnxrasterwindow.h +++ b/src/plugins/platforms/qnx/qqnxrasterwindow.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE class QQnxRasterWindow : public QQnxWindow { public: - QQnxRasterWindow(QWindow *window, screen_context_t context); + QQnxRasterWindow(QWindow *window, screen_context_t context, bool needRootWindow); void post(const QRegion &dirty); @@ -60,7 +60,7 @@ public: bool hasBuffers() const { return !bufferSize().isEmpty(); } - WindowType windowType() const Q_DECL_OVERRIDE { return Raster; } + void adjustBufferSize(); protected: int pixelFormat() const; @@ -69,6 +69,9 @@ protected: // Copies content from the previous buffer (back buffer) to the current buffer (front buffer) void blitPreviousToCurrent(const QRegion ®ion, int dx, int dy, bool flush=false); + void blitHelper(QQnxBuffer &source, QQnxBuffer &target, const QPoint &sourceOffset, + const QPoint &targetOffset, const QRegion ®ion, bool flush = false); + private: QRegion m_previousDirty; QRegion m_scrolled; diff --git a/src/plugins/platforms/qnx/qqnxrootwindow.cpp b/src/plugins/platforms/qnx/qqnxrootwindow.cpp deleted file mode 100644 index b3f5c87176..0000000000 --- a/src/plugins/platforms/qnx/qqnxrootwindow.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/*************************************************************************** -** -** Copyright (C) 2011 - 2012 Research In Motion -** Contact: http://www.qt-project.org/legal -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qqnxrootwindow.h" - -#include "qqnxscreen.h" - -#include -#include - -#if defined(QQNXROOTWINDOW_DEBUG) -#define qRootWindowDebug qDebug -#else -#define qRootWindowDebug QT_NO_QDEBUG_MACRO -#endif - -#include -#include - -static const int MAGIC_ZORDER_FOR_NO_NAV = 10; - -QQnxRootWindow::QQnxRootWindow(const QQnxScreen *screen) - : m_screen(screen), - m_window(0), - m_windowGroupName(), - m_translucent(false) -{ - qRootWindowDebug() << Q_FUNC_INFO; - // Create one top-level QNX window to act as a container for child windows - // since navigator only supports one application window - errno = 0; - int result = screen_create_window(&m_window, m_screen->nativeContext()); - int val[2]; - if (result != 0) - qFatal("QQnxRootWindow: failed to create window, errno=%d", errno); - - // Move window to proper display - errno = 0; - screen_display_t display = m_screen->nativeDisplay(); - result = screen_set_window_property_pv(m_window, SCREEN_PROPERTY_DISPLAY, (void **)&display); - if (result != 0) - qFatal("QQnxRootWindow: failed to set window display, errno=%d", errno); - - // Make sure window is above navigator but below keyboard if running as root - // since navigator won't automatically set our z-order in this case - if (getuid() == 0) { - errno = 0; - val[0] = MAGIC_ZORDER_FOR_NO_NAV; - result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ZORDER, val); - if (result != 0) - qFatal("QQnxRootWindow: failed to set window z-order, errno=%d", errno); - } - - // Window won't be visible unless it has some buffers so make one dummy buffer that is 1x1 - errno = 0; - val[0] = SCREEN_USAGE_NATIVE; - result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_USAGE, val); - if (result != 0) - qFatal("QQnxRootWindow: failed to set window buffer usage, errno=%d", errno); - - errno = 0; - val[0] = m_screen->nativeFormat(); - result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, val); - if (result != 0) - qFatal("QQnxRootWindow: failed to set window pixel format, errno=%d", errno); - - errno = 0; - val[0] = 1; - val[1] = 1; - result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val); - if (result != 0) - qFatal("QQnxRootWindow: failed to set window buffer size, errno=%d", errno); - - errno = 0; - result = screen_create_window_buffers(m_window, 1); - if (result != 0) - qFatal("QQNX: failed to create window buffer, errno=%d", errno); - - // Window is always the size of the display - errno = 0; - QRect geometry = m_screen->geometry(); - val[0] = geometry.width(); - val[1] = geometry.height(); - result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, val); - if (result != 0) - qFatal("QQnxRootWindow: failed to set window size, errno=%d", errno); - - // Fill the window with solid black. Note that the LSB of the pixel value - // 0x00000000 just happens to be 0x00, so if and when this root window's - // alpha blending mode is changed from None to Source-Over, it will then - // be interpreted as transparent. - errno = 0; - val[0] = 0; - result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_COLOR, val); - if (result != 0) - qFatal("QQnxRootWindow: failed to set window colour, errno=%d", errno); - - // Make the window opaque - errno = 0; - val[0] = SCREEN_TRANSPARENCY_NONE; - result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, val); - if (result != 0) - qFatal("QQnxRootWindow: failed to set window transparency, errno=%d", errno); - - // Set the swap interval to 1 - errno = 0; - val[0] = 1; - result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SWAP_INTERVAL, val); - if (result != 0) - qFatal("QQnxRootWindow: failed to set window swap interval, errno=%d", errno); - - // Set viewport size equal to window size but move outside buffer so the fill colour is used exclusively - errno = 0; - val[0] = geometry.width(); - val[1] = geometry.height(); - result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, val); - if (result != 0) - qFatal("QQnxRootWindow: failed to set window source size, errno=%d", errno); - - errno = 0; - val[0] = 0; - val[1] = 0; - result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_POSITION, val); - if (result != 0) - qFatal("QQnxRootWindow: failed to set window source position, errno=%d", errno); - - // Optionally disable the screen power save - bool ok = false; - const int disablePowerSave = qgetenv("QQNX_DISABLE_POWER_SAVE").toInt(&ok); - if (ok && disablePowerSave) { - const int mode = SCREEN_IDLE_MODE_KEEP_AWAKE; - result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_IDLE_MODE, &mode); - if (result != 0) - qWarning("QQnxRootWindow: failed to disable power saving mode"); - } - - createWindowGroup(); - - // Don't post yet. This will be lazily done from QQnxScreen upon first posting of - // a child window. Doing it now pre-emptively would create a flicker if one of - // the QWindow's about to be created sets its Qt::WA_TranslucentBackground flag - // and immediately triggers the buffer re-creation in makeTranslucent(). -} - -void QQnxRootWindow::makeTranslucent() -{ - if (m_translucent) - return; - - int result; - - errno = 0; - const int val = SCREEN_TRANSPARENCY_DISCARD; - result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, &val); - if (result != 0) { - qFatal("QQnxRootWindow: failed to set window transparency, errno=%d", errno); - } - - m_translucent = true; - post(); -} - -QQnxRootWindow::~QQnxRootWindow() -{ - // Cleanup top-level QNX window - screen_destroy_window(m_window); -} - -void QQnxRootWindow::post() const -{ - qRootWindowDebug() << Q_FUNC_INFO; - errno = 0; - screen_buffer_t buffer; - int result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)&buffer); - if (result != 0) - qFatal("QQnxRootWindow: failed to query window buffer, errno=%d", errno); - - errno = 0; - int dirtyRect[] = {0, 0, 1, 1}; - result = screen_post_window(m_window, buffer, 1, dirtyRect, 0); - if (result != 0) - qFatal("QQNX: failed to post window buffer, errno=%d", errno); -} - -void QQnxRootWindow::flush() const -{ - qRootWindowDebug() << Q_FUNC_INFO; - // Force immediate display update - errno = 0; - int result = screen_flush_context(m_screen->nativeContext(), 0); - if (result != 0) - qFatal("QQnxRootWindow: failed to flush context, errno=%d", errno); -} - -void QQnxRootWindow::setRotation(int rotation) -{ - qRootWindowDebug() << Q_FUNC_INFO << "angle =" << rotation; - errno = 0; - int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ROTATION, &rotation); - if (result != 0) - qFatal("QQnxRootWindow: failed to set window rotation, errno=%d", errno); -} - -void QQnxRootWindow::resize(const QSize &size) -{ - errno = 0; - int val[] = {size.width(), size.height()}; - int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, val); - if (result != 0) - qFatal("QQnxRootWindow: failed to set window size, errno=%d", errno); - - errno = 0; - result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, val); - if (result != 0) - qFatal("QQnxRootWindow: failed to set window source size, errno=%d", errno); - - // NOTE: display will update when child windows relayout and repaint -} - -void QQnxRootWindow::createWindowGroup() -{ - // Generate a random window group name - m_windowGroupName = QUuid::createUuid().toString().toLatin1(); - - // Create window group so child windows can be parented by container window - errno = 0; - int result = screen_create_window_group(m_window, m_windowGroupName.constData()); - if (result != 0) - qFatal("QQnxRootWindow: failed to create app window group, errno=%d", errno); -} diff --git a/src/plugins/platforms/qnx/qqnxrootwindow.h b/src/plugins/platforms/qnx/qqnxrootwindow.h deleted file mode 100644 index ea7c7faace..0000000000 --- a/src/plugins/platforms/qnx/qqnxrootwindow.h +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************** -** -** Copyright (C) 2011 - 2012 Research In Motion -** Contact: http://www.qt-project.org/legal -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQNXROOTWINDOW_H -#define QQNXROOTWINDOW_H - -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -class QQnxScreen; - -class QQnxRootWindow -{ -public: - QQnxRootWindow(const QQnxScreen *screen); - ~QQnxRootWindow(); - - screen_window_t nativeHandle() const { return m_window; } - - void post() const; - void flush() const; - - void setRotation(int rotation); - - void resize(const QSize &size); - - void makeTranslucent(); - - QByteArray groupName() const { return m_windowGroupName; } - -private: - void createWindowGroup(); - - const QQnxScreen *m_screen; - screen_window_t m_window; - QByteArray m_windowGroupName; - - bool m_translucent; -}; - -QT_END_NAMESPACE - -#endif // QQNXROOTWINDOW_H diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 3dab2b3bc9..a09d6ce1f5 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -1,6 +1,6 @@ /*************************************************************************** ** -** Copyright (C) 2011 - 2012 Research In Motion +** Copyright (C) 2011 - 2013 BlackBerry Limited. All rights reserved. ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. @@ -154,8 +154,8 @@ static QQnxWindow *findMultimediaWindow(const QList windows, QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, bool primaryScreen) : m_screenContext(screenContext), m_display(display), + m_rootWindow(0), m_primaryScreen(primaryScreen), - m_posted(false), m_keyboardHeight(0), m_nativeOrientation(Qt::PrimaryOrientation), m_coverWindow(0), @@ -292,7 +292,8 @@ void QQnxScreen::setRotation(int rotation) { qScreenDebug() << Q_FUNC_INFO << "orientation =" << rotation; // Check if rotation changed - if (m_currentRotation != rotation) { + // We only want to rotate if we are the primary screen + if (m_currentRotation != rotation && isPrimaryScreen()) { // Update rotation of root window if (rootWindow()) rootWindow()->setRotation(rotation); @@ -312,15 +313,13 @@ void QQnxScreen::setRotation(int rotation) if (isOrthogonal(m_currentRotation, rotation)) { qScreenDebug() << Q_FUNC_INFO << "resize, size =" << m_currentGeometry.size(); if (rootWindow()) - rootWindow()->resize(m_currentGeometry.size()); + rootWindow()->setGeometry(QRect(QPoint(0,0), m_currentGeometry.size())); - if (m_primaryScreen) - resizeWindows(previousScreenGeometry); + resizeWindows(previousScreenGeometry); } else { // TODO: Find one global place to flush display updates // Force immediate display update if no geometry changes required - if (rootWindow()) - rootWindow()->flush(); + screen_flush_context(nativeContext(), 0); } // Save new rotation @@ -490,6 +489,8 @@ void QQnxScreen::removeWindow(QQnxWindow *window) if (window != m_coverWindow) { const int numWindowsRemoved = m_childWindows.removeAll(window); + if (window == m_rootWindow) //We just removed the root window + m_rootWindow = 0; //TODO we need a new root window ;) if (numWindowsRemoved > 0) updateHierarchy(); } else { @@ -525,13 +526,15 @@ void QQnxScreen::updateHierarchy() QList::const_iterator it; int result; - int topZorder; + int topZorder = 0; errno = 0; - if (isPrimaryScreen()) { + if (rootWindow()) { result = screen_get_window_property_iv(rootWindow()->nativeHandle(), SCREEN_PROPERTY_ZORDER, &topZorder); - if (result != 0) - qFatal("QQnxScreen: failed to query root window z-order, errno=%d", errno); + if (result != 0) { //This can happen if we use winId in QWidgets + topZorder = 10; + qWarning("QQnxScreen: failed to query root window z-order, errno=%d", errno); + } } else { topZorder = 0; //We do not need z ordering on the secondary screen, because only one window //is supported there @@ -539,16 +542,17 @@ void QQnxScreen::updateHierarchy() topZorder++; // root window has the lowest z-order in the windowgroup + int underlayZorder = -1; // Underlays sit immediately above the root window in the z-ordering Q_FOREACH (screen_window_t underlay, m_underlays) { // Do nothing when this fails. This can happen if we have stale windows in m_underlays, // which in turn can happen because a window was removed but we didn't get a notification // yet. - screen_set_window_property_iv(underlay, SCREEN_PROPERTY_ZORDER, &topZorder); - topZorder++; + screen_set_window_property_iv(underlay, SCREEN_PROPERTY_ZORDER, &underlayZorder); + underlayZorder--; } - // Normal Qt windows come next above underlays in the z-ordering + // Normal Qt windows come next above the root window z-ordering for (it = m_childWindows.constBegin(); it != m_childWindows.constEnd(); ++it) (*it)->updateZorder(topZorder); @@ -564,20 +568,6 @@ void QQnxScreen::updateHierarchy() screen_flush_context( m_screenContext, 0 ); } -void QQnxScreen::onWindowPost(QQnxWindow *window) -{ - qScreenDebug() << Q_FUNC_INFO; - Q_UNUSED(window) - - // post app window (so navigator will show it) after first child window - // has posted; this only needs to happen once as the app window's content - // never changes - if (!m_posted && rootWindow()) { - rootWindow()->post(); - m_posted = true; - } -} - void QQnxScreen::adjustOrientation() { if (!m_primaryScreen) @@ -713,7 +703,7 @@ void QQnxScreen::windowGroupStateChanged(const QByteArray &id, Qt::WindowState s if (!rootWindow() || id != rootWindow()->groupName()) return; - QWindow * const window = topMostChildWindow(); + QWindow * const window = rootWindow()->window(); if (!window) return; @@ -728,7 +718,7 @@ void QQnxScreen::activateWindowGroup(const QByteArray &id) if (!rootWindow() || id != rootWindow()->groupName()) return; - QWindow * const window = topMostChildWindow(); + QWindow * const window = rootWindow()->window(); if (!window) return; @@ -755,18 +745,28 @@ void QQnxScreen::deactivateWindowGroup(const QByteArray &id) Q_FOREACH (QQnxWindow *childWindow, m_childWindows) childWindow->setExposed(false); - QWindowSystemInterface::handleWindowActivated(0); + QWindowSystemInterface::handleWindowActivated(rootWindow()->window()); } -QSharedPointer QQnxScreen::rootWindow() const +QQnxWindow *QQnxScreen::rootWindow() const { - // We only create the root window if we are the primary display. - if (m_primaryScreen && !m_rootWindow) - m_rootWindow = QSharedPointer(new QQnxRootWindow(this)); - return m_rootWindow; } +void QQnxScreen::setRootWindow(QQnxWindow *window) +{ + // Optionally disable the screen power save + bool ok = false; + const int disablePowerSave = qgetenv("QQNX_DISABLE_POWER_SAVE").toInt(&ok); + if (ok && disablePowerSave) { + const int mode = SCREEN_IDLE_MODE_KEEP_AWAKE; + int result = screen_set_window_property_iv(window->nativeHandle(), SCREEN_PROPERTY_IDLE_MODE, &mode); + if (result != 0) + qWarning("QQnxRootWindow: failed to disable power saving mode"); + } + m_rootWindow = window; +} + QWindow * QQnxScreen::topMostChildWindow() const { if (!m_childWindows.isEmpty()) { diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index 014f7905f3..61c47e6c72 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -44,7 +44,7 @@ #include -#include "qqnxrootwindow.h" +#include "qqnxwindow.h" #include #include @@ -91,10 +91,10 @@ public: void lowerWindow(QQnxWindow *window); void updateHierarchy(); - void onWindowPost(QQnxWindow *window); void adjustOrientation(); - QSharedPointer rootWindow() const; + QQnxWindow *rootWindow() const; + void setRootWindow(QQnxWindow*); QPlatformCursor *cursor() const; @@ -126,9 +126,8 @@ private: screen_context_t m_screenContext; screen_display_t m_display; - mutable QSharedPointer m_rootWindow; + QQnxWindow *m_rootWindow; const bool m_primaryScreen; - bool m_posted; int m_initialRotation; int m_currentRotation; diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 749a336fcc..1e58d482d4 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -1,6 +1,6 @@ /*************************************************************************** ** -** Copyright (C) 2011 - 2012 Research In Motion +** Copyright (C) 2011 - 2013 BlackBerry Limited. All rights reserved. ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. @@ -40,15 +40,16 @@ ****************************************************************************/ #include "qqnxwindow.h" -#if !defined(QT_NO_OPENGL) -#include "qqnxglcontext.h" -#endif #include "qqnxintegration.h" #include "qqnxscreen.h" +#include + #include #include +#include "private/qguiapplication_p.h" + #include #if defined(Q_OS_BLACKBERRY) @@ -69,12 +70,12 @@ QT_BEGIN_NAMESPACE -QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) +QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootWindow) : QPlatformWindow(window), m_screenContext(context), + m_parentWindow(0), m_window(0), m_screen(0), - m_parentWindow(0), m_visible(false), m_exposed(true), m_windowState(Qt::WindowNoState), @@ -83,13 +84,22 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) qWindowDebug() << Q_FUNC_INFO << "window =" << window << ", size =" << window->size(); int result; - // Create child QNX window + QQnxScreen *platformScreen = static_cast(window->screen()->handle()); + + m_isTopLevel = ( needRootWindow && !platformScreen->rootWindow()) + || (!needRootWindow && !parent()) + || window->type() == Qt::CoverWindow; + errno = 0; - if (static_cast(window->screen()->handle())->isPrimaryScreen() - && window->type() != Qt::CoverWindow) { - result = screen_create_window_type(&m_window, m_screenContext, SCREEN_CHILD_WINDOW); + if (m_isTopLevel) { + result = screen_create_window(&m_window, m_screenContext); // Creates an application window + if (window->type() != Qt::CoverWindow) { + if (needRootWindow) + platformScreen->setRootWindow(this); + createWindowGroup(); + } } else { - result = screen_create_window(&m_window, m_screenContext); + result = screen_create_window_type(&m_window, m_screenContext, SCREEN_CHILD_WINDOW); } if (result != 0) qFatal("QQnxWindow: failed to create window, errno=%d", errno); @@ -116,20 +126,24 @@ QQnxWindow::~QQnxWindow() void QQnxWindow::setGeometry(const QRect &rect) { - const QRect oldGeometry = setGeometryHelper(rect); + QRect newGeometry = rect; + if (screen()->rootWindow() == this) //If this is the root window, it has to be shown fullscreen + newGeometry = screen()->geometry(); + + const QRect oldGeometry = setGeometryHelper(newGeometry); // Send a geometry change event to Qt (triggers resizeEvent() in QWindow/QWidget). // Calling flushWindowSystemEvents() here would flush input events which // could result in re-entering QQnxWindow::setGeometry() again. - QWindowSystemInterface::setSynchronousWindowsSystemEvents(true); - QWindowSystemInterface::handleGeometryChange(window(), rect); - QWindowSystemInterface::handleExposeEvent(window(), rect); + QWindowSystemInterface::setSynchronousWindowsSystemEvents(true); //This does not work + QWindowSystemInterface::handleGeometryChange(window(), newGeometry); + QWindowSystemInterface::handleExposeEvent(window(), newGeometry); QWindowSystemInterface::setSynchronousWindowsSystemEvents(false); // Now move all children. if (!oldGeometry.isEmpty()) { - const QPoint offset = rect.topLeft() - oldGeometry.topLeft(); + const QPoint offset = newGeometry.topLeft() - oldGeometry.topLeft(); Q_FOREACH (QQnxWindow *childWindow, m_childWindows) childWindow->setOffset(offset); } @@ -263,16 +277,6 @@ bool QQnxWindow::isExposed() const return m_visible && m_exposed; } -void QQnxWindow::adjustBufferSize() -{ - if (m_parentWindow) - return; - - const QSize windowSize = window()->size(); - if (windowSize != bufferSize()) - setBufferSize(windowSize); -} - void QQnxWindow::setBufferSize(const QSize &size) { qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "size =" << size; @@ -291,6 +295,8 @@ void QQnxWindow::setBufferSize(const QSize &size) // Create window buffers if they do not exist if (m_bufferSize.isEmpty()) { val[0] = pixelFormat(); + if (val[0] == -1) // The platform GL context was not set yet on the window, so we can't procede + return; errno = 0; result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, val); @@ -304,12 +310,6 @@ void QQnxWindow::setBufferSize(const QSize &size) qFatal("QQnxWindow: failed to create window buffers, errno=%d", errno); } - // If the child window has been configured for transparency, lazily create - // a full-screen buffer to back the root window. - if (window()->requestedFormat().hasAlpha()) { - m_screen->rootWindow()->makeTranslucent(); - } - // check if there are any buffers available int bufferCount = 0; result = screen_get_window_property_iv(m_window, SCREEN_PROPERTY_RENDER_BUFFER_COUNT, &bufferCount); @@ -334,6 +334,9 @@ void QQnxWindow::setScreen(QQnxScreen *platformScreen) if (platformScreen == 0) { // The screen has been destroyed m_screen = 0; + Q_FOREACH (QQnxWindow *childWindow, m_childWindows) { + childWindow->setScreen(0); + } return; } @@ -343,26 +346,36 @@ void QQnxWindow::setScreen(QQnxScreen *platformScreen) if (m_screen) { qWindowDebug() << Q_FUNC_INFO << "Moving window to different screen"; m_screen->removeWindow(this); - screen_leave_window_group(m_window); + QQnxIntegration *platformIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); + + if ((platformIntegration->options() & QQnxIntegration::RootWindow)) { + screen_leave_window_group(m_window); + } } - platformScreen->addWindow(this); m_screen = platformScreen; - - // Move window to proper screen/display - errno = 0; - screen_display_t display = platformScreen->nativeDisplay(); - int result = screen_set_window_property_pv(m_window, SCREEN_PROPERTY_DISPLAY, (void **)&display); - if (result != 0) - qFatal("QQnxWindow: failed to set window display, errno=%d", errno); - - - if (m_screen->isPrimaryScreen() && window()->type() != Qt::CoverWindow) { - // Add window to display's window group + if (!m_parentWindow) { + platformScreen->addWindow(this); + } + if (m_isTopLevel) { + // Move window to proper screen/display errno = 0; - result = screen_join_window_group(m_window, platformScreen->windowGroupName()); + screen_display_t display = platformScreen->nativeDisplay(); + int result = screen_set_window_property_pv(m_window, SCREEN_PROPERTY_DISPLAY, (void **)&display); if (result != 0) - qFatal("QQnxWindow: failed to join window group, errno=%d", errno); + qFatal("QQnxWindow: failed to set window display, errno=%d", errno); + } else { + errno = 0; + int result; + if (!parent()) { + result = screen_join_window_group(m_window, platformScreen->windowGroupName()); + if (result != 0) + qFatal("QQnxWindow: failed to join window group, errno=%d", errno); + } else { + result = screen_join_window_group(m_window, static_cast(parent())->groupName().constData()); + if (result != 0) + qFatal("QQnxWindow: failed to join window group, errno=%d", errno); + } Q_FOREACH (QQnxWindow *childWindow, m_childWindows) { // Only subwindows and tooltips need necessarily be moved to another display with the window. @@ -406,20 +419,12 @@ void QQnxWindow::setParent(const QPlatformWindow *window) setScreen(m_parentWindow->m_screen); m_parentWindow->m_childWindows.push_back(this); - - // we don't need any buffers, since - // Qt will draw to the parent TLW - // backing store. - setBufferSize(QSize(1, 1)); } else { m_screen->addWindow(this); - - // recreate buffers, in case the - // window has been reparented and - // becomes a TLW - adjustBufferSize(); } + adjustBufferSize(); + m_screen->updateHierarchy(); } @@ -541,6 +546,15 @@ void QQnxWindow::minimize() #endif } +void QQnxWindow::setRotation(int rotation) +{ + qWindowDebug() << Q_FUNC_INFO << "angle =" << rotation; + errno = 0; + int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ROTATION, &rotation); + if (result != 0) + qFatal("QQnxRootWindow: failed to set window rotation, errno=%d", errno); +} + void QQnxWindow::initWindow() { // Alpha channel is always pre-multiplied if present @@ -595,9 +609,24 @@ void QQnxWindow::initWindow() if (window()->parent() && window()->parent()->handle()) setParent(window()->parent()->handle()); setGeometryHelper(window()->geometry()); + if (screen()->rootWindow() == this) { + setGeometry(screen()->geometry()); + } } +void QQnxWindow::createWindowGroup() +{ + // Generate a random window group name + m_windowGroupName = QUuid::createUuid().toString().toLatin1(); + + // Create window group so child windows can be parented by container window + errno = 0; + int result = screen_create_window_group(m_window, m_windowGroupName.constData()); + if (result != 0) + qFatal("QQnxRootWindow: failed to create app window group, errno=%d", errno); +} + void QQnxWindow::updateZorder(int &topZorder) { updateZorder(m_window, topZorder); diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h index 52d22235a2..3c8070b0be 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.h +++ b/src/plugins/platforms/qnx/qqnxwindow.h @@ -66,12 +66,7 @@ class QQnxWindow : public QPlatformWindow { friend class QQnxScreen; public: - enum WindowType { - EGL, - Raster - }; - - QQnxWindow(QWindow *window, screen_context_t context); + QQnxWindow(QWindow *window, screen_context_t context, bool needRootWindow); virtual ~QQnxWindow(); void setGeometry(const QRect &rect); @@ -83,7 +78,7 @@ public: WId winId() const { return (WId)m_window; } screen_window_t nativeHandle() const { return m_window; } - void adjustBufferSize(); + virtual void adjustBufferSize() = 0; void setBufferSize(const QSize &size); QSize bufferSize() const { return m_bufferSize; } @@ -114,7 +109,10 @@ public: screen_window_t mmRendererWindow() const { return m_mmRendererWindow; } - virtual WindowType windowType() const = 0; + void setRotation(int rotation); + + QByteArray groupName() const { return m_windowGroupName; } + protected: virtual int pixelFormat() const = 0; virtual void resetBuffers() = 0; @@ -124,7 +122,10 @@ protected: screen_context_t m_screenContext; QScopedPointer m_cover; + QQnxWindow *m_parentWindow; + private: + void createWindowGroup(); QRect setGeometryHelper(const QRect &rect); void removeFromParent(); void setOffset(const QPoint &setOffset); @@ -138,13 +139,16 @@ private: QQnxScreen *m_screen; QList m_childWindows; - QQnxWindow *m_parentWindow; bool m_visible; bool m_exposed; QRect m_unmaximizedGeometry; Qt::WindowState m_windowState; QString m_mmRendererWindowName; screen_window_t m_mmRendererWindow; + + QByteArray m_windowGroupName; + + bool m_isTopLevel; }; QT_END_NAMESPACE -- cgit v1.2.3 From f1053d94f59f053ce4acad9320df14f1fbe4faac Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 11 Nov 2013 14:27:40 +0100 Subject: Fully expand entities to ensure deep or widely nested ones fail parsing With 46a8885ae486e238a39efa5119c2714f328b08e4, we failed when parsing entities whose partially expanded size was greater than 1024 characters. That was not enough, so now we fully expand all entities. Amends 46a8885ae486e238a39efa5119c2714f328b08e4. Change-Id: Ie80720d7e04d825eb4eebf528140eb94806c02b1 Reviewed-by: Richard J. Moore Reviewed-by: Lars Knoll --- src/xml/sax/qxml.cpp | 62 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index e6d78d3434..f3a1e479f2 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -426,7 +426,9 @@ private: // The limit to the amount of times the DTD parsing functions can be called // for the DTD currently being parsed. - int dtdRecursionLimit; + static const int dtdRecursionLimit = 2; + // The maximum amount of characters an entity value may contain, after expansion. + static const int entityCharacterLimit = 1024; const QString &string(); void stringClear(); @@ -497,7 +499,7 @@ private: void parseFailed(ParseFunction where, int state); void pushParseState(ParseFunction function, int state); - bool isPartiallyExpandedEntityValueTooLarge(QString *errorMessage); + bool isExpandedEntityValueTooLarge(QString *errorMessage); Q_DECLARE_PUBLIC(QXmlSimpleReader) QXmlSimpleReader *q_ptr; @@ -2763,8 +2765,6 @@ QXmlSimpleReaderPrivate::QXmlSimpleReaderPrivate(QXmlSimpleReader *reader) useNamespacePrefixes = false; reportWhitespaceCharData = true; reportEntities = false; - - dtdRecursionLimit = 2; } QXmlSimpleReaderPrivate::~QXmlSimpleReaderPrivate() @@ -6657,30 +6657,43 @@ bool QXmlSimpleReaderPrivate::parseChoiceSeq() return false; } -bool QXmlSimpleReaderPrivate::isPartiallyExpandedEntityValueTooLarge(QString *errorMessage) +bool QXmlSimpleReaderPrivate::isExpandedEntityValueTooLarge(QString *errorMessage) { - const QString value = string(); - QMap referencedEntityCounts; - foreach (QString entityName, entities.keys()) { - for (int i = 0; i < value.size() && i != -1; ) { - i = value.indexOf(entityName, i); - if (i != -1) { - // The entityName we're currently trying to find - // was matched in this string; increase our count. - ++referencedEntityCounts[entityName]; - i += entityName.size(); + QMap literalEntitySizes; + // The entity at (QMap) times. + QMap > referencesToOtherEntities; + QMap expandedSizes; + + // For every entity, check how many times all entity names were referenced in its value. + foreach (QString toSearch, entities.keys()) { + // The amount of characters that weren't entity names, but literals, like 'X'. + QString leftOvers = entities.value(toSearch); + // How many times was entityName referenced by toSearch? + foreach (QString entityName, entities.keys()) { + for (int i = 0; i < leftOvers.size() && i != -1; ) { + i = leftOvers.indexOf(QString::fromLatin1("&%1;").arg(entityName), i); + if (i != -1) { + leftOvers.remove(i, entityName.size() + 2); + // The entityName we're currently trying to find was matched in this string; increase our count. + ++referencesToOtherEntities[toSearch][entityName]; + } } } + literalEntitySizes[toSearch] = leftOvers.size(); } - foreach (QString entityName, referencedEntityCounts.keys()) { - const int timesReferenced = referencedEntityCounts[entityName]; - const QString entityValue = entities[entityName]; - if (entityValue.size() * timesReferenced > 1024) { + foreach (QString entity, referencesToOtherEntities.keys()) { + expandedSizes[entity] = literalEntitySizes[entity]; + foreach (QString referenceTo, referencesToOtherEntities.value(entity).keys()) { + const int references = referencesToOtherEntities.value(entity).value(referenceTo); + // The total size of an entity's value is the expanded size of all of its referenced entities, plus its literal size. + expandedSizes[entity] += expandedSizes[referenceTo] * references + literalEntitySizes[referenceTo] * references; + } + + if (expandedSizes[entity] > entityCharacterLimit) { if (errorMessage) { - *errorMessage = QString::fromLatin1("The XML entity \"%1\"" - "expands too a string that is too large to process when " - "referencing \"%2\" %3 times.").arg(entityName).arg(entityName).arg(timesReferenced); + *errorMessage = QString::fromLatin1("The XML entity \"%1\" expands too a string that is too large to process (%2 characters > %3)."); + *errorMessage = (*errorMessage).arg(entity).arg(expandedSizes[entity]).arg(entityCharacterLimit); } return true; } @@ -6783,10 +6796,7 @@ bool QXmlSimpleReaderPrivate::parseEntityDecl() case EValue: if ( !entityExist(name())) { QString errorMessage; - if (isPartiallyExpandedEntityValueTooLarge(&errorMessage)) { - // The entity at entityName is entityValue.size() characters - // long in its unexpanded form, and was mentioned timesReferenced times, - // resulting in a string that would be greater than 1024 characters. + if (isExpandedEntityValueTooLarge(&errorMessage)) { reportParseError(errorMessage); return false; } -- cgit v1.2.3 From 6b745d6c6336445ec98cbed4dfa1fd3fb801b369 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 9 Nov 2013 16:58:52 +0100 Subject: Move MaxKeyCount from QKeySequenceEditPrivate to QKeySequencePrivate Adjust users and add a static_cast that MaxKeyCount be 4. That is instead of adjusting all the code to use MaxKeyCount instead, some of which cannot be thus changed (e.g. where using the QKeySequence(int, int, int, int) constructor). This was requested in the original review, but never implemented. Change-Id: I3812340890f4d75257139f04e73e83083ca09760 Reviewed-by: Konstantin Ritt Reviewed-by: Friedemann Kleint --- src/gui/kernel/qkeysequence_p.h | 1 + src/widgets/widgets/qkeysequenceedit.cpp | 8 +++++--- src/widgets/widgets/qkeysequenceedit_p.h | 5 ++--- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h index eac0d4b0a6..3751660500 100644 --- a/src/gui/kernel/qkeysequence_p.h +++ b/src/gui/kernel/qkeysequence_p.h @@ -69,6 +69,7 @@ struct Q_AUTOTEST_EXPORT QKeyBinding class Q_AUTOTEST_EXPORT QKeySequencePrivate { public: + enum { MaxKeyCount = 4 }; // used in QKeySequenceEdit inline QKeySequencePrivate() : ref(1) { key[0] = key[1] = key[2] = key[3] = 0; diff --git a/src/widgets/widgets/qkeysequenceedit.cpp b/src/widgets/widgets/qkeysequenceedit.cpp index db39ceb08a..858a122b28 100644 --- a/src/widgets/widgets/qkeysequenceedit.cpp +++ b/src/widgets/widgets/qkeysequenceedit.cpp @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_KEYSEQUENCEEDIT +Q_STATIC_ASSERT(QKeySequencePrivate::MaxKeyCount == 4); // assumed by the code around here + void QKeySequenceEditPrivate::init() { Q_Q(QKeySequenceEdit); @@ -280,7 +282,7 @@ void QKeySequenceEdit::keyPressEvent(QKeyEvent *e) return; } - if (d->keyNum >= QKeySequenceEditPrivate::MaxKeyCount) + if (d->keyNum >= QKeySequencePrivate::MaxKeyCount) return; nextKey |= d->translateModifiers(e->modifiers(), e->text()); @@ -291,7 +293,7 @@ void QKeySequenceEdit::keyPressEvent(QKeyEvent *e) QKeySequence key(d->key[0], d->key[1], d->key[2], d->key[3]); d->keySequence = key; QString text = key.toString(QKeySequence::NativeText); - if (d->keyNum < QKeySequenceEditPrivate::MaxKeyCount) { + if (d->keyNum < QKeySequencePrivate::MaxKeyCount) { //: This text is an "unfinished" shortcut, expands like "Ctrl+A, ..." text = tr("%1, ...").arg(text); } @@ -307,7 +309,7 @@ void QKeySequenceEdit::keyReleaseEvent(QKeyEvent *e) Q_D(QKeySequenceEdit); if (d->prevKey == e->key()) { - if (d->keyNum < QKeySequenceEditPrivate::MaxKeyCount) + if (d->keyNum < QKeySequencePrivate::MaxKeyCount) d->releaseTimer = startTimer(1000); else d->finishEditing(); diff --git a/src/widgets/widgets/qkeysequenceedit_p.h b/src/widgets/widgets/qkeysequenceedit_p.h index 58c9699059..f74433bb71 100644 --- a/src/widgets/widgets/qkeysequenceedit_p.h +++ b/src/widgets/widgets/qkeysequenceedit_p.h @@ -46,6 +46,7 @@ #include "qkeysequenceedit.h" #include +#include QT_BEGIN_NAMESPACE @@ -57,8 +58,6 @@ class QKeySequenceEditPrivate : public QWidgetPrivate { Q_DECLARE_PUBLIC(QKeySequenceEdit) public: - enum { MaxKeyCount = 4 }; - void init(); int translateModifiers(Qt::KeyboardModifiers state, const QString &text); void resetState(); @@ -67,7 +66,7 @@ public: QLineEdit *lineEdit; QKeySequence keySequence; int keyNum; - int key[MaxKeyCount]; + int key[QKeySequencePrivate::MaxKeyCount]; int prevKey; int releaseTimer; }; -- cgit v1.2.3 From 4d1ece8b44b27294cdf77c685aa3d34882cdef95 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 9 Nov 2013 17:41:26 +0100 Subject: QKeySequenceEdit: simplify clear() As the test case shows, clear() is semantically equivalent to setKeySequence(QKeySequence()), so implement it that way. Change-Id: Id68edbbf85aac3bcff82c81310c38274ed8e6708 Reviewed-by: J-P Nurmi Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qkeysequenceedit.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qkeysequenceedit.cpp b/src/widgets/widgets/qkeysequenceedit.cpp index 858a122b28..c056967cf7 100644 --- a/src/widgets/widgets/qkeysequenceedit.cpp +++ b/src/widgets/widgets/qkeysequenceedit.cpp @@ -224,15 +224,7 @@ void QKeySequenceEdit::setKeySequence(const QKeySequence &keySequence) */ void QKeySequenceEdit::clear() { - Q_D(QKeySequenceEdit); - - d->resetState(); - - d->lineEdit->clear(); - d->keySequence = QKeySequence(); - d->keyNum = d->key[0] = d->key[1] = d->key[2] = d->key[3] = 0; - d->prevKey = -1; - emit keySequenceChanged(d->keySequence); + setKeySequence(QKeySequence()); } /*! -- cgit v1.2.3 From f75c5c7dc64ae6248f8fbbabb434f871c0867d59 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 9 Nov 2013 17:50:45 +0100 Subject: QKeySequenceEdit: add to qfeatures.txt QT_NO_KEYSEQUENCEEDIT was only added to qfeatures.h whose removal killed the feature. Change-Id: I0644bcffdd814bb0bdb4c94d281d56fa3baff3a3 Reviewed-by: J-P Nurmi Reviewed-by: Konstantin Ritt Reviewed-by: Ivan Komissarov Reviewed-by: Friedemann Kleint Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qfeatures.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 3e9fc88eba..84c9379bbc 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -476,6 +476,12 @@ Section: Widgets Requires: GRAPHICSVIEW PRINTER MAINWINDOW Name: QPrintPreviewWidget +Feature: KEYSEQUENCEEDIT +Description: Provides a widget for editing QKeySequences +Section: Widgets +Requires: LINEEDIT SHORTCUT +Name: QKeySequenceEdit + # Dialogs Feature: MESSAGEBOX -- cgit v1.2.3 From e6eadd6f61ae38a49a6bb355c02532cad2aacf4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 11 Nov 2013 15:38:43 +0100 Subject: iOS: Flesh out device-pixel-ratio handling in QIOSWindow We don't need to cache the device-pixel-ratio, as we can ask the UIView directly. We do need to set it though, as the default behavior of matching the screen scale does not apply for EAGL-backed views, but the ratio needs to match the current screen the view is on. Change-Id: I29e4a4fa4f4b767d86265ec899fb43a355b5c3a3 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioswindow.h | 1 - src/plugins/platforms/ios/qioswindow.mm | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index b60290e479..9ab9a3a45e 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -87,7 +87,6 @@ private: QRect m_normalGeometry; int m_windowLevel; - qreal m_devicePixelRatio; void raiseOrLower(bool raise); void updateWindowLevel(); diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index f46616db1d..6d7b793f0b 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -127,6 +127,16 @@ return self; } +- (void)willMoveToWindow:(UIWindow *)newWindow +{ + // UIKIt will normally set the scale factor of a view to match the corresponding + // screen scale factor, but views backed by CAEAGLLayers need to do this manually. + self.contentScaleFactor = newWindow && newWindow.screen ? + newWindow.screen.scale : [[UIScreen mainScreen] scale]; + + // FIXME: Allow the scale factor to be customized through QSurfaceFormat. +} + - (void)layoutSubviews { // This method is the de facto way to know that view has been resized, @@ -331,19 +341,9 @@ QIOSWindow::QIOSWindow(QWindow *window) , m_view([[QUIView alloc] initWithQIOSWindow:this]) , m_normalGeometry(QPlatformWindow::geometry()) , m_windowLevel(0) - , m_devicePixelRatio(1.0) { setParent(parent()); setWindowState(window->windowState()); - - // Retina support: get screen scale factor and set it in the content view. - // This will make framebufferObject() create a 2x frame buffer on retina - // displays. Also set m_devicePixelRatio which is used for scaling the - // paint device. - if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] == YES) { - m_devicePixelRatio = [[UIScreen mainScreen] scale]; - [m_view setContentScaleFactor: m_devicePixelRatio]; - } } QIOSWindow::~QIOSWindow() @@ -522,7 +522,7 @@ void QIOSWindow::handleContentOrientationChange(Qt::ScreenOrientation orientatio qreal QIOSWindow::devicePixelRatio() const { - return m_devicePixelRatio; + return m_view.contentScaleFactor; } QT_END_NAMESPACE -- cgit v1.2.3 From 18182a6275bb353dfb67ebc1562649e7624ccb0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 11 Nov 2013 16:33:21 +0100 Subject: iOS: Handle key window as part of QWindow activation The default UIWindow may not be the only UIWindow around in a multi screen setup. Change-Id: Ia7243190321a1416e577634bf5e010dd67d482e6 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosapplicationdelegate.mm | 2 +- src/plugins/platforms/ios/qioswindow.mm | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm index e06d2b8840..def6d2ff04 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm @@ -64,7 +64,7 @@ self.window.backgroundColor = [UIColor cyanColor]; #endif - [self.window makeKeyAndVisible]; + self.window.hidden = NO; return YES; } diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 6d7b793f0b..23e6ad82b5 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -456,6 +456,8 @@ void QIOSWindow::requestActivateWindow() if (!window()->isTopLevel() || blockedByModal()) return; + [m_view.window makeKeyWindow]; + raise(); QPlatformInputContext *context = QGuiApplicationPrivate::platformIntegration()->inputContext(); static_cast(context)->focusViewChanged(m_view); -- cgit v1.2.3 From bb1225f5ba6f4bc5d7b8c2878d8f4ac492631c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 11 Nov 2013 15:17:56 +0100 Subject: iOS: Tie QIOSContext FBOs to corresponding QPlatformWindow, not QWindow A QWindow may be created() and destroyed() multiple times in the lifetime of the window, each time resulting in a new platform window (QIOSWindow) being created. This QIOSWindow is backed by a new UIView each time, hence it needs a new FBO and renderbuffer-mapping, since the previous renderbuffer was mapped to the old UIView. This fixes a bug where a QWindow would not render after a destroy() unless it was resized (which triggered new FBO/renderbuffers). We need to inherit QObject so that we can watch the destroyed() signal. Change-Id: I93172dd6280b86b49755bf7abddf061d7e6b66f1 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioscontext.h | 4 +++- src/plugins/platforms/ios/qioscontext.mm | 9 ++++----- src/plugins/platforms/ios/qioswindow.h | 4 +++- src/plugins/platforms/ios/qioswindow.mm | 4 +++- 4 files changed, 13 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioscontext.h b/src/plugins/platforms/ios/qioscontext.h index 961661c5d3..c48a0251a9 100644 --- a/src/plugins/platforms/ios/qioscontext.h +++ b/src/plugins/platforms/ios/qioscontext.h @@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE +class QIOSWindow; + class QIOSContext : public QObject, public QPlatformOpenGLContext { Q_OBJECT @@ -87,7 +89,7 @@ private: static void deleteBuffers(const FramebufferObject &framebufferObject); - mutable QHash m_framebufferObjects; + mutable QHash m_framebufferObjects; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm index d7b9314ae0..7310d2904f 100644 --- a/src/plugins/platforms/ios/qioscontext.mm +++ b/src/plugins/platforms/ios/qioscontext.mm @@ -113,7 +113,7 @@ void QIOSContext::swapBuffers(QPlatformSurface *surface) { Q_ASSERT(surface && surface->surface()->surfaceType() == QSurface::OpenGLSurface); Q_ASSERT(surface->surface()->surfaceClass() == QSurface::Window); - QWindow *window = static_cast(surface->surface()); + QIOSWindow *window = static_cast(surface); Q_ASSERT(m_framebufferObjects.contains(window)); [EAGLContext setCurrentContext:m_eaglContext]; @@ -124,7 +124,7 @@ void QIOSContext::swapBuffers(QPlatformSurface *surface) GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const { Q_ASSERT(surface && surface->surface()->surfaceClass() == QSurface::Window); - QWindow *window = static_cast(surface->surface()); + QIOSWindow *window = static_cast(surface); FramebufferObject &framebufferObject = m_framebufferObjects[window]; @@ -155,8 +155,7 @@ GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const } // Ensure that the FBO's buffers match the size of the layer - QIOSWindow *platformWindow = static_cast(surface); - UIView *view = reinterpret_cast(platformWindow->winId()); + UIView *view = reinterpret_cast(window->winId()); CAEAGLLayer *layer = static_cast(view.layer); if (framebufferObject.renderbufferWidth != (layer.frame.size.width * layer.contentsScale) || framebufferObject.renderbufferHeight != (layer.frame.size.height * layer.contentsScale)) { @@ -191,7 +190,7 @@ GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const void QIOSContext::windowDestroyed(QObject *object) { - QWindow *window = static_cast(object); + QIOSWindow *window = static_cast(object); if (m_framebufferObjects.contains(window)) { EAGLContext *originalContext = [EAGLContext currentContext]; [EAGLContext setCurrentContext:m_eaglContext]; diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index 9ab9a3a45e..5ded589205 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -58,8 +58,10 @@ QT_BEGIN_NAMESPACE @class QUIView; -class QIOSWindow : public QPlatformWindow +class QIOSWindow : public QObject, public QPlatformWindow { + Q_OBJECT + public: explicit QIOSWindow(QWindow *window); ~QIOSWindow(); diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 23e6ad82b5..215f590595 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -342,7 +342,7 @@ QIOSWindow::QIOSWindow(QWindow *window) , m_normalGeometry(QPlatformWindow::geometry()) , m_windowLevel(0) { - setParent(parent()); + setParent(QPlatformWindow::parent()); setWindowState(window->windowState()); } @@ -527,4 +527,6 @@ qreal QIOSWindow::devicePixelRatio() const return m_view.contentScaleFactor; } +#include "moc_qioswindow.cpp" + QT_END_NAMESPACE -- cgit v1.2.3 From 2afbd92274446359d278b5a1025067e20dd11df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 8 Nov 2013 09:26:37 +0100 Subject: iOS: Get rid of separate release pool for QIOSScreen We don't use separate pools anwyhere else, and this was copied straight from the UIKit plugin. Unless there's a good reason for having it in this particular place we should keep things consistent. Change-Id: I9a3f83bcc5894a2cdfd9af7818b46d6c0f8448da Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosscreen.mm | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index c28d8881bf..d57e678810 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -123,8 +123,6 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex) , m_uiScreen([[UIScreen screens] objectAtIndex:qMin(NSUInteger(screenIndex), [[UIScreen screens] count] - 1)]) , m_orientationListener(0) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - QString deviceIdentifier = deviceModelIdentifier(); if (deviceIdentifier == QStringLiteral("iPhone2,1") /* iPhone 3GS */ @@ -153,8 +151,6 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex) // When in a non-mixed environment, let QScreen follow the current interface orientation: setPrimaryOrientation(toQtScreenOrientation(UIDeviceOrientation(qiosViewController().interfaceOrientation))); } - - [pool release]; } QIOSScreen::~QIOSScreen() -- cgit v1.2.3 From 3a7104420cc8f8eb11b3596cef310f52c350bbd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 12 Nov 2013 15:28:07 +0100 Subject: iOS: Remove background color for UIWindow and UIViewController's root view They were handy while debugging the iOS platform plugin, but should not affect users who link against debug libraries, so let's just remove them. Change-Id: I61b157e81130e5d951c22892e00f71e593082b1d Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosapplicationdelegate.mm | 4 ---- src/plugins/platforms/ios/qiosviewcontroller.mm | 8 -------- 2 files changed, 12 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm index def6d2ff04..4d88faba75 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm @@ -60,10 +60,6 @@ self.qiosViewController = [[[QIOSViewController alloc] init] autorelease]; self.window.rootViewController = self.qiosViewController; -#ifdef QT_DEBUG - self.window.backgroundColor = [UIColor cyanColor]; -#endif - self.window.hidden = NO; return YES; diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index d315b49776..656a86027d 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -48,14 +48,6 @@ @implementation QIOSViewController -- (void)viewDidLoad -{ -#ifdef QT_DEBUG - if (!self.nibName) - self.view.backgroundColor = [UIColor magentaColor]; -#endif -} - -(BOOL)shouldAutorotate { // Until a proper orientation and rotation API is in place, we always auto rotate. -- cgit v1.2.3 From d160f195077af1d06fd8ac1da30fd7044f6bb3bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 12 Nov 2013 16:25:25 +0100 Subject: iOS: Enable clipping of subviews when QWindow has child windows QWindow::setParent() is documented to imply that the geometry of the window is in the parent's coordinate system and that the window is clipped to the parent. Instead of always enabling clipping of subviews for our UIView subclass we dynamically detect if we have QWindow children and enable/disable it on the fly. Change-Id: If83de94c55cbd19de401ab835e86bb7be5999d71 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioswindow.mm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 215f590595..e02f570634 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -137,6 +137,22 @@ // FIXME: Allow the scale factor to be customized through QSurfaceFormat. } +- (void)didAddSubview:(UIView *)subview +{ + if ([subview isKindOfClass:[QUIView class]]) + self.clipsToBounds = YES; +} + +- (void)willRemoveSubview:(UIView *)subview +{ + for (UIView *view in self.subviews) { + if (view != subview && [view isKindOfClass:[QUIView class]]) + return; + } + + self.clipsToBounds = NO; +} + - (void)layoutSubviews { // This method is the de facto way to know that view has been resized, -- cgit v1.2.3 From 3ebcbdd322c070c9bada31eceea1ea3c6ac2c0de Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 11 Nov 2013 14:40:50 +0100 Subject: Android: fix crash on exit Let's not try to dereference the null pointer. Task-number: QTBUG-34746 Change-Id: Iee79b711bd81614e36af4ab3612f9a87053a39f2 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/src/androidjnimenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/android/src/androidjnimenu.cpp b/src/plugins/platforms/android/src/androidjnimenu.cpp index 866acd3c7e..293af2b9cd 100644 --- a/src/plugins/platforms/android/src/androidjnimenu.cpp +++ b/src/plugins/platforms/android/src/androidjnimenu.cpp @@ -142,7 +142,7 @@ namespace QtAndroidMenu void setActiveTopLevelWindow(QWindow *window) { - Qt::WindowFlags flags = window->flags(); + Qt::WindowFlags flags = window ? window->flags() : Qt::WindowFlags(); bool isNonRegularWindow = flags & (Qt::Desktop | Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window; if (isNonRegularWindow) return; -- cgit v1.2.3 From 4abf5fd3ea21501f8caf06ff7e3fcd01084e1d2e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 12:35:54 +0100 Subject: QOpenGLPixelTransferOptions: declare as shared, add move assignment operator A move constructor cannot be added because the class uses a smart pointer to hold its pImpl, so the move ctor would have to be out-of-line, destroying BC between C++11 and C++98 versions of Qt. Member-swap is required for Q_DECLARED_SHARED, which in turn enables efficient use of the class in Qt containers by marking it movable. Change-Id: I1aaa5bf3343a92e621d9464d8e4352f4e5ceff1f Reviewed-by: Sean Harmer --- src/gui/opengl/qopenglpixeltransferoptions.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/gui/opengl/qopenglpixeltransferoptions.h b/src/gui/opengl/qopenglpixeltransferoptions.h index 1a5d3f00e2..c150e8aff4 100644 --- a/src/gui/opengl/qopenglpixeltransferoptions.h +++ b/src/gui/opengl/qopenglpixeltransferoptions.h @@ -60,6 +60,14 @@ public: QOpenGLPixelTransferOptions &operator=(const QOpenGLPixelTransferOptions &); ~QOpenGLPixelTransferOptions(); +#ifdef Q_COMPILER_RVALUE_REFS + QOpenGLPixelTransferOptions &operator=(QOpenGLPixelTransferOptions &&other) + { swap(other); return *this; } +#endif + + void swap(QOpenGLPixelTransferOptions &other) + { data.swap(other.data); } + void setAlignment(int alignment); int alignment() const; @@ -88,6 +96,8 @@ private: QSharedDataPointer data; }; +Q_DECLARE_SHARED(QOpenGLPixelTransferOptions) + QT_END_NAMESPACE #endif // QT_NO_OPENGL -- cgit v1.2.3 From a256c8459a8eee06833d59b0292c67150e856e8d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 12:36:58 +0100 Subject: QOpenGLTexture: mark (Target) ctor explicit Disables implicit conversions from Target to QOpenGLTexture. Change-Id: I2edd2dc4528a311577f0b7df4f6ce22696336a88 Reviewed-by: Sean Harmer --- src/gui/opengl/qopengltexture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h index e06cf26f60..b761d63775 100644 --- a/src/gui/opengl/qopengltexture.h +++ b/src/gui/opengl/qopengltexture.h @@ -96,7 +96,7 @@ public: DontResetTextureUnit }; - QOpenGLTexture(Target target); + explicit QOpenGLTexture(Target target); QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps); ~QOpenGLTexture(); -- cgit v1.2.3 From c887fbd79503824882df08365e39d27580164ac9 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 12:37:20 +0100 Subject: QOpenGLTexture: mark (QImage) ctor explicit Disables implicit conversions from QImage to QOpenGLTexture. Change-Id: I09b4d236dde8eae5258e6a954f4e02b4451990bd Reviewed-by: Sean Harmer --- src/gui/opengl/qopengltexture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h index b761d63775..3428f0d74a 100644 --- a/src/gui/opengl/qopengltexture.h +++ b/src/gui/opengl/qopengltexture.h @@ -97,7 +97,7 @@ public: }; explicit QOpenGLTexture(Target target); - QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps); + explicit QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps); ~QOpenGLTexture(); // Creation and destruction -- cgit v1.2.3 From bcf5dbc8a02a42dbb300805c9a380debc3a6f2d3 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 14 Nov 2013 12:17:09 +0100 Subject: Fix jerky animations in Qt Quick for iOS. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will make Qt Quick use consistent timing which prepares animation frames for the time they go to screen, rather than the current time at the time of the animation tick, which can be quite jerky in many situations. Change-Id: I1bbd4394db0c757553ee406d416fccb3ef937db8 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosintegration.mm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index 393a9f317d..44ac749454 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -101,6 +101,8 @@ QIOSIntegration::~QIOSIntegration() bool QIOSIntegration::hasCapability(Capability cap) const { switch (cap) { + case BufferQueueingOpenGL: + return true; case OpenGL: case ThreadedOpenGL: return true; -- cgit v1.2.3 From 2828072d509fd052aaae18fee59d9b4f5d079717 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Tue, 12 Nov 2013 10:45:26 +0200 Subject: Android: Initialize mWindowState Use the same variable in QAndroidPlatformWindow. Task-number: QTBUG-34764 Change-Id: Idf33707e81cf7306663196f3c17735d8dc1dde5d Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/platformsupport/fbconvenience/qfbwindow.cpp | 2 +- .../platforms/android/src/raster/qandroidplatformwindow.cpp | 8 +++----- src/plugins/platforms/android/src/raster/qandroidplatformwindow.h | 3 --- 3 files changed, 4 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/platformsupport/fbconvenience/qfbwindow.cpp b/src/platformsupport/fbconvenience/qfbwindow.cpp index b489ed351c..98c16e61c8 100644 --- a/src/platformsupport/fbconvenience/qfbwindow.cpp +++ b/src/platformsupport/fbconvenience/qfbwindow.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE QFbWindow::QFbWindow(QWindow *window) - : QPlatformWindow(window), mBackingStore(0) + : QPlatformWindow(window), mBackingStore(0), mWindowState(Qt::WindowNoState) { static QAtomicInt winIdGenerator(1); mWindowId = winIdGenerator.fetchAndAddRelaxed(1); diff --git a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp index 2dedc77027..7ff18526d9 100644 --- a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp +++ b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp @@ -46,7 +46,6 @@ QAndroidPlatformWindow::QAndroidPlatformWindow(QWindow *window) : QFbWindow(window) - , m_state(Qt::WindowNoState) { } @@ -65,9 +64,9 @@ void QAndroidPlatformWindow::updateStatusBarVisibility() Qt::WindowFlags flags = window()->flags(); bool isNonRegularWindow = flags & (Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window; if (!isNonRegularWindow) { - if (m_state & Qt::WindowFullScreen) + if (mWindowState & Qt::WindowFullScreen) QtAndroid::hideStatusBar(); - else if (m_state & Qt::WindowMaximized) + else if (mWindowState & Qt::WindowMaximized) QtAndroid::showStatusBar(); } } @@ -80,10 +79,9 @@ void QAndroidPlatformWindow::raise() void QAndroidPlatformWindow::setWindowState(Qt::WindowState state) { - if (m_state == state) + if (mWindowState == state) return; - m_state = state; if (window()->isVisible()) updateStatusBarVisibility(); diff --git a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h index 87626b982a..9e3f203201 100644 --- a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h +++ b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h @@ -59,9 +59,6 @@ public: public slots: void setGeometry(const QRect &rect); - -private: - Qt::WindowState m_state; }; #endif // ANDROIDPLATFORMWINDOW_H -- cgit v1.2.3 From 4577026397ac15bead5ddcbda4b0a57bae831acb Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 12:01:48 +0100 Subject: QTimeZone: add member-swap This is customary for Qt value types these days. Change-Id: If5374c2595a904337eaef4afc08cdc993229ac25 Reviewed-by: John Layt Reviewed-by: Lars Knoll --- src/corelib/tools/qtimezone.cpp | 7 +++++++ src/corelib/tools/qtimezone.h | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index b6196d99e5..6fe42ab45e 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -422,6 +422,13 @@ QTimeZone &QTimeZone::operator=(const QTimeZone &other) return *this; } +/* + \fn void QTimeZone::swap(QTimeZone &other) + + Swaps this timezone with \a other. This function is very fast and + never fails. +*/ + /*! \fn QTimeZone &QTimeZone::operator=(QTimeZone &&other) diff --git a/src/corelib/tools/qtimezone.h b/src/corelib/tools/qtimezone.h index 1a6a923cf4..7fb4a885ef 100644 --- a/src/corelib/tools/qtimezone.h +++ b/src/corelib/tools/qtimezone.h @@ -87,9 +87,12 @@ public: QTimeZone &operator=(const QTimeZone &other); #ifdef Q_COMPILER_RVALUE_REFS - QTimeZone &operator=(QTimeZone &&other) { std::swap(d, other.d); return *this; } + QTimeZone &operator=(QTimeZone &&other) { swap(other); return *this; } #endif + void swap(QTimeZone &other) + { d.swap(other.d); } + bool operator==(const QTimeZone &other) const; bool operator!=(const QTimeZone &other) const; -- cgit v1.2.3 From b8c93d4592837f3a4d30a543d461d432f2cd59eb Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 14 Nov 2013 15:39:28 +0100 Subject: Android: work around input method cursor position bug Since the Qt input method queries only give us information on the position within the block, moving to the same position in a different block will be interpreted as not moving. The quick fix is to send a fake position before the real one in this case. Task-number: QTBUG-34845 Change-Id: I5d62bdffc283e41d0384c60a0b69c01811caa629 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: BogDan Vatra --- .../platforms/android/src/androidjniinput.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/android/src/androidjniinput.cpp b/src/plugins/platforms/android/src/androidjniinput.cpp index 27d29129f8..8ce95532d3 100644 --- a/src/plugins/platforms/android/src/androidjniinput.cpp +++ b/src/plugins/platforms/android/src/androidjniinput.cpp @@ -67,12 +67,32 @@ namespace QtAndroidInput static QPointer m_mouseGrabber; + static int m_lastCursorPos = -1; + void updateSelection(int selStart, int selEnd, int candidatesStart, int candidatesEnd) { AttachedJNIEnv env; if (!env.jniEnv) return; +#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL + qDebug() << ">>> UPDATESELECTION" << selStart << selEnd << candidatesStart << candidatesEnd; +#endif + if (candidatesStart == -1 && candidatesEnd == -1 && selStart == selEnd) { + // Qt only gives us position inside the block, so if we move to the + // same position in another block, the Android keyboard will believe + // we have not changed position, and be terribly confused. + if (selStart == m_lastCursorPos) { +#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL + qDebug() << ">>> FAKEUPDATESELECTION" << selStart+1; +#endif + env.jniEnv->CallStaticVoidMethod(applicationClass(), m_updateSelectionMethodID, + selStart+1, selEnd+1, candidatesStart, candidatesEnd); + } + m_lastCursorPos = selStart; + } else { + m_lastCursorPos = -1; + } env.jniEnv->CallStaticVoidMethod(applicationClass(), m_updateSelectionMethodID, selStart, selEnd, candidatesStart, candidatesEnd); } -- cgit v1.2.3 From 81ef7f685710dc83bc42c4eb81d71140e89bea40 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 12:03:07 +0100 Subject: QTimeZone: declare as shared This enables specialisations of (std and q) swap using member-swap and declares the types movable for efficient use in Qt containers, and QList in particular. This is a binary-incompatible change, so cannot wait for 5.2.1. Change-Id: I431315e148b95f82dc3d4471c57ef729539dca9f Reviewed-by: John Layt Reviewed-by: Lars Knoll --- src/corelib/tools/qtimezone.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/corelib/tools/qtimezone.h b/src/corelib/tools/qtimezone.h index 7fb4a885ef..3f0d1ee9e7 100644 --- a/src/corelib/tools/qtimezone.h +++ b/src/corelib/tools/qtimezone.h @@ -152,6 +152,7 @@ private: }; Q_DECLARE_TYPEINFO(QTimeZone::OffsetData, Q_MOVABLE_TYPE); +Q_DECLARE_SHARED(QTimeZone) #ifndef QT_NO_DATASTREAM Q_CORE_EXPORT QDataStream &operator<<(QDataStream &ds, const QTimeZone &tz); -- cgit v1.2.3 From 9e78ab458714cb143703ded378be9e84380c2c98 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 12:03:44 +0100 Subject: Doc: remove superfluous \since 5.2 The whole QTimeZone class is \since 5.2. Change-Id: I681b924b534f2f75315b2eaf506aaa7d9590efa1 Reviewed-by: John Layt Reviewed-by: Lars Knoll --- src/corelib/tools/qtimezone.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index 6fe42ab45e..9288dc7756 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -434,8 +434,6 @@ QTimeZone &QTimeZone::operator=(const QTimeZone &other) Move-assigns \a other to this QTimeZone instance, transferring the ownership of the managed pointer to this instance. - - \since 5.2 */ /*! -- cgit v1.2.3 From 6128f4efb42dec892ce057d92832adc820114c60 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 12:07:08 +0100 Subject: QTimeZone: mark ctors as explicit An int is not a proper representation for a QTimeZone, so don't provide an implicit conversion from it. OTOH, {QByteArray, int, QString, QString} _does_ nicely represent a QTimeZone, so explicitly state the implicitness of that constructor so {}-init continues to work in C++11. Change-Id: I865a6b38b8ab3c577625b7b08efbfc98914abfbe Reviewed-by: John Layt Reviewed-by: Lars Knoll --- src/corelib/tools/qtimezone.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qtimezone.h b/src/corelib/tools/qtimezone.h index 3f0d1ee9e7..cbc4f3e4ad 100644 --- a/src/corelib/tools/qtimezone.h +++ b/src/corelib/tools/qtimezone.h @@ -78,8 +78,8 @@ public: QTimeZone(); explicit QTimeZone(const QByteArray &olsenId); - QTimeZone(int offsetSeconds); - QTimeZone(const QByteArray &zoneId, int offsetSeconds, const QString &name, + explicit QTimeZone(int offsetSeconds); + /*implicit*/ QTimeZone(const QByteArray &zoneId, int offsetSeconds, const QString &name, const QString &abbreviation, QLocale::Country country = QLocale::AnyCountry, const QString &comment = QString()); QTimeZone(const QTimeZone &other); -- cgit v1.2.3 From 20981e2953adc8ad64735806e8564fc258d21900 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 14 Nov 2013 12:09:19 +0100 Subject: REG: Fix changing input method parameters on Android After b7440536c788b04861591187edd071bf2c2ec137, we no longer restart the input method when the keyboard is shown, even if the parameters for the input method has changed. The effect was that if you had opened a keyboard with, say, digits only, then all keyboards would be digits only forever, regardless of the settings on text input. This patch tries to be conservative, so it only adds back the restartInput() logic when any of parameters have actually been changed. Tested the code the original patch was made to fix and it still works as before. Task-number: QTBUG-34827 Change-Id: Icaee6026d5c3e95b605bb76485acf4fd651f81bd Reviewed-by: Paul Olav Tvete Reviewed-by: BogDan Vatra --- .../jar/src/org/qtproject/qt5/android/QtActivityDelegate.java | 5 +++++ src/android/jar/src/org/qtproject/qt5/android/QtEditText.java | 10 ++++++++++ 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index da2f6163ea..3dcffeb07d 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -192,6 +192,7 @@ public class QtActivityDelegate @Override public void run() { m_imm.restartInput(m_editText); + m_editText.m_optionsChanged = false; } }, 5); } @@ -279,6 +280,10 @@ public class QtActivityDelegate } } }); + if (m_editText.m_optionsChanged) { + m_imm.restartInput(m_editText); + m_editText.m_optionsChanged = false; + } } }, 15); } diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java b/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java index 7e3ebb539a..593746aac9 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java @@ -53,22 +53,32 @@ public class QtEditText extends View int m_initialCapsMode = 0; int m_imeOptions = 0; int m_inputType = InputType.TYPE_CLASS_TEXT; + boolean m_optionsChanged = false; QtActivityDelegate m_activityDelegate; public void setImeOptions(int m_imeOptions) { + if (m_imeOptions == this.m_imeOptions) + return; this.m_imeOptions = m_imeOptions; + m_optionsChanged = true; } public void setInitialCapsMode(int m_initialCapsMode) { + if (m_initialCapsMode == this.m_initialCapsMode) + return; this.m_initialCapsMode = m_initialCapsMode; + m_optionsChanged = true; } public void setInputType(int m_inputType) { + if (m_inputType == this.m_inputType) + return; this.m_inputType = m_inputType; + m_optionsChanged = true; } public QtEditText(Context context, QtActivityDelegate activityDelegate) -- cgit v1.2.3 From 038b0dae83c8fde5f3b20b92eb51cbc3534a037b Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Mon, 4 Nov 2013 15:59:55 +0000 Subject: Update QSurfaceFormat when creating a GL context in the cocoa qpa Task-number: QTBUG-34471 Change-Id: I99f643280b8a4aaa8d63329232c0c3f4b2faed4b Reviewed-by: Gunnar Sletta --- src/plugins/platforms/cocoa/qcocoaglcontext.h | 1 + src/plugins/platforms/cocoa/qcocoaglcontext.mm | 139 +++++++++++++++++++++++++ 2 files changed, 140 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h index 29affb0e4a..e1d4b602c9 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.h +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h @@ -77,6 +77,7 @@ public: private: void setActiveWindow(QWindow *window); + void updateSurfaceFormat(); NSOpenGLContext *m_context; NSOpenGLContext *m_shareContext; diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index f709c94c6d..b3695c2635 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -48,6 +48,74 @@ #import +static inline QByteArray getGlString(GLenum param) +{ + if (const GLubyte *s = glGetString(param)) + return QByteArray(reinterpret_cast(s)); + return QByteArray(); +} + +#if !defined(GL_CONTEXT_FLAGS) +#define GL_CONTEXT_FLAGS 0x821E +#endif + +#if !defined(GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 +#endif + +#if !defined(GL_CONTEXT_PROFILE_MASK) +#define GL_CONTEXT_PROFILE_MASK 0x9126 +#endif + +#if !defined(GL_CONTEXT_CORE_PROFILE_BIT) +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#endif + +#if !defined(GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 +#endif + +static void updateFormatFromContext(QSurfaceFormat *format) +{ + Q_ASSERT(format); + + // Update the version, profile, and context bit of the format + int major = 0, minor = 0; + QByteArray versionString(getGlString(GL_VERSION)); + if (QPlatformOpenGLContext::parseOpenGLVersion(versionString, major, minor)) { + format->setMajorVersion(major); + format->setMinorVersion(minor); + } + + format->setProfile(QSurfaceFormat::NoProfile); + + Q_ASSERT(format->renderableType() == QSurfaceFormat::OpenGL); + if (format->version() < qMakePair(3, 0)) { + format->setOption(QSurfaceFormat::DeprecatedFunctions); + return; + } + + // Version 3.0 onwards - check if it includes deprecated functionality + GLint value = 0; + glGetIntegerv(GL_CONTEXT_FLAGS, &value); + if (!(value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)) + format->setOption(QSurfaceFormat::DeprecatedFunctions); + + // Debug context option not supported on OS X + + if (format->version() < qMakePair(3, 2)) + return; + + // Version 3.2 and newer have a profile + value = 0; + glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value); + + if (value & GL_CONTEXT_CORE_PROFILE_BIT) + format->setProfile(QSurfaceFormat::CoreProfile); + else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) + format->setProfile(QSurfaceFormat::CompatibilityProfile); +} + QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share) : m_context(nil), m_shareContext(nil), @@ -82,6 +150,8 @@ QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLCo int zeroOpacity = 0; [m_context setValues:&zeroOpacity forParameter:NSOpenGLCPSurfaceOpacity]; } + + updateSurfaceFormat(); } QCocoaGLContext::~QCocoaGLContext() @@ -137,6 +207,75 @@ void QCocoaGLContext::setActiveWindow(QWindow *window) [(QNSView *) cocoaWindow->contentView() setQCocoaGLContext:this]; } +void QCocoaGLContext::updateSurfaceFormat() +{ + // At present it is impossible to turn an option off on a QSurfaceFormat (see + // https://codereview.qt-project.org/#change,70599). So we have to populate + // the actual surface format from scratch + QSurfaceFormat requestedFormat = m_format; + m_format = QSurfaceFormat(); + m_format.setRenderableType(QSurfaceFormat::OpenGL); + + // CoreGL doesn't require a drawable to make the context current + CGLContextObj oldContext = CGLGetCurrentContext(); + CGLContextObj ctx = static_cast([m_context CGLContextObj]); + CGLSetCurrentContext(ctx); + + // Get the data that OpenGL provides + updateFormatFromContext(&m_format); + + // Get the data contained within the pixel format + CGLPixelFormatObj cglPixelFormat = static_cast(CGLGetPixelFormat(ctx)); + NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithCGLPixelFormatObj:cglPixelFormat]; + + int colorSize = -1; + [pixelFormat getValues:&colorSize forAttribute:NSOpenGLPFAColorSize forVirtualScreen:0]; + if (colorSize > 0) { + // This seems to return the total color buffer depth, including alpha + m_format.setRedBufferSize(colorSize / 4); + m_format.setGreenBufferSize(colorSize / 4); + m_format.setBlueBufferSize(colorSize / 4); + } + + // The pixel format always seems to return 8 for alpha. However, the framebuffer only + // seems to have alpha enabled if we requested it explicitly. I can't find any other + // attribute to check explicitly for this so we use our best guess for alpha. + int alphaSize = -1; + [pixelFormat getValues:&alphaSize forAttribute:NSOpenGLPFAAlphaSize forVirtualScreen:0]; + qDebug() << "alphaSize =" << alphaSize; + if (alphaSize > 0 && requestedFormat.alphaBufferSize() > 0) + m_format.setAlphaBufferSize(alphaSize); + + int depthSize = -1; + [pixelFormat getValues:&depthSize forAttribute:NSOpenGLPFADepthSize forVirtualScreen:0]; + if (depthSize > 0) + m_format.setDepthBufferSize(depthSize); + + int stencilSize = -1; + [pixelFormat getValues:&stencilSize forAttribute:NSOpenGLPFAStencilSize forVirtualScreen:0]; + if (stencilSize > 0) + m_format.setStencilBufferSize(stencilSize); + + int samples = -1; + [pixelFormat getValues:&samples forAttribute:NSOpenGLPFASamples forVirtualScreen:0]; + if (samples > 0) + m_format.setSamples(samples); + + int doubleBuffered = -1; + [pixelFormat getValues:&doubleBuffered forAttribute:NSOpenGLPFADoubleBuffer forVirtualScreen:0]; + m_format.setSwapBehavior(doubleBuffered == 1 ? QSurfaceFormat::DoubleBuffer : QSurfaceFormat::SingleBuffer); + + int steroBuffers = -1; + [pixelFormat getValues:&steroBuffers forAttribute:NSOpenGLPFAStereo forVirtualScreen:0]; + if (steroBuffers == 1) + m_format.setOption(QSurfaceFormat::StereoBuffers); + + [pixelFormat release]; + + // Restore the original context + CGLSetCurrentContext(oldContext); +} + void QCocoaGLContext::doneCurrent() { if (m_currentWindow && m_currentWindow.data()->handle()) -- cgit v1.2.3 From 9f75292a602ba22b1a3a46f8a161020d2f847565 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Tue, 12 Nov 2013 13:43:37 +0000 Subject: Remove side effects of QGLXContext::queryDummyContext() Task-number: QTBUG-34782 Change-Id: I411c89238b3002a118b1750af0157ccff5c78712 Reviewed-by: Gunnar Sletta --- src/plugins/platforms/xcb/qglxintegration.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index 4ac4cf21ab..d05de63c8f 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -431,6 +431,11 @@ void QGLXContext::queryDummyContext() if (skip) return; + QOpenGLContext *oldContext = QOpenGLContext::currentContext(); + QSurface *oldSurface = 0; + if (oldContext) + oldSurface = oldContext->surface(); + QOffscreenSurface surface; surface.create(); QOpenGLContext context; @@ -446,6 +451,9 @@ void QGLXContext::queryDummyContext() break; } } + + if (oldContext && oldSurface) + oldContext->makeCurrent(oldSurface); } bool QGLXContext::supportsThreading() -- cgit v1.2.3 From f3f25b14693b7211467ae39279b01c580ef8e5b4 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 12 Nov 2013 15:37:57 +0100 Subject: Avoid using GLX pbuffers on fglrx Task-number: QTBUG-34427 Change-Id: Ief4fe2fe2ab099d4ec61b6bfb2272724dfb2a800 Reviewed-by: Gunnar Sletta Reviewed-by: Sean Harmer --- src/plugins/platforms/xcb/qglxintegration.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index d05de63c8f..e6fa8fc898 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -436,11 +436,23 @@ void QGLXContext::queryDummyContext() if (oldContext) oldSurface = oldContext->surface(); - QOffscreenSurface surface; - surface.create(); + QScopedPointer surface; + const char *vendor = glXGetClientString(glXGetCurrentDisplay(), GLX_VENDOR); + if (vendor && !strcmp(vendor, "ATI")) { + QWindow *window = new QWindow; + window->resize(64, 64); + window->setSurfaceType(QSurface::OpenGLSurface); + window->create(); + surface.reset(window); + } else { + QOffscreenSurface *offSurface = new QOffscreenSurface; + offSurface->create(); + surface.reset(offSurface); + } + QOpenGLContext context; context.create(); - context.makeCurrent(&surface); + context.makeCurrent(surface.data()); const char *renderer = (const char *) glGetString(GL_RENDERER); @@ -452,6 +464,7 @@ void QGLXContext::queryDummyContext() } } + context.doneCurrent(); if (oldContext && oldSurface) oldContext->makeCurrent(oldSurface); } -- cgit v1.2.3 From d7d7786026f57cfbd1b5c5ef4e2eb80d832e2d47 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Tue, 5 Nov 2013 12:25:29 +0100 Subject: Enable QOpenGLTexture for OpenGL ES 2 Change-Id: I3ec2b7af303070c92e86c0f5ca729eb1a1731682 Reviewed-by: Sean Harmer --- src/gui/kernel/qopenglcontext.cpp | 6 -- src/gui/kernel/qopenglcontext.h | 2 - src/gui/opengl/opengl.pri | 22 +++--- src/gui/opengl/qopengltexture.cpp | 132 ++++++++++++++++++++++++++++++-- src/gui/opengl/qopengltexture.h | 17 +++- src/gui/opengl/qopengltexturehelper.cpp | 17 ++++ src/gui/opengl/qopengltexturehelper_p.h | 8 ++ 7 files changed, 179 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 7b111c73e1..39dd2a2dfa 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -56,9 +56,7 @@ #include #include -#if !defined(QT_OPENGL_ES_2) #include -#endif #include @@ -527,10 +525,8 @@ void QOpenGLContext::destroy() d->versionFunctions.clear(); qDeleteAll(d->versionFunctionsBackend); d->versionFunctionsBackend.clear(); -#if !defined(QT_OPENGL_ES_2) delete d->textureFunctions; d->textureFunctions = 0; -#endif } /*! @@ -984,7 +980,6 @@ void QOpenGLContext::removeFunctionsBackend(const QOpenGLVersionStatus &v) d->versionFunctionsBackend.remove(v); } -#if !defined(QT_OPENGL_ES_2) /*! \internal */ @@ -1002,7 +997,6 @@ void QOpenGLContext::setTextureFunctions(QOpenGLTextureHelper* textureFuncs) Q_D(QOpenGLContext); d->textureFunctions = textureFuncs; } -#endif /*! \class QOpenGLContextGroup diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h index 9756be30df..ce34a2d5a5 100644 --- a/src/gui/kernel/qopenglcontext.h +++ b/src/gui/kernel/qopenglcontext.h @@ -221,10 +221,8 @@ private: QOpenGLVersionFunctionsBackend *backend); void removeFunctionsBackend(const QOpenGLVersionStatus &v); -#if !defined(QT_OPENGL_ES_2) QOpenGLTextureHelper* textureFunctions() const; void setTextureFunctions(QOpenGLTextureHelper* textureFuncs); -#endif void destroy(); }; diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri index 8212c0981f..d249b855f5 100644 --- a/src/gui/opengl/opengl.pri +++ b/src/gui/opengl/opengl.pri @@ -53,6 +53,17 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) { opengl/qopenglvertexarrayobject.cpp \ opengl/qopengldebug.cpp + !wince* { + HEADERS += opengl/qopengltexture.h \ + opengl/qopengltexture_p.h \ + opengl/qopengltexturehelper_p.h \ + opengl/qopenglpixeltransferoptions.h + + SOURCES += opengl/qopengltexture.cpp \ + opengl/qopengltexturehelper.cpp \ + opengl/qopenglpixeltransferoptions.cpp + } + !contains(QT_CONFIG, opengles2) { HEADERS += opengl/qopenglfunctions_1_0.h \ opengl/qopenglfunctions_1_1.h \ @@ -77,11 +88,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) { opengl/qopenglfunctions_4_2_compatibility.h \ opengl/qopenglfunctions_4_3_compatibility.h \ opengl/qopenglqueryhelper_p.h \ - opengl/qopengltimerquery.h \ - opengl/qopengltexture.h \ - opengl/qopengltexture_p.h \ - opengl/qopengltexturehelper_p.h \ - opengl/qopenglpixeltransferoptions.h + opengl/qopengltimerquery.h SOURCES += opengl/qopenglfunctions_1_0.cpp \ opengl/qopenglfunctions_1_1.cpp \ @@ -105,10 +112,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) { opengl/qopenglfunctions_4_1_compatibility.cpp \ opengl/qopenglfunctions_4_2_compatibility.cpp \ opengl/qopenglfunctions_4_3_compatibility.cpp \ - opengl/qopengltimerquery.cpp \ - opengl/qopengltexture.cpp \ - opengl/qopengltexturehelper.cpp \ - opengl/qopenglpixeltransferoptions.cpp + opengl/qopengltimerquery.cpp } contains(QT_CONFIG, opengles2) { diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 5407142b18..e3fffe5a1c 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -50,6 +50,11 @@ QT_BEGIN_NAMESPACE +//this is to work around GL_TEXTURE_WRAP_R_OES which also has 0x8072 as value +#if !defined(GL_TEXTURE_WRAP_R) + #define GL_TEXTURE_WRAP_R 0x8072 +#endif + QOpenGLTexturePrivate::QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarget, QOpenGLTexture *qq) : q_ptr(qq), @@ -1255,6 +1260,13 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target \value SRGB_Alpha_DXT3 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT \value SRGB_Alpha_DXT5 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT \value SRGB_BP_UNorm Equivalent to GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB + + \value DepthFormat Equivalent to GL_DEPTH_COMPONENT (OpenGL ES 2 only and when OES_depth_texture is present) + \value AlphaFormat Equivalent to GL_ALPHA (OpenGL ES 2 only) + \value RGBFormat Equivalent to GL_RGB (OpenGL ES 2 only) + \value RGBAFormat Equivalent to GL_RGBA (OpenGL ES 2 only) + \value LuminanceFormat Equivalent to GL_LUMINANCE (OpenGL ES 2 only) + \value LuminanceAlphaFormat Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only) */ /*! @@ -1289,6 +1301,10 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target \value BGRA_Integer Equivalent to GL_BGRA_INTEGER \value Depth Equivalent to GL_DEPTH_COMPONENT \value DepthStencil Equivalent to GL_DEPTH_STENCIL + \value Alpha Equivalent to GL_ALPHA (OpenGL ES 2 only) + \value Luminance Equivalent to GL_LUMINANCE (OpenGL ES 2 only) + \value LuminanceAlpha Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only) + */ /*! @@ -1303,6 +1319,7 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target \value Int32 Equivalent to GL_INT \value UInt32 Equivalent to GL_UNSIGNED_INT \value Float16 Equivalent to GL_HALF_FLOAT + \value Float16OES Equivalent to GL_HALF_FLOAT_OES \value Float32 Equivalent to GL_FLOAT \value UInt32_RGB9_E5 Equivalent to GL_UNSIGNED_INT_5_9_9_9_REV \value UInt32_RG11B10F Equivalent to GL_UNSIGNED_INT_10F_11F_11F_REV @@ -1752,6 +1769,12 @@ void QOpenGLTexture::setFormat(TextureFormat format) case D32: case D32F: case D32FS8X24: + case DepthFormat: + case AlphaFormat: + case RGBFormat: + case RGBAFormat: + case LuminanceFormat: + case LuminanceAlphaFormat: d->formatClass = FormatClass_Unique; break; } @@ -2242,6 +2265,7 @@ bool QOpenGLTexture::hasFeature(Feature feature) bool supported = false; switch (feature) { +#if !defined(QT_OPENGL_ES_2) case ImmutableMultisampleStorage: case TextureBuffer: case StencilTexturing: @@ -2289,16 +2313,38 @@ bool QOpenGLTexture::hasFeature(Feature feature) break; } +#else + case Texture3D: + supported = ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_3D")); + break; + case AnisotropicFiltering: + supported = ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_filter_anisotropic")); + break; + case NPOTTextures: + case NPOTTextureRepeat: + supported = f.version() >= qMakePair(3,0); + if (!supported) { + supported = ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_npot")); + if (!supported) + supported = ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_non_power_of_two")); + } + default: + break; + } +#endif + return supported; } /*! Sets the base mipmap level used for all texture lookups with this texture to \a baseLevel. + \note This function has no effect on Qt built for OpenGL ES 2. \sa mipBaseLevel(), setMipMaxLevel(), setMipLevelRange() */ void QOpenGLTexture::setMipBaseLevel(int baseLevel) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->textureId); @@ -2306,6 +2352,10 @@ void QOpenGLTexture::setMipBaseLevel(int baseLevel) Q_ASSERT(baseLevel <= d->maxLevel); d->baseLevel = baseLevel; d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_BASE_LEVEL, baseLevel); +#else + Q_UNUSED(baseLevel); + qWarning("QOpenGLTexture: Mipmap base level is not supported"); +#endif } /*! @@ -2323,10 +2373,12 @@ int QOpenGLTexture::mipBaseLevel() const /*! Sets the maximum mipmap level used for all texture lookups with this texture to \a maxLevel. + \note This function has no effect on Qt built for OpenGL ES 2. \sa mipMaxLevel(), setMipBaseLevel(), setMipLevelRange() */ void QOpenGLTexture::setMipMaxLevel(int maxLevel) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->textureId); @@ -2334,6 +2386,10 @@ void QOpenGLTexture::setMipMaxLevel(int maxLevel) Q_ASSERT(d->baseLevel <= maxLevel); d->maxLevel = maxLevel; d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_MAX_LEVEL, maxLevel); +#else + Q_UNUSED(maxLevel); + qWarning("QOpenGLTexture: Mipmap max level is not supported"); +#endif } /*! @@ -2351,10 +2407,12 @@ int QOpenGLTexture::mipMaxLevel() const Sets the range of mipmap levels that can be used for texture lookups with this texture to range from \a baseLevel to \a maxLevel. + \note This function has no effect on Qt built for OpenGL ES 2. \sa setMipBaseLevel(), setMipMaxLevel(), mipLevelRange() */ void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->textureId); @@ -2362,6 +2420,11 @@ void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel) Q_ASSERT(baseLevel <= maxLevel); d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_BASE_LEVEL, baseLevel); d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_MAX_LEVEL, maxLevel); +#else + Q_UNUSED(baseLevel); + Q_UNUSED(maxLevel); + qWarning("QOpenGLTexture: Mipmap level range is not supported"); +#endif } /*! @@ -2451,11 +2514,12 @@ void QOpenGLTexture::generateMipMaps(int baseLevel, bool resetBaseLevel) This function maps \a component to the output \a value. + \note This function has no effect on Mac and Qt built for OpenGL ES 2. \sa swizzleMask() */ void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue value) { -#if !defined(Q_OS_MAC) +#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2467,9 +2531,9 @@ void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue val d->swizzleMask[component - SwizzleRed] = value; d->texFuncs->glTextureParameteri(d->textureId, d->target, component, value); #else - qWarning("Texture swizzling is not supported"); Q_UNUSED(component); Q_UNUSED(value); + qWarning("QOpenGLTexture: Texture swizzling is not supported"); #endif } @@ -2479,7 +2543,7 @@ void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue val void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g, SwizzleValue b, SwizzleValue a) { -#if !defined(Q_OS_MAC) +#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2495,11 +2559,11 @@ void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g, d->swizzleMask[3] = a; d->texFuncs->glTextureParameteriv(d->textureId, d->target, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); #else - qWarning("Texture swizzling is not supported"); Q_UNUSED(r); Q_UNUSED(g); Q_UNUSED(b); Q_UNUSED(a); + qWarning("QOpenGLTexture: Texture swizzling is not supported"); #endif } @@ -2520,11 +2584,12 @@ QOpenGLTexture::SwizzleValue QOpenGLTexture::swizzleMask(SwizzleComponent compon shader will access the depth component as a single float, as normal. But when the parameter is set to StencilMode?, the shader will access the stencil component. + \note This function has no effect on Mac and Qt built for OpenGL ES 2. \sa depthStencilMode() */ void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode) { -#if !defined(Q_OS_MAC) +#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2537,7 +2602,7 @@ void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode) d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_DEPTH_STENCIL_TEXTURE_MODE, mode); #else Q_UNUSED(mode); - qWarning("DepthStencil Mode is not supported"); + qWarning("QOpenGLTexture: DepthStencil Mode is not supported"); #endif } @@ -2706,10 +2771,12 @@ QOpenGLTexture::WrapMode QOpenGLTexture::wrapMode(QOpenGLTexture::CoordinateDire /*! Sets the border color of the texture to \a color. + \note This function has no effect on Mac and Qt built for OpenGL ES 2. \sa borderColor() */ void QOpenGLTexture::setBorderColor(QColor color) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2723,6 +2790,10 @@ void QOpenGLTexture::setBorderColor(QColor color) for (int i = 0; i < 4; ++i) d->borderColor.append(QVariant(values[i])); d->texFuncs->glTextureParameterfv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values); +#else + Q_UNUSED(color); + qWarning("QOpenGLTexture: Border color is not supported"); +#endif } /*! @@ -2730,6 +2801,7 @@ void QOpenGLTexture::setBorderColor(QColor color) */ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2743,6 +2815,13 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a) for (int i = 0; i < 4; ++i) d->borderColor.append(QVariant(values[i])); d->texFuncs->glTextureParameterfv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values); +#else + Q_UNUSED(r); + Q_UNUSED(g); + Q_UNUSED(b); + Q_UNUSED(a); + qWarning("QOpenGLTexture: Border color is not supported"); +#endif } /*! @@ -2750,6 +2829,7 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a) */ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2763,6 +2843,13 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a) for (int i = 0; i < 4; ++i) d->borderColor.append(QVariant(values[i])); d->texFuncs->glTextureParameteriv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values); +#else + Q_UNUSED(r); + Q_UNUSED(g); + Q_UNUSED(b); + Q_UNUSED(a); + qWarning("QOpenGLTexture: Border color is not supported"); +#endif // TODO Handle case of using glTextureParameterIiv() based on format } @@ -2772,6 +2859,7 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a) */ void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2785,6 +2873,13 @@ void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a) for (int i = 0; i < 4; ++i) d->borderColor.append(QVariant(values[i])); d->texFuncs->glTextureParameteriv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values); +#else + Q_UNUSED(r); + Q_UNUSED(g); + Q_UNUSED(b); + Q_UNUSED(a); + qWarning("QOpenGLTexture: Border color is not supported"); +#endif // TODO Handle case of using glTextureParameterIuiv() based on format } @@ -2862,10 +2957,12 @@ void QOpenGLTexture::borderColor(unsigned int *border) const Sets the minimum level of detail to \a value. This limits the selection of highest resolution mipmap (lowest mipmap level). The default value is -1000. + \note This function has no effect on Qt built for OpenGL ES 2. \sa minimumLevelOfDetail(), setMaximumLevelOfDetail(), setLevelOfDetailRange() */ void QOpenGLTexture::setMinimumLevelOfDetail(float value) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2873,6 +2970,10 @@ void QOpenGLTexture::setMinimumLevelOfDetail(float value) Q_ASSERT(value < d->maxLevelOfDetail); d->minLevelOfDetail = value; d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MIN_LOD, value); +#else + Q_UNUSED(value); + qWarning("QOpenGLTexture: Detail level is not supported"); +#endif } /*! @@ -2890,10 +2991,12 @@ float QOpenGLTexture::minimumLevelOfDetail() const Sets the maximum level of detail to \a value. This limits the selection of lowest resolution mipmap (highest mipmap level). The default value is 1000. + \note This function has no effect on Qt built for OpenGL ES 2. \sa maximumLevelOfDetail(), setMinimumLevelOfDetail(), setLevelOfDetailRange() */ void QOpenGLTexture::setMaximumLevelOfDetail(float value) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2901,6 +3004,10 @@ void QOpenGLTexture::setMaximumLevelOfDetail(float value) Q_ASSERT(value > d->minLevelOfDetail); d->maxLevelOfDetail = value; d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MAX_LOD, value); +#else + Q_UNUSED(value); + qWarning("QOpenGLTexture: Detail level is not supported"); +#endif } /*! @@ -2917,10 +3024,12 @@ float QOpenGLTexture::maximumLevelOfDetail() const /*! Sets the minimum and maximum level of detail parameters. + \note This function has no effect on Qt built for OpenGL ES 2. \sa levelOfDetailRange(), setMinimumLevelOfDetail(), setMaximumLevelOfDetail() */ void QOpenGLTexture::setLevelOfDetailRange(float min, float max) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2930,6 +3039,11 @@ void QOpenGLTexture::setLevelOfDetailRange(float min, float max) d->maxLevelOfDetail = max; d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MIN_LOD, min); d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MAX_LOD, max); +#else + Q_UNUSED(min); + Q_UNUSED(max); + qWarning("QOpenGLTexture: Detail level is not supported"); +#endif } /*! @@ -2946,16 +3060,22 @@ QPair QOpenGLTexture::levelOfDetailRange() const /*! Sets the level of detail bias parameter. + \note This function has no effect on Qt built for OpenGL ES 2. \sa levelofDetailBias() */ void QOpenGLTexture::setLevelofDetailBias(float bias) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); Q_ASSERT(d->textureId); d->levelOfDetailBias = bias; d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_LOD_BIAS, bias); +#else + Q_UNUSED(bias); + qWarning("QOpenGLTexture: Detail level is not supported"); +#endif } /*! diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h index 3428f0d74a..5c0f8101a6 100644 --- a/src/gui/opengl/qopengltexture.h +++ b/src/gui/opengl/qopengltexture.h @@ -222,7 +222,16 @@ public: SRGB_Alpha_DXT1 = 0x8C4D, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT SRGB_Alpha_DXT3 = 0x8C4E, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT SRGB_Alpha_DXT5 = 0x8C4F, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT - SRGB_BP_UNorm = 0x8E8D // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB + SRGB_BP_UNorm = 0x8E8D, // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB + + // ES 2 formats + DepthFormat = 0x1902, // GL_DEPTH_COMPONENT + AlphaFormat = 0x1906, // GL_ALPHA + RGBFormat = 0x1907, // GL_RGB + RGBAFormat = 0x1908, // GL_RGBA + LuminanceFormat = 0x1909, // GL_LUMINANCE + LuminanceAlphaFormat = 0x190A + }; // This is not used externally yet but is reserved to allow checking of @@ -296,7 +305,10 @@ public: RGBA_Integer = 0x8D99, // GL_RGBA_INTEGER BGRA_Integer = 0x8D9B, // GL_BGRA_INTEGER Depth = 0x1902, // GL_DEPTH_COMPONENT - DepthStencil = 0x84F9 // GL_DEPTH_STENCIL + DepthStencil = 0x84F9, // GL_DEPTH_STENCIL + Alpha = 0x1906, // GL_ALPHA + Luminance = 0x1909, // GL_LUMINANCE + LuminanceAlpha = 0x190A // GL_LUMINANCE_ALPHA }; enum PixelType { @@ -308,6 +320,7 @@ public: Int32 = 0x1404, // GL_INT UInt32 = 0x1405, // GL_UNSIGNED_INT Float16 = 0x140B, // GL_HALF_FLOAT + Float16OES = 0x8D61, // GL_HALF_FLOAT_OES Float32 = 0x1406, // GL_FLOAT UInt32_RGB9_E5 = 0x8C3E, // GL_UNSIGNED_INT_5_9_9_9_REV UInt32_RG11B10F = 0x8C3B, // GL_UNSIGNED_INT_10F_11F_11F_REV diff --git a/src/gui/opengl/qopengltexturehelper.cpp b/src/gui/opengl/qopengltexturehelper.cpp index e09b84cce6..7cd7ca54b2 100644 --- a/src/gui/opengl/qopengltexturehelper.cpp +++ b/src/gui/opengl/qopengltexturehelper.cpp @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) { // Resolve EXT_direct_state_access entry points if present +#if !defined(QT_OPENGL_ES_2) if (context->hasExtension(QByteArrayLiteral("GL_EXT_direct_state_access"))) { TextureParameteriEXT = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTextureParameteriEXT"))); TextureParameterivEXT = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTextureParameterivEXT"))); @@ -96,6 +97,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) CompressedTextureImage2D = &QOpenGLTextureHelper::dsa_CompressedTextureImage2D; CompressedTextureImage3D = &QOpenGLTextureHelper::dsa_CompressedTextureImage3D; } else { +#endif // Use our own DSA emulation TextureParameteri = &QOpenGLTextureHelper::qt_TextureParameteri; TextureParameteriv = &QOpenGLTextureHelper::qt_TextureParameteriv; @@ -117,9 +119,21 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) CompressedTextureImage1D = &QOpenGLTextureHelper::qt_CompressedTextureImage1D; CompressedTextureImage2D = &QOpenGLTextureHelper::qt_CompressedTextureImage2D; CompressedTextureImage3D = &QOpenGLTextureHelper::qt_CompressedTextureImage3D; +#if defined(QT_OPENGL_ES_2) + if (context->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"))) { + TexImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTexImage3DOES"))); + TexSubImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTexSubImage3DOES"))); + CompressedTexImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3DOES"))); + CompressedTexSubImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage3DOES"))); + } +#endif + +#if !defined(QT_OPENGL_ES_2) } +#endif // Some DSA functions are part of NV_texture_multisample instead +#if !defined(QT_OPENGL_ES_2) if (context->hasExtension(QByteArrayLiteral("GL_NV_texture_multisample"))) { TextureImage3DMultisampleNV = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTextureImage3DMultisampleNV"))); TextureImage2DMultisampleNV = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTextureImage2DMultisampleNV"))); @@ -127,9 +141,12 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) TextureImage3DMultisample = &QOpenGLTextureHelper::dsa_TextureImage3DMultisample; TextureImage2DMultisample = &QOpenGLTextureHelper::dsa_TextureImage2DMultisample; } else { +#endif TextureImage3DMultisample = &QOpenGLTextureHelper::qt_TextureImage3DMultisample; TextureImage2DMultisample = &QOpenGLTextureHelper::qt_TextureImage2DMultisample; +#if !defined(QT_OPENGL_ES_2) } +#endif #if defined(Q_OS_WIN) HMODULE handle = GetModuleHandleA("opengl32.dll"); diff --git a/src/gui/opengl/qopengltexturehelper_p.h b/src/gui/opengl/qopengltexturehelper_p.h index e3abaa80af..fa4bd8120a 100644 --- a/src/gui/opengl/qopengltexturehelper_p.h +++ b/src/gui/opengl/qopengltexturehelper_p.h @@ -256,6 +256,7 @@ public: } private: +#if !defined(QT_OPENGL_ES_2) // DSA wrapper (so we can use pointer to member function as switch) inline void dsa_TextureParameteri(GLuint texture, GLenum target, GLenum pname, GLint param) { @@ -403,6 +404,7 @@ private: { CompressedTextureImage3DEXT(texture, target, level, internalFormat, width, height, depth, border, imageSize, bits); } +#endif // DSA-like API @@ -899,6 +901,7 @@ public: int val = 0; glGetIntegerv(GL_UNPACK_ALIGNMENT, &val); options.setAlignment(val); +#if !defined(QT_OPENGL_ES_2) glGetIntegerv(GL_UNPACK_SKIP_IMAGES, &val); options.setSkipImages(val); glGetIntegerv(GL_UNPACK_SKIP_ROWS, &val); @@ -914,12 +917,14 @@ public: options.setLeastSignificantByteFirst(b); glGetBooleanv(GL_UNPACK_SWAP_BYTES, &b); options.setSwapBytesEnabled(b); +#endif return options; } inline void setPixelUploadOptions(const QOpenGLPixelTransferOptions &options) { glPixelStorei(GL_UNPACK_ALIGNMENT, options.alignment()); +#if !defined(QT_OPENGL_ES_2) glPixelStorei(GL_UNPACK_SKIP_IMAGES, options.skipImages()); glPixelStorei(GL_UNPACK_SKIP_ROWS, options.skipRows()); glPixelStorei(GL_UNPACK_SKIP_PIXELS, options.skipPixels()); @@ -927,6 +932,7 @@ public: glPixelStorei(GL_UNPACK_ROW_LENGTH, options.rowLength()); glPixelStorei(GL_UNPACK_LSB_FIRST, options.isLeastSignificantBitFirst()); glPixelStorei(GL_UNPACK_SWAP_BYTES, options.isSwapBytesEnabled()); +#endif } private: @@ -982,6 +988,7 @@ private: CompressedTextureImage2DMemberFunc CompressedTextureImage2D; CompressedTextureImage3DMemberFunc CompressedTextureImage3D; +#if !defined(QT_OPENGL_ES_2) // Raw function pointers for core and DSA functions // EXT_direct_state_access used when DSA is available @@ -1012,6 +1019,7 @@ private: // Plus some missing ones that are in the NV_texture_multisample extension instead void (QOPENGLF_APIENTRYP TextureImage3DMultisampleNV)(GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); void (QOPENGLF_APIENTRYP TextureImage2DMultisampleNV)(GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +#endif // OpenGL 1.0 void (QOPENGLF_APIENTRYP GetIntegerv)(GLenum pname, GLint *params); -- cgit v1.2.3 From f5ef78cec2e2905cf58961a31fc1302cf154b73c Mon Sep 17 00:00:00 2001 From: Venu Date: Tue, 12 Nov 2013 17:42:07 +0100 Subject: Doc: Updated the \l links in the manual - Replaced all \l instances that were using the html file name qualifier to link to a \target. - Updated the linking instructions to not mention the html file name way to link. Task-number: QTBUG-32173 Change-Id: Ic3e266e58de7566d533bbc7fbec7ff5c3ec8f231 Reviewed-by: Nico Vertriest Reviewed-by: Martin Smith --- src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc | 234 ++++++++++++------------ src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc | 56 +++--- src/tools/qdoc/doc/qdoc-manual-intro.qdoc | 4 +- src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc | 157 ++++++++-------- src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc | 70 +++---- 5 files changed, 256 insertions(+), 265 deletions(-) (limited to 'src') diff --git a/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc b/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc index 97d9151e40..a713b2738d 100644 --- a/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc @@ -37,123 +37,123 @@ \list - \li \l {04-qdoc-commands-textmarkup.html#a-command} {\\a} - \li \l {11-qdoc-commands-specialcontent.html#abstract-command} {\\abstract} - \li \l {12-0-qdoc-commands-miscellaneous.html#annotatedlist-command} {\\annotatedlist} - \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\b} \span {class="newStuff"} {(new 5/3/2012)} - \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\bold} \span {class="newStuff"} {(deprecated, use \\b)} - \li \l {11-qdoc-commands-specialcontent.html#brief-command} {\\brief} - \li \l {04-qdoc-commands-textmarkup.html#c-command} {\\c} - \li \l {09-qdoc-commands-includingimages.html#caption-command} {\\caption} - \li \l {05-qdoc-commands-documentstructure.html#chapter-command} {\\chapter} - \li \l {13-qdoc-commands-topics.html#class-command} {\\class} - \li \l {06-qdoc-commands-includecodeinline.html#code-command} {\\code} - \li \l {07-0-qdoc-commands-includingexternalcode.html#codeline-command} {\\codeline}, - \li \l {16-qdoc-commands-status.html#compat-command} {\\compat} - \li \l {15-qdoc-commands-navigation.html#contentspage-command} {\\contentspage} - \li \l {16-qdoc-commands-status.html#default-command} {\\default} - \li \l {21-0-qdoc-creating-dita-maps.html#ditamap-command} {\\ditamap} \span {class="newStuff"} {(new 05/03/12)} - \li \l {04-qdoc-commands-textmarkup.html#div-command} {\\div} - \li \l {07-0-qdoc-commands-includingexternalcode.html#dots-command} {\\dots} - \li \l {04-qdoc-commands-textmarkup.html#e-command} {\\e} \span {class="newStuff"} {(new 5/3/2012)} - \li \l {12-0-qdoc-commands-miscellaneous.html#else-command} {\\else} - \li \l {12-0-qdoc-commands-miscellaneous.html#endif-command} {\\endif} - \li \l {13-qdoc-commands-topics.html#enum-command} {\\enum} - \li \l {13-qdoc-commands-topics.html#example-command} {\\example} - \li \l {13-qdoc-commands-topics.html#externalpage-command} {\\externalpage} - \li \l {13-qdoc-commands-topics.html#fn-command} {\\fn} - \li \l {11-qdoc-commands-specialcontent.html#footnote-command} {\\footnote} - \li \l {12-0-qdoc-commands-miscellaneous.html#generatelist-command} {\\generatelist} - \li \l {13-qdoc-commands-topics.html#group-command} {\\group} - \li \l {10-qdoc-commands-tablesandlists.html#header-command} {\\header} - \li \l {13-qdoc-commands-topics.html#headerfile-command} {\\headerfile} - \li \l {04-qdoc-commands-textmarkup.html#e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)} - \li \l {12-0-qdoc-commands-miscellaneous.html#if-command} {\\if} - \li \l {09-qdoc-commands-includingimages.html#image-command} {\\image} - \li \l {12-0-qdoc-commands-miscellaneous.html#include-command} {\\include} - \li \l {15-qdoc-commands-navigation.html#indexpage-command} {\\indexpage} - \li \l {19-qdoc-commands-grouping.html#ingroup-command} {\\ingroup} - \li \l {18-qdoc-commands-relating.html#inherits-command}{\\inherits} - \li \l {09-qdoc-commands-includingimages.html#inlineimage-command} {\\inlineimage} - \li \l {19-qdoc-commands-grouping.html#inmodule-command} {\\inmodule} - \li \l {13-qdoc-commands-topics.html#inqmlmodule-command} {\\inqmlmodule} - \li \l {13-qdoc-commands-topics.html#instantiates-command} {\\instantiates} \span {class="newStuff"} {(new 27/7/2012)} - \li \l {16-qdoc-commands-status.html#internal-command} {\\internal} - \li \l {08-qdoc-commands-creatinglinks.html#keyword-command} {\\keyword} - \li \l {08-qdoc-commands-creatinglinks.html#l-command} {\\l} - \li \l {11-qdoc-commands-specialcontent.html#legalese-command} {\\legalese} - \li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\li} \span {class="newStuff"} {(new 5/3/2012)} - \li \l {10-qdoc-commands-tablesandlists.html#list-command} {\\list} - \li \l {13-qdoc-commands-topics.html#macro-command} {\\macro} - \li \l {19-qdoc-commands-grouping.html#mainclass-command} {\\mainclass} - \li \l {21-0-qdoc-creating-dita-maps.html#mapref-command} {\\mapref} \span {class="newStuff"} {(new 05/03/12)} - \li \l {12-0-qdoc-commands-miscellaneous.html#meta-command} {\\meta} - \li \l {13-qdoc-commands-topics.html#module-command} {\\module} - \li \l {13-qdoc-commands-topics.html#namespace-command} {\\namespace} - \li \l {15-qdoc-commands-navigation.html#nextpage-command} {\\nextpage} - \li \l {06-qdoc-commands-includecodeinline.html#newcode-command} {\\newcode} - \li \l {17-qdoc-commands-thread.html#nonreentrant-command} {\\nonreentrant} - \li \l {11-qdoc-commands-specialcontent.html#note-command} {\\note} - \li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)} + \li \l {a-command} {\\a} + \li \l {abstract-command} {\\abstract} + \li \l {annotatedlist-command} {\\annotatedlist} + \li \l {b-command} {\\b} \span {class="newStuff"} + \li \l {b-command} {\\bold} \span {class="newStuff"} {(deprecated, use \\b)} + \li \l {brief-command} {\\brief} + \li \l {c-command} {\\c} + \li \l {caption-command} {\\caption} + \li \l {chapter-command} {\\chapter} + \li \l {class-command} {\\class} + \li \l {code-command} {\\code} + \li \l {codeline-command} {\\codeline}, + \li \l {compat-command} {\\compat} + \li \l {contentspage-command} {\\contentspage} + \li \l {default-command} {\\default} + \li \l {ditamap-command} {\\ditamap} \span {class="newStuff"} + \li \l {div-command} {\\div} + \li \l {dots-command} {\\dots} + \li \l {e-command} {\\e} \span {class="newStuff"} + \li \l {else-command} {\\else} + \li \l {endif-command} {\\endif} + \li \l {enum-command} {\\enum} + \li \l {example-command} {\\example} + \li \l {externalpage-command} {\\externalpage} + \li \l {fn-command} {\\fn} + \li \l {footnote-command} {\\footnote} + \li \l {generatelist-command} {\\generatelist} + \li \l {group-command} {\\group} + \li \l {header-command} {\\header} + \li \l {headerfile-command} {\\headerfile} + \li \l {e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)} + \li \l {if-command} {\\if} + \li \l {image-command} {\\image} + \li \l {include-command} {\\include} + \li \l {indexpage-command} {\\indexpage} + \li \l {ingroup-command} {\\ingroup} + \li \l {inherits-command}{\\inherits} + \li \l {inlineimage-command} {\\inlineimage} + \li \l {inmodule-command} {\\inmodule} + \li \l {inqmlmodule-command} {\\inqmlmodule} + \li \l {instantiates-command} {\\instantiates} \span {class="newStuff"} {(new 27/7/2012)} + \li \l {internal-command} {\\internal} + \li \l {keyword-command} {\\keyword} + \li \l {l-command} {\\l} + \li \l {legalese-command} {\\legalese} + \li \l {li-command} {\\li} \span {class="newStuff"} + \li \l {list-command} {\\list} + \li \l {macro-command} {\\macro} + \li \l {mainclass-command} {\\mainclass} + \li \l {mapref-command} {\\mapref} \span {class="newStuff"} + \li \l {meta-command} {\\meta} + \li \l {module-command} {\\module} + \li \l {namespace-command} {\\namespace} + \li \l {nextpage-command} {\\nextpage} + \li \l {newcode-command} {\\newcode} + \li \l {nonreentrant-command} {\\nonreentrant} + \li \l {note-command} {\\note} + \li \l {li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)} - \li \l {16-qdoc-commands-status.html#obsolete-command} {\\obsolete} - \li \l {06-qdoc-commands-includecodeinline.html#oldcode-command} {\\oldcode} - \li \l {12-0-qdoc-commands-miscellaneous.html#omit-command} {\\omit} - \li \l {10-qdoc-commands-tablesandlists.html#omitvalue-command} {\\omitvalue} - \li \l {18-qdoc-commands-relating.html#overload-command} {\\overload} - \li \l {13-qdoc-commands-topics.html#page-command} {\\page} - \li \l {05-qdoc-commands-documentstructure.html#part-command} {\\part} - \li \l {16-qdoc-commands-status.html#preliminary-command} {\\preliminary} - \li \l {15-qdoc-commands-navigation.html#previouspage-command} {\\previouspage} - \li \l {07-0-qdoc-commands-includingexternalcode.html#printline-command} {\\printline} - \li \l {07-0-qdoc-commands-includingexternalcode.html#printto-command} {\\printto} - \li \l {07-0-qdoc-commands-includingexternalcode.html#printuntil-command} {\\printuntil} - \li \l {13-qdoc-commands-topics.html#property-command} {\\property} - \li \l {13-qdoc-commands-topics.html#qmlattachedproperty-command} {\\qmlattachedproperty} - \li \l {13-qdoc-commands-topics.html#qmlattachedsignal-command} {\\qmlattachedsignal} - \li \l {13-qdoc-commands-topics.html#qmlbasictype-command} {\\qmlbasictype} - \li \l {13-qdoc-commands-topics.html#qmlclass-command} {\\qmlclass} \span {class="newStuff"} {(deprecated, use \\qmltype)} - \li \l {13-qdoc-commands-topics.html#qmltype-command} {\\qmltype} \span {class="newStuff"} {(new 27/7/2012)} - \li \l {13-qdoc-commands-topics.html#qmlmethod-command} {\\qmlmethod} - \li \l {13-qdoc-commands-topics.html#qmlproperty-command} {\\qmlproperty} - \li \l {13-qdoc-commands-topics.html#qmlsignal-command} {\\qmlsignal} - \li \l {13-qdoc-commands-topics.html#qmlmodule-command} {\\qmlmodule} - \li \l {11-qdoc-commands-specialcontent.html#quotation-command} {\\quotation} - \li \l {07-0-qdoc-commands-includingexternalcode.html#quotefile-command} {\\quotefile} - \li \l {07-0-qdoc-commands-includingexternalcode.html#quotefromfile-command} {\\quotefromfile} - \li \l {12-0-qdoc-commands-miscellaneous.html#raw-command} {\\raw} \span {class="newStuff"} {(avoid)} - \li \l {17-qdoc-commands-thread.html#reentrant-command} {\\reentrant} - \li \l {18-qdoc-commands-relating.html#reimp-command} {\\reimp} - \li \l {18-qdoc-commands-relating.html#relates-command} {\\relates} - \li \l {10-qdoc-commands-tablesandlists.html#row-command} {\\row} - \li \l {08-qdoc-commands-creatinglinks.html#sa-command} {\\sa} - \li \l {05-qdoc-commands-documentstructure.html#sectionOne-command} {\\section1} - \li \l {05-qdoc-commands-documentstructure.html#sectionTwo-command} {\\section2} - \li \l {05-qdoc-commands-documentstructure.html#sectionThree-command} {\\section3} - \li \l {05-qdoc-commands-documentstructure.html#sectionFour-command} {\\section4} - \li \l {13-qdoc-commands-topics.html#service-command} {\\service} - \li \l {16-qdoc-commands-status.html#since-command} {\\since} - \li \l {07-0-qdoc-commands-includingexternalcode.html#skipline-command} {\\skipline} - \li \l {07-0-qdoc-commands-includingexternalcode.html#skipto-command} {\\skipto} - \li \l {07-0-qdoc-commands-includingexternalcode.html#skipuntil-command} {\\skipuntil} - \li \l {07-0-qdoc-commands-includingexternalcode.html#snippet-command} {\\snippet}, - \li \l {04-qdoc-commands-textmarkup.html#span-command} {\\span} - \li \l {15-qdoc-commands-navigation.html#startpage-command} {\\startpage} - \li \l {04-qdoc-commands-textmarkup.html#sub-command} {\\sub} - \li \l {20-qdoc-commands-namingthings.html#subtitle-command} {\\subtitle} - \li \l {04-qdoc-commands-textmarkup.html#sup-command} {\\sup} - \li \l {10-qdoc-commands-tablesandlists.html#table-command} {\\table} - \li \l {11-qdoc-commands-specialcontent.html#tableofcontents-command} {\\tableofcontents} - \li \l {08-qdoc-commands-creatinglinks.html#target-command} {\\target} - \li \l {17-qdoc-commands-thread.html#threadsafe-command} {\\threadsafe} - \li \l {20-qdoc-commands-namingthings.html#title-command} {\\title} - \li \l {21-0-qdoc-creating-dita-maps.html#topicref-command} {\\topicref} \span {class="newStuff"} {(new 05/03/12)} - \li \l {04-qdoc-commands-textmarkup.html#tt-command} {\\tt} - \li \l {13-qdoc-commands-topics.html#typedef-command} {\\typedef} - \li \l {04-qdoc-commands-textmarkup.html#uicontrol-command} {\\uicontrol} {(new 25/3/2012)} - \li \l {04-qdoc-commands-textmarkup.html#underline-command} {\\underline} - \li \l {13-qdoc-commands-topics.html#variable-command} {\\variable} - \li \l {10-qdoc-commands-tablesandlists.html#value-command} {\\value} - \li \l {11-qdoc-commands-specialcontent.html#warning-command} {\\warning} + \li \l {obsolete-command} {\\obsolete} + \li \l {oldcode-command} {\\oldcode} + \li \l {omit-command} {\\omit} + \li \l {omitvalue-command} {\\omitvalue} + \li \l {overload-command} {\\overload} + \li \l {page-command} {\\page} + \li \l {part-command} {\\part} + \li \l {preliminary-command} {\\preliminary} + \li \l {previouspage-command} {\\previouspage} + \li \l {printline-command} {\\printline} + \li \l {printto-command} {\\printto} + \li \l {printuntil-command} {\\printuntil} + \li \l {property-command} {\\property} + \li \l {qmlattachedproperty-command} {\\qmlattachedproperty} + \li \l {qmlattachedsignal-command} {\\qmlattachedsignal} + \li \l {qmlbasictype-command} {\\qmlbasictype} + \li \l {qmlclass-command} {\\qmlclass} \span {class="newStuff"} {(deprecated, use \\qmltype)} + \li \l {qmltype-command} {\\qmltype} \span {class="newStuff"} + \li \l {qmlmethod-command} {\\qmlmethod} + \li \l {qmlproperty-command} {\\qmlproperty} + \li \l {qmlsignal-command} {\\qmlsignal} + \li \l {qmlmodule-command} {\\qmlmodule} + \li \l {quotation-command} {\\quotation} + \li \l {quotefile-command} {\\quotefile} + \li \l {quotefromfile-command} {\\quotefromfile} + \li \l {raw-command} {\\raw} \span {class="newStuff"} {(avoid)} + \li \l {reentrant-command} {\\reentrant} + \li \l {reimp-command} {\\reimp} + \li \l {relates-command} {\\relates} + \li \l {row-command} {\\row} + \li \l {sa-command} {\\sa} + \li \l {sectionOne-command} {\\section1} + \li \l {sectionTwo-command} {\\section2} + \li \l {sectionThree-command} {\\section3} + \li \l {sectionFour-command} {\\section4} + \li \l {service-command} {\\service} + \li \l {since-command} {\\since} + \li \l {skipline-command} {\\skipline} + \li \l {skipto-command} {\\skipto} + \li \l {skipuntil-command} {\\skipuntil} + \li \l {snippet-command} {\\snippet}, + \li \l {span-command} {\\span} + \li \l {startpage-command} {\\startpage} + \li \l {sub-command} {\\sub} + \li \l {subtitle-command} {\\subtitle} + \li \l {sup-command} {\\sup} + \li \l {table-command} {\\table} + \li \l {tableofcontents-command} {\\tableofcontents} + \li \l {target-command} {\\target} + \li \l {threadsafe-command} {\\threadsafe} + \li \l {title-command} {\\title} + \li \l {topicref-command} {\\topicref} \span {class="newStuff"} + \li \l {tt-command} {\\tt} + \li \l {typedef-command} {\\typedef} + \li \l {uicontrol-command} {\\uicontrol} + \li \l {underline-command} {\\underline} + \li \l {variable-command} {\\variable} + \li \l {value-command} {\\value} + \li \l {warning-command} {\\warning} \endlist */ diff --git a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc index 8faf4a7f0d..1f777ea441 100644 --- a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc @@ -46,28 +46,28 @@ below the \l {Topic Commands} {topic} command. \list - \li \l {16-qdoc-commands-status.html#compat-command}{\\compat}, - \li \l {15-qdoc-commands-navigation.html#contentspage-command}{\\contentspage}, - \li \l {15-qdoc-commands-navigation.html#indexpage-command}{\\indexpage}, - \li \l {19-qdoc-commands-grouping.html#ingroup-command}{\\ingroup}, - \li \l {18-qdoc-commands-relating.html#inherits-command}{\\inherits}, - \li \l {19-qdoc-commands-grouping.html#inmodule-command}{\\inmodule}, - \li \l {16-qdoc-commands-status.html#internal-command}{\\internal}, - \li \l {19-qdoc-commands-grouping.html#mainclass-command}{\\mainclass}, - \li \l {15-qdoc-commands-navigation.html#nextpage-command}{\\nextpage}, - \li \l {17-qdoc-commands-thread.html#nonreentrant-command}{\\nonreentrant}, - \li \l {16-qdoc-commands-status.html#obsolete-command}{\\obsolete}, - \li \l {18-qdoc-commands-relating.html#overload-command}{\\overload}, - \li \l {16-qdoc-commands-status.html#preliminary-command}{\\preliminary}, - \li \l {15-qdoc-commands-navigation.html#previouspage-command}{\\previouspage}, - \li \l {17-qdoc-commands-thread.html#reentrant-command}{\\reentrant}, - \li \l {18-qdoc-commands-relating.html#reimp-command}{\\reimp}, - \li \l {18-qdoc-commands-relating.html#relates-command}{\\relates}, - \li \l {16-qdoc-commands-status.html#since-command}{\\since}, - \li \l {15-qdoc-commands-navigation.html#startpage-command}{\\startpage}, - \li \l {20-qdoc-commands-namingthings.html#subtitle-command}{\\subtitle} - \li \l {17-qdoc-commands-thread.html#threadsafe-command}{\\threadsafe}, - \li \l {20-qdoc-commands-namingthings.html#title-command}{\\title} + \li \l {compat-command}{\\compat}, + \li \l {contentspage-command}{\\contentspage}, + \li \l {indexpage-command}{\\indexpage}, + \li \l {ingroup-command}{\\ingroup}, + \li \l {inherits-command}{\\inherits}, + \li \l {inmodule-command}{\\inmodule}, + \li \l {internal-command}{\\internal}, + \li \l {mainclass-command}{\\mainclass}, + \li \l {nextpage-command}{\\nextpage}, + \li \l {nonreentrant-command}{\\nonreentrant}, + \li \l {obsolete-command}{\\obsolete}, + \li \l {overload-command}{\\overload}, + \li \l {preliminary-command}{\\preliminary}, + \li \l {previouspage-command}{\\previouspage}, + \li \l {reentrant-command}{\\reentrant}, + \li \l {reimp-command}{\\reimp}, + \li \l {relates-command}{\\relates}, + \li \l {since-command}{\\since}, + \li \l {startpage-command}{\\startpage}, + \li \l {subtitle-command}{\\subtitle} + \li \l {threadsafe-command}{\\threadsafe}, + \li \l {title-command}{\\title} \endlist */ @@ -297,7 +297,7 @@ \section1 \\default The \\default command is for marking a QML property as the - \l {http://qt-project.org/doc/qt-4.7/qdeclarativeintroduction.html#default-properties} + \l {default-properties} {default property}. The word \span {class="newStuff"} {default} is shown in red in the documentation of the property. @@ -314,7 +314,7 @@ \endcode See how QDoc renders this property on the reference page for the - \l {http://qt-project.org/doc/qt-4.7/qml-state.html#changes-prop} {State} + \l {changes-prop} {State} type. \target obsolete-command @@ -448,7 +448,7 @@ \list \li ... \li Joining - \l {http://qt-project.org/doc/qt-5.0/qtcore/qchar.html#Joining-enum} + \l {Joining-enum} {joining}() const \c (preliminary) \li ... @@ -497,7 +497,7 @@ configuration variable. For that reason this reference will change according to the current documentation project. - See also \l {25-qdoc-configuration-derivedprojects.html#project} + See also \l {project} {\c project}. */ @@ -794,7 +794,7 @@ \endraw - This function overloads \l {http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#addAction} {addAction()} + This function overloads \l {addAction} {addAction()} This convenience function creates a new action with an \e icon and some \e text. The function adds the newly @@ -802,7 +802,7 @@ returns it. See also - \l {http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#addAction} + \l {addAction} {QWidget::addAction}(). \endquotation diff --git a/src/tools/qdoc/doc/qdoc-manual-intro.qdoc b/src/tools/qdoc/doc/qdoc-manual-intro.qdoc index db34e2a46c..ad3779048a 100644 --- a/src/tools/qdoc/doc/qdoc-manual-intro.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-intro.qdoc @@ -80,7 +80,7 @@ \endcode From the QDoc comment above, QDoc generates the HTML page - \l {http://qt-project.org/doc/qt-5.0/qtcore/qobject.html#details} + \l {details} {QObject Class Reference}. This manual explains how to use the QDoc commands in QDoc comments @@ -120,7 +120,7 @@ also specify \e {DITAXML} to get DITA XML output instead. Next, QDoc uses the values of the - \l {22-qdoc-configuration-generalvariables.html#headerdirs-variable} + \l {headerdirs-variable} {headerdirs} variable and/or the \l {22-qdoc-configuration-generalvariables.html#headers-variable} {headers} variable to find and parse all the header files for your diff --git a/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc index b41c450748..ee0a7b41db 100644 --- a/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc @@ -37,72 +37,72 @@ appearance and logical structure. \list - \li \l {04-qdoc-commands-textmarkup.html#a-command} {\\a} - \li \l {11-qdoc-commands-specialcontent.html#abstract-command} {\\abstract} - \li \l {12-0-qdoc-commands-miscellaneous.html#annotatedlist-command} {\\annotatedlist} - \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\b} \span {class="newStuff"} {(new 5/3/2012)} - \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\bold} {(deprecated, use \\b)} - \li \l {11-qdoc-commands-specialcontent.html#brief-command} {\\brief} - \li \l {04-qdoc-commands-textmarkup.html#c-command} {\\c} - \li \l {09-qdoc-commands-includingimages.html#caption-command} {\\caption} - \li \l {05-qdoc-commands-documentstructure.html#chapter-command} {\\chapter} - \li \l {06-qdoc-commands-includecodeinline.html#code-command} {\\code} - \li \l {07-0-qdoc-commands-includingexternalcode.html#codeline-command} {\\codeline} - \li \l {04-qdoc-commands-textmarkup.html#div-command} {\\div} - \li \l {07-0-qdoc-commands-includingexternalcode.html#dots-command} {\\dots} - \li \l {04-qdoc-commands-textmarkup.html#e-command} {\\e} \span {class="newStuff"} {(new 5/3/2012)} - \li \l {12-0-qdoc-commands-miscellaneous.html#else-command} {\\else} - \li \l {12-0-qdoc-commands-miscellaneous.html#endif-command} {\\endif} - \li \l {11-qdoc-commands-specialcontent.html#footnote-command} {\\footnote} - \li \l {12-0-qdoc-commands-miscellaneous.html#generatelist-command} {\\generatelist} - \li \l {10-qdoc-commands-tablesandlists.html#header-command} {\\header} - \li \l {04-qdoc-commands-textmarkup.html#e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)} - \li \l {12-0-qdoc-commands-miscellaneous.html#if-command} {\\if} - \li \l {09-qdoc-commands-includingimages.html#image-command} {\\image} - \li \l {12-0-qdoc-commands-miscellaneous.html#include-command} {\\include} - \li \l {12-0-qdoc-commands-miscellaneous.html#include-command} {\\input} - \li \l {09-qdoc-commands-includingimages.html#inlineimage-command} {\\inlineimage} - \li \l {08-qdoc-commands-creatinglinks.html#keyword-command} {\\keyword} - \li \l {08-qdoc-commands-creatinglinks.html#l-command} {\\l} - \li \l {11-qdoc-commands-specialcontent.html#legalese-command} {\\legalese} - \li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\li} \span {class="newStuff"} {(new 5/3/2012)} - \li \l {10-qdoc-commands-tablesandlists.html#list-command} {\\list} - \li \l {12-0-qdoc-commands-miscellaneous.html#meta-command} {\\meta} - \li \l {06-qdoc-commands-includecodeinline.html#newcode-command} {\\newcode} - \li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)} - \li \l {11-qdoc-commands-specialcontent.html#note-command} {\\note} - \li \l {06-qdoc-commands-includecodeinline.html#oldcode-command} {\\oldcode} - \li \l {12-0-qdoc-commands-miscellaneous.html#omit-command} {\\omit} - \li \l {05-qdoc-commands-documentstructure.html#part-command} {\\part} - \li \l {07-0-qdoc-commands-includingexternalcode.html#printline-command} {\\printline} - \li \l {07-0-qdoc-commands-includingexternalcode.html#printto-command} {\\printto} - \li \l {07-0-qdoc-commands-includingexternalcode.html#printuntil-command} {\\printuntil} - \li \l {11-qdoc-commands-specialcontent.html#quotation-command} {\\quotation} - \li \l {07-0-qdoc-commands-includingexternalcode.html#quotefile-command} {\\quotefile} - \li \l {07-0-qdoc-commands-includingexternalcode.html#quotefromfile-command} {\\quotefromfile} - \li \l {12-0-qdoc-commands-miscellaneous.html#raw-command} {\\raw} - \li \l {10-qdoc-commands-tablesandlists.html#row-command} {\\row} - \li \l {08-qdoc-commands-creatinglinks.html#sa-command} {\\sa} - \li \l {05-qdoc-commands-documentstructure.html#sectionOne-command} {\\section1} - \li \l {05-qdoc-commands-documentstructure.html#sectionTwo-command} {\\section2} - \li \l {05-qdoc-commands-documentstructure.html#sectionThree-command} {\\section3} - \li \l {05-qdoc-commands-documentstructure.html#sectionFour-command} {\\section4} - \li \l {07-0-qdoc-commands-includingexternalcode.html#skipline-command} {\\skipline} - \li \l {07-0-qdoc-commands-includingexternalcode.html#skipto-command} {\\skipto} - \li \l {07-0-qdoc-commands-includingexternalcode.html#skipuntil-command} {\\skipuntil} - \li \l {07-0-qdoc-commands-includingexternalcode.html#snippet-command} {\\snippet} - \li \l {04-qdoc-commands-textmarkup.html#span-command} {\\span} - \li \l {04-qdoc-commands-textmarkup.html#sub-command} {\\sub} - \li \l {04-qdoc-commands-textmarkup.html#sup-command} {\\sup} - \li \l {10-qdoc-commands-tablesandlists.html#table-command} {\\table} - \li \l {11-qdoc-commands-specialcontent.html#tableofcontents-command} {\\tableofcontents} - \li \l {08-qdoc-commands-creatinglinks.html#target-command} {\\target} - \li \l {04-qdoc-commands-textmarkup.html#tt-command} {\\tt} - \li \l {04-qdoc-commands-textmarkup.html#uicontrol-command} {\\uicontrol} {(new 25/3/2012)} - \li \l {04-qdoc-commands-textmarkup.html#underline-command} {\\underline} - \li \l {12-0-qdoc-commands-miscellaneous.html#raw-command} {\\unicode} - \li \l {11-qdoc-commands-specialcontent.html#warning-command} {\\warning} - \li \l {04-qdoc-commands-textmarkup.html#backslash-command} {\\\\} + \li \l {a-command} {\\a} + \li \l {abstract-command} {\\abstract} + \li \l {annotatedlist-command} {\\annotatedlist} + \li \l {b-command} {\\b} \span {class="newStuff"} + \li \l {b-command} {\\bold} {(deprecated, use \\b)} + \li \l {brief-command} {\\brief} + \li \l {c-command} {\\c} + \li \l {caption-command} {\\caption} + \li \l {chapter-command} {\\chapter} + \li \l {code-command} {\\code} + \li \l {codeline-command} {\\codeline} + \li \l {div-command} {\\div} + \li \l {dots-command} {\\dots} + \li \l {e-command} {\\e} \span {class="newStuff"} + \li \l {else-command} {\\else} + \li \l {endif-command} {\\endif} + \li \l {footnote-command} {\\footnote} + \li \l {generatelist-command} {\\generatelist} + \li \l {header-command} {\\header} + \li \l {e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)} + \li \l {if-command} {\\if} + \li \l {image-command} {\\image} + \li \l {include-command} {\\include} + \li \l {include-command} {\\input} + \li \l {inlineimage-command} {\\inlineimage} + \li \l {keyword-command} {\\keyword} + \li \l {l-command} {\\l} + \li \l {legalese-command} {\\legalese} + \li \l {li-command} {\\li} \span {class="newStuff"} + \li \l {list-command} {\\list} + \li \l {meta-command} {\\meta} + \li \l {newcode-command} {\\newcode} + \li \l {li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)} + \li \l {note-command} {\\note} + \li \l {oldcode-command} {\\oldcode} + \li \l {omit-command} {\\omit} + \li \l {part-command} {\\part} + \li \l {printline-command} {\\printline} + \li \l {printto-command} {\\printto} + \li \l {printuntil-command} {\\printuntil} + \li \l {quotation-command} {\\quotation} + \li \l {quotefile-command} {\\quotefile} + \li \l {quotefromfile-command} {\\quotefromfile} + \li \l {raw-command} {\\raw} + \li \l {row-command} {\\row} + \li \l {sa-command} {\\sa} + \li \l {sectionOne-command} {\\section1} + \li \l {sectionTwo-command} {\\section2} + \li \l {sectionThree-command} {\\section3} + \li \l {sectionFour-command} {\\section4} + \li \l {skipline-command} {\\skipline} + \li \l {skipto-command} {\\skipto} + \li \l {skipuntil-command} {\\skipuntil} + \li \l {snippet-command} {\\snippet} + \li \l {span-command} {\\span} + \li \l {sub-command} {\\sub} + \li \l {sup-command} {\\sup} + \li \l {table-command} {\\table} + \li \l {tableofcontents-command} {\\tableofcontents} + \li \l {target-command} {\\target} + \li \l {tt-command} {\\tt} + \li \l {uicontrol-command} {\\uicontrol} {(new 25/3/2012)} + \li \l {underline-command} {\\underline} + \li \l {raw-command} {\\unicode} + \li \l {warning-command} {\\warning} + \li \l {backslash-command} {\\\\} \endlist */ @@ -1826,7 +1826,7 @@ \endcode For the one-parameter version, the braces can often be omitted. - The \\l command supports several kinds of links: + The \\l command supports several ways of linking: \list @@ -1855,9 +1855,6 @@ \li \c {\l {Shared Classes}} - A keyword named in a \l {keyword-command} {\\keyword} command. - \li \c {\l network.html} - The file name used in a \l - {page-command} {\\page} command. - \li \c {\l http://qt-project.org/} - A URL. \endlist @@ -1974,22 +1971,15 @@ \endcode The target name \e{capturing parentheses} can be linked from - within the same document containing the target in two ways: + within the same document containing the target in the following way: \list \li \c {\l {capturing parentheses}} (from within the same QDoc comment) - \li \c {\l qregexp.html#capturing-parentheses} (from elsewhere in the same document) \endlist \note The brackets in the link example are required because the target name contains spaces. - The target name can be linked to in the following way from other documents: - - \list - \li \c {\l http://qt-project.org/doc/qt-5.0/qtcore/qregexp.html#capturing-parentheses} - \endlist - See also \l {l-command} {\\l}, \l {sa-command} {\\sa} and \l {keyword-command} {\\keyword}. @@ -2042,7 +2032,7 @@ \quotation When a string is surrounded by slashes, it is - interpreted as a \l {QRegExp}{regular expression}. + interpreted as a \l {regular expression}. \endquotation If the keyword text contains spaces, the brackets are required. @@ -2961,15 +2951,16 @@ \target brief class - When the \\brief command is used to describe a class, the brief - text should be a complete sentence and must start like this: + When the \\brief command is used to describe a class, we recommend + using a complete sentence like this: \code The class is|provides|contains|specifies... \endcode - \warning The brief statement is used as the first paragraph of the - detailed description. Do not repeat the sentence. + \warning Do not repeat your detailed description with the same sentence as + the brief statement will be the first paragraph of the detailed + description. \code / *! diff --git a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc index 74f5ad0c7b..3adcf9b213 100644 --- a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc @@ -63,7 +63,7 @@ Some configuration variables accept a list of strings as their value, for example: - \l {22-qdoc-configuration-generalvariables.html#sourcedirs-variable} + \l {sourcedirs-variable} {\c{sourcedirs}}, while others accept only a single string. Double quotes around a value string are optional, but including them allows you to use special characters like '=' and ' \" ' within the value @@ -87,39 +87,39 @@ \section1 Variable List \list - \li \l {22-qdoc-configuration-generalvariables.html#alias-variable} {alias} - \li \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoredirectives-variable} {Cpp.ignoredirectives} - \li \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoretokens-variable} {Cpp.ignoretokens} - \li \l {22-qdoc-configuration-generalvariables.html#defines-variable} {defines} - \li \l {22-qdoc-configuration-generalvariables.html#edition-variable} {edition} - \li \l {22-qdoc-configuration-generalvariables.html#exampledirs-variable} {exampledirs} - \li \l {22-qdoc-configuration-generalvariables.html#examples-variable} {examples} - \li \l {22-qdoc-configuration-generalvariables.html#examples.fileextensions-variable} {examples.fileextensions} - \li \l {22-qdoc-configuration-generalvariables.html#excludedirs-variable} {excludedirs} - \li \l {22-qdoc-configuration-generalvariables.html#excludefiles-variable} {excludefiles} - \li \l {22-qdoc-configuration-generalvariables.html#extraimages-variable} {extraimages} - \li \l {22-qdoc-configuration-generalvariables.html#falsehoods-variable} {falsehoods} - \li \l {22-qdoc-configuration-generalvariables.html#headerdirs-variable} {headerdirs} - \li \l {22-qdoc-configuration-generalvariables.html#headers-variable} {headers} - \li \l {22-qdoc-configuration-generalvariables.html#headers.fileextensions-variable} {headers.fileextensions} - \li \l {24-qdoc-configuration-htmlvariables.html#HTML.footer-variable} {HTML.footer} - \li \l {24-qdoc-configuration-htmlvariables.html#HTML.postheader-variable} {HTML.postheader} - \li \l {24-qdoc-configuration-htmlvariables.html#HTML.style-variable} {HTML.style} - \li \l {22-qdoc-configuration-generalvariables.html#imagedirs-variable} {imagedirs} - \li \l {22-qdoc-configuration-generalvariables.html#images-variable} {images} - \li \l {22-qdoc-configuration-generalvariables.html#images.fileextensions-variable} {images.fileextensions} - \li \l {22-qdoc-configuration-generalvariables.html#language-variable} {language} - \li \l {22-qdoc-configuration-generalvariables.html#macro-variable} {macro} - \li \l {22-qdoc-configuration-generalvariables.html#manifestmeta-variable} {manifestmeta} - \li \l {22-qdoc-configuration-generalvariables.html#outputdir-variable} {outputdir} - \li \l {22-qdoc-configuration-generalvariables.html#outputformats-variable} {outputformats} - \li \l {22-qdoc-configuration-generalvariables.html#sourcedirs-variable} {sourcedirs} - \li \l {22-qdoc-configuration-generalvariables.html#sources-variable} {sources} - \li \l {22-qdoc-configuration-generalvariables.html#sources.fileextensions-variable} {sources.fileextensions} - \li \l {22-qdoc-configuration-generalvariables.html#spurious-variable} {spurious} - \li \l {22-qdoc-configuration-generalvariables.html#tabsize-variable} {tabsize} - \li \l {22-qdoc-configuration-generalvariables.html#version-variable} {version} - \li \l {22-qdoc-configuration-generalvariables.html#versionsym-variable} {versionsym} + \li \l {alias-variable} {alias} + \li \l {Cpp.ignoredirectives-variable} {Cpp.ignoredirectives} + \li \l {Cpp.ignoretokens-variable} {Cpp.ignoretokens} + \li \l {defines-variable} {defines} + \li \l {edition-variable} {edition} + \li \l {exampledirs-variable} {exampledirs} + \li \l {examples-variable} {examples} + \li \l {examples.fileextensions-variable} {examples.fileextensions} + \li \l {excludedirs-variable} {excludedirs} + \li \l {excludefiles-variable} {excludefiles} + \li \l {extraimages-variable} {extraimages} + \li \l {falsehoods-variable} {falsehoods} + \li \l {headerdirs-variable} {headerdirs} + \li \l {headers-variable} {headers} + \li \l {headers.fileextensions-variable} {headers.fileextensions} + \li \l {HTML.footer-variable} {HTML.footer} + \li \l {HTML.postheader-variable} {HTML.postheader} + \li \l {HTML.style-variable} {HTML.style} + \li \l {imagedirs-variable} {imagedirs} + \li \l {images-variable} {images} + \li \l {images.fileextensions-variable} {images.fileextensions} + \li \l {language-variable} {language} + \li \l {macro-variable} {macro} + \li \l {manifestmeta-variable} {manifestmeta} + \li \l {outputdir-variable} {outputdir} + \li \l {outputformats-variable} {outputformats} + \li \l {sourcedirs-variable} {sourcedirs} + \li \l {sources-variable} {sources} + \li \l {sources.fileextensions-variable} {sources.fileextensions} + \li \l {spurious-variable} {spurious} + \li \l {tabsize-variable} {tabsize} + \li \l {version-variable} {version} + \li \l {versionsym-variable} {versionsym} \endlist \section1 Categories @@ -1574,7 +1574,7 @@ dita.metadata.default.audience = programmer \endcode - See the \l {12-0-qdoc-commands-miscellaneous.html#meta-command} + See the \l {meta-command} {\\meta} command for more details on DITA metadata. */ -- cgit v1.2.3 From 127c18ff1100a9fb8559ca651dbc03ff1f8eabbd Mon Sep 17 00:00:00 2001 From: Marcel Krems Date: Sun, 10 Nov 2013 04:05:34 +0100 Subject: Doc: Add missing \since 5.2 to QMap::first/last{,Key} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I04b356bfdd2298dccb174ac7cc83d54a3fbcdc02 Reviewed-by: Thorbjørn Lund Martsum --- src/corelib/tools/qmap.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 9aebbb7b3c..22d744f869 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -897,6 +897,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! \fn const Key &QMap::firstKey() const + \since 5.2 Returns a reference to the smallest key in the map. This function assumes that the map is not empty. @@ -907,6 +908,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! \fn const Key &QMap::lastKey() const + \since 5.2 Returns a reference to the largest key in the map. This function assumes that the map is not empty. @@ -917,6 +919,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! \fn T &QMap::first() + \since 5.2 Returns a reference to the first value in the map, that is the value mapped to the smallest key. This function assumes that the map is not empty. @@ -927,11 +930,13 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! \fn const T &QMap::first() const + \since 5.2 \overload */ /*! \fn T &QMap::last() + \since 5.2 Returns a reference to the last value in the map, that is the value mapped to the largest key. This function assumes that the map is not empty. @@ -942,6 +947,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! \fn const T &QMap::last() const + \since 5.2 \overload */ -- cgit v1.2.3 From 3396ba5612c1047d1b21a90c4996dff848c00114 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 13 Sep 2013 23:20:38 +0200 Subject: Match up the specified paper size to an existing one if possible When EnumForms was used then the dmPaperSize was not always correct for the custom paper sizes available on some printers. By using DeviceCapabilities we can be sure that the information is correct in this respect. This also fixes respecting of the custom paper size if one is given and there is no corresponding existing paper size for it. Task-number: QTBUG-34276 Change-Id: I9924d5be8527027fc434261e37f6c7aae66210c3 Reviewed-by: Friedemann Kleint --- src/printsupport/kernel/qprintengine_win.cpp | 128 +++++++++++++++++---------- 1 file changed, 82 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index acaa32304e..e2446c19b1 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -67,6 +67,8 @@ QT_BEGIN_NAMESPACE Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat = 0); extern QPainterPath qt_regionToPath(const QRegion ®ion); +Q_PRINTSUPPORT_EXPORT QSizeF qt_SizeFromUnitToMillimeter(const QSizeF &, QPrinter::Unit, double); +Q_PRINTSUPPORT_EXPORT double qt_multiplierForUnit(QPrinter::Unit unit, int resolution); // #define QT_DEBUG_DRAW @@ -114,6 +116,52 @@ static const struct { { 0, QPrinter::Custom } }; +// Return a list of printer paper sizes in millimeters with the corresponding dmPaperSize value +static QList > printerPaperSizes(const QString &printerName) +{ + QList > result; + const wchar_t *name = reinterpret_cast(printerName.utf16()); + DWORD paperNameCount = DeviceCapabilities(name, NULL, DC_PAPERS, NULL, NULL); + if ((int)paperNameCount > 0) { + // If they are not equal, then there seems to be a problem with the driver + if (paperNameCount != DeviceCapabilities(name, NULL, DC_PAPERSIZE, NULL, NULL)) + return result; + QScopedArrayPointer papersNames(new wchar_t[paperNameCount]); + paperNameCount = DeviceCapabilities(name, NULL, DC_PAPERS, papersNames.data(), NULL); + result.reserve(paperNameCount); + QScopedArrayPointer paperSizes(new POINT[paperNameCount]); + paperNameCount = DeviceCapabilities(name, NULL, DC_PAPERSIZE, (wchar_t *)paperSizes.data(), NULL); + for (int i=0; i <(int)paperNameCount; i++) + result.push_back(qMakePair(QSizeF(paperSizes[i].x / 10, paperSizes[i].y / 10), papersNames[i])); + } + return result; +} + +// Find the best-matching printer paper for size in millimeters. +static inline int findCustomPaperSize(const QSizeF &needlePt, const QString &printerName) +{ + const QList > sizes = printerPaperSizes(printerName); + const qreal nw = needlePt.width(); + const qreal nh = needlePt.height(); + for (int i = 0; i < sizes.size(); ++i) { + if (qAbs(nw - sizes.at(i).first.width()) <= 1 && qAbs(nh - sizes.at(i).first.height()) <= 1) + return sizes.at(i).second; + } + return -1; +} + +static inline void setDevModePaperFlags(DEVMODE *devMode, bool custom) +{ + if (custom) { + devMode->dmPaperSize = DMPAPER_USER; + devMode->dmFields |= DM_PAPERLENGTH | DM_PAPERWIDTH; + } else { + devMode->dmFields &= ~(DM_PAPERLENGTH | DM_PAPERWIDTH); + devMode->dmPaperLength = 0; + devMode->dmPaperWidth = 0; + } +} + QPrinter::PaperSize mapDevmodePaperSize(int s) { int i = 0; @@ -1293,6 +1341,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & break; d->devMode->dmPaperSize = mapPaperSizeDevmode(QPrinter::PaperSize(value.toInt())); d->has_custom_paper_size = (QPrinter::PaperSize(value.toInt()) == QPrinter::Custom); + setDevModePaperFlags(d->devMode, d->has_custom_paper_size); d->doReinit(); break; case PPK_PaperName: @@ -1320,9 +1369,19 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & wchar_t *papers = new wchar_t[size]; size = DeviceCapabilities(reinterpret_cast(d->name.utf16()), NULL, DC_PAPERS, papers, NULL); - d->has_custom_paper_size = false; - d->devMode->dmPaperSize = papers[paperPos]; - d->doReinit(); + QScopedArrayPointer paperSizes(new POINT[size]); + DWORD paperNameCount = DeviceCapabilities(reinterpret_cast(d->name.utf16()), NULL, DC_PAPERSIZE, (wchar_t *)paperSizes.data(), NULL); + if (paperNameCount == size) { + const double multiplier = qt_multiplierForUnit(QPrinter::Millimeter, d->resolution); + d->paper_size = QSizeF((paperSizes[paperPos].x / 10.0) * multiplier, (paperSizes[paperPos].y / 10.0) * multiplier); + // Our sizes may not match the paper name's size exactly + // So we treat it as custom so we know the paper size is correct + d->has_custom_paper_size = true; + d->devMode->dmPaperSize = papers[paperPos]; + setDevModePaperFlags(d->devMode, false); + d->doReinit(); + } + delete [] papers; } } @@ -1373,6 +1432,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & break; d->has_custom_paper_size = false; d->devMode->dmPaperSize = value.toInt(); + setDevModePaperFlags(d->devMode, d->has_custom_paper_size); d->doReinit(); break; @@ -1382,30 +1442,17 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & d->paper_size = value.toSizeF(); if (!d->devMode) break; - int orientation = d->devMode->dmOrientation; - DWORD needed = 0; - DWORD returned = 0; - if (!EnumForms(d->hPrinter, 1, 0, 0, &needed, &returned)) { - BYTE *forms = (BYTE *) malloc(needed); - if (EnumForms(d->hPrinter, 1, forms, needed, &needed, &returned)) { - for (DWORD i=0; i< returned; ++i) { - FORM_INFO_1 *formArray = reinterpret_cast(forms); - // the form sizes are specified in 1000th of a mm, - // convert the size to Points - QSizeF size((formArray[i].Size.cx * 72/25.4)/1000.0, - (formArray[i].Size.cy * 72/25.4)/1000.0); - if (qAbs(d->paper_size.width() - size.width()) <= 2 - && qAbs(d->paper_size.height() - size.height()) <= 2) - { - d->devMode->dmPaperSize = i + 1; - break; - } - } - } - free(forms); + const QSizeF sizeMM = qt_SizeFromUnitToMillimeter(d->paper_size, QPrinter::Point, d->resolution); + const int match = findCustomPaperSize(sizeMM, d->name); + setDevModePaperFlags(d->devMode, (match >= 0) ? false : true); + if (match >= 0) { + d->devMode->dmPaperSize = match; + if (d->devMode->dmOrientation != DMORIENT_PORTRAIT) + qSwap(d->paper_size.rwidth(), d->paper_size.rheight()); + } else { + d->devMode->dmPaperLength = qRound(sizeMM.height() * 10.0); + d->devMode->dmPaperWidth = qRound(sizeMM.width() * 10.0); } - if (orientation != DMORIENT_PORTRAIT) - d->paper_size = QSizeF(d->paper_size.height(), d->paper_size.width()); break; } @@ -1692,7 +1739,7 @@ QList > QWin32PrintEngine::supportedSizesWithNames(const for (int i=0;i<(int)size;i++) { wchar_t *paper = papers + (i * 64); QString str = QString::fromWCharArray(paper, qwcsnlen(paper, 64)); - paperSizes << qMakePair(str, QSizeF(points[i].x / 10, points[i].y / 10)); + paperSizes << qMakePair(str, QSizeF(points[i].x / 10.0, points[i].y / 10.0)); } delete [] points; } @@ -1908,30 +1955,19 @@ static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC h SelectObject(hdc, old_font); } - void QWin32PrintEnginePrivate::updateCustomPaperSize() { - uint paperSize = devMode->dmPaperSize; + const uint paperSize = devMode->dmPaperSize; + has_custom_paper_size = true; if (paperSize > 0 && mapDevmodePaperSize(paperSize) == QPrinter::Custom) { - has_custom_paper_size = true; - DWORD needed = 0; - DWORD returned = 0; - if (!EnumForms(hPrinter, 1, 0, 0, &needed, &returned)) { - BYTE *forms = (BYTE *) malloc(needed); - if (EnumForms(hPrinter, 1, forms, needed, &needed, &returned)) { - if (paperSize <= returned) { - FORM_INFO_1 *formArray = (FORM_INFO_1 *) forms; - int width = formArray[paperSize - 1].Size.cx; // 1/1000 of a mm - int height = formArray[paperSize - 1].Size.cy; // 1/1000 of a mm - paper_size = QSizeF((width * 72 /25.4) / 1000.0, (height * 72 / 25.4) / 1000.0); - } else { - has_custom_paper_size = false; - } + const QList > paperSizes = printerPaperSizes(name); + for (int i=0; i Date: Sat, 9 Nov 2013 17:39:04 +0100 Subject: QKeySequenceEdit: remove RESET function from keySequence Q_PROPERTY A RESET function is only needed if the default value of the property cannot be set with the normal setter. This is not the case here, as clear() is the same as setKeySequence(QKeySequence()). Change-Id: Ib751677436ebdcec0a7951dceae1e0f0323500ff Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/widgets/widgets/qkeysequenceedit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/widgets/qkeysequenceedit.h b/src/widgets/widgets/qkeysequenceedit.h index 5d827a3be8..7eeff4e504 100644 --- a/src/widgets/widgets/qkeysequenceedit.h +++ b/src/widgets/widgets/qkeysequenceedit.h @@ -53,7 +53,7 @@ class QKeySequenceEditPrivate; class Q_WIDGETS_EXPORT QKeySequenceEdit : public QWidget { Q_OBJECT - Q_PROPERTY(QKeySequence keySequence READ keySequence WRITE setKeySequence RESET clear NOTIFY keySequenceChanged USER true) + Q_PROPERTY(QKeySequence keySequence READ keySequence WRITE setKeySequence NOTIFY keySequenceChanged USER true) public: explicit QKeySequenceEdit(QWidget *parent = 0); -- cgit v1.2.3 From 38e90ad2b3cff1220c9214290b4c4fed9dd39bd5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 12 Nov 2013 11:17:05 +0100 Subject: qcompilerdetection.h: add Q_COMPILER_UNIFORM_INIT Up to now, the feature classe Uniform Initialization was subsumed by the Q_COMPILER_INITIALIZER_LISTS flag together with support for std::initializer_list. This caused at least two problems: 1. On QNX, the standard libray does not ship , even though the compiler (a GCC 4.6, IIRC) supports it. But since there was only one Q_COMPILER flag for both, support for the compiler-only part of the feature had to be disabled, too. 2. MSVC 2013 supports initializer lists, but has a bug that renders full uniform initialization support, as required for QUuid, useless. By splitting the feature into two, we can separate them better, and do so in QUuid, which is the only class that currently takes advantage of uniform initialization (to provide constexpr constructors). Since Q_COMPILER_INITIALIZER_LISTS worked as a flag for uniform initialization so far, with the two known exceptions above, UNIFORM_INIT is defined whenever INITIALIZER_LIST is, except that I don't revert UNIFORM_INIT on QNX as I do for INITIALIZER_LISTS and that I expect the MSVC 2013 features to set INITIALIZER_LIST, but not UNIFORM_INIT. Task-number: QTBUG-34705 Change-Id: I81916e950a0f3aab3de7977e0326d2de3d31b14c Reviewed-by: Yuchen Deng Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 7 ++++++- src/corelib/plugin/quuid.h | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index d02e4cf199..f23478d75c 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -465,6 +465,7 @@ * N2659 Q_COMPILER_THREAD_LOCAL * N2765 Q_COMPILER_UDL * N2442 Q_COMPILER_UNICODE_STRINGS + * N2640 Q_COMPILER_UNIFORM_INIT * N2544 Q_COMPILER_UNRESTRICTED_UNIONS * N1653 Q_COMPILER_VARIADIC_MACROS * N2242 N2555 Q_COMPILER_VARIADIC_TEMPLATES @@ -502,6 +503,7 @@ // constexpr support is only partial //# define Q_COMPILER_CONSTEXPR # define Q_COMPILER_INITIALIZER_LISTS +# define Q_COMPILER_UNIFORM_INIT # define Q_COMPILER_NOEXCEPT # endif # if __INTEL_COMPILER >= 1400 @@ -573,6 +575,7 @@ # endif # if __has_feature(cxx_generalized_initializers) # define Q_COMPILER_INITIALIZER_LISTS +# define Q_COMPILER_UNIFORM_INIT /* both covered by this feature macro, according to docs */ # endif # if __has_feature(cxx_lambdas) # define Q_COMPILER_LAMBDA @@ -645,6 +648,7 @@ # define Q_COMPILER_DELETE_MEMBERS # define Q_COMPILER_EXTERN_TEMPLATES # define Q_COMPILER_INITIALIZER_LISTS +# define Q_COMPILER_UNIFORM_INIT # define Q_COMPILER_UNICODE_STRINGS # define Q_COMPILER_VARIADIC_TEMPLATES # endif @@ -718,8 +722,9 @@ # define Q_COMPILER_DECLTYPE # define Q_COMPILER_RVALUE_REFS # define Q_COMPILER_STATIC_ASSERT -// MSVC has std::initilizer_list, but does not support the braces initialization +// MSVC's library has std::initilizer_list, but the compiler does not support the braces initialization //# define Q_COMPILER_INITIALIZER_LISTS +//# define Q_COMPILER_UNIFORM_INIT # endif # if _MSC_VER >= 1700 /* C++11 features supported in VC11 = VC2012: */ diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index 31b9890351..a0d2923bed 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -82,7 +82,7 @@ public: Sha1 = 5 // 0 1 0 1 }; -#if defined(Q_COMPILER_INITIALIZER_LISTS) && !defined(Q_QDOC) +#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC) Q_DECL_CONSTEXPR QUuid() : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {} Q_DECL_CONSTEXPR QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, @@ -147,7 +147,7 @@ public: #if defined(Q_OS_WIN) // On Windows we have a type GUID that is used by the platform API, so we // provide convenience operators to cast from and to this type. -#if defined(Q_COMPILER_INITIALIZER_LISTS) && !defined(Q_QDOC) +#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC) Q_DECL_CONSTEXPR QUuid(const GUID &guid) : data1(guid.Data1), data2(guid.Data2), data3(guid.Data3), data4{guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], -- cgit v1.2.3 From 63824d2e00de53ae61158547ad01e97038160137 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 14 Nov 2013 14:11:39 +0100 Subject: Android: Support popup menus This is used by QML comboboxes, menu buttons, etc. Task-number: QTBUG-31420 Change-Id: I6d3f32fd80ce91c4be34eae636d1b95a4e251a49 Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/src/qandroidplatformmenu.cpp | 10 +++++++++- src/plugins/platforms/android/src/qandroidplatformmenu.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/android/src/qandroidplatformmenu.cpp b/src/plugins/platforms/android/src/qandroidplatformmenu.cpp index 253c22a12f..1ecabb25e2 100644 --- a/src/plugins/platforms/android/src/qandroidplatformmenu.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformmenu.cpp @@ -141,6 +141,15 @@ bool QAndroidPlatformMenu::isVisible() const return m_isVisible; } +void QAndroidPlatformMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatformMenuItem *item) +{ + Q_UNUSED(parentWindow); + Q_UNUSED(pos); + Q_UNUSED(item); + setVisible(true); + QtAndroidMenu::showContextMenu(this); +} + QPlatformMenuItem *QAndroidPlatformMenu::menuItemAt(int position) const { if (position < m_menuItems.size()) @@ -154,7 +163,6 @@ QPlatformMenuItem *QAndroidPlatformMenu::menuItemForTag(quintptr tag) const if (menuItem->tag() == tag) return menuItem; } - return 0; } diff --git a/src/plugins/platforms/android/src/qandroidplatformmenu.h b/src/plugins/platforms/android/src/qandroidplatformmenu.h index 20236cb636..305b64168a 100644 --- a/src/plugins/platforms/android/src/qandroidplatformmenu.h +++ b/src/plugins/platforms/android/src/qandroidplatformmenu.h @@ -71,6 +71,7 @@ public: bool isEnabled() const; void setVisible(bool visible); bool isVisible() const; + void showPopup(const QWindow *parentWindow, QPoint pos, const QPlatformMenuItem *item); QPlatformMenuItem *menuItemAt(int position) const; QPlatformMenuItem *menuItemForTag(quintptr tag) const; -- cgit v1.2.3 From 7d72516b52b20b0782d972224a55a43e74b8ae5a Mon Sep 17 00:00:00 2001 From: Alan Alpert <416365416c@gmail.com> Date: Fri, 13 Sep 2013 13:57:21 -0700 Subject: Change platform selectors to match qmake selectors Previously matched Qt.platform.os, however that can only provide one string. Multiple selectors can be present at once, so we can provide both unix and linux instead of having to pick the most specialized one. Task-number: QTBUG-34796 Change-Id: I219517d740fa7385e923a9e09cb7e241378fbaee Reviewed-by: David Faure --- src/corelib/io/qfileselector.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp index d67ea80e51..eed9e8870a 100644 --- a/src/corelib/io/qfileselector.cpp +++ b/src/corelib/io/qfileselector.cpp @@ -348,22 +348,28 @@ void QFileSelectorPrivate::updateSelectors() QStringList QFileSelectorPrivate::platformSelectors() { QStringList ret; -#if defined(Q_OS_LINUX_ANDROID) +#if defined(Q_OS_WIN) + ret << QStringLiteral("windows"); +# if defined(Q_OS_WINCE) + ret << QStringLiteral("wince"); +# endif +#elif defined(Q_OS_UNIX) + ret << QStringLiteral("unix"); +# if defined(Q_OS_LINUX_ANDROID) ret << QStringLiteral("android"); -#elif defined(Q_OS_BLACKBERRY) +# elif defined(Q_OS_BLACKBERRY) ret << QStringLiteral("blackberry"); -#elif defined(Q_OS_IOS) +# elif defined(Q_OS_IOS) ret << QStringLiteral("ios"); -#elif defined(Q_OS_WINCE) - ret << QStringLiteral("wince"); -#elif defined(Q_OS_WIN) - ret << QStringLiteral("windows"); -#elif defined(Q_OS_LINUX) +# elif defined(Q_OS_LINUX) ret << QStringLiteral("linux"); -#elif defined(Q_OS_OSX) - ret << QStringLiteral("osx"); -#elif defined(Q_OS_UNIX) - ret << QStringLiteral("generic_unix"); +# elif defined(Q_OS_MAC) + ret << QStringLiteral("mac"); +# else + struct utsname u; + if (uname(&u) != -1) + ret << QString::fromLatin1(u.sysname).toLower(); +# endif #endif return ret; } -- cgit v1.2.3 From 00b13e63888dad5fe9d5e07426ea34aa60e8f709 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Wed, 13 Nov 2013 17:24:21 +0100 Subject: QNX: Fixed touch event positions Touch positions reported by libscreen have to be adjusted relative to the window position to be properly interpreted by Qt. Task-number: QTBUG-34812 Change-Id: I68744dc9da95fb1d0d1704d12154fb24c148fe03 Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index 9db62865bb..6f06797393 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -438,7 +438,14 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType) m_touchPoints[touchId].normalPosition = QPointF(static_cast(pos[0]) / screenSize.width(), static_cast(pos[1]) / screenSize.height()); - m_touchPoints[touchId].area = QRectF( pos[0], pos[1], 0.0, 0.0 ); + + m_touchPoints[touchId].area = QRectF(w->geometry().left() + windowPos[0], + w->geometry().top() + windowPos[1], 0.0, 0.0); + QWindow *parent = w->parent(); + while (parent) { + m_touchPoints[touchId].area.translate(parent->geometry().topLeft()); + parent = parent->parent(); + } // determine event type and update state of current touch point QEvent::Type type = QEvent::None; @@ -473,8 +480,8 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType) // inject event into Qt QWindowSystemInterface::handleTouchEvent(w, m_touchDevice, pointList); qScreenEventDebug() << Q_FUNC_INFO << "Qt touch, w =" << w - << ", p=(" << pos[0] << "," << pos[1] - << "), t=" << type; + << ", p=" << m_touchPoints[touchId].area.topLeft() + << ", t=" << type; } } } -- cgit v1.2.3 From 50a64e7626197dc566db4becd4ed17fd53998b43 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Tue, 12 Nov 2013 11:35:53 +0200 Subject: Don't maximize dialogs. Task-number: QTBUG-34765 Change-Id: Ia249e93dbbea11f3c03881c5fb88396bfad0e8fa Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/kernel/qwindow.cpp | 2 +- src/widgets/kernel/qwidget.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index a6223987c2..4a40dd7e29 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1662,7 +1662,7 @@ void QWindow::show() bool isPopup = d_func()->windowFlags & Qt::Popup & ~Qt::Window; if (!isPopup && qApp->styleHints()->showIsFullScreen()) showFullScreen(); - else if (!isPopup && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool()) + else if (!isPopup && !(d_func()->windowFlags & Qt::Dialog & ~Qt::Window) && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool()) showMaximized(); else showNormal(); diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index a41d14e7d0..933294e21f 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -7012,7 +7012,7 @@ void QWidget::show() bool isPopup = data->window_flags & Qt::Popup & ~Qt::Window; if (isWindow() && !isPopup && qApp->styleHints()->showIsFullScreen()) showFullScreen(); - else if (isWindow() && !isPopup && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool()) + else if (isWindow() && !(data->window_flags & Qt::Dialog & ~Qt::Window) && !isPopup && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool()) showMaximized(); else setVisible(true); -- cgit v1.2.3 From 191f96cb8817a6d1632331c67f4f8d45535205e1 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Wed, 13 Nov 2013 08:49:44 +0100 Subject: Avoid compiler warning about alignment for MSVC2013 (x64) Only align if we actually *need to* (due to SSE/XOP usage) The code will currently not compile as it is now with UseSSE or UseXOP defined, (so the ALIGN macro could just be totally removed). In order to keep the diff to upstream as small as possible, we keep the ALIGN macro definition. Task-number: QTBUG-34362 Change-Id: I6cf420205896e3a476cdcfbf3308a07e0ae0c84e Reviewed-by: Richard J. Moore Reviewed-by: Thiago Macieira --- src/3rdparty/sha3/KeccakF-1600-opt64.c | 8 ++++++-- src/3rdparty/sha3/KeccakSponge.h | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/3rdparty/sha3/KeccakF-1600-opt64.c b/src/3rdparty/sha3/KeccakF-1600-opt64.c index 0432f1ab18..7bd442ef69 100755 --- a/src/3rdparty/sha3/KeccakF-1600-opt64.c +++ b/src/3rdparty/sha3/KeccakF-1600-opt64.c @@ -19,12 +19,16 @@ http://creativecommons.org/publicdomain/zero/1.0/ typedef unsigned char UINT8; typedef unsigned long long int UINT64; +#if defined(UseSSE) || defined(UseXOP) #if defined(__GNUC__) #define ALIGN __attribute__ ((aligned(32))) #elif defined(_MSC_VER) #define ALIGN __declspec(align(32)) -#else -#define ALIGN +#endif +#endif + +#ifndef ALIGN +# define ALIGN #endif #if defined(UseSSE) diff --git a/src/3rdparty/sha3/KeccakSponge.h b/src/3rdparty/sha3/KeccakSponge.h index a545cacb30..8bb11a8a1d 100755 --- a/src/3rdparty/sha3/KeccakSponge.h +++ b/src/3rdparty/sha3/KeccakSponge.h @@ -19,12 +19,16 @@ http://creativecommons.org/publicdomain/zero/1.0/ #define KeccakMaximumRate 1536 #define KeccakMaximumRateInBytes (KeccakMaximumRate/8) +#if defined(UseSSE) || defined(UseXOP) #if defined(__GNUC__) #define ALIGN __attribute__ ((aligned(32))) #elif defined(_MSC_VER) #define ALIGN __declspec(align(32)) -#else -#define ALIGN +#endif +#endif + +#ifndef ALIGN +# define ALIGN #endif ALIGN typedef struct spongeStateStruct { -- cgit v1.2.3 From de5b3780cf57154c0ae3bc59e125c12904856ae4 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Wed, 13 Nov 2013 10:35:17 +0100 Subject: QFormLayout: Avoid assertion with negative spacings. It's not really clear if styles *must* return a non-negative value for QStyle::pixelMetric(PM_Layout{Vertical,Horizontal}Spacing), but both QBoxLayout and QGridLayout seems to be robust enough to handle this. They will simply make sure that the spacing is never negative. We therefore make QFormLayout equally robust. Task-number: QTBUG-34731 Change-Id: I62235bfcd8adf7757cf15bc9927b29650ae6459d Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qformlayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index e1376c754f..c1d3e95e7a 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -641,7 +641,7 @@ static inline int spacingHelper(QWidget* parent, QStyle *style, int userVSpacing spacing = qMax(spacing, prevItem2->geometry().top() - wid->geometry().top() ); } } - return spacing; + return qMax(spacing, 0); } static inline void initLayoutStruct(QLayoutStruct& sl, QFormLayoutItem* item) -- cgit v1.2.3 From a106be6f462b24bbb7caed5236d4f28e8a855c09 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 11 Nov 2013 09:15:24 +0100 Subject: Fix QCoreApplication documentation. Task-number: QTBUG-33360 Change-Id: Ifdc0bcc580d0a2dacc6a0bdce10aa278e0bdfe9c Reviewed-by: Jerome Pasion --- src/corelib/kernel/qcoreapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 1ae4da12e8..43c64b7b2c 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1027,7 +1027,7 @@ bool QCoreApplication::closingDown() You can call this function occasionally when your program is busy performing a long operation (e.g. copying a file). - In event you are running a local loop which calls this function + In the event that you are running a local loop which calls this function continuously, without an event loop, the \l{QEvent::DeferredDelete}{DeferredDelete} events will not be processed. This can affect the behaviour of widgets, -- cgit v1.2.3 From f59e29d9bfab2863b29769e318ae96f4640bd768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Fri, 11 Oct 2013 18:14:43 +0100 Subject: Don't accept wheel events if sendEvent() returns false. Otherwise wheeling over disabled items won't let the wheel event propagate to the parent. An easy way to reproduce the problem is by having a flickable with some disabled item in it. Task-number: QTBUG-33477 Change-Id: Ib327cc34dd9f415617ffbc41064f689507446c05 Reviewed-by: Nicolas Arnaud-Cormos Reviewed-by: Giuseppe D'Angelo --- src/widgets/graphicsview/qgraphicsscene.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index ad7a82518e..41d4fc925a 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -4147,8 +4147,9 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent) wheelEvent->widget())); wheelEvent->accept(); bool isPanel = item->isPanel(); - d->sendEvent(item, wheelEvent); - if (isPanel || wheelEvent->isAccepted()) + bool ret = d->sendEvent(item, wheelEvent); + + if (ret && (isPanel || wheelEvent->isAccepted())) break; } } -- cgit v1.2.3 From 3e88ebc43dc1ca68f9f521f34584b4374452df9b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 15 Nov 2013 12:58:49 +0100 Subject: Remove stray debug output This was actually causing test failures in qtdeclarative and blocking the CI there. Change-Id: I4538342f16b6468ad60b283c19948863b20ad5d4 Reviewed-by: Gunnar Sletta --- src/plugins/platforms/cocoa/qcocoaglcontext.mm | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index b3695c2635..144144338f 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -242,7 +242,6 @@ void QCocoaGLContext::updateSurfaceFormat() // attribute to check explicitly for this so we use our best guess for alpha. int alphaSize = -1; [pixelFormat getValues:&alphaSize forAttribute:NSOpenGLPFAAlphaSize forVirtualScreen:0]; - qDebug() << "alphaSize =" << alphaSize; if (alphaSize > 0 && requestedFormat.alphaBufferSize() > 0) m_format.setAlphaBufferSize(alphaSize); -- cgit v1.2.3 From e3383ab646381cfca217af5ea6b059e59a837edd Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 12 Nov 2013 15:36:50 +0100 Subject: GTK theme should not claim to provide a native MessageDialog yet It was providing all possible types, but now MessageDialog is a new native dialog type, and only on Android at the moment. Task-number: QTBUG-34784 Change-Id: I2fb288c8d5e176ca4dafbbc310de2f29bbcfc000 Reviewed-by: J-P Nurmi --- src/plugins/platformthemes/gtk2/qgtk2theme.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platformthemes/gtk2/qgtk2theme.cpp b/src/plugins/platformthemes/gtk2/qgtk2theme.cpp index f069d9f97c..812f4bc000 100644 --- a/src/plugins/platformthemes/gtk2/qgtk2theme.cpp +++ b/src/plugins/platformthemes/gtk2/qgtk2theme.cpp @@ -87,8 +87,16 @@ QVariant QGtk2Theme::themeHint(QPlatformTheme::ThemeHint hint) const bool QGtk2Theme::usePlatformNativeDialog(DialogType type) const { - Q_UNUSED(type); - return true; + switch (type) { + case ColorDialog: + return true; + case FileDialog: + return true; + case FontDialog: + return true; + default: + return false; + } } QPlatformDialogHelper *QGtk2Theme::createPlatformDialogHelper(DialogType type) const -- cgit v1.2.3 From 4225e7103825a55ecddf27c21ec6a7ab5f5d0f63 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 11:40:26 +0100 Subject: QCollator: mark ctor explicit QCollator and QLocale are not equivalent types, so there should be no implicit conversion between them. Change-Id: I395f8dc3c35b4202c9276c3eea0686176f8e07cc Reviewed-by: Aleix Pol Gonzalez Reviewed-by: Thiago Macieira --- src/corelib/tools/qcollator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index b99fd1c0cc..011c2a8d02 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -79,7 +79,7 @@ private: class Q_CORE_EXPORT QCollator { public: - QCollator(const QLocale &locale = QLocale()); + explicit QCollator(const QLocale &locale = QLocale()); QCollator(const QCollator &); ~QCollator(); QCollator &operator=(const QCollator &); -- cgit v1.2.3 From 2c450d90b6cb21fa5f4d2195d603c19c7bebb9ad Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 11:27:11 +0100 Subject: QCollator(SortKey): add member-swap This is required for a Qt value type these days. Change-Id: Ibd4e1581a4f4791a410caa10fede92c26b35dd9d Reviewed-by: Thiago Macieira --- src/corelib/tools/qcollator.cpp | 7 +++++++ src/corelib/tools/qcollator.h | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp index a3a9ef940b..cfb5fe77ae 100644 --- a/src/corelib/tools/qcollator.cpp +++ b/src/corelib/tools/qcollator.cpp @@ -117,6 +117,13 @@ QCollator &QCollator::operator=(const QCollator &other) return *this; } +/*! + \fn void QCollator::swap(QCollator &other) + + Swaps this collator with \a other. This function is very fast and + never fails. +*/ + /*! \internal */ diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index 011c2a8d02..e5abc91967 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -61,8 +61,10 @@ public: QCollatorSortKey &operator=(const QCollatorSortKey &other); #ifdef Q_COMPILER_RVALUE_REFS inline QCollatorSortKey &operator=(QCollatorSortKey &&other) - { qSwap(d, other.d); return *this; } + { swap(other); return *this; } #endif + void swap(QCollatorSortKey &other) + { d.swap(other.d); } bool operator<(const QCollatorSortKey &key) const; int compare(const QCollatorSortKey &key) const; @@ -84,6 +86,9 @@ public: ~QCollator(); QCollator &operator=(const QCollator &); + void swap(QCollator &other) + { qSwap(d, other.d); } + void setLocale(const QLocale &locale); QLocale locale() const; -- cgit v1.2.3 From 81f2d6eaacb905500f11d102e3f19c702535ec24 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 11 Nov 2013 10:35:33 +0100 Subject: Fix compiler warning for cast from int to id. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qcocoaapplication.mm:118:61: warning: cast to 'id' from smaller integer type 'int' [-Wint-to-pointer-cast] id a1 = ([args->arg1 isKindOfClass:[NSNumber class]]) ? (id)[args->arg1 intValue] : args->arg1; ^ qcocoaapplication.mm:119:61: warning: cast to 'id' from smaller integer type 'int' [-Wint-to-pointer-cast] id a2 = ([args->arg2 isKindOfClass:[NSNumber class]]) ? (id)[args->arg2 intValue] : args->arg2; Change-Id: Ibcf3d5d5698ff863f3c9bd65e0388ccca147f419 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoaapplication.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm index c293f4cd52..551a59823c 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplication.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm @@ -115,8 +115,8 @@ QT_USE_NAMESPACE QCocoaPostMessageArgs *args = reinterpret_cast(lower | (upper << 32)); // Special case for convenience: if the argument is an NSNumber, we unbox it directly. // Use NSValue instead if this behaviour is unwanted. - id a1 = ([args->arg1 isKindOfClass:[NSNumber class]]) ? (id)[args->arg1 intValue] : args->arg1; - id a2 = ([args->arg2 isKindOfClass:[NSNumber class]]) ? (id)[args->arg2 intValue] : args->arg2; + id a1 = ([args->arg1 isKindOfClass:[NSNumber class]]) ? (id)[args->arg1 longValue] : args->arg1; + id a2 = ([args->arg2 isKindOfClass:[NSNumber class]]) ? (id)[args->arg2 longValue] : args->arg2; switch (args->argCount) { case 0: [args->target performSelector:args->selector]; -- cgit v1.2.3 From 345525db99cf0805af04492e08aeeb9a7bbc6bec Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 13 Nov 2013 14:39:33 +0100 Subject: Missing entry in QImage inplace_converter_map The inplace_converter_map never had an entry for ARGB4444_Premultiplied this leads to the possibility of accessing outside of the array, and means the RGBA8888 formats are misplaced. Change-Id: Ida0d94912b53a7730b8fb5f6ccc31e7879ea3d27 Reviewed-by: Gunnar Sletta --- src/gui/image/qimage.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index d602ed4035..0916826529 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -3852,6 +3852,9 @@ static InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QIma { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Format_RGB444 + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, // Format_ARGB4444_Premultiplied { 0, 0, -- cgit v1.2.3 From 42aacbf5eb0f43556be500d52fbbce106f32b049 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 6 Nov 2013 19:32:45 -0600 Subject: Improve interaction between QPlatformTheme and QPlatformIntegration hinting. Ensure that custom style hints returned by subclassed QPlatformIntegration::styleHints() are used if not explicitly overridden by subclassed QPlatformTheme::themHints(). Task-number: QTBUG-34589 Change-Id: I0a3114cb00b532d2a5cd40941eca192b32412bcf Reviewed-by: Friedemann Kleint Reviewed-by: Paul Olav Tvete --- src/gui/kernel/qplatformtheme.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp index 562df1c913..1844232efe 100644 --- a/src/gui/kernel/qplatformtheme.cpp +++ b/src/gui/kernel/qplatformtheme.cpp @@ -50,6 +50,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -399,7 +400,32 @@ QPixmap QPlatformTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF & QVariant QPlatformTheme::themeHint(ThemeHint hint) const { - return QPlatformTheme::defaultThemeHint(hint); + // For theme hints which mirror platform integration style hints, query + // the platform integration. The base QPlatformIntegration::styleHint() + // function will in turn query QPlatformTheme::defaultThemeHint() if there + // is no custom value. + switch (hint) { + case QPlatformTheme::CursorFlashTime: + return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::CursorFlashTime); + case QPlatformTheme::KeyboardInputInterval: + return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardInputInterval); + case QPlatformTheme::KeyboardAutoRepeatRate: + return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardAutoRepeatRate); + case QPlatformTheme::MouseDoubleClickInterval: + return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MouseDoubleClickInterval); + case QPlatformTheme::StartDragDistance: + return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragDistance); + case QPlatformTheme::StartDragTime: + return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragTime); + case QPlatformTheme::StartDragVelocity: + return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragVelocity); + case QPlatformTheme::PasswordMaskDelay: + return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskDelay); + case QPlatformTheme::PasswordMaskCharacter: + return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskCharacter); + default: + return QPlatformTheme::defaultThemeHint(hint); + } } QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint) -- cgit v1.2.3 From e9af987f2821112ec6b03af5e2527c37c5580c68 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 11 Nov 2013 16:34:51 +0100 Subject: Try to find GL headers in Mac SDKs. Task-number: QTBUG-32308 Change-Id: Ibbab3852e5cc289faa63d0a66a3816ab8062ccb9 Reviewed-by: Stephen Kelly Reviewed-by: Brad King --- src/gui/Qt5GuiConfigExtras.cmake.in | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in index b79845b07c..75a2385d57 100644 --- a/src/gui/Qt5GuiConfigExtras.cmake.in +++ b/src/gui/Qt5GuiConfigExtras.cmake.in @@ -77,7 +77,21 @@ unset(_qt5gui_OPENGL_INCLUDE_DIR CACHE) macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs) set(Qt5Gui_${Name}_LIBRARIES) +!!IF !mac set(Qt5Gui_${Name}_INCLUDE_DIRS ${IncDirs}) +!!ELSE + foreach(_dir ${IncDirs}) + if (EXISTS ${_dir}) + list(APPEND Qt5Gui_${Name}_INCLUDE_DIRS ${_dir}) + else() + find_path(_actual_dir ${_dir}) # Look in sdk directories + if (_actual_dir) + list(APPEND Qt5Gui_${Name}_INCLUDE_DIRS ${_actual_dir}) + endif() + unset(_actual_dir CACHE) + endif() + endforeach() +!!ENDIF foreach(_lib ${Libs}) string(REGEX REPLACE "[^_A-Za-z0-9]" "_" _cmake_lib_name ${_lib}) if (NOT TARGET Qt5::Gui_${_cmake_lib_name}) @@ -100,7 +114,7 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs) endif() endif() add_library(Qt5::Gui_${_cmake_lib_name} SHARED IMPORTED) - set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${IncDirs}) + set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_${Name}_INCLUDE_DIRS}) set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) _qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\") @@ -130,7 +144,7 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs) list(APPEND Qt5Gui_${Name}_LIBRARIES Qt5::Gui_${_cmake_lib_name}) endforeach() if (NOT CMAKE_CROSSCOMPILING) - foreach(_dir ${IncDirs}) + foreach(_dir ${Qt5Gui_${Name}_INCLUDE_DIRS}) _qt5_Gui_check_file_exists(${_dir}) endforeach() endif() -- cgit v1.2.3 From be405c86f8efac7c6bc8b749725d6d0e0499314d Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 12 Nov 2013 09:41:42 +0100 Subject: Fix the window flags for Cocoa windows This ensures that the possible window flag combinations are respected where possible in Cocoa. Task-number: QTBUG-34645 Task-number: QTBUG-31616 Change-Id: I6be8ca666b7cbc397575e97cd95ea298f52a7113 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 228ef9d484..c22f254aef 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -470,14 +470,12 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags) styleMask = (NSUtilityWindowMask | NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask); } else { - // Filter flags for supported properties - flags &= Qt::WindowType_Mask | Qt::FramelessWindowHint | Qt::WindowTitleHint | - Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint; - if (flags == Qt::Window) { + if (type == Qt::Window && !(flags & Qt::CustomizeWindowHint)) { styleMask = (NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask); - } else if ((flags & Qt::Dialog) == Qt::Dialog) { + } else if (type == Qt::Dialog) { if (flags & Qt::CustomizeWindowHint) { - styleMask = NSResizableWindowMask; + if (flags & Qt::WindowMaximizeButtonHint) + styleMask = NSResizableWindowMask; if (flags & Qt::WindowTitleHint) styleMask |= NSTitledWindowMask; if (flags & Qt::WindowCloseButtonHint) @@ -488,7 +486,7 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags) styleMask = NSResizableWindowMask | NSClosableWindowMask | NSTitledWindowMask; } } else if (!(flags & Qt::FramelessWindowHint)) { - if ((flags & Qt::Dialog) || (flags & Qt::WindowMaximizeButtonHint)) + if (flags & Qt::WindowMaximizeButtonHint) styleMask |= NSResizableWindowMask; if (flags & Qt::WindowTitleHint) styleMask |= NSTitledWindowMask; -- cgit v1.2.3 From 8cbea7a886e336bca6e17f5cb8404a91cbec9fda Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 11:52:44 +0100 Subject: QFileSelector: mark ctor explicit This is standard for (QObject*) ctors. Change-Id: I4756ba50b1f3148d72e95e581d52a37ebd47a7ae Reviewed-by: John Layt Reviewed-by: Alan Alpert Reviewed-by: Olivier Goffart --- src/corelib/io/qfileselector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/io/qfileselector.h b/src/corelib/io/qfileselector.h index 9afd985757..cb5f71faae 100644 --- a/src/corelib/io/qfileselector.h +++ b/src/corelib/io/qfileselector.h @@ -52,7 +52,7 @@ class Q_CORE_EXPORT QFileSelector : public QObject { Q_OBJECT public: - QFileSelector(QObject *parent = 0); + explicit QFileSelector(QObject *parent = 0); ~QFileSelector(); QString select(const QString &filePath) const; -- cgit v1.2.3 From 6c04c21c101b70401ad9cb08de1562dc90166e9c Mon Sep 17 00:00:00 2001 From: Martin Pley Date: Fri, 15 Nov 2013 22:01:54 +0100 Subject: Crash fix in QTreeView::sizeHintForColumn(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vertical scrollbar may get out of sync. When this happens, the calculation of firstVisibleItem will retrun "-1". This must be handled in ::sizeHintForColumn(). Added an auto-test for the crashes. Task-number: QTBUG-34717 Change-Id: I867fd144ef3ce45e382337c5eafe345f573cd944 Reviewed-by: Thorbjørn Lund Martsum --- src/widgets/itemviews/qtreeview.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index fc0d639483..4d0eb5c3ad 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -2858,6 +2858,21 @@ int QTreeView::sizeHintForColumn(int column) const int offset = 0; int start = d->firstVisibleItem(&offset); int end = d->lastVisibleItem(start, offset); + if (start < 0 || end < 0 || end == viewItems.size() - 1) { + end = viewItems.size() - 1; + if (maximumProcessRows < 0) { + start = 0; + } else if (maximumProcessRows == 0) { + start = qMax(0, end - 1); + int remainingHeight = viewport()->height(); + while (start > 0 && remainingHeight > 0) { + remainingHeight -= d->itemHeight(start); + --start; + } + } else { + start = qMax(0, end - maximumProcessRows); + } + } int rowsProcessed = 0; @@ -3606,8 +3621,11 @@ int QTreeViewPrivate::firstVisibleItem(int *offset) const int QTreeViewPrivate::lastVisibleItem(int firstVisual, int offset) const { - if (firstVisual < 0 || offset < 0) + if (firstVisual < 0 || offset < 0) { firstVisual = firstVisibleItem(&offset); + if (firstVisual < 0) + return -1; + } int y = - offset; int value = viewport->height(); -- cgit v1.2.3 From 2026e502596cf6d447caf9545ffed8d3f73fe597 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 2 Sep 2013 10:26:21 +0200 Subject: QCommandLineParser: add word-wrapping algorithm Rather than breaking at column 79 precisely, break entire words, to improve readability. Change-Id: Ie30db00f0e6ed95cce87480c3b91804826c6076b Reviewed-by: Oswald Buddenhagen --- src/corelib/tools/qcommandlineparser.cpp | 49 ++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp index 8054542333..5463e4f0c1 100644 --- a/src/corelib/tools/qcommandlineparser.cpp +++ b/src/corelib/tools/qcommandlineparser.cpp @@ -845,11 +845,50 @@ static QString wrapText(const QString &names, int longestOptionNameString, const { const QLatin1Char nl('\n'); QString text = QStringLiteral(" ") + names.leftJustified(longestOptionNameString) + QLatin1Char(' '); - const int leftColumnWidth = text.length(); - const int rightColumnWidth = 79 - leftColumnWidth; - text += description.left(rightColumnWidth) + nl; - for (int n = rightColumnWidth; n < description.length(); n += rightColumnWidth) - text += QStringLiteral(" ").repeated(leftColumnWidth) + description.mid(n, rightColumnWidth) + nl; + const int indent = text.length(); + int lineStart = 0; + int lastBreakable = -1; + const int max = 79 - indent; + int x = 0; + const int len = description.length(); + + for (int i = 0; i < len; ++i) { + ++x; + const QChar c = description.at(i); + if (c.isSpace()) + lastBreakable = i; + + int breakAt = -1; + int nextLineStart = -1; + if (x > max && lastBreakable != -1) { + // time to break and we know where + breakAt = lastBreakable; + nextLineStart = lastBreakable + 1; + } else if ((x > max - 1 && lastBreakable == -1) || i == len - 1) { + // time to break but found nowhere [-> break here], or end of last line + breakAt = i + 1; + nextLineStart = breakAt; + } else if (c == nl) { + // forced break + breakAt = i; + nextLineStart = i + 1; + } + + if (breakAt != -1) { + const int numChars = breakAt - lineStart; + //qDebug() << "breakAt=" << description.at(breakAt) << "breakAtSpace=" << breakAtSpace << lineStart << "to" << breakAt << description.mid(lineStart, numChars); + if (lineStart > 0) + text += QString(indent, QLatin1Char(' ')); + text += description.midRef(lineStart, numChars) + nl; + x = 0; + lastBreakable = -1; + lineStart = nextLineStart; + if (lineStart < len && description.at(lineStart).isSpace()) + ++lineStart; // don't start a line with a space + i = lineStart; + } + } + return text; } -- cgit v1.2.3 From 3e803b5180e7059c01c15ea84cadd54982e1a221 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 11:37:37 +0100 Subject: QCollator: enable move semantics This necessitates adding d==0 checks in QCollator. By documenting that moved-from instances can only be assigned to or destroyed, we can limit the functions in which to check for d==0 to the assignment operator and the destructor. Doing otherwise would destroy all advantages of move semantics by introducing a heap allocation to re-populate other.d. Add a test for this (QCollator didn't have any before). Change-Id: Ic6ff202072822bebfd5e48259c3d0fa345a63118 Reviewed-by: Thiago Macieira --- src/corelib/tools/qcollator.cpp | 26 +++++++++++++++++++++++--- src/corelib/tools/qcollator.h | 6 ++++++ 2 files changed, 29 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp index cfb5fe77ae..80d330bfca 100644 --- a/src/corelib/tools/qcollator.cpp +++ b/src/corelib/tools/qcollator.cpp @@ -99,7 +99,7 @@ QCollator::QCollator(const QCollator &other) */ QCollator::~QCollator() { - if (!d->ref.deref()) + if (d && !d->ref.deref()) delete d; } @@ -109,14 +109,34 @@ QCollator::~QCollator() QCollator &QCollator::operator=(const QCollator &other) { if (this != &other) { - if (!d->ref.deref()) + if (d && !d->ref.deref()) delete d; d = other.d; - d->ref.ref(); + if (d) d->ref.ref(); } return *this; } +/* + \fn void QCollator::QCollator(QCollator &&other) + + Move constructor. Moves from \a other into this collator. + + Note that a moved-from QCollator can only be destroyed or assigned + to. The effect of calling other functions than the destructor or + one of the assignment operators is undefined. +*/ + +/* + \fn QCollator &QCollator::operator=(QCollator &&other) + + Move-assigns from \a other to this collator. + + Note that a moved-from QCollator can only be destroyed or assigned + to. The effect of calling other functions than the destructor or + one of the assignment operators is undefined. +*/ + /*! \fn void QCollator::swap(QCollator &other) diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index e5abc91967..1007aa7623 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -85,6 +85,12 @@ public: QCollator(const QCollator &); ~QCollator(); QCollator &operator=(const QCollator &); +#ifdef Q_COMPILER_RVALUE_REFS + QCollator(QCollator &&other) + : d(other.d) { other.d = 0; } + QCollator &operator=(QCollator &&other) + { swap(other); return *this; } +#endif void swap(QCollator &other) { qSwap(d, other.d); } -- cgit v1.2.3 From 70bc2e882ffc2ea998717d7fcde2b02a2124f52e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 11:29:47 +0100 Subject: QCollator(SortKey): declare as shared This enables specialisations of (std and q) swap using member-swap and declares the types movable for efficient use in Qt containers, and QList in particular. This is a binary-incompatible change, so cannot wait for 5.2.1. Change-Id: I7e90b6397ac4d00d0a7a5c42bae166c1b43e1994 Reviewed-by: Aleix Pol Gonzalez Reviewed-by: Thiago Macieira --- src/corelib/tools/qcollator.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index 1007aa7623..941637e200 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -122,6 +122,9 @@ private: void detach(); }; +Q_DECLARE_SHARED(QCollatorSortKey) +Q_DECLARE_SHARED(QCollator) + QT_END_NAMESPACE #endif // QCOLLATOR_P_H -- cgit v1.2.3 From e721cf15081c8174a38797cc88f7c5197d9e527c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 11:25:19 +0100 Subject: QCollatorSortKey: inline operator< This code was duplicated in every qcollator_platform.cpp and identical everywhere, except in _icu, which uses a QByteArray m_key and the implementation used QByteArray::operator<, which is semantically and probably code-wise identical to what the other implementations did (after inlining). Inlining this function removes a potential maintenance problem and increases speed without violating encapsulation. Change-Id: If3e9d38a7d4326b49f0611a9f4187c53960e8a03 Reviewed-by: Lars Knoll --- src/corelib/tools/qcollator.cpp | 9 +++++---- src/corelib/tools/qcollator.h | 6 +++++- src/corelib/tools/qcollator_icu.cpp | 5 ----- src/corelib/tools/qcollator_macx.cpp | 5 ----- src/corelib/tools/qcollator_posix.cpp | 5 ----- src/corelib/tools/qcollator_win.cpp | 5 ----- 6 files changed, 10 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp index 80d330bfca..9c97d6b158 100644 --- a/src/corelib/tools/qcollator.cpp +++ b/src/corelib/tools/qcollator.cpp @@ -328,12 +328,13 @@ QCollatorSortKey& QCollatorSortKey::operator=(const QCollatorSortKey &other) } /*! - \fn bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const + \fn bool operator<(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs) + \relates QCollatorSortKey - According to the QCollator that created the key, returns \c true if the - key should be sorted before than \a otherKey; otherwise returns \c false. + According to the QCollator that created the keys, returns \c true if \a lhs + should be sorted before \a rhs; otherwise returns \c false. - \sa compare() + \sa QCollatorSortKey::compare() */ /*! diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index 941637e200..781e95b10c 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -66,7 +66,6 @@ public: void swap(QCollatorSortKey &other) { d.swap(other.d); } - bool operator<(const QCollatorSortKey &key) const; int compare(const QCollatorSortKey &key) const; protected: @@ -78,6 +77,11 @@ private: QCollatorSortKey(); }; +inline bool operator<(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs) +{ + return lhs.compare(rhs) < 0; +} + class Q_CORE_EXPORT QCollator { public: diff --git a/src/corelib/tools/qcollator_icu.cpp b/src/corelib/tools/qcollator_icu.cpp index 46f830a34c..407a493d25 100644 --- a/src/corelib/tools/qcollator_icu.cpp +++ b/src/corelib/tools/qcollator_icu.cpp @@ -151,11 +151,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const return QCollatorSortKey(new QCollatorSortKeyPrivate(result)); } -bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const -{ - return d->m_key < otherKey.d->m_key; -} - int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const { return qstrcmp(d->m_key, otherKey.d->m_key); diff --git a/src/corelib/tools/qcollator_macx.cpp b/src/corelib/tools/qcollator_macx.cpp index 8edd190fbe..8985cd4eba 100644 --- a/src/corelib/tools/qcollator_macx.cpp +++ b/src/corelib/tools/qcollator_macx.cpp @@ -162,11 +162,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const return QCollatorSortKey(new QCollatorSortKeyPrivate(ret)); } -bool QCollatorSortKey::operator<(const QCollatorSortKey &key) const -{ - return compare(key) < 0; -} - int QCollatorSortKey::compare(const QCollatorSortKey &key) const { SInt32 order; diff --git a/src/corelib/tools/qcollator_posix.cpp b/src/corelib/tools/qcollator_posix.cpp index a43618dcf1..b47b546d01 100644 --- a/src/corelib/tools/qcollator_posix.cpp +++ b/src/corelib/tools/qcollator_posix.cpp @@ -135,11 +135,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const return QCollatorSortKey(new QCollatorSortKeyPrivate(result)); } -bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const -{ - return compare(otherKey) < 0; -} - int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const { return std::wcscmp(d->m_key.constData(), diff --git a/src/corelib/tools/qcollator_win.cpp b/src/corelib/tools/qcollator_win.cpp index 282711fbc6..8e59000946 100644 --- a/src/corelib/tools/qcollator_win.cpp +++ b/src/corelib/tools/qcollator_win.cpp @@ -155,11 +155,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const return QCollatorSortKey(new QCollatorSortKeyPrivate(ret)); } -bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const -{ - return d->m_key < otherKey.d->m_key; -} - int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const { return d->m_key.compare(otherKey.d->m_key); -- cgit v1.2.3 From aafbd7392ead765c2038a1ac6b569d083effb81d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Martsum?= Date: Tue, 12 Nov 2013 20:01:22 +0100 Subject: QHeaderView - do not ignore -1 as minimum section size We claim that -1 is a special automatic value, but calling setMinimumSectionSize with -1 is unfortunately ignored due a regression in 524c3e05e811d81fbcd71eedb377b7eaa0a21ef3 Change-Id: I7d7e5dbbf78e561849d2f2352c9edb2df36aa181 Reviewed-by: Giuseppe D'Angelo --- src/widgets/itemviews/qheaderview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index c2bcc1585f..75a513fb67 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -1599,7 +1599,7 @@ int QHeaderView::minimumSectionSize() const void QHeaderView::setMinimumSectionSize(int size) { Q_D(QHeaderView); - if (size < 0 || size > maxSizeSection) + if (size < -1 || size > maxSizeSection) return; d->minimumSectionSize = size; if (d->minimumSectionSize > maximumSectionSize()) -- cgit v1.2.3 From cd93a2c0e14090cecbe3e83748937dcd15d98dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Fri, 15 Nov 2013 15:36:18 +0000 Subject: Windows: Fix bug where windows stopped painting after a restore. This is an improvement over 6800728d where we only fixed it if the window was in "normal" state (Qt::WindowNoState) before minimizing. With this patch, if the window was previously maximized or full-screen it will also get the expose events when being restored. Change-Id: I4a30423145e0999c5d0a5ee2a989730b83f4e3f2 Reviewed-by: Friedemann Kleint Reviewed-by: Nicolas Arnaud-Cormos --- src/plugins/platforms/windows/qwindowswindow.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index d2fb481824..58047124a1 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1500,6 +1500,8 @@ void QWindowsWindow::handleWindowStateChange(Qt::WindowState state) handleHidden(); QWindowSystemInterface::flushWindowSystemEvents(); // Tell QQuickWindow to stop rendering now. break; + case Qt::WindowMaximized: + case Qt::WindowFullScreen: case Qt::WindowNoState: { // QTBUG-17548: We send expose events when receiving WM_Paint, but for // layered windows and transient children, we won't receive any WM_Paint. -- cgit v1.2.3 From 98f0b4668999d677d8bf91d57ac095d96e7a661c Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Mon, 18 Nov 2013 10:31:42 +0200 Subject: Android: Use native platform menus. This is an Android only patch, a proper implementation will be pushed soon to stable branch. Task-number: QTBUG-29462 Task-number: QTBUG-33588 Change-Id: I3447c523b4533a768d7f95e4ae60541b09a7944f Reviewed-by: Christoph Schleifenbaum Reviewed-by: Marc Mutz Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/widgets/widgets/qmenu.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 3a4fd449c8..0cbd1c720c 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1834,6 +1834,14 @@ QSize QMenu::sizeHint() const void QMenu::popup(const QPoint &p, QAction *atAction) { Q_D(QMenu); + +#ifdef Q_OS_ANDROID + if (!d->platformMenu.isNull() && !testAttribute(Qt::WA_SetStyle)) { + d->platformMenu->showPopup(window()->windowHandle(), p, 0); + return; + } +#endif + if (d->scroll) { // reset scroll state from last popup if (d->scroll->scrollOffset) d->itemsDirty = 1; // sizeHint will be incorrect if there is previous scroll -- cgit v1.2.3 From eccd365ac544c0e24da86bfaf09d24130feb2e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 15 Nov 2013 19:42:49 +0100 Subject: iOS: Don't enable kEAGLDrawablePropertyRetainedBacking We report our swap-behavior as QSurfaceFormat::DoubleBuffer, which means there's no point in using retained backing. This was a left-over from when we reported single-buffered swaps, which didn't work to well as clients would wrongly assume swap was not needed at all. Change-Id: Id26df2f8b282892c720d48cfe85eb9e010f1500d Reviewed-by: Richard Moe Gustavsen Reviewed-by: Gunnar Sletta --- src/plugins/platforms/ios/qioswindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index e02f570634..af429f9d65 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -105,7 +105,7 @@ CAEAGLLayer *eaglLayer = static_cast(self.layer); eaglLayer.opaque = TRUE; eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithBool:YES], kEAGLDrawablePropertyRetainedBacking, + [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil]; // Set up text input -- cgit v1.2.3 From 7e768dde39f9365a4e1fc45afc492b74744a44e6 Mon Sep 17 00:00:00 2001 From: Christoph Schleifenbaum Date: Sat, 16 Nov 2013 17:17:15 +0100 Subject: Widgets: Never revoke focus by click on focused widget. When clicking on a widget currently focused, w/o having Qt::ClickFocus set as focus policy, the focus should stay on the widget and not get propagated to the widget's parent. Task-number: QTBUG-34042 Change-Id: I53f1153829cc7228de02a90e38125b5cf4ee5008 Reviewed-by: Marc Mutz --- src/widgets/kernel/qapplication.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 4e3ecf144a..9056ffe461 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3761,6 +3761,16 @@ void QApplicationPrivate::giveFocusAccordingToFocusPolicy(QWidget *widget, QEven } if (focusWidget->isWindow()) break; + + // find out whether this widget (or its proxy) already has focus + QWidget *f = focusWidget; + if (focusWidget->d_func()->extra && focusWidget->d_func()->extra->focus_proxy) + f = focusWidget->d_func()->extra->focus_proxy; + // if it has, stop here. + // otherwise a click on the focused widget would remove its focus if ClickFocus isn't set + if (f->hasFocus()) + break; + localPos += focusWidget->pos(); focusWidget = focusWidget->parentWidget(); } -- cgit v1.2.3 From f087ffdc53254fbab438180cd2da750d54c2be76 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Tue, 12 Nov 2013 10:50:42 +0100 Subject: Remove the GLES 2 dependency for eglfs and kms Change-Id: If7b80487e01db726367f5a67d2860073f60a0844 Reviewed-by: Gunnar Sletta --- src/plugins/platforms/eglfs/qeglfsbackingstore.cpp | 1 + src/plugins/platforms/eglfs/qeglfsbackingstore.h | 3 ++- src/plugins/platforms/eglfs/qeglfscompositor.cpp | 7 ++++++- src/plugins/platforms/eglfs/qeglfscompositor.h | 6 ++++-- src/plugins/platforms/eglfs/qeglfscursor.cpp | 5 +++-- src/plugins/platforms/eglfs/qeglfscursor.h | 7 +++++-- src/plugins/platforms/kms/qkmsbackingstore.cpp | 6 ++++++ src/plugins/platforms/kms/qkmsbackingstore.h | 4 +++- src/plugins/platforms/kms/qkmsscreen.h | 3 +-- 9 files changed, 31 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp index 9de5960fdb..03531916cf 100644 --- a/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp +++ b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp @@ -139,6 +139,7 @@ void QEglFSBackingStore::resize(const QSize &size, const QRegion &staticContents m_window->create(); rootWin->screen()->rootContext()->makeCurrent(rootWin->window()); + initializeOpenGLFunctions(); if (m_texture) glDeleteTextures(1, &m_texture); diff --git a/src/plugins/platforms/eglfs/qeglfsbackingstore.h b/src/plugins/platforms/eglfs/qeglfsbackingstore.h index 535428aac1..9af856e8e7 100644 --- a/src/plugins/platforms/eglfs/qeglfsbackingstore.h +++ b/src/plugins/platforms/eglfs/qeglfsbackingstore.h @@ -43,6 +43,7 @@ #define QEGLFSBACKINGSTORE_H #include +#include #include #include @@ -52,7 +53,7 @@ QT_BEGIN_NAMESPACE class QOpenGLPaintDevice; class QEglFSWindow; -class QEglFSBackingStore : public QPlatformBackingStore +class QEglFSBackingStore : public QPlatformBackingStore, public QOpenGLFunctions { public: QEglFSBackingStore(QWindow *window); diff --git a/src/plugins/platforms/eglfs/qeglfscompositor.cpp b/src/plugins/platforms/eglfs/qeglfscompositor.cpp index 9db43a57a1..845bb5b3b5 100644 --- a/src/plugins/platforms/eglfs/qeglfscompositor.cpp +++ b/src/plugins/platforms/eglfs/qeglfscompositor.cpp @@ -53,7 +53,8 @@ static QEglFSCompositor *compositor = 0; QEglFSCompositor::QEglFSCompositor() : m_screen(0), - m_program(0) + m_program(0), + m_initialized(false) { Q_ASSERT(!compositor); m_updateTimer.setSingleShot(true); @@ -86,6 +87,10 @@ void QEglFSCompositor::renderAll() Q_ASSERT(context); context->makeCurrent(rootWin->window()); + if (!m_initialized) { + initializeOpenGLFunctions(); + m_initialized = true; + } ensureProgram(); m_program->bind(); diff --git a/src/plugins/platforms/eglfs/qeglfscompositor.h b/src/plugins/platforms/eglfs/qeglfscompositor.h index ade2e06031..0d5daafa2c 100644 --- a/src/plugins/platforms/eglfs/qeglfscompositor.h +++ b/src/plugins/platforms/eglfs/qeglfscompositor.h @@ -42,7 +42,8 @@ #ifndef QEGLFSCOMPOSITOR_H #define QEGLFSCOMPOSITOR_H -#include +#include +#include QT_BEGIN_NAMESPACE @@ -50,7 +51,7 @@ class QEglFSScreen; class QEglFSWindow; class QOpenGLShaderProgram; -class QEglFSCompositor : public QObject +class QEglFSCompositor : public QObject, public QOpenGLFunctions { Q_OBJECT @@ -76,6 +77,7 @@ private: int m_vertexCoordEntry; int m_textureCoordEntry; int m_isRasterEntry; + bool m_initialized; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfscursor.cpp b/src/plugins/platforms/eglfs/qeglfscursor.cpp index c00e86de35..0066426769 100644 --- a/src/plugins/platforms/eglfs/qeglfscursor.cpp +++ b/src/plugins/platforms/eglfs/qeglfscursor.cpp @@ -79,7 +79,7 @@ void QEglFSCursor::resetResources() m_cursorAtlas.texture = 0; } -static GLuint createShader(GLenum shaderType, const char *program) +GLuint QEglFSCursor::createShader(GLenum shaderType, const char *program) { GLuint shader = glCreateShader(shaderType); glShaderSource(shader, 1 /* count */, &program, NULL /* lengths */); @@ -98,7 +98,7 @@ static GLuint createShader(GLenum shaderType, const char *program) return 0; } -static GLuint createProgram(GLuint vshader, GLuint fshader) +GLuint QEglFSCursor::createProgram(GLuint vshader, GLuint fshader) { GLuint program = glCreateProgram(); glAttachShader(program, vshader); @@ -286,6 +286,7 @@ void QEglFSCursor::draw(const QRectF &r) { if (!m_program) { // one time initialization + initializeOpenGLFunctions(); createShaderPrograms(); if (!m_cursorAtlas.texture) { diff --git a/src/plugins/platforms/eglfs/qeglfscursor.h b/src/plugins/platforms/eglfs/qeglfscursor.h index 51a34e041d..71ff73b8f3 100644 --- a/src/plugins/platforms/eglfs/qeglfscursor.h +++ b/src/plugins/platforms/eglfs/qeglfscursor.h @@ -43,15 +43,15 @@ #define QEGLFSCURSOR_H #include +#include #include "qeglfsscreen.h" -#include QT_BEGIN_NAMESPACE class QOpenGLShaderProgram; class QEglFSScreen; -class QEglFSCursor : public QPlatformCursor +class QEglFSCursor : public QPlatformCursor, public QOpenGLFunctions { public: QEglFSCursor(QEglFSScreen *screen); @@ -78,6 +78,9 @@ protected: void draw(const QRectF &rect); void update(const QRegion ®ion); + GLuint createShader(GLenum shaderType, const char *program); + GLuint createProgram(GLuint vshader, GLuint fshader); + QEglFSScreen *m_screen; // current cursor information diff --git a/src/plugins/platforms/kms/qkmsbackingstore.cpp b/src/plugins/platforms/kms/qkmsbackingstore.cpp index 29395f3b4f..fa4ef847cd 100644 --- a/src/plugins/platforms/kms/qkmsbackingstore.cpp +++ b/src/plugins/platforms/kms/qkmsbackingstore.cpp @@ -52,6 +52,7 @@ QKmsBackingStore::QKmsBackingStore(QWindow *window) , m_context(new QOpenGLContext) , m_texture(0) , m_program(0) + , m_initialized(false) { m_context->setFormat(window->requestedFormat()); m_context->setScreen(window->screen()); @@ -85,6 +86,11 @@ void QKmsBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoin m_context->makeCurrent(window); + if (!m_initialized) { + initializeOpenGLFunctions(); + m_initialized = true; + } + if (!m_program) { static const char *textureVertexProgram = "attribute highp vec2 vertexCoordEntry;\n" diff --git a/src/plugins/platforms/kms/qkmsbackingstore.h b/src/plugins/platforms/kms/qkmsbackingstore.h index 34ea49a346..c5f6c81d18 100644 --- a/src/plugins/platforms/kms/qkmsbackingstore.h +++ b/src/plugins/platforms/kms/qkmsbackingstore.h @@ -43,6 +43,7 @@ #define QBACKINGSTORE_KMS_H #include +#include #include QT_BEGIN_NAMESPACE @@ -50,7 +51,7 @@ QT_BEGIN_NAMESPACE class QOpenGLContext; class QOpenGLShaderProgram; -class QKmsBackingStore : public QPlatformBackingStore +class QKmsBackingStore : public QPlatformBackingStore, public QOpenGLFunctions { public: QKmsBackingStore(QWindow *window); @@ -69,6 +70,7 @@ private: uint m_texture; QOpenGLShaderProgram *m_program; QRegion m_dirty; + bool m_initialized; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/kms/qkmsscreen.h b/src/plugins/platforms/kms/qkmsscreen.h index a90d6fa051..f0c49ad11c 100644 --- a/src/plugins/platforms/kms/qkmsscreen.h +++ b/src/plugins/platforms/kms/qkmsscreen.h @@ -55,8 +55,7 @@ extern "C" { #include #include -#include -#include +#include #include -- cgit v1.2.3 From dcd71a08972e9d6de73242ce8073de89a19f7c97 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 13 Nov 2013 13:23:09 +0100 Subject: Android: Remove usage of QObject::tr() Change-Id: I948d9fc36aa52d2d247a84b5d9b2cf949b93387d Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Paul Olav Tvete --- .../android/src/qandroidplatformdialoghelpers.cpp | 57 ++++++++-------------- 1 file changed, 19 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp index f9eb34751e..f379402e18 100644 --- a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp @@ -63,64 +63,45 @@ void QAndroidPlatformMessageDialogHelper::exec() static QString standardButtonText(int sbutton) { - QString buttonText = 0; switch (sbutton) { case QMessageDialogOptions::Ok: - buttonText = QObject::tr("OK"); - break; + return QAndroidPlatformMessageDialogHelper::tr("OK"); case QMessageDialogOptions::Save: - buttonText = QObject::tr("Save"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Save"); case QMessageDialogOptions::Open: - buttonText = QObject::tr("Open"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Open"); case QMessageDialogOptions::Cancel: - buttonText = QObject::tr("Cancel"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Cancel"); case QMessageDialogOptions::Close: - buttonText = QObject::tr("Close"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Close"); case QMessageDialogOptions::Apply: - buttonText = QObject::tr("Apply"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Apply"); case QMessageDialogOptions::Reset: - buttonText = QObject::tr("Reset"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Reset"); case QMessageDialogOptions::Help: - buttonText = QObject::tr("Help"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Help"); case QMessageDialogOptions::Discard: - buttonText = QObject::tr("Discard"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Discard"); case QMessageDialogOptions::Yes: - buttonText = QObject::tr("Yes"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Yes"); case QMessageDialogOptions::YesToAll: - buttonText = QObject::tr("Yes to All"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Yes to All"); case QMessageDialogOptions::No: - buttonText = QObject::tr("No"); - break; + return QAndroidPlatformMessageDialogHelper::tr("No"); case QMessageDialogOptions::NoToAll: - buttonText = QObject::tr("No to All"); - break; + return QAndroidPlatformMessageDialogHelper::tr("No to All"); case QMessageDialogOptions::SaveAll: - buttonText = QObject::tr("Save All"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Save All"); case QMessageDialogOptions::Abort: - buttonText = QObject::tr("Abort"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Abort"); case QMessageDialogOptions::Retry: - buttonText = QObject::tr("Retry"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Retry"); case QMessageDialogOptions::Ignore: - buttonText = QObject::tr("Ignore"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Ignore"); case QMessageDialogOptions::RestoreDefaults: - buttonText = QObject::tr("Restore Defaults"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Restore Defaults"); } // switch - return buttonText; + return QString(); } bool QAndroidPlatformMessageDialogHelper::show(Qt::WindowFlags windowFlags -- cgit v1.2.3 From 911cfc4e905c022e10932812632d8b894e9e3004 Mon Sep 17 00:00:00 2001 From: Alberto Mardegan Date: Fri, 15 Nov 2013 13:26:12 +0200 Subject: XCB: do not assume that sizeof(long)==4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code was using the "long" type when a 32 bit type was actually needed. This can cause bugs in those systems where "long" is 64 bits wide, such as Linux x86-64 (which is LP64). Task-number: QTBUG-34861 Change-Id: Iab289b2af3847dd62d8b4ecea51896936ca4c7a2 Reviewed-by: Friedemann Kleint Reviewed-by: Gunnar Sletta Reviewed-by: Jørgen Lind --- src/plugins/platforms/xcb/qxcbwindow.cpp | 12 ++++++------ src/plugins/platforms/xcb/qxcbwindow.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index dd404d044d..e2c6932992 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -154,7 +154,7 @@ enum QX11EmbedMessageType { XEMBED_ACTIVATE_ACCELERATOR = 14 }; -const long XEMBED_VERSION = 0; +const quint32 XEMBED_VERSION = 0; // Returns \c true if we should set WM_TRANSIENT_FOR on \a w static inline bool isTransient(const QWindow *w) @@ -403,7 +403,7 @@ void QXcbWindow::create() } // set the PID to let the WM kill the application if unresponsive - long pid = getpid(); + quint32 pid = getpid(); Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, atom(QXcbAtom::_NET_WM_PID), XCB_ATOM_CARDINAL, 32, 1, &pid)); @@ -422,7 +422,7 @@ void QXcbWindow::create() 1, &leader)); /* Add XEMBED info; this operation doesn't initiate the embedding. */ - long data[] = { XEMBED_VERSION, XEMBED_MAPPED }; + quint32 data[] = { XEMBED_VERSION, XEMBED_MAPPED }; Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, atom(QXcbAtom::_XEMBED_INFO), atom(QXcbAtom::_XEMBED_INFO), @@ -1824,7 +1824,7 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev xcb_get_property_reply(xcb_connection(), get_cookie, NULL); if (reply && reply->format == 32 && reply->type == wmStateAtom) { - const long *data = (const long *)xcb_get_property_value(reply); + const quint32 *data = (const quint32 *)xcb_get_property_value(reply); if (reply->length != 0 && XCB_WM_STATE_ICONIC == data[0]) newState = Qt::WindowMinimized; } @@ -1995,8 +1995,8 @@ bool QXcbWindow::startSystemResize(const QPoint &pos, Qt::Corner corner) } // Sends an XEmbed message. -void QXcbWindow::sendXEmbedMessage(xcb_window_t window, long message, - long detail, long data1, long data2) +void QXcbWindow::sendXEmbedMessage(xcb_window_t window, quint32 message, + quint32 detail, quint32 data1, quint32 data2) { xcb_client_message_event_t event; diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 5601a115e9..45d44b213f 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -169,8 +169,8 @@ private: void updateDoesNotAcceptFocus(bool doesNotAcceptFocus); QRect windowToWmGeometry(QRect r) const; - void sendXEmbedMessage(xcb_window_t window, long message, - long detail = 0, long data1 = 0, long data2 = 0); + void sendXEmbedMessage(xcb_window_t window, quint32 message, + quint32 detail = 0, quint32 data1 = 0, quint32 data2 = 0); void handleXEmbedMessage(const xcb_client_message_event_t *event); void create(); -- cgit v1.2.3 From 1f22d924e86e35940c0356fd267f2c7521853961 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 6 Nov 2013 14:40:59 +0100 Subject: Clear focus from active widget when windowcontainer gets focus. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-31853 Change-Id: If0d29ee0a125464b32be99332502473b7c626bb0 Reviewed-by: Jørgen Lind --- src/widgets/kernel/qwindowcontainer.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index 6914f64f8e..7482f1587a 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -222,6 +222,11 @@ void QWindowContainer::focusWindowChanged(QWindow *focusWindow) { Q_D(QWindowContainer); d->oldFocusWindow = focusWindow; + if (focusWindow == d->window) { + QWidget *widget = QApplication::focusWidget(); + if (widget) + widget->clearFocus(); + } } /*! -- cgit v1.2.3 From 9943ac440ef809d234b056fe414d5ae16ebaab82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Tue, 19 Nov 2013 18:10:42 +0000 Subject: Doc: Q_REVISION/Q_INVOKABLE are added to declaration not definition. Change-Id: Ia06d33df1b5d38783e22b0c45956a5154338ed33 Reviewed-by: Marc Mutz --- src/corelib/kernel/qobject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index c19c3fcbb5..6fb22054cc 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4140,7 +4140,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) { \macro Q_INVOKABLE \relates QObject - Apply this macro to definitions of member functions to allow them to + Apply this macro to declarations of member functions to allow them to be invoked via the meta-object system. The macro is written before the return type, as shown in the following example: @@ -4157,7 +4157,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) { \macro Q_REVISION \relates QObject - Apply this macro to definitions of member functions to tag them with a + Apply this macro to declarations of member functions to tag them with a revision number in the meta-object system. The macro is written before the return type, as shown in the following example: -- cgit v1.2.3 From 97abe053e28fc98b705659c230abfc8a0d46bee1 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Tue, 19 Nov 2013 12:00:35 +0100 Subject: Bump Qt version to 5.2.1 Change-Id: I6ee560e48625307e1ea24854fe58fdc190650a4f Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qglobal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 1629339fd1..c2bb7173ba 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -45,11 +45,11 @@ #include -#define QT_VERSION_STR "5.2.0" +#define QT_VERSION_STR "5.2.1" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x050200 +#define QT_VERSION 0x050201 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ -- cgit v1.2.3 From cefa54d478fa69d1482602ff442af45bb73c5a7f Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 20 Nov 2013 07:42:14 +0100 Subject: When we get a WindowBlocked event then reset the qt_button_down value Whenever a window gets blocked, then the qt_button_down variable should be reset as it is not going to receive the release event for the mouse. This fixes problems with the mouse cursor not being updated when moving over widgets (such as QLineEdit) after a dialog is shown in response to a press event. Change-Id: Idfd072eaf36f51b816a0b2a0391cdc447d7a5d9d Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qwidgetwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index e977ab3d6f..2e96247873 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -251,7 +251,9 @@ bool QWidgetWindow::event(QEvent *event) case QEvent::Show: case QEvent::Hide: return QWindow::event(event); - + case QEvent::WindowBlocked: + qt_button_down = 0; + break; default: break; } -- cgit v1.2.3 From 829b1d13b225e87b8a385397e2b53c7a9f8cda9e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 28 Oct 2013 14:11:50 +0100 Subject: Ensure Qt::WA_Mapped is set in case of obscured native windows. Task-number: QTBUG-33520 Change-Id: I51f9b4634be29fd32f4ad9cc8b5d3e10b19ea2f5 Reviewed-by: Oliver Wolff Reviewed-by: Joerg Bornemann Reviewed-by: Gunnar Sletta --- src/widgets/kernel/qwidget_qpa.cpp | 2 +- src/widgets/kernel/qwidgetwindow.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index ae8a0b25b9..18045e3b09 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -506,9 +506,9 @@ void QWidgetPrivate::show_sys() QWindow *window = q->windowHandle(); + q->setAttribute(Qt::WA_Mapped); if (q->testAttribute(Qt::WA_DontShowOnScreen)) { invalidateBuffer(q->rect()); - q->setAttribute(Qt::WA_Mapped); if (q->isWindow() && q->windowModality() != Qt::NonModal && window) { // add our window to the modal window list QGuiApplicationPrivate::showModalWindow(window); diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index e977ab3d6f..22e15e23fe 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -713,6 +713,10 @@ void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event break; } + // Note that widgetState == m_widget->data->window_state when triggered by QWidget::setWindowState(). + if (!(widgetState & Qt::WindowMinimized)) + m_widget->setAttribute(Qt::WA_Mapped); + // Sent event if the state changed (that is, it is not triggered by // QWidget::setWindowState(), which also sends an event to the widget). if (widgetState != int(m_widget->data->window_state)) { -- cgit v1.2.3 From f3a4bc17ab4a68941b3c5bf48a9d5288cff2a8b7 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 6 Sep 2013 11:02:46 +0200 Subject: Keep the dockwidget with the mouse when moving to another screen When you move a dockwidget from one screen to another then it needs to be kept at the same position on the new screen, i.e. with the mouse pointer. This fix ensures that this is happening including when the screens may not 100% align up with each other. Task-number: QTBUG-33369 Change-Id: If414effdd0e0415629ca31a86f8bbe382dd29f80 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 197a2058af..4a5696b35e 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -599,7 +599,17 @@ NSRect qt_mac_flipRect(const QRect &rect, QWindow *window) { QPlatformScreen *onScreen = QPlatformScreen::platformScreenForWindow(window); int flippedY = onScreen->geometry().height() - (rect.y() + rect.height()); - + QList screens = QGuiApplication::screens(); + if (screens.size() > 1) { + int height = 0; + foreach (QScreen *scr, screens) + height = qMax(height, scr->size().height()); + int difference = height - onScreen->geometry().height(); + if (difference > 0) + flippedY += difference; + else + flippedY -= difference; + } // In case of automatic positioning, try to put as much of the window onscreen as possible. if (window->isTopLevel() && qt_window_private(const_cast(window))->positionAutomatic && flippedY < 0) flippedY = onScreen->geometry().height() - onScreen->availableGeometry().height() - onScreen->availableGeometry().y(); -- cgit v1.2.3 From 711d0a16580022d9f38a782f269f5cc3af0f3af7 Mon Sep 17 00:00:00 2001 From: Arvid Nilsson Date: Tue, 12 Nov 2013 10:27:28 +0100 Subject: Add QQnxNativeInterface::nativeResourceForContext This mechanism is used by QtWebEngine to extract the platform GL context. In the QNX case, the platform context is an EGL context, so the resource you need to ask for is the "eglcontext". Compare to the xcb native interface which has a similar implementation already. Change-Id: I873eaadf96898abb24de347ac624c88cd54254cb Reviewed-by: Jocelyn Turcotte Reviewed-by: Kevin Krammer Reviewed-by: Fabian Bumberger --- src/plugins/platforms/qnx/qqnxglcontext.h | 2 ++ src/plugins/platforms/qnx/qqnxnativeinterface.cpp | 10 ++++++++++ src/plugins/platforms/qnx/qqnxnativeinterface.h | 1 + 3 files changed, 13 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxglcontext.h b/src/plugins/platforms/qnx/qqnxglcontext.h index ff57861498..2b12657da9 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.h +++ b/src/plugins/platforms/qnx/qqnxglcontext.h @@ -75,6 +75,8 @@ public: static EGLDisplay getEglDisplay(); EGLConfig getEglConfig() const { return m_eglConfig;} + EGLContext getEglContext() const { return m_eglContext; } + private: //Can be static because different displays returne the same handle static EGLDisplay ms_eglDisplay; diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp index 8958a5c1e2..6e7fc35a82 100644 --- a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp +++ b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp @@ -41,9 +41,11 @@ #include "qqnxnativeinterface.h" +#include "qqnxglcontext.h" #include "qqnxscreen.h" #include "qqnxwindow.h" +#include #include #include @@ -71,6 +73,14 @@ void *QQnxNativeInterface::nativeResourceForScreen(const QByteArray &resource, Q return 0; } +void *QQnxNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) +{ + if (resource == "eglcontext" && context) + return static_cast(context->handle())->getEglContext(); + + return 0; +} + void QQnxNativeInterface::setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value) { if (name == QStringLiteral("mmRendererWindowName")) { diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.h b/src/plugins/platforms/qnx/qqnxnativeinterface.h index b61f6a56cc..dfd386214e 100644 --- a/src/plugins/platforms/qnx/qqnxnativeinterface.h +++ b/src/plugins/platforms/qnx/qqnxnativeinterface.h @@ -51,6 +51,7 @@ class QQnxNativeInterface : public QPlatformNativeInterface public: void *nativeResourceForWindow(const QByteArray &resource, QWindow *window); void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen); + void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context); void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value); }; -- cgit v1.2.3 From 1e446fc99167a992b1a8342168b6254f43b097fe Mon Sep 17 00:00:00 2001 From: El Mehdi Fekari Date: Thu, 14 Nov 2013 16:17:31 +0100 Subject: QLocale: Avoid a deadlock in error case QBBSystemLocaleData emits qwarnings when it fails to open or read a pps object. If the user code installs a message handler that will invoke QLocale API again (i.e QDate, QDateTime, ...) which leads to a deadlock situation, since the QBBSystemLocaleData global static object's ctor() is not yet done. This patch logs the QBBSystemLocale's warnings to stderr and skips the Qt message handler. Change-Id: I3d51f85761253e09b14a44179dd14a887733b392 Reviewed-by: Rafael Roquetto --- src/corelib/tools/qlocale_blackberry.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qlocale_blackberry.cpp b/src/corelib/tools/qlocale_blackberry.cpp index e2dfa6c801..48faa73070 100644 --- a/src/corelib/tools/qlocale_blackberry.cpp +++ b/src/corelib/tools/qlocale_blackberry.cpp @@ -68,17 +68,20 @@ QBBSystemLocaleData::QBBSystemLocaleData() , measurementNotifier(0) , hourNotifier(0) { + // Do not use qWarning to log warnings if qt_safe_open fails to open the pps file + // since the user code may install a message handler that invokes QLocale API again + // (i.e QDate, QDateTime, ...) which will cause a deadlock. if ((measurementFd = qt_safe_open(ppsUomPath, O_RDONLY)) == -1) - qWarning("Failed to open uom pps, errno=%d", errno); + fprintf(stderr, "Failed to open uom pps, errno=%d\n", errno); if ((regionFd = qt_safe_open(ppsRegionLocalePath, O_RDONLY)) == -1) - qWarning("Failed to open region pps, errno=%d", errno); + fprintf(stderr, "Failed to open region pps, errno=%d\n", errno); if ((languageFd = qt_safe_open(ppsLanguageLocalePath, O_RDONLY)) == -1) - qWarning("Failed to open language pps, errno=%d", errno); + fprintf(stderr, "Failed to open language pps, errno=%d\n", errno); if ((hourFd = qt_safe_open(ppsHourFormatPath, O_RDONLY)) == -1) - qWarning("Failed to open hour format pps, errno=%d", errno); + fprintf(stderr, "Failed to open hour format pps, errno=%d\n", errno); // we cannot call this directly, because by the time this constructor is // called, the event dispatcher has not yet been created, causing the @@ -186,8 +189,12 @@ QByteArray QBBSystemLocaleData::readPpsValue(const char *ppsObject, int ppsFd) char buffer[ppsBufferSize]; int bytes = qt_safe_read(ppsFd, buffer, ppsBufferSize - 1); + // This method is called in the ctor(), so do not use qWarning to log warnings + // if qt_safe_read fails to read the pps file + // since the user code may install a message handler that invokes QLocale API again + // (i.e QDate, QDateTime, ...) which will cause a deadlock. if (bytes == -1) { - qWarning("Failed to read Locale pps, errno=%d", errno); + fprintf(stderr, "Failed to read pps object:%s, errno=%d\n", ppsObject, errno); return result; } // ensure data is null terminated -- cgit v1.2.3 From 0c012b647064bd39eaf751b9a0e467fbf18441ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 15 Nov 2013 10:52:50 +0100 Subject: iOS: Send expose events in the window's coordinate system, not the parent's Change-Id: I4aa1a354ca14864bd9898ebd331871d7b32d3ae0 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Gunnar Sletta --- src/plugins/platforms/ios/qioswindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index af429f9d65..3d1fe935e5 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -168,7 +168,7 @@ QRect geometry = fromCGRect(self.frame); m_qioswindow->QPlatformWindow::setGeometry(geometry); QWindowSystemInterface::handleGeometryChange(m_qioswindow->window(), geometry); - QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), geometry); + QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), QRect(QPoint(), geometry.size())); // If we have a new size here we need to resize the FBO's corresponding buffers, // but we defer that to when the application calls makeCurrent. -- cgit v1.2.3 From 837228151d085264e8244969349b3d68d6f9cc94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 18 Nov 2013 11:32:32 +0100 Subject: iOS: Don't keep around reference to a single QIOSViewController We might have more of them in a multi-screen setup or when implementing support for modal windows using sub-viewcontrollers. Change-Id: Ibe98273a13af981fffe2704a2c05bfd9d3f3e9e0 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosapplicationdelegate.h | 1 - src/plugins/platforms/ios/qiosapplicationdelegate.mm | 5 +---- src/plugins/platforms/ios/qiosglobal.h | 1 - src/plugins/platforms/ios/qiosglobal.mm | 11 ----------- src/plugins/platforms/ios/qiosscreen.mm | 2 +- src/plugins/platforms/ios/qioswindow.h | 1 + src/plugins/platforms/ios/qioswindow.mm | 19 +++++++++++++++++-- 7 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.h b/src/plugins/platforms/ios/qiosapplicationdelegate.h index bfe31af198..617b740d6e 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.h +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.h @@ -47,6 +47,5 @@ @interface QIOSApplicationDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; -@property (strong, nonatomic) QIOSViewController *qiosViewController; @end diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm index 4d88faba75..775074baae 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm @@ -49,7 +49,6 @@ @implementation QIOSApplicationDelegate @synthesize window; -@synthesize qiosViewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { @@ -57,8 +56,7 @@ Q_UNUSED(launchOptions); self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; - self.qiosViewController = [[[QIOSViewController alloc] init] autorelease]; - self.window.rootViewController = self.qiosViewController; + self.window.rootViewController = [[[QIOSViewController alloc] init] autorelease]; self.window.hidden = NO; @@ -67,7 +65,6 @@ - (void)dealloc { - [qiosViewController release]; [window release]; [super dealloc]; } diff --git a/src/plugins/platforms/ios/qiosglobal.h b/src/plugins/platforms/ios/qiosglobal.h index fd328c9171..41b0d7f93a 100644 --- a/src/plugins/platforms/ios/qiosglobal.h +++ b/src/plugins/platforms/ios/qiosglobal.h @@ -52,7 +52,6 @@ QT_BEGIN_NAMESPACE class QPlatformScreen; bool isQtApplication(); -QIOSViewController *qiosViewController(); CGRect toCGRect(const QRect &rect); QRect fromCGRect(const CGRect &rect); diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm index 9b8462a6cc..be68e4d7d5 100644 --- a/src/plugins/platforms/ios/qiosglobal.mm +++ b/src/plugins/platforms/ios/qiosglobal.mm @@ -58,17 +58,6 @@ bool isQtApplication() return isQt; } -QIOSViewController *qiosViewController() -{ - // If Qt controls the application, we have created a root view controller were we place top-level - // QWindows. Note that in a mixed native application, our view controller might later be removed or - // added as a child of another controller. To protect against that, we keep an explicit pointer to the - // view controller in cases where this is the controller we need to access. - static QIOSViewController *c = isQtApplication() ? - static_cast([UIApplication sharedApplication].delegate).qiosViewController : nil; - return c; -} - CGRect toCGRect(const QRect &rect) { return CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()); diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index d57e678810..9d01053548 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -149,7 +149,7 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex) if (isQtApplication()) { // When in a non-mixed environment, let QScreen follow the current interface orientation: - setPrimaryOrientation(toQtScreenOrientation(UIDeviceOrientation(qiosViewController().interfaceOrientation))); + setPrimaryOrientation(toQtScreenOrientation(UIDeviceOrientation([UIApplication sharedApplication].statusBarOrientation))); } } diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index 5ded589205..6e8683af00 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -52,6 +52,7 @@ class QIOSWindow; @interface UIView (QIOS) @property(readonly) QWindow *qwindow; +@property(readonly) UIViewController *viewController; @end QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 3d1fe935e5..b13ce456a4 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -348,6 +348,16 @@ return nil; } +- (UIViewController *)viewController +{ + id responder = self; + while ((responder = [responder nextResponder])) { + if ([responder isKindOfClass:UIViewController.class]) + return responder; + } + return nil; +} + @end QT_BEGIN_NAMESPACE @@ -404,7 +414,7 @@ void QIOSWindow::setVisible(bool visible) requestActivateWindow(); } else { // Activate top-most visible QWindow: - NSArray *subviews = qiosViewController().view.subviews; + NSArray *subviews = m_view.viewController.view.subviews; for (int i = int(subviews.count) - 1; i >= 0; --i) { UIView *view = [subviews objectAtIndex:i]; if (!view.hidden) { @@ -460,7 +470,12 @@ void QIOSWindow::setParent(const QPlatformWindow *parentWindow) UIView *parentView = reinterpret_cast(parentWindow->winId()); [parentView addSubview:m_view]; } else if (isQtApplication()) { - [qiosViewController().view addSubview:m_view]; + for (UIWindow *uiWindow in [[UIApplication sharedApplication] windows]) { + if (uiWindow.screen == static_cast(screen())->uiScreen()) { + [uiWindow.rootViewController.view addSubview:m_view]; + break; + } + } } } -- cgit v1.2.3 From c3e949ac7dd9ddfc3c089061908000c5b4d9dc4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 15 Nov 2013 19:33:57 +0100 Subject: iOS: Allow non-top-level windows to be activated As tested and assumed by tst_QWindow::isActive(). Change-Id: I8d09263ce0acc9c3390a70b4089396257197a1be Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioswindow.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index b13ce456a4..de56084848 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -484,12 +484,14 @@ void QIOSWindow::requestActivateWindow() // Note that several windows can be active at the same time if they exist in the same // hierarchy (transient children). But only one window can be QGuiApplication::focusWindow(). // Dispite the name, 'requestActivateWindow' means raise and transfer focus to the window: - if (!window()->isTopLevel() || blockedByModal()) + if (blockedByModal()) return; [m_view.window makeKeyWindow]; - raise(); + if (window()->isTopLevel()) + raise(); + QPlatformInputContext *context = QGuiApplicationPrivate::platformIntegration()->inputContext(); static_cast(context)->focusViewChanged(m_view); QWindowSystemInterface::handleWindowActivated(window()); -- cgit v1.2.3 From 2e2c7327dd26678d26fd7fc431a78c1d05d94411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 18 Nov 2013 18:25:24 +0100 Subject: iOS: Prepare platform screen for reacting to dynamic updates to properties Change-Id: Idb378416da2b559ed88eb5a764cacff149264f70 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosscreen.h | 3 +- src/plugins/platforms/ios/qiosscreen.mm | 78 +++++++++++++------------ src/plugins/platforms/ios/qiosviewcontroller.mm | 9 +-- 3 files changed, 45 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosscreen.h b/src/plugins/platforms/ios/qiosscreen.h index 40c7a3ccf7..e70ff4b1a9 100644 --- a/src/plugins/platforms/ios/qiosscreen.h +++ b/src/plugins/platforms/ios/qiosscreen.h @@ -72,13 +72,14 @@ public: UIScreen *uiScreen() const; - void setPrimaryOrientation(Qt::ScreenOrientation orientation); + void updateProperties(); private: UIScreen *m_uiScreen; QRect m_geometry; QRect m_availableGeometry; int m_depth; + uint m_unscaledDpi; QSizeF m_physicalSize; QIOSOrientationListener *m_orientationListener; }; diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 9d01053548..2d8ff7d8e1 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -132,25 +132,14 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex) m_depth = 24; } - int unscaledDpi = 163; // Regular iPhone DPI if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad && !deviceIdentifier.contains(QRegularExpression("^iPad2,[567]$")) /* excluding iPad Mini */) { - unscaledDpi = 132; - }; - - CGRect bounds = [m_uiScreen bounds]; - m_geometry = QRect(bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height); - - CGRect frame = m_uiScreen.applicationFrame; - m_availableGeometry = QRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); - - const qreal millimetersPerInch = 25.4; - m_physicalSize = QSizeF(m_geometry.size()) / unscaledDpi * millimetersPerInch; - - if (isQtApplication()) { - // When in a non-mixed environment, let QScreen follow the current interface orientation: - setPrimaryOrientation(toQtScreenOrientation(UIDeviceOrientation([UIApplication sharedApplication].statusBarOrientation))); + m_unscaledDpi = 132; + } else { + m_unscaledDpi = 163; // Regular iPhone DPI } + + updateProperties(); } QIOSScreen::~QIOSScreen() @@ -158,6 +147,41 @@ QIOSScreen::~QIOSScreen() [m_orientationListener release]; } +void QIOSScreen::updateProperties() +{ + UIWindow *uiWindow = 0; + for (uiWindow in [[UIApplication sharedApplication] windows]) { + if (uiWindow.screen == m_uiScreen) + break; + } + + bool inPortrait = UIInterfaceOrientationIsPortrait(uiWindow.rootViewController.interfaceOrientation); + QRect geometry = inPortrait ? fromCGRect(m_uiScreen.bounds) + : QRect(m_uiScreen.bounds.origin.x, m_uiScreen.bounds.origin.y, + m_uiScreen.bounds.size.height, m_uiScreen.bounds.size.width); + + if (geometry != m_geometry) { + m_geometry = geometry; + + const qreal millimetersPerInch = 25.4; + m_physicalSize = QSizeF(m_geometry.size()) / m_unscaledDpi * millimetersPerInch; + + QWindowSystemInterface::handleScreenGeometryChange(screen(), m_geometry); + } + + QRect availableGeometry = geometry; + + CGSize applicationFrameSize = m_uiScreen.applicationFrame.size; + int statusBarHeight = geometry.height() - (inPortrait ? applicationFrameSize.height : applicationFrameSize.width); + + availableGeometry.adjust(0, statusBarHeight, 0, 0); + + if (availableGeometry != m_availableGeometry) { + m_availableGeometry = availableGeometry; + QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), m_availableGeometry); + } +} + QRect QIOSScreen::geometry() const { return m_geometry; @@ -213,28 +237,6 @@ void QIOSScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask) } } -void QIOSScreen::setPrimaryOrientation(Qt::ScreenOrientation orientation) -{ - // Note that UIScreen never changes orientation, but QScreen should. To work around - // this, we let QIOSViewController call us whenever interface orientation changes, and - // use that as primary orientation. After all, the viewcontrollers geometry is what we - // place QWindows on top of. A problem with this approach is that QIOSViewController is - // not in use in a mixed environment, which results in no change to primary orientation. - // We see that as acceptable since Qt should most likely not interfere with orientation - // for that case anyway. - bool portrait = screen()->isPortrait(orientation); - if (portrait && m_geometry.width() < m_geometry.height()) - return; - - // Switching portrait/landscape means swapping width/height (and adjusting x/y): - m_geometry = QRect(0, 0, m_geometry.height(), m_geometry.width()); - m_physicalSize = QSizeF(m_physicalSize.height(), m_physicalSize.width()); - m_availableGeometry = fromPortraitToPrimary(fromCGRect(m_uiScreen.applicationFrame), this); - - QWindowSystemInterface::handleScreenGeometryChange(screen(), m_geometry); - QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), m_availableGeometry); -} - UIScreen *QIOSScreen::uiScreen() const { return m_uiScreen; diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 656a86027d..1d5e69beac 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -62,19 +62,16 @@ return UIInterfaceOrientationMaskAll; } -- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration +- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration { Q_UNUSED(duration); + Q_UNUSED(interfaceOrientation); if (!QCoreApplication::instance()) return; // FIXME: Store orientation for later (?) - Qt::ScreenOrientation orientation = toQtScreenOrientation(UIDeviceOrientation(toInterfaceOrientation)); - if (orientation == -1) - return; - QIOSScreen *qiosScreen = static_cast(QGuiApplication::primaryScreen()->handle()); - qiosScreen->setPrimaryOrientation(orientation); + qiosScreen->updateProperties(); } @end -- cgit v1.2.3 From ce6fd574b46cb10204f6ef598ea4377639ad1516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 18 Nov 2013 18:27:37 +0100 Subject: iOS: Report native orientation of QScreen in relation to size Instead of hard-coding it to assume the properties of the main/device screen. Change-Id: I94c978d4334cae5be9d1094a0c315031e54e8e1f Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosscreen.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 2d8ff7d8e1..b93511d755 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -219,7 +219,9 @@ qreal QIOSScreen::devicePixelRatio() const Qt::ScreenOrientation QIOSScreen::nativeOrientation() const { - return Qt::PortraitOrientation; + // A UIScreen stays in the native orientation, regardless of rotation + return m_uiScreen.bounds.size.width >= m_uiScreen.bounds.size.height ? + Qt::LandscapeOrientation : Qt::PortraitOrientation; } Qt::ScreenOrientation QIOSScreen::orientation() const -- cgit v1.2.3 From 16ad93af4959b3c0ae96a4a0d88e25c1626f587d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 18 Nov 2013 19:21:10 +0100 Subject: iOS: Don't use auto resizing masks to deal with maximized/fullscreen It breaks down when the view-controller is fullscreen and we want to take statusbar height into account as well. Unfortunately we can't use constraints either, as it's iOS6+. The approach of managing the geometry manually is closer to what Android does as well. Change-Id: Ib521ba0f50b110c440ab68aacef5a524d5d41154 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosscreen.mm | 3 +++ src/plugins/platforms/ios/qioswindow.mm | 27 +++++++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index b93511d755..de6585fd19 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -180,6 +180,9 @@ void QIOSScreen::updateProperties() m_availableGeometry = availableGeometry; QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), m_availableGeometry); } + + if (screen()) + resizeMaximizedWindows(); } QRect QIOSScreen::geometry() const diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index de56084848..2413a45e11 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -448,19 +448,26 @@ void QIOSWindow::setWindowState(Qt::WindowState state) // Perhaps setting QWindow to maximized should also mean that we'll show // the statusbar, and vice versa for fullscreen? + if (state != Qt::WindowNoState) + m_normalGeometry = geometry(); + switch (state) { + case Qt::WindowNoState: + setGeometry(m_normalGeometry); + break; case Qt::WindowMaximized: - case Qt::WindowFullScreen: { - // Since UIScreen does not take orientation into account when - // reporting geometry, we need to look at the top view instead: - CGSize fullscreenSize = m_view.window.rootViewController.view.bounds.size; - m_view.frame = CGRectMake(0, 0, fullscreenSize.width, fullscreenSize.height); - m_view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - break; } - default: - m_view.frame = toCGRect(m_normalGeometry); - m_view.autoresizingMask = UIViewAutoresizingNone; + setGeometry(screen()->availableGeometry()); break; + case Qt::WindowFullScreen: + setGeometry(screen()->geometry()); + break; + case Qt::WindowMinimized: + setGeometry(QRect()); + break; + case Qt::WindowActive: + Q_UNREACHABLE(); + default: + Q_UNREACHABLE(); } } -- cgit v1.2.3 From 54b8c27e03d04c1e5cd35f75d5c0a8111240eb74 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 15 Nov 2013 11:26:38 +0100 Subject: Fix crash when windowcontainer is used in a dockwidget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dockwidget's toplevel window would be a parent of the container's window when floating. When plugged back into the mainwindow the dockwidget's window is destroyed and the container's window along with it. Added a function toplevelAboutToBeDestroyed to unparent the containers window before this happens so parentWasChanged will work correctly. Change-Id: I06679cfb3a8fa3834c0db0be5973c012b8277275 Reviewed-by: Ulf Hermann Reviewed-by: Jørgen Lind --- src/widgets/kernel/qwidget_qpa.cpp | 6 +++++- src/widgets/kernel/qwindowcontainer.cpp | 19 ++++++++++++++++--- src/widgets/kernel/qwindowcontainer_p.h | 1 + 3 files changed, 22 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 18045e3b09..3c4985591e 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -53,6 +53,7 @@ #include #include "QtGui/private/qwindow_p.h" #include "QtGui/private/qguiapplication_p.h" +#include #include #include @@ -267,8 +268,11 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide); // Reparenting toplevel to child - if (wasCreated && !(f & Qt::Window) && (oldFlags & Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow)) + if (wasCreated && !(f & Qt::Window) && (oldFlags & Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow)) { + if (extra && extra->hasWindowContainer) + QWindowContainer::toplevelAboutToBeDestroyed(q); q->destroy(); + } adjustFlags(f, q); data.window_flags = f; diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index 6914f64f8e..7c319c5095 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -300,15 +300,28 @@ static void qwindowcontainer_traverse(QWidget *parent, qwindowcontainer_traverse } } +void QWindowContainer::toplevelAboutToBeDestroyed(QWidget *parent) +{ + if (QWindowContainerPrivate *d = QWindowContainerPrivate::get(parent)) { + d->window->setParent(&d->fakeParent); + } + qwindowcontainer_traverse(parent, toplevelAboutToBeDestroyed); +} + void QWindowContainer::parentWasChanged(QWidget *parent) { if (QWindowContainerPrivate *d = QWindowContainerPrivate::get(parent)) { if (d->window->parent()) { d->updateUsesNativeWidgets(); d->markParentChain(); - d->window->setParent(d->usesNativeWidgets - ? parent->windowHandle() - : parent->window()->windowHandle()); + QWidget *toplevel = d->usesNativeWidgets ? parent : parent->window(); + if (!toplevel->windowHandle()) { + QWidgetPrivate *tld = static_cast(QWidgetPrivate::get(toplevel)); + tld->createTLExtra(); + tld->createTLSysExtra(); + Q_ASSERT(toplevel->windowHandle()); + } + d->window->setParent(toplevel->windowHandle()); d->updateGeometry(); } } diff --git a/src/widgets/kernel/qwindowcontainer_p.h b/src/widgets/kernel/qwindowcontainer_p.h index e2446bef42..a21f9bd35a 100644 --- a/src/widgets/kernel/qwindowcontainer_p.h +++ b/src/widgets/kernel/qwindowcontainer_p.h @@ -57,6 +57,7 @@ public: explicit QWindowContainer(QWindow *embeddedWindow, QWidget *parent = 0, Qt::WindowFlags f = 0); ~QWindowContainer(); + static void toplevelAboutToBeDestroyed(QWidget *parent); static void parentWasChanged(QWidget *parent); static void parentWasMoved(QWidget *parent); static void parentWasRaised(QWidget *parent); -- cgit v1.2.3 From 982da20cf2b58dd6f42e70d406c37219ea204a78 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 7 Nov 2013 19:31:09 +0100 Subject: Remove empty QAccessible2 header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ia5e9b1adf9280e6b7d7aaf8cb5b5167b694a6070 Reviewed-by: Jan Arve Sæther --- src/gui/accessible/accessible.pri | 1 - src/gui/accessible/qaccessible2_p.h | 45 ---------------------- .../android/src/androidjniaccessibility.cpp | 2 +- src/plugins/platforms/cocoa/qcocoaaccessibility.mm | 3 +- .../platforms/cocoa/qcocoaaccessibilityelement.mm | 3 +- .../platforms/cocoa/qnsviewaccessibility.mm | 2 +- .../platforms/windows/accessible/iaccessible2.cpp | 2 +- .../windows/accessible/qwindowsaccessibility.cpp | 1 - .../windows/accessible/qwindowsmsaaaccessible.cpp | 1 - 9 files changed, 5 insertions(+), 55 deletions(-) delete mode 100644 src/gui/accessible/qaccessible2_p.h (limited to 'src') diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri index 9453ac20d0..615323dbec 100644 --- a/src/gui/accessible/accessible.pri +++ b/src/gui/accessible/accessible.pri @@ -4,7 +4,6 @@ contains(QT_CONFIG, accessibility) { HEADERS += \ accessible/qaccessible.h \ accessible/qaccessiblecache_p.h \ - accessible/qaccessible2_p.h \ accessible/qaccessibleobject.h \ accessible/qaccessibleplugin.h \ accessible/qplatformaccessibility.h diff --git a/src/gui/accessible/qaccessible2_p.h b/src/gui/accessible/qaccessible2_p.h deleted file mode 100644 index bb5ddf6edf..0000000000 --- a/src/gui/accessible/qaccessible2_p.h +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QACCESSIBLE2_H -#define QACCESSIBLE2_H - -#endif diff --git a/src/plugins/platforms/android/src/androidjniaccessibility.cpp b/src/plugins/platforms/android/src/androidjniaccessibility.cpp index a27d9f5aed..b987c49c9c 100644 --- a/src/plugins/platforms/android/src/androidjniaccessibility.cpp +++ b/src/plugins/platforms/android/src/androidjniaccessibility.cpp @@ -46,7 +46,7 @@ #include "qguiapplication.h" #include "qwindow.h" #include "qrect.h" -#include "private/qaccessible2_p.h" +#include "QtGui/qaccessible.h" #include "qdebug.h" diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm index f43beb1bb5..1371eb3658 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm @@ -40,8 +40,7 @@ ****************************************************************************/ #include "qcocoaaccessibility.h" #include "qcocoaaccessibilityelement.h" -#include -#include +#include #include QCocoaAccessibility::QCocoaAccessibility() diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index 7eae22f720..8e20a96a48 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -42,8 +42,7 @@ #include "qcocoaaccessibility.h" #include "qcocoahelpers.h" -#include -#include +#include #import diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm index 86e5066fbb..e8f26aa8c4 100644 --- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm +++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm @@ -47,7 +47,7 @@ #include "qcocoaaccessibilityelement.h" #include -#include +#include #include #import diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp index 9170c774b4..66ed9d85dc 100644 --- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp +++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp @@ -44,7 +44,7 @@ #include "iaccessible2.h" #include "qwindowsaccessibility.h" -#include +#include #include #include #include diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp index 63b4370dc2..885bc37cff 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp @@ -51,7 +51,6 @@ #include #include #include -#include #include #include #include diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp index 93592eb969..8bb7646258 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp @@ -54,7 +54,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3 From f1268d137ea7839b320c84314d0c2265f5a629ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 20 Nov 2013 13:03:14 +0100 Subject: Allow platform to decide default behavior for show() based on window flags The ShowIsMaximized and ShowIsFullscreen style hints were not granular enough to build a default behavior from that would be correct for all platforms. The recent Android patch that excluded dialogs from being shown maximized (Ia249e93dbbea1) has now been moved into a platform override in the Android integration plugin, leaving other platforms to the default behavior of using the style-hints. We still special case popup-windows though, as that behavior has been there for a while. Task-number: QTBUG-34969 Change-Id: Id36346d71bfc46171383ffe334592ca0b94e456f Reviewed-by: BogDan Vatra Reviewed-by: Paul Olav Tvete --- src/gui/kernel/qplatformintegration.cpp | 14 ++++++++++++++ src/gui/kernel/qplatformintegration.h | 1 + src/gui/kernel/qstylehints.cpp | 3 +++ src/gui/kernel/qwindow.cpp | 13 ++++++------- .../android/src/qandroidplatformintegration.cpp | 9 +++++++++ .../android/src/qandroidplatformintegration.h | 1 + src/widgets/kernel/qwidget.cpp | 20 ++++++++++---------- 7 files changed, 44 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index 08a3b63ee4..26aaf931b3 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -364,6 +364,20 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const return 0; } +Qt::WindowState QPlatformIntegration::defaultWindowState(Qt::WindowFlags flags) const +{ + // Leave popup-windows as is + if (flags & Qt::Popup & ~Qt::Window) + return Qt::WindowNoState; + + if (styleHint(QPlatformIntegration::ShowIsFullScreen).toBool()) + return Qt::WindowFullScreen; + else if (styleHint(QPlatformIntegration::ShowIsMaximized).toBool()) + return Qt::WindowMaximized; + + return Qt::WindowNoState; +} + Qt::KeyboardModifiers QPlatformIntegration::queryKeyboardModifiers() const { return QGuiApplication::keyboardModifiers(); diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index d397270c10..580fc15233 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -152,6 +152,7 @@ public: }; virtual QVariant styleHint(StyleHint hint) const; + virtual Qt::WindowState defaultWindowState(Qt::WindowFlags) const; virtual Qt::KeyboardModifiers queryKeyboardModifiers() const; virtual QList possibleKeys(const QKeyEvent *) const; diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp index 04ea9c27d5..68eb724454 100644 --- a/src/gui/kernel/qstylehints.cpp +++ b/src/gui/kernel/qstylehints.cpp @@ -176,6 +176,9 @@ int QStyleHints::cursorFlashTime() const Returns \c true if the platform defaults to windows being fullscreen, otherwise \c false. + \note The platform may still choose to show certain windows non-fullscreen, + such as popups or dialogs. This method only returns the default behavior. + \sa QWindow::show() */ bool QStyleHints::showIsFullScreen() const diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 4a40dd7e29..2e1d8f9976 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1651,18 +1651,17 @@ QObject *QWindow::focusObject() const /*! Shows the window. - This equivalent to calling showFullScreen() or showNormal(), depending - on whether the platform defaults to windows being fullscreen or not, and - whether the window is a popup. + This is equivalent to calling showFullScreen(), showMaximized(), or showNormal(), + depending on the platform's default behavior for the window type and flags. - \sa showFullScreen(), showNormal(), hide(), QStyleHints::showIsFullScreen(), flags() + \sa showFullScreen(), showMaximized(), showNormal(), hide(), QStyleHints::showIsFullScreen(), flags() */ void QWindow::show() { - bool isPopup = d_func()->windowFlags & Qt::Popup & ~Qt::Window; - if (!isPopup && qApp->styleHints()->showIsFullScreen()) + Qt::WindowState defaultState = QGuiApplicationPrivate::platformIntegration()->defaultWindowState(d_func()->windowFlags); + if (defaultState == Qt::WindowFullScreen) showFullScreen(); - else if (!isPopup && !(d_func()->windowFlags & Qt::Dialog & ~Qt::Window) && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool()) + else if (defaultState == Qt::WindowMaximized) showMaximized(); else showNormal(); diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp index 6d0ec306ab..ae3e257d3c 100644 --- a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp @@ -242,6 +242,15 @@ QVariant QAndroidPlatformIntegration::styleHint(StyleHint hint) const } } +Qt::WindowState QAndroidPlatformIntegration::defaultWindowState(Qt::WindowFlags flags) const +{ + // Don't maximize dialogs on Android + if (flags & Qt::Dialog & ~Qt::Window) + return Qt::WindowNoState; + + return QPlatformIntegration::defaultWindowState(flags); +} + static const QLatin1String androidThemeName("android"); QStringList QAndroidPlatformIntegration::themeNames() const { diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.h b/src/plugins/platforms/android/src/qandroidplatformintegration.h index 3b34cdf7df..bd08ad694c 100644 --- a/src/plugins/platforms/android/src/qandroidplatformintegration.h +++ b/src/plugins/platforms/android/src/qandroidplatformintegration.h @@ -121,6 +121,7 @@ public: #endif QVariant styleHint(StyleHint hint) const; + Qt::WindowState defaultWindowState(Qt::WindowFlags flags) const Q_DECL_OVERRIDE; QStringList themeNames() const; QPlatformTheme *createPlatformTheme(const QString &name) const; diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 933294e21f..1da0be9781 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -6999,23 +6999,23 @@ void QWidget::setUpdatesEnabled(bool enable) } /*! - Shows the widget and its child widgets. This function is - equivalent to setVisible(true) in the normal case, and equivalent - to showFullScreen() if the QStyleHints::showIsFullScreen() hint - is true and the window is not a popup. + Shows the widget and its child widgets. - \sa raise(), showEvent(), hide(), setVisible(), showMinimized(), showMaximized(), - showNormal(), isVisible(), windowFlags() + This is equivalent to calling showFullScreen(), showMaximized(), or setVisible(true), + depending on the platform's default behavior for the window flags. + + \sa raise(), showEvent(), hide(), setVisible(), showMinimized(), showMaximized(), + showNormal(), isVisible(), windowFlags(), flags() */ void QWidget::show() { - bool isPopup = data->window_flags & Qt::Popup & ~Qt::Window; - if (isWindow() && !isPopup && qApp->styleHints()->showIsFullScreen()) + Qt::WindowState defaultState = QGuiApplicationPrivate::platformIntegration()->defaultWindowState(data->window_flags); + if (defaultState == Qt::WindowFullScreen) showFullScreen(); - else if (isWindow() && !(data->window_flags & Qt::Dialog & ~Qt::Window) && !isPopup && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool()) + else if (defaultState == Qt::WindowMaximized) showMaximized(); else - setVisible(true); + setVisible(true); // FIXME: Why not showNormal(), like QWindow::show()? } /*! \internal -- cgit v1.2.3 From 486889523c8fe15277e3148904509789a19d25fe Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Tue, 19 Nov 2013 15:07:25 +0100 Subject: Workaround source compatibility issue introduced by xcb 1.9.3 Previous version of the struct: typedef struct { uint8_t response_type; /**< Type of the response */ uint8_t pad0; /**< Padding */ uint16_t sequence; /**< Sequence number */ uint32_t length; uint16_t event_type; uint16_t pad1; uint32_t pad[5]; /**< Padding */ uint32_t full_sequence; /**< full sequence */ } xcb_ge_event_t; New version of it: typedef struct xcb_ge_event_t { uint8_t response_type; /**< */ uint8_t extension; /**< */ uint16_t sequence; /**< */ uint32_t length; /**< */ uint16_t event_type; /**< */ uint8_t pad0[22]; /**< */ uint32_t full_sequence; /**< */ } xcb_ge_event_t; Changes are: - "pad0" became "extension" - "pad1" and "pad" became "pad0" More details in https://bugs.freedesktop.org/show_bug.cgi?id=71502 Task-number: QTBUG-34748 Change-Id: Ibd801c11510f75fa82d5c14346b95236142487ac Reviewed-by: Uli Schlachter Reviewed-by: Lars Knoll --- src/plugins/platforms/xcb/qxcbconnection.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index cc8c42f96b..4d2735ca85 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1749,10 +1749,26 @@ bool QXcbConnection::xi2GetValuatorValueIfSet(void *event, int valuatorNum, doub return true; } -bool QXcbConnection::xi2PrepareXIGenericDeviceEvent(xcb_ge_event_t *event, int opCode) +// Starting from the xcb version 1.9.3 struct xcb_ge_event_t has changed: +// - "pad0" became "extension" +// - "pad1" and "pad" became "pad0" +// New and old version of this struct share the following fields: +// NOTE: API might change again in the next release of xcb in which case this comment will +// need to be updated to reflect the reality. +typedef struct qt_xcb_ge_event_t { + uint8_t response_type; + uint8_t extension; + uint16_t sequence; + uint32_t length; + uint16_t event_type; +} qt_xcb_ge_event_t; + +bool QXcbConnection::xi2PrepareXIGenericDeviceEvent(xcb_ge_event_t *ev, int opCode) { - // xGenericEvent has "extension" on the second byte, xcb_ge_event_t has "pad0". - if (event->pad0 == opCode) { + qt_xcb_ge_event_t *event = (qt_xcb_ge_event_t *)ev; + // xGenericEvent has "extension" on the second byte, the same is true for xcb_ge_event_t starting from + // the xcb version 1.9.3, prior to that it was called "pad0". + if (event->extension == opCode) { // xcb event structs contain stuff that wasn't on the wire, the full_sequence field // adds an extra 4 bytes and generic events cookie data is on the wire right after the standard 32 bytes. // Move this data back to have the same layout in memory as it was on the wire -- cgit v1.2.3 From e89a9428d5a9b5e5494954dfc3ea4233563c5906 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Tue, 19 Nov 2013 09:42:33 +0100 Subject: BlackBerry: Fixed root window size On BlackBerry the first window shown is treated as root window and should be displayed full screen. The geometry has to be adjusted properly to achieve this. Task-number: QTBUG-34930 Change-Id: I6c011620116cc463e16dd352521b2b901a9f9f69 Reviewed-by: Fabian Bumberger Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qqnxeglwindow.cpp | 12 ++++++++---- src/plugins/platforms/qnx/qqnxwindow.cpp | 11 +++++------ 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxeglwindow.cpp b/src/plugins/platforms/qnx/qqnxeglwindow.cpp index 6afc3cad21..b57227a60b 100644 --- a/src/plugins/platforms/qnx/qqnxeglwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxeglwindow.cpp @@ -58,12 +58,13 @@ QT_BEGIN_NAMESPACE QQnxEglWindow::QQnxEglWindow(QWindow *window, screen_context_t context, bool needRootWindow) : QQnxWindow(window, context, needRootWindow), - m_requestedBufferSize(window->geometry().size()), m_platformOpenGLContext(0), m_newSurfaceRequested(true), m_eglSurface(EGL_NO_SURFACE) { initWindow(); + m_requestedBufferSize = screen()->rootWindow() == this ? + screen()->geometry().size() : window->geometry().size(); } QQnxEglWindow::~QQnxEglWindow() @@ -145,6 +146,9 @@ EGLSurface QQnxEglWindow::getSurface() void QQnxEglWindow::setGeometry(const QRect &rect) { + //If this is the root window, it has to be shown fullscreen + const QRect &newGeometry = screen()->rootWindow() == this ? screen()->geometry() : rect; + //We need to request that the GL context updates // the EGLsurface on which it is rendering. { @@ -152,11 +156,11 @@ void QQnxEglWindow::setGeometry(const QRect &rect) // setting m_requestedBufferSize and therefore extended the scope to include // that test. const QMutexLocker locker(&m_mutex); - m_requestedBufferSize = rect.size(); - if (m_platformOpenGLContext != 0 && bufferSize() != rect.size()) + m_requestedBufferSize = newGeometry.size(); + if (m_platformOpenGLContext != 0 && bufferSize() != newGeometry.size()) m_newSurfaceRequested.testAndSetRelease(false, true); } - QQnxWindow::setGeometry(rect); + QQnxWindow::setGeometry(newGeometry); } QSize QQnxEglWindow::requestedBufferSize() const diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 1e58d482d4..731e0e5ea7 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -136,7 +136,7 @@ void QQnxWindow::setGeometry(const QRect &rect) // Calling flushWindowSystemEvents() here would flush input events which // could result in re-entering QQnxWindow::setGeometry() again. - QWindowSystemInterface::setSynchronousWindowsSystemEvents(true); //This does not work + QWindowSystemInterface::setSynchronousWindowsSystemEvents(true); QWindowSystemInterface::handleGeometryChange(window(), newGeometry); QWindowSystemInterface::handleExposeEvent(window(), newGeometry); QWindowSystemInterface::setSynchronousWindowsSystemEvents(false); @@ -608,12 +608,11 @@ void QQnxWindow::initWindow() setWindowState(window()->windowState()); if (window()->parent() && window()->parent()->handle()) setParent(window()->parent()->handle()); - setGeometryHelper(window()->geometry()); - if (screen()->rootWindow() == this) { - setGeometry(screen()->geometry()); - } -} + const QRect &initialGeometry = screen()->rootWindow() == this ? + screen()->geometry() : window()->geometry(); + setGeometryHelper(initialGeometry); +} void QQnxWindow::createWindowGroup() { -- cgit v1.2.3 From a695371b8faa6a043c304859a298a81c1d408bd0 Mon Sep 17 00:00:00 2001 From: Frank Osterfeld Date: Wed, 20 Nov 2013 16:44:39 +0100 Subject: QNX: Fix build Return "qnx" on non-BB10 QNX. Task-number: QTBUG-34980 Change-Id: I80a95f8d4945fb180fdd565147cf344b51d79fda Reviewed-by: Rafael Roquetto --- src/corelib/io/qfileselector.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp index eed9e8870a..72e4198fb0 100644 --- a/src/corelib/io/qfileselector.cpp +++ b/src/corelib/io/qfileselector.cpp @@ -359,6 +359,8 @@ QStringList QFileSelectorPrivate::platformSelectors() ret << QStringLiteral("android"); # elif defined(Q_OS_BLACKBERRY) ret << QStringLiteral("blackberry"); +# elif defined(Q_OS_QNX) + ret << QStringLiteral("qnx"); # elif defined(Q_OS_IOS) ret << QStringLiteral("ios"); # elif defined(Q_OS_LINUX) -- cgit v1.2.3 From e70ecc06b1e266b73f47291aa037114bd3d1baf7 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 9 Oct 2013 00:55:39 +0200 Subject: Clear QCoreApplication::applicationFilePath cache if argv[0] changes. This allows boosters to precreate Q*Application instances. Change-Id: Ie2c1399b216d9cc996210e077fa6d42d24bf9b0e Reviewed-by: Thiago Macieira --- src/corelib/kernel/qcoreapplication.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 43c64b7b2c..61ad4f9be1 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1939,6 +1939,14 @@ QString QCoreApplication::applicationFilePath() } QCoreApplicationPrivate *d = self->d_func(); + + static char *procName = d->argv[0]; + if (qstrcmp(procName, d->argv[0]) != 0) { + // clear the cache if the procname changes, so we reprocess it. + d->cachedApplicationFilePath = QString(); + procName = d->argv[0]; + } + if (!d->cachedApplicationFilePath.isNull()) return d->cachedApplicationFilePath; -- cgit v1.2.3 From 52ba7b1ffcb90772dc97b3e9a34beee5781ed2d7 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 13 Nov 2013 14:54:49 +0100 Subject: Cleanup freetype data in a thread-safe way One less obvious part of this patch: the fontCache pointer in engineData was not safe. It isn't safe to rely on pointer addresses to verify we're cleaning up the right thing, as a sequence of malloc()/free()/malloc() can return the same pointer, and nothing was cleaning up the dangling pointer in engineData. With this, it is possible to safely drop OpenGL contexts in QtQuick under all conditions with no possibility of crashes. Done-with: Aaron Kennedy Change-Id: I7b91384251593730124323a74737d41333a05f59 Reviewed-by: Konstantin Ritt Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfont.cpp | 9 ++++++--- src/gui/text/qfont_p.h | 5 ++++- src/gui/text/qfontengine_ft.cpp | 44 ++++++++++++++++++++++++++++++----------- src/gui/text/qfontengine_ft_p.h | 2 ++ 4 files changed, 45 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index a410004c06..49b5a9ba46 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -208,7 +208,7 @@ QFontEngine *QFontPrivate::engineForScript(int script) const QMutexLocker locker(qt_fontdatabase_mutex()); if (script <= QChar::Script_Latin) script = QChar::Script_Common; - if (engineData && engineData->fontCache != QFontCache::instance()) { + if (engineData && engineData->fontCacheId != QFontCache::instance()->id()) { // throw out engineData that came from a different thread if (!engineData->ref.deref()) delete engineData; @@ -317,7 +317,7 @@ void QFontPrivate::resolve(uint mask, const QFontPrivate *other) QFontEngineData::QFontEngineData() - : ref(0), fontCache(QFontCache::instance()) + : ref(0), fontCacheId(QFontCache::instance()->id()) { memset(engines, 0, QChar::ScriptCount * sizeof(QFontEngine *)); } @@ -2638,9 +2638,12 @@ void QFontCache::cleanup() } #endif // QT_NO_THREAD +QBasicAtomicInt font_cache_id = Q_BASIC_ATOMIC_INITIALIZER(1); + QFontCache::QFontCache() : QObject(), total_cost(0), max_cost(min_cost), - current_timestamp(0), fast(false), timer_id(-1) + current_timestamp(0), fast(false), timer_id(-1), + m_id(font_cache_id.fetchAndAddRelaxed(1)) { } diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 115e866f24..5b7f918e21 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -140,7 +140,7 @@ public: ~QFontEngineData(); QAtomicInt ref; - QFontCache *fontCache; + const int fontCacheId; QFontEngine *engines[QChar::ScriptCount]; @@ -206,6 +206,8 @@ public: QFontCache(); ~QFontCache(); + int id() const { return m_id; } + void clear(); struct Key { @@ -263,6 +265,7 @@ private: uint current_timestamp; bool fast; int timer_id; + const int m_id; }; Q_GUI_EXPORT int qt_defaultDpiX(); diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 5f53a36629..6af97145d6 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -124,11 +124,21 @@ public: QtFreetypeData() : library(0) { } + ~QtFreetypeData(); FT_Library library; QHash faces; }; +QtFreetypeData::~QtFreetypeData() +{ + for (QHash::ConstIterator iter = faces.begin(); iter != faces.end(); ++iter) + iter.value()->cleanup(); + faces.clear(); + FT_Done_FreeType(library); + library = 0; +} + #ifdef QT_NO_THREAD Q_GLOBAL_STATIC(QtFreetypeData, theFreetypeData) @@ -292,23 +302,35 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id, return freetype; } +void QFreetypeFace::cleanup() +{ + if (hbFace && hbFace_destroy_func) { + hbFace_destroy_func(hbFace); + hbFace = 0; + } + FT_Done_Face(face); + face = 0; +} + void QFreetypeFace::release(const QFontEngine::FaceId &face_id) { - QtFreetypeData *freetypeData = qt_getFreetypeData(); if (!ref.deref()) { - if (hbFace && hbFace_destroy_func) { - hbFace_destroy_func(hbFace); - hbFace = 0; + if (face) { + QtFreetypeData *freetypeData = qt_getFreetypeData(); + + cleanup(); + + if (freetypeData->faces.contains(face_id)) + freetypeData->faces.take(face_id); + + if (freetypeData->faces.isEmpty()) { + FT_Done_FreeType(freetypeData->library); + freetypeData->library = 0; + } } - FT_Done_Face(face); - if(freetypeData->faces.contains(face_id)) - freetypeData->faces.take(face_id); + delete this; } - if (freetypeData->faces.isEmpty()) { - FT_Done_FreeType(freetypeData->library); - freetypeData->library = 0; - } } diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index e64fec2f27..7df66b9678 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -114,9 +114,11 @@ public: private: friend class QFontEngineFT; + friend class QtFreetypeData; friend struct QScopedPointerDeleter; QFreetypeFace() : _lock(QMutex::Recursive) {} ~QFreetypeFace() {} + void cleanup(); QAtomicInt ref; QMutex _lock; QByteArray fontData; -- cgit v1.2.3 From cd61eacae12ed89ceb82b59d3813f5c79e778821 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 18 Nov 2013 17:35:18 +0100 Subject: Fix crash regression for ApplicationWindow on Mac This fixes a recent regression following the integration of change: 7cc1656fef21e6bdc044968a79f0a41155357c29 (Make sure menu bar has a parent window ...) As it now consistently crashes on mac in several of the Qt Quick Controls examples, it is critical that it gets into the release branch. Change-Id: If3db1025229a7f7fd4e7ecc703d5f655db73964d Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoamenubar.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index 0fea55ac68..5a8664747e 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -175,6 +175,7 @@ void QCocoaMenuBar::handleReparent(QWindow *newParentWindow) if (newParentWindow == NULL) { m_window = NULL; } else { + newParentWindow->create(); m_window = static_cast(newParentWindow->handle()); m_window->setMenubar(this); } -- cgit v1.2.3 From eef293b1a02efaa0206f1b9c5086a15cf659ad7d Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 15 Nov 2013 14:03:17 +0200 Subject: Don't send ApplicationStateChanged, if platformIntegration is not set. Task-number: QTBUG-34868 Change-Id: Ia86877550884a3037b9ddedf5d8e227ec1ead2d6 Reviewed-by: Marc Mutz Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/android/src/androidjnimain.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp index 3ab4eedb26..3064e5d4e2 100644 --- a/src/plugins/platforms/android/src/androidjnimain.cpp +++ b/src/plugins/platforms/android/src/androidjnimain.cpp @@ -40,6 +40,7 @@ ** ****************************************************************************/ +#include #include #include @@ -691,7 +692,7 @@ static void updateApplicationState(JNIEnv */*env*/, jobject /*thiz*/, jint state { m_activityActive = (state == Qt::ApplicationActive); - if (!m_androidPlatformIntegration) + if (!m_androidPlatformIntegration || !QGuiApplicationPrivate::platformIntegration()) return; QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState(state)); -- cgit v1.2.3 From 13b456c6c17ac8ca9c755042ece4461c4786b263 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 13 Nov 2013 21:42:54 +0800 Subject: Add list of C++11 features supported by MSVC 2013 Task-number: QTBUG-34705 Change-Id: I22caecdf30c417d323fbc80e7a1fd66e4253cec4 Reviewed-by: Marc Mutz Reviewed-by: Yuchen Deng Reviewed-by: Thiago Macieira Reviewed-by: Olivier Goffart --- src/corelib/global/qcompilerdetection.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index f23478d75c..44077132d4 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -735,6 +735,20 @@ # define Q_COMPILER_CLASS_ENUM # define Q_COMPILER_ATOMICS # endif /* VC 11 */ +# if _MSC_VER >= 1800 + /* C++11 features in VC12 = VC2013 */ +# define Q_COMPILER_DEFAULT_MEMBERS +# define Q_COMPILER_DELETE_MEMBERS +# define Q_COMPILER_DELEGATING_CONSTRUCTORS +# define Q_COMPILER_EXPLICIT_CONVERSIONS +# define Q_COMPILER_NONSTATIC_MEMBER_INIT +# define Q_COMPILER_INITIALIZER_LISTS +// implemented in principle, but has a bug that makes it unusable: http://connect.microsoft.com/VisualStudio/feedback/details/802058/c-11-unified-initialization-fails-with-c-style-arrays +// #define Q_COMPILER_UNIFORM_INIT +# define Q_COMPILER_RAW_STRINGS +# define Q_COMPILER_TEMPLATE_ALIAS +# define Q_COMPILER_VARIADIC_TEMPLATES +# endif /* VC 12 */ #endif /* Q_CC_MSVC */ #ifdef __cplusplus -- cgit v1.2.3 From 6533a736a7dd899280069b5d1855cfa13767341b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Urba=C5=84czyk?= Date: Wed, 13 Nov 2013 21:53:52 +0800 Subject: Fix compilation with MSVC2013 & C++11 support See Variadic templates issue: https://connect.microsoft.com/VisualStudio/feedback/details/801828/c2143-error-when-compiling-c-code-with-variadic-templates Task-number: QTBUG-34705 Change-Id: I733f1451f6d1e9b958c3a76998810fcff3fe779b Reviewed-by: Yuchen Deng Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira Reviewed-by: Olivier Goffart --- src/corelib/kernel/qobject_impl.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/corelib/kernel/qobject_impl.h b/src/corelib/kernel/qobject_impl.h index 1bbd548be6..d2996e6e4d 100644 --- a/src/corelib/kernel/qobject_impl.h +++ b/src/corelib/kernel/qobject_impl.h @@ -99,6 +99,8 @@ namespace QtPrivate { template ::Value > struct ConnectionTypes { static const int *types() { return 0; } }; + template <> struct ConnectionTypes, true> + { static const int *types() { return 0; } }; template struct ConnectionTypes, true> { static const int *types() { static const int t[sizeof...(Args) + 1] = { (QtPrivate::QMetaTypeIdHelper::qt_metatype_id())..., 0 }; return t; } }; #endif -- cgit v1.2.3 From fe312204a355025d7e39f0ea9ec4d2994026120a Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Wed, 20 Nov 2013 16:28:42 +0100 Subject: Fix xkb.h compile warning on 32 bit systems The message: ../../../3rdparty/xcb/include/xcb/xkb.h:118:5: error: this decimal constant is unsigned only in ISO C90 [-Werror] From the C89 standard: "The type of an integer constant is the first of the corresponding list in which its value can be represented. Unsuffixed decimal: int, long int, unsigned long int;" In the later standards "unsigned long int" is removed from the "Unsuffixed decimal" list. If integer constant is suffixed by the letter u or U, then the list is: unsigned int, unsigned long int, .. "unsigned long int" is sufficient on 32 bit systems to store the values of XCB_XKB_CONTROL_PER_KEY_REPEAT and XCB_XKB_CONTROL_CONTROLS_ENABLED Task-number: QTBUG-34142 Change-Id: Ic23781fcd00d4901ec9bb5a85068f4315c14bfb8 Reviewed-by: Lars Knoll --- src/3rdparty/xcb/include/xcb/xkb.h | 4 ++-- .../libxcb/fix_compiler_warning_on_32bit_systems.patch | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 src/3rdparty/xcb/libxcb/fix_compiler_warning_on_32bit_systems.patch (limited to 'src') diff --git a/src/3rdparty/xcb/include/xcb/xkb.h b/src/3rdparty/xcb/include/xcb/xkb.h index 44b0a8d1ae..0180ec8b58 100644 --- a/src/3rdparty/xcb/include/xcb/xkb.h +++ b/src/3rdparty/xcb/include/xcb/xkb.h @@ -114,8 +114,8 @@ typedef enum xcb_xkb_control_t { XCB_XKB_CONTROL_GROUPS_WRAP = 134217728, XCB_XKB_CONTROL_INTERNAL_MODS = 268435456, XCB_XKB_CONTROL_IGNORE_LOCK_MODS = 536870912, - XCB_XKB_CONTROL_PER_KEY_REPEAT = 1073741824, - XCB_XKB_CONTROL_CONTROLS_ENABLED = 2147483648 + XCB_XKB_CONTROL_PER_KEY_REPEAT = 1073741824u, + XCB_XKB_CONTROL_CONTROLS_ENABLED = 2147483648u } xcb_xkb_control_t; typedef enum xcb_xkb_axfb_opt_t { diff --git a/src/3rdparty/xcb/libxcb/fix_compiler_warning_on_32bit_systems.patch b/src/3rdparty/xcb/libxcb/fix_compiler_warning_on_32bit_systems.patch new file mode 100644 index 0000000000..240c20d2ac --- /dev/null +++ b/src/3rdparty/xcb/libxcb/fix_compiler_warning_on_32bit_systems.patch @@ -0,0 +1,15 @@ +diff --git a/src/3rdparty/xcb/include/xcb/xkb.h b/src/3rdparty/xcb/include/xcb/xkb.h +index 44b0a8d..0180ec8 100644 +--- a/src/3rdparty/xcb/include/xcb/xkb.h ++++ b/src/3rdparty/xcb/include/xcb/xkb.h +@@ -114,8 +114,8 @@ typedef enum xcb_xkb_control_t { + XCB_XKB_CONTROL_GROUPS_WRAP = 134217728, + XCB_XKB_CONTROL_INTERNAL_MODS = 268435456, + XCB_XKB_CONTROL_IGNORE_LOCK_MODS = 536870912, +- XCB_XKB_CONTROL_PER_KEY_REPEAT = 1073741824, +- XCB_XKB_CONTROL_CONTROLS_ENABLED = 2147483648 ++ XCB_XKB_CONTROL_PER_KEY_REPEAT = 1073741824u, ++ XCB_XKB_CONTROL_CONTROLS_ENABLED = 2147483648u + } xcb_xkb_control_t; + + typedef enum xcb_xkb_axfb_opt_t { -- cgit v1.2.3 From 6bf759b31040fb5d05044cd14d5889fbd19a8942 Mon Sep 17 00:00:00 2001 From: John Layt Date: Mon, 11 Nov 2013 13:30:44 +0100 Subject: QTimeZone - Change Olsen ID to IANA ID The name Olson was misspelled as Olsen in the public api of QTimeZone which is needed to be fixed before first public release in 5.2 would freeze the api and prevent it being fixed. It has been decided that renaming as IANA ID would be more future-proof. Fixes to the private code will be done separately to keep this patch against release branch to the minimum required. Task-number: QTBUG-34735 Change-Id: I8ee90644862c907f6d1937b8536f0c02583ae736 Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- src/corelib/tools/qtimezone.cpp | 111 +++++++++++++++-------------- src/corelib/tools/qtimezone.h | 14 ++-- src/corelib/tools/qtimezoneprivate.cpp | 12 ++-- src/corelib/tools/qtimezoneprivate_p.h | 10 +-- src/corelib/tools/qtimezoneprivate_win.cpp | 8 +-- 5 files changed, 79 insertions(+), 76 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index 9288dc7756..37d6e183a7 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -105,7 +105,7 @@ public: QTimeZoneSingleton() : backend(newBackendTimeZone()) {} // The backend_tz is the tz to use in static methods such as availableTimeZoneIds() and - // isTimeZoneIdAvailable() and to create named Olsen time zones. This is usually the host + // isTimeZoneIdAvailable() and to create named IANA time zones. This is usually the host // system, but may be different if the host resources are insufficient or if // QT_NO_SYSTEMLOCALE is set. A simple UTC backend is used if no alternative is available. QSharedDataPointer backend; @@ -135,18 +135,21 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz); \section1 - \section2 Olsen Time Zone IDs + \section2 IANA Time Zone IDs - QTimeZone uses the Olsen time zone IDs as defined in the IANA Time Zone + QTimeZone uses the IANA time zone IDs as defined in the IANA Time Zone Database (http://www.iana.org/time-zones). This is to ensure a standard ID - across all supported platforms. Most platforms support the Olsen IDs + across all supported platforms. Most platforms support the IANA IDs and the IANA Database natively, but for Windows a mapping is required to the native IDs. See below for more details. - The Olsen IDs can and do change on a regular basis, and can vary depending + The IANA IDs can and do change on a regular basis, and can vary depending on how recently the host system data was updated. As such you cannot rely on any given ID existing on any host system. You must use - availableTimeZoneIds() to determine what Olsen IDs are available. + availableTimeZoneIds() to determine what IANA IDs are available. + + The IANA IDs and database are also know as the Olson IDs and database, + named after their creator. \section2 UTC Offset Time Zones @@ -165,7 +168,7 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz); the current year. QTimeZone uses a conversion table derived form the Unicode CLDR data to map - between Olsen IDs and Windows IDs. Depending on your version of Windows + between IANA IDs and Windows IDs. Depending on your version of Windows and Qt, this table may not be able to provide a valid conversion, in which "UTC" will be returned. @@ -180,7 +183,7 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz); If you require a QDateTime that uses the current system time zone at any given moment then you should use a Qt::TimeSpec of Qt::LocalTime. - The method systemTimeZoneId() returns the current system Olsen time zone + The method systemTimeZoneId() returns the current system IANA time zone ID which on OSX and Linux will always be correct. On Windows this ID is translated from the the Windows system ID using an internal translation table and the user's selected country. As a consequence there is a small @@ -323,7 +326,7 @@ QTimeZone::QTimeZone() } /*! - Creates an instance of the requested time zone \a olsenId. + Creates an instance of the requested time zone \a ianaId. The ID must be one of the available system IDs otherwise an invalid time zone will be returned. @@ -331,14 +334,14 @@ QTimeZone::QTimeZone() \sa availableTimeZoneIds() */ -QTimeZone::QTimeZone(const QByteArray &olsenId) +QTimeZone::QTimeZone(const QByteArray &ianaId) { // Try and see if it's a valid UTC offset ID, just as quick to try create as look-up - d = new QUtcTimeZonePrivate(olsenId); + d = new QUtcTimeZonePrivate(ianaId); // If not a valid UTC offset ID then try create it with the system backend // Relies on backend not creating valid tz with invalid name if (!d->isValid()) - d = newBackendTimeZone(olsenId); + d = newBackendTimeZone(ianaId); } /*! @@ -359,14 +362,14 @@ QTimeZone::QTimeZone(int offsetSeconds) } /*! - Creates a custom time zone with an ID of \a olsenId and an offset from UTC + Creates a custom time zone with an ID of \a ianaId and an offset from UTC of \a offsetSeconds. The \a name will be the name used by displayName() for the LongName, the \a abbreviation will be used by displayName() for the ShortName and by abbreviation(), and the optional \a country will be used by country(). The \a comment is an optional note that may be displayed in a GUI to assist users in selecting a time zone. - The \a olsenId must not be one of the available system IDs returned by + The \a ianaId must not be one of the available system IDs returned by availableTimeZoneIds(). The \a offsetSeconds from UTC must be in the range -14 hours to +14 hours. @@ -374,12 +377,12 @@ QTimeZone::QTimeZone(int offsetSeconds) default value of QLocale::AnyCountry. */ -QTimeZone::QTimeZone(const QByteArray &olsenId, int offsetSeconds, const QString &name, +QTimeZone::QTimeZone(const QByteArray &ianaId, int offsetSeconds, const QString &name, const QString &abbreviation, QLocale::Country country, const QString &comment) { - // olsenId must be a valid ID and must not clash with the standard system names - if (QTimeZonePrivate::isValidId(olsenId) && !availableTimeZoneIds().contains(olsenId)) - d = new QUtcTimeZonePrivate(olsenId, offsetSeconds, name, abbreviation, country, comment); + // ianaId must be a valid ID and must not clash with the standard system names + if (QTimeZonePrivate::isValidId(ianaId) && !availableTimeZoneIds().contains(ianaId)) + d = new QUtcTimeZonePrivate(ianaId, offsetSeconds, name, abbreviation, country, comment); else d = 0; } @@ -473,10 +476,10 @@ bool QTimeZone::isValid() const } /*! - Returns the Olsen ID for the time zone. + Returns the IANA ID for the time zone. - Olsen IDs are used on all platforms. On Windows these are translated - from the Windows ID into the closest Olsen ID for the time zone and country. + IANA IDs are used on all platforms. On Windows these are translated + from the Windows ID into the closest IANA ID for the time zone and country. */ QByteArray QTimeZone::id() const @@ -760,7 +763,7 @@ QTimeZone::OffsetDataList QTimeZone::transitions(const QDateTime &fromDateTime, // Static methods /*! - Returns the current system time zone Olsen ID. + Returns the current system time zone IANA ID. On Windows this ID is translated from the the Windows ID using an internal translation table and the user's selected country. As a consequence there @@ -774,20 +777,20 @@ QByteArray QTimeZone::systemTimeZoneId() } /*! - Returns \c true if a given time zone \a olsenId is available on this system. + Returns \c true if a given time zone \a ianaId is available on this system. \sa availableTimeZoneIds() */ -bool QTimeZone::isTimeZoneIdAvailable(const QByteArray &olsenId) +bool QTimeZone::isTimeZoneIdAvailable(const QByteArray &ianaId) { // isValidId is not strictly required, but faster to weed out invalid // IDs as availableTimeZoneIds() may be slow - return (QTimeZonePrivate::isValidId(olsenId) && (availableTimeZoneIds().contains(olsenId))); + return (QTimeZonePrivate::isValidId(ianaId) && (availableTimeZoneIds().contains(ianaId))); } /*! - Returns a list of all available Olsen time zone IDs on this system. + Returns a list of all available IANA time zone IDs on this system. \sa isTimeZoneIdAvailable() */ @@ -802,7 +805,7 @@ QList QTimeZone::availableTimeZoneIds() } /*! - Returns a list of all available Olsen time zone IDs for a given \a country. + Returns a list of all available IANA time zone IDs for a given \a country. As a special case, a \a country of Qt::AnyCountry returns those time zones that do not have any country related to them, such as UTC. If you require @@ -822,7 +825,7 @@ QList QTimeZone::availableTimeZoneIds(QLocale::Country country) } /*! - Returns a list of all available Olsen time zone IDs with a given standard + Returns a list of all available IANA time zone IDs with a given standard time offset of \a offsetSeconds. \sa isTimeZoneIdAvailable() @@ -838,79 +841,79 @@ QList QTimeZone::availableTimeZoneIds(int offsetSeconds) } /*! - Returns the Windows ID equivalent to the given \a olsenId. + Returns the Windows ID equivalent to the given \a ianaId. - \sa windowsIdToDefaultOlsenId(), windowsIdToOlsenIds() + \sa windowsIdToDefaultIanaId(), windowsIdToIanaIds() */ -QByteArray QTimeZone::olsenIdToWindowsId(const QByteArray &olsenId) +QByteArray QTimeZone::ianaIdToWindowsId(const QByteArray &ianaId) { - return QTimeZonePrivate::olsenIdToWindowsId(olsenId); + return QTimeZonePrivate::ianaIdToWindowsId(ianaId); } /*! - Returns the default Olsen ID for a given \a windowsId. + Returns the default IANA ID for a given \a windowsId. - Because a Windows ID can cover several Olsen IDs in several different - countries, this function returns the most frequently used Olsen ID with no + Because a Windows ID can cover several IANA IDs in several different + countries, this function returns the most frequently used IANA ID with no regard for the country and should thus be used with care. It is usually best to request the default for a specific country. - \sa olsenIdToWindowsId(), windowsIdToOlsenIds() + \sa ianaIdToWindowsId(), windowsIdToIanaIds() */ -QByteArray QTimeZone::windowsIdToDefaultOlsenId(const QByteArray &windowsId) +QByteArray QTimeZone::windowsIdToDefaultIanaId(const QByteArray &windowsId) { - return QTimeZonePrivate::windowsIdToDefaultOlsenId(windowsId); + return QTimeZonePrivate::windowsIdToDefaultIanaId(windowsId); } /*! - Returns the default Olsen ID for a given \a windowsId and \a country. + Returns the default IANA ID for a given \a windowsId and \a country. - Because a Windows ID can cover several Olsen IDs within a given country, - the most frequently used Olsen ID in that country is returned. + Because a Windows ID can cover several IANA IDs within a given country, + the most frequently used IANA ID in that country is returned. - As a special case, QLocale::AnyCountry returns the default of those Olsen IDs + As a special case, QLocale::AnyCountry returns the default of those IANA IDs that do not have any specific country. - \sa olsenIdToWindowsId(), windowsIdToOlsenIds() + \sa ianaIdToWindowsId(), windowsIdToIanaIds() */ -QByteArray QTimeZone::windowsIdToDefaultOlsenId(const QByteArray &windowsId, +QByteArray QTimeZone::windowsIdToDefaultIanaId(const QByteArray &windowsId, QLocale::Country country) { - return QTimeZonePrivate::windowsIdToDefaultOlsenId(windowsId, country); + return QTimeZonePrivate::windowsIdToDefaultIanaId(windowsId, country); } /*! - Returns all the Olsen IDs for a given \a windowsId. + Returns all the IANA IDs for a given \a windowsId. The returned list is sorted alphabetically. - \sa olsenIdToWindowsId(), windowsIdToDefaultOlsenId() + \sa ianaIdToWindowsId(), windowsIdToDefaultIanaId() */ -QList QTimeZone::windowsIdToOlsenIds(const QByteArray &windowsId) +QList QTimeZone::windowsIdToIanaIds(const QByteArray &windowsId) { - return QTimeZonePrivate::windowsIdToOlsenIds(windowsId); + return QTimeZonePrivate::windowsIdToIanaIds(windowsId); } /*! - Returns all the Olsen IDs for a given \a windowsId and \a country. + Returns all the IANA IDs for a given \a windowsId and \a country. - As a special case QLocale::AnyCountry returns those Olsen IDs that do + As a special case QLocale::AnyCountry returns those IANA IDs that do not have any specific country. The returned list is in order of frequency of usage, i.e. larger zones within a country are listed first. - \sa olsenIdToWindowsId(), windowsIdToDefaultOlsenId() + \sa ianaIdToWindowsId(), windowsIdToDefaultIanaId() */ -QList QTimeZone::windowsIdToOlsenIds(const QByteArray &windowsId, +QList QTimeZone::windowsIdToIanaIds(const QByteArray &windowsId, QLocale::Country country) { - return QTimeZonePrivate::windowsIdToOlsenIds(windowsId, country); + return QTimeZonePrivate::windowsIdToIanaIds(windowsId, country); } #ifndef QT_NO_DATASTREAM diff --git a/src/corelib/tools/qtimezone.h b/src/corelib/tools/qtimezone.h index cbc4f3e4ad..b038d66a65 100644 --- a/src/corelib/tools/qtimezone.h +++ b/src/corelib/tools/qtimezone.h @@ -77,7 +77,7 @@ public: typedef QVector OffsetDataList; QTimeZone(); - explicit QTimeZone(const QByteArray &olsenId); + explicit QTimeZone(const QByteArray &ianaId); explicit QTimeZone(int offsetSeconds); /*implicit*/ QTimeZone(const QByteArray &zoneId, int offsetSeconds, const QString &name, const QString &abbreviation, QLocale::Country country = QLocale::AnyCountry, @@ -126,18 +126,18 @@ public: static QByteArray systemTimeZoneId(); - static bool isTimeZoneIdAvailable(const QByteArray &olsenId); + static bool isTimeZoneIdAvailable(const QByteArray &ianaId); static QList availableTimeZoneIds(); static QList availableTimeZoneIds(QLocale::Country country); static QList availableTimeZoneIds(int offsetSeconds); - static QByteArray olsenIdToWindowsId(const QByteArray &olsenId); - static QByteArray windowsIdToDefaultOlsenId(const QByteArray &windowsId); - static QByteArray windowsIdToDefaultOlsenId(const QByteArray &windowsId, + static QByteArray ianaIdToWindowsId(const QByteArray &ianaId); + static QByteArray windowsIdToDefaultIanaId(const QByteArray &windowsId); + static QByteArray windowsIdToDefaultIanaId(const QByteArray &windowsId, QLocale::Country country); - static QList windowsIdToOlsenIds(const QByteArray &windowsId); - static QList windowsIdToOlsenIds(const QByteArray &windowsId, + static QList windowsIdToIanaIds(const QByteArray &windowsId); + static QList windowsIdToIanaIds(const QByteArray &windowsId, QLocale::Country country); private: diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp index 8d5d60bf37..cbf731a19e 100644 --- a/src/corelib/tools/qtimezoneprivate.cpp +++ b/src/corelib/tools/qtimezoneprivate.cpp @@ -477,7 +477,7 @@ QString QTimeZonePrivate::isoOffsetFormat(int offsetFromUtc) .arg(qAbs(mins) % 60, 2, 10, QLatin1Char('0')); } -QByteArray QTimeZonePrivate::olsenIdToWindowsId(const QByteArray &id) +QByteArray QTimeZonePrivate::ianaIdToWindowsId(const QByteArray &id) { for (int i = 0; i < zoneDataTableSize; ++i) { const QZoneData *data = zoneData(i); @@ -487,7 +487,7 @@ QByteArray QTimeZonePrivate::olsenIdToWindowsId(const QByteArray &id) return QByteArray(); } -QByteArray QTimeZonePrivate::windowsIdToDefaultOlsenId(const QByteArray &windowsId) +QByteArray QTimeZonePrivate::windowsIdToDefaultIanaId(const QByteArray &windowsId) { const quint16 windowsIdKey = toWindowsIdKey(windowsId); for (int i = 0; i < windowsDataTableSize; ++i) { @@ -498,17 +498,17 @@ QByteArray QTimeZonePrivate::windowsIdToDefaultOlsenId(const QByteArray &windows return QByteArray(); } -QByteArray QTimeZonePrivate::windowsIdToDefaultOlsenId(const QByteArray &windowsId, +QByteArray QTimeZonePrivate::windowsIdToDefaultIanaId(const QByteArray &windowsId, QLocale::Country country) { - const QList list = windowsIdToOlsenIds(windowsId, country); + const QList list = windowsIdToIanaIds(windowsId, country); if (list.count() > 0) return list.first(); else return QByteArray(); } -QList QTimeZonePrivate::windowsIdToOlsenIds(const QByteArray &windowsId) +QList QTimeZonePrivate::windowsIdToIanaIds(const QByteArray &windowsId) { const quint16 windowsIdKey = toWindowsIdKey(windowsId); QList list; @@ -524,7 +524,7 @@ QList QTimeZonePrivate::windowsIdToOlsenIds(const QByteArray &window return list; } -QList QTimeZonePrivate::windowsIdToOlsenIds(const QByteArray &windowsId, +QList QTimeZonePrivate::windowsIdToIanaIds(const QByteArray &windowsId, QLocale::Country country) { const quint16 windowsIdKey = toWindowsIdKey(windowsId); diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h index 9f99f49fcf..186a352a2f 100644 --- a/src/corelib/tools/qtimezoneprivate_p.h +++ b/src/corelib/tools/qtimezoneprivate_p.h @@ -146,12 +146,12 @@ public: static bool isValidId(const QByteArray &olsenId); static QString isoOffsetFormat(int offsetFromUtc); - static QByteArray olsenIdToWindowsId(const QByteArray &olsenId); - static QByteArray windowsIdToDefaultOlsenId(const QByteArray &windowsId); - static QByteArray windowsIdToDefaultOlsenId(const QByteArray &windowsId, + static QByteArray ianaIdToWindowsId(const QByteArray &ianaId); + static QByteArray windowsIdToDefaultIanaId(const QByteArray &windowsId); + static QByteArray windowsIdToDefaultIanaId(const QByteArray &windowsId, QLocale::Country country); - static QList windowsIdToOlsenIds(const QByteArray &windowsId); - static QList windowsIdToOlsenIds(const QByteArray &windowsId, + static QList windowsIdToIanaIds(const QByteArray &windowsId); + static QList windowsIdToIanaIds(const QByteArray &windowsId, QLocale::Country country); protected: diff --git a/src/corelib/tools/qtimezoneprivate_win.cpp b/src/corelib/tools/qtimezoneprivate_win.cpp index f411d35b3d..55949128ae 100644 --- a/src/corelib/tools/qtimezoneprivate_win.cpp +++ b/src/corelib/tools/qtimezoneprivate_win.cpp @@ -362,7 +362,7 @@ void QWinTimeZonePrivate::init(const QByteArray &olsenId) m_windowsId = windowsSystemZoneId(); m_id = systemTimeZoneId(); } else { - m_windowsId = olsenIdToWindowsId(olsenId); + m_windowsId = ianaIdToWindowsId(olsenId); m_id = olsenId; } @@ -620,10 +620,10 @@ QByteArray QWinTimeZonePrivate::systemTimeZoneId() const QByteArray olsenId; // If we have a real country, then try get a specific match for that country if (country != QLocale::AnyCountry) - olsenId = windowsIdToDefaultOlsenId(windowsId, country); + olsenId = windowsIdToDefaultIanaId(windowsId, country); // If we don't have a real country, or there wasn't a specific match, try the global default if (olsenId.isEmpty()) { - olsenId = windowsIdToDefaultOlsenId(windowsId); + olsenId = windowsIdToDefaultIanaId(windowsId); // If no global default then probably an unknown Windows ID so return UTC if (olsenId.isEmpty()) return QByteArrayLiteral("UTC"); @@ -635,7 +635,7 @@ QSet QWinTimeZonePrivate::availableTimeZoneIds() const { QSet set; foreach (const QByteArray &winId, availableWindowsIds()) { - foreach (const QByteArray &olsenId, windowsIdToOlsenIds(winId)) + foreach (const QByteArray &olsenId, windowsIdToIanaIds(winId)) set << olsenId; } return set; -- cgit v1.2.3 From c03ea9be38a3c23b54e56bb567205a02ad4d1e19 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 11 Nov 2013 18:22:25 +0100 Subject: QTimeZone - Fix Windows Transitions with null rules Fix the Windows handling of null DST rules for a given year, if the calculation rules have a null value then can skip trying to loop through the calculations until the min/max year is hit which causes the stress test to time-out in CI, and instead return a value immediately. Change-Id: Ie2d4ee55c5487e040e0cead91d1be2a0c06d3074 Reviewed-by: Thiago Macieira --- src/corelib/tools/qtimezoneprivate_win.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/tools/qtimezoneprivate_win.cpp b/src/corelib/tools/qtimezoneprivate_win.cpp index 55949128ae..04588b2ba8 100644 --- a/src/corelib/tools/qtimezoneprivate_win.cpp +++ b/src/corelib/tools/qtimezoneprivate_win.cpp @@ -305,7 +305,7 @@ static void calculateTransitionsForYear(const QWinTimeZonePrivate::QWinTransitio QDate daylightDate = calculateTransitionLocalDate(rule.daylightTimeRule, year); QTime daylightTime = QTime(rule.daylightTimeRule.wHour, rule.daylightTimeRule.wMinute, rule.daylightTimeRule.wSecond); - if (standardDate.isValid() && standardTime.isValid()) + if (daylightDate.isValid() && daylightTime.isValid()) *dstMSecs = timeToMSecs(daylightDate, daylightTime) + (rule.standardTimeBias * 60000); else *dstMSecs = QTimeZonePrivate::invalidMSecs(); @@ -488,6 +488,9 @@ QTimeZonePrivate::Data QWinTimeZonePrivate::data(qint64 forMSecsSinceEpoch) cons do { // Convert the transition rules into msecs for the year we want to try rule = ruleForYear(year); + // If no transition rules to calculate then no DST, so just use rule for std + if (rule.standardTimeRule.wMonth == 0 && rule.daylightTimeRule.wMonth == 0) + break; calculateTransitionsForYear(rule, year, &stdMSecs, &dstMSecs); if (stdMSecs < dstMSecs) { first = stdMSecs; @@ -543,6 +546,9 @@ QTimeZonePrivate::Data QWinTimeZonePrivate::nextTransition(qint64 afterMSecsSinc do { // Convert the transition rules into msecs for the year we want to try rule = ruleForYear(year); + // If no transition rules to calculate then no next transition + if (rule.standardTimeRule.wMonth == 0 && rule.daylightTimeRule.wMonth == 0) + return invalidData(); calculateTransitionsForYear(rule, year, &stdMSecs, &dstMSecs); // Find the first and second transition for the year if (stdMSecs < dstMSecs) { @@ -591,6 +597,9 @@ QTimeZonePrivate::Data QWinTimeZonePrivate::previousTransition(qint64 beforeMSec do { // Convert the transition rules into msecs for the year we want to try rule = ruleForYear(year); + // If no transition rules to calculate then no previous transition + if (rule.standardTimeRule.wMonth == 0 && rule.daylightTimeRule.wMonth == 0) + return invalidData(); calculateTransitionsForYear(rule, year, &stdMSecs, &dstMSecs); if (stdMSecs < dstMSecs) { first = stdMSecs; -- cgit v1.2.3 From 8e6258f059140ce735391b6438d5976dc9469e95 Mon Sep 17 00:00:00 2001 From: John Layt Date: Fri, 20 Sep 2013 18:35:08 +0200 Subject: QTimeZone - Fix TZ file abbreviations Fix parsing of TZ file abbreviations, to correctly return cases where POSIX rule doesn't have separate DST rules, and where abbreviation is a sub-string of another abbreviation, otherwise any toString() call will crash. Add test to exercise all available time zones, especially useful for TZ file to confirm all file format variations dealt with. Fix parsing of Version 3 of TZ file, and ICU display name, to allow all files generated from release 2013f to pass, otherwise isValid() call will crash. Task-number: QTBUG-34061 Change-Id: Ie0b6abc218adff1c8967eb33fdb0762041d2305f Reviewed-by: Thiago Macieira --- src/corelib/tools/qtimezone.cpp | 6 + src/corelib/tools/qtimezoneprivate.cpp | 5 +- src/corelib/tools/qtimezoneprivate_p.h | 1 + src/corelib/tools/qtimezoneprivate_tz.cpp | 259 +++++++++++++++++++----------- 4 files changed, 171 insertions(+), 100 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index 37d6e183a7..5fec06b30a 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -708,6 +708,9 @@ bool QTimeZone::hasTransitions() const This is most useful when you have a Transition time and wish to find the Transition after it. + If there is no transition after the given \a afterDateTime then an invalid + OffsetData will be returned with an invalid QDateTime. + The given \a afterDateTime is exclusive. \sa hasTransitions(), previousTransition(), transitions() @@ -726,6 +729,9 @@ QTimeZone::OffsetData QTimeZone::nextTransition(const QDateTime &afterDateTime) This is most useful when you have a Transition time and wish to find the Transition before it. + If there is no transition before the given \a beforeDateTime then an invalid + OffsetData will be returned with an invalid QDateTime. + The given \a beforeDateTime is exclusive. \sa hasTransitions(), nextTransition(), transitions() diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp index cbf731a19e..dd4e18e01f 100644 --- a/src/corelib/tools/qtimezoneprivate.cpp +++ b/src/corelib/tools/qtimezoneprivate.cpp @@ -328,10 +328,11 @@ QTimeZonePrivate::DataList QTimeZonePrivate::transitions(qint64 fromMSecsSinceEp qint64 toMSecsSinceEpoch) const { DataList list; - if (toMSecsSinceEpoch > fromMSecsSinceEpoch) { + if (toMSecsSinceEpoch >= fromMSecsSinceEpoch) { // fromMSecsSinceEpoch is inclusive but nextTransitionTime() is exclusive so go back 1 msec Data next = nextTransition(fromMSecsSinceEpoch - 1); - while (next.atMSecsSinceEpoch <= toMSecsSinceEpoch) { + while (next.atMSecsSinceEpoch != invalidMSecs() + && next.atMSecsSinceEpoch <= toMSecsSinceEpoch) { list.append(next); next = nextTransition(next.atMSecsSinceEpoch); } diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h index 186a352a2f..108aec2654 100644 --- a/src/corelib/tools/qtimezoneprivate_p.h +++ b/src/corelib/tools/qtimezoneprivate_p.h @@ -309,6 +309,7 @@ private: bool operator==(const QTzTransitionRule &other) { return (stdOffset == other.stdOffset && dstOffset == other.dstOffset && abbreviationIndex == other.abbreviationIndex); } }; + Data dataForTzTransition(QTzTransitionTime tran) const; QList m_tranTimes; QList m_tranRules; QList m_abbreviations; diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp index 4bf19178fa..1fb6bb1b5a 100644 --- a/src/corelib/tools/qtimezoneprivate_tz.cpp +++ b/src/corelib/tools/qtimezoneprivate_tz.cpp @@ -149,11 +149,13 @@ static QTzHeader parseTzHeader(QDataStream &ds, bool *ok) if (memcmp(hdr.tzh_magic, TZ_MAGIC, 4) != 0 || ds.status() != QDataStream::Ok) return hdr; - // Parse Version, 1 byte, before 2005 was '\0', since 2005 a '2' + // Parse Version, 1 byte, before 2005 was '\0', since 2005 a '2', since 2013 a '3' ds >> ch; hdr.tzh_version = ch; - if (ds.status() != QDataStream::Ok || (hdr.tzh_version != '2' && hdr.tzh_version != '\0')) + if (ds.status() != QDataStream::Ok + || (hdr.tzh_version != '2' && hdr.tzh_version != '\0' && hdr.tzh_version != '3')) { return hdr; + } // Parse reserved space, 15 bytes ds.readRawData(hdr.tzh_reserved, 15); @@ -238,30 +240,31 @@ static QList parseTzTypes(QDataStream &ds, int tzh_typecnt) return typeList; } -static QMap parseTzAbbreviations(QDataStream &ds, int tzh_charcnt) +static QMap parseTzAbbreviations(QDataStream &ds, int tzh_charcnt, QList typeList) { // Parse the abbreviation list which is tzh_charcnt long with '\0' separated strings. The - // tz_abbrind index points to the first char of the abbreviation in the array, not the - // occurrence in the list. By parsing char at a time we can track the char index and convert - // to an occurrence index. By using a map with tz_abbrind as ordered key we get both index + // QTzType.tz_abbrind index points to the first char of the abbreviation in the array, not the + // occurrence in the list. It can also point to a partial string so we need to use the actual typeList + // index values when parsing. By using a map with tz_abbrind as ordered key we get both index // methods in one data structure and can convert the types afterwards. QMap map; quint8 ch; - QByteArray abbrev; - // Track the start position of each abbreviation - int tz_abbrind = 0; + QByteArray input; + // First parse the full abbrev string for (int i = 0; i < tzh_charcnt && ds.status() == QDataStream::Ok; ++i) { ds >> ch; - if (ds.status() == QDataStream::Ok) { - if (ch == '\0') { - // Have reached end of an abbreviation, so add to map - map[tz_abbrind] = abbrev; - tz_abbrind = i + 1; - abbrev.clear(); - } else { - abbrev.append((char)ch); - } - } + if (ds.status() == QDataStream::Ok) + input.append(char(ch)); + else + return map; + } + // Then extract all the substrings pointed to by typeList + foreach (const QTzType type, typeList) { + QByteArray abbrev; + for (int i = type.tz_abbrind; input.at(i) != '\0'; ++i) + abbrev.append(input.at(i)); + // Have reached end of an abbreviation, so add to map + map[type.tz_abbrind] = abbrev; } return map; } @@ -371,7 +374,7 @@ static QDate calculatePosixDate(const QByteArray dateRule, int year) } } -static QTime parsePosixTime(const QByteArray timeRule) +static QTime parsePosixTime(const QByteArray &timeRule) { // Format "HH:mm:ss", put check parts count just in case QList parts = timeRule.split(':'); @@ -385,7 +388,7 @@ static QTime parsePosixTime(const QByteArray timeRule) return QTime(2, 0, 0); } -static int parsePosixOffset(const QByteArray timeRule) +static int parsePosixOffset(const QByteArray &timeRule) { // Format "[+|-]hh[:mm[:ss]]" QList parts = timeRule.split(':'); @@ -399,7 +402,9 @@ static int parsePosixOffset(const QByteArray timeRule) return 0; } -static QList calculatePosixTransitions(const QByteArray &posixRule, int startYear, int endYear) +static QList calculatePosixTransitions(const QByteArray &posixRule, + int startYear, int endYear, + int lastTranMSecs) { QList list; @@ -443,11 +448,13 @@ static QList calculatePosixTransitions(const QByteArray // If only the name part then no transitions if (parts.count() == 1) { QTimeZonePrivate::Data data; - data.atMSecsSinceEpoch = 0; + data.atMSecsSinceEpoch = lastTranMSecs; data.offsetFromUtc = utcOffset; data.standardTimeOffset = utcOffset; data.daylightTimeOffset = 0; data.abbreviation = stdName; + list << data; + return list; } // If not populated the total dst offset is 1 hour @@ -572,7 +579,7 @@ void QTzTimeZonePrivate::init(const QByteArray &olsenId) QList typeList = parseTzTypes(ds, hdr.tzh_typecnt); if (ds.status() != QDataStream::Ok) return; - QMap abbrevMap = parseTzAbbreviations(ds, hdr.tzh_charcnt); + QMap abbrevMap = parseTzAbbreviations(ds, hdr.tzh_charcnt, typeList); if (ds.status() != QDataStream::Ok) return; parseTzLeapSeconds(ds, hdr.tzh_leapcnt, false); @@ -583,7 +590,7 @@ void QTzTimeZonePrivate::init(const QByteArray &olsenId) return; // If version 2 then parse the second block of data - if (hdr.tzh_version == '2') { + if (hdr.tzh_version == '2' || hdr.tzh_version == '3') { ok = false; QTzHeader hdr2 = parseTzHeader(ds, &ok); if (!ok || ds.status() != QDataStream::Ok) @@ -594,7 +601,7 @@ void QTzTimeZonePrivate::init(const QByteArray &olsenId) typeList = parseTzTypes(ds, hdr2.tzh_typecnt); if (ds.status() != QDataStream::Ok) return; - abbrevMap = parseTzAbbreviations(ds, hdr2.tzh_charcnt); + abbrevMap = parseTzAbbreviations(ds, hdr2.tzh_charcnt, typeList); if (ds.status() != QDataStream::Ok) return; parseTzLeapSeconds(ds, hdr2.tzh_leapcnt, true); @@ -682,12 +689,14 @@ QString QTzTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch, if (!m_icu) m_icu = new QIcuTimeZonePrivate(m_id); // TODO small risk may not match if tran times differ due to outdated files - return m_icu->displayName(atMSecsSinceEpoch, nameType, locale); + // TODO Some valid TZ names are not valid ICU names, use translation table? + if (m_icu->isValid()) + return m_icu->displayName(atMSecsSinceEpoch, nameType, locale); #else Q_UNUSED(nameType) Q_UNUSED(locale) - return abbreviation(atMSecsSinceEpoch); #endif // QT_USE_ICU + return abbreviation(atMSecsSinceEpoch); } QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType, @@ -698,19 +707,59 @@ QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType, if (!m_icu) m_icu = new QIcuTimeZonePrivate(m_id); // TODO small risk may not match if tran times differ due to outdated files - return m_icu->displayName(timeType, nameType, locale); + // TODO Some valid TZ names are not valid ICU names, use translation table? + if (m_icu->isValid()) + return m_icu->displayName(timeType, nameType, locale); #else Q_UNUSED(timeType) Q_UNUSED(nameType) Q_UNUSED(locale) - const int atMSecsSinceEpoch = QDateTime::currentMSecsSinceEpoch(); - QTimeZonePrivate::Data tran = data(atMSecsSinceEpoch); - while ((timeType == QTimeZone::StandardTime && tran.daylightTimeOffset != 0) - || (timeType == QTimeZone::DaylightTime && tran.daylightTimeOffset == 0)) { - tran = nextTransition(tran.atMSecsSinceEpoch); - } - return tran.abbreviation; #endif // QT_USE_ICU + // If no ICU available then have to use abbreviations instead + // Abbreviations don't have GenericTime + if (timeType == QTimeZone::GenericTime) + timeType = QTimeZone::StandardTime; + + // Get current tran, if valid and is what we want, then use it + const qint64 currentMSecs = QDateTime::currentMSecsSinceEpoch(); + QTimeZonePrivate::Data tran = data(currentMSecs); + if (tran.atMSecsSinceEpoch != invalidMSecs() + && ((timeType == QTimeZone::DaylightTime && tran.daylightTimeOffset != 0) + || (timeType == QTimeZone::StandardTime && tran.daylightTimeOffset == 0))) { + return tran.abbreviation; + } + + // Otherwise get next tran and if valid and is what we want, then use it + tran = nextTransition(currentMSecs); + if (tran.atMSecsSinceEpoch != invalidMSecs() + && ((timeType == QTimeZone::DaylightTime && tran.daylightTimeOffset != 0) + || (timeType == QTimeZone::StandardTime && tran.daylightTimeOffset == 0))) { + return tran.abbreviation; + } + + // Otherwise get prev tran and if valid and is what we want, then use it + tran = previousTransition(currentMSecs); + if (tran.atMSecsSinceEpoch != invalidMSecs()) + tran = previousTransition(tran.atMSecsSinceEpoch); + if (tran.atMSecsSinceEpoch != invalidMSecs() + && ((timeType == QTimeZone::DaylightTime && tran.daylightTimeOffset != 0) + || (timeType == QTimeZone::StandardTime && tran.daylightTimeOffset == 0))) { + return tran.abbreviation; + } + + // Otherwise is strange sequence, so work backwards through trans looking for first match, if any + for (int i = m_tranTimes.size() - 1; i >= 0; --i) { + if (m_tranTimes.at(i).atMSecsSinceEpoch <= currentMSecs) { + tran = dataForTzTransition(m_tranTimes.at(i)); + if ((timeType == QTimeZone::DaylightTime && tran.daylightTimeOffset != 0) + || (timeType == QTimeZone::StandardTime && tran.daylightTimeOffset == 0)) { + return tran.abbreviation; + } + } + } + + // Otherwise if no match use current data + return data(currentMSecs).abbreviation; } QString QTzTimeZonePrivate::abbreviation(qint64 atMSecsSinceEpoch) const @@ -749,35 +798,55 @@ bool QTzTimeZonePrivate::isDaylightTime(qint64 atMSecsSinceEpoch) const return (daylightTimeOffset(atMSecsSinceEpoch) != 0); } +QTimeZonePrivate::Data QTzTimeZonePrivate::dataForTzTransition(QTzTransitionTime tran) const +{ + QTimeZonePrivate::Data data; + data.atMSecsSinceEpoch = tran.atMSecsSinceEpoch; + QTzTransitionRule rule = m_tranRules.at(tran.ruleIndex); + data.standardTimeOffset = rule.stdOffset; + data.daylightTimeOffset = rule.dstOffset; + data.offsetFromUtc = rule.stdOffset + rule.dstOffset; + data.abbreviation = QString::fromUtf8(m_abbreviations.at(rule.abbreviationIndex)); + return data; +} + QTimeZonePrivate::Data QTzTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const { - QTimeZonePrivate::Data data = invalidData(); - int lastTran = m_tranTimes.size() - 1; - int tran; - for (tran = lastTran; tran > 0; --tran) { - if (m_tranTimes.at(tran).atMSecsSinceEpoch <= forMSecsSinceEpoch) - break; - } - // If after the last transition time then we need to use the posix rule if available - if (tran >= lastTran && !m_posixRule.isEmpty()) { - QDateTime dt = QDateTime::fromMSecsSinceEpoch(forMSecsSinceEpoch); - int year = dt.date().year(); - QList posixTrans = calculatePosixTransitions(m_posixRule, year - 1, year + 1); - for (int i = posixTrans.size() - 1; i > 0; --i) { + // If the required time is after the last transition and we have a POSIX rule then use it + if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < forMSecsSinceEpoch + &&!m_posixRule.isEmpty() && forMSecsSinceEpoch >= 0) { + const int year = QDateTime::fromMSecsSinceEpoch(forMSecsSinceEpoch, Qt::UTC).date().year(); + const int lastMSecs = (m_tranTimes.size() > 0) ? m_tranTimes.last().atMSecsSinceEpoch : 0; + QList posixTrans = calculatePosixTransitions(m_posixRule, year - 1, + year + 1, lastMSecs); + for (int i = posixTrans.size() - 1; i >= 0; --i) { if (posixTrans.at(i).atMSecsSinceEpoch <= forMSecsSinceEpoch) { + QTimeZonePrivate::Data data; data = posixTrans.at(i); data.atMSecsSinceEpoch = forMSecsSinceEpoch; return data; } } } - data.atMSecsSinceEpoch = forMSecsSinceEpoch; - QTzTransitionRule rule = m_tranRules.at(m_tranTimes.at(tran).ruleIndex); - data.standardTimeOffset = rule.stdOffset; - data.daylightTimeOffset = rule.dstOffset; - data.offsetFromUtc = rule.stdOffset + rule.dstOffset; - data.abbreviation = QString::fromUtf8(m_abbreviations.at(rule.abbreviationIndex)); - return data; + + // Otherwise if we can find a valid tran then use its rule + for (int i = m_tranTimes.size() - 1; i >= 0; --i) { + if (m_tranTimes.at(i).atMSecsSinceEpoch <= forMSecsSinceEpoch) { + Data data = dataForTzTransition(m_tranTimes.at(i)); + data.atMSecsSinceEpoch = forMSecsSinceEpoch; + return data; + } + } + + // Otherwise use the earliest transition we have + if (m_tranTimes.size() > 0) { + Data data = dataForTzTransition(m_tranTimes.at(0)); + data.atMSecsSinceEpoch = forMSecsSinceEpoch; + return data; + } + + // Otherwise we have no rules, so probably an invalid tz, so return invalid data + return invalidData(); } bool QTzTimeZonePrivate::hasTransitions() const @@ -787,60 +856,54 @@ bool QTzTimeZonePrivate::hasTransitions() const QTimeZonePrivate::Data QTzTimeZonePrivate::nextTransition(qint64 afterMSecsSinceEpoch) const { - int lastTran = m_tranTimes.size() - 1; - int tran; - for (tran = 0; tran < lastTran; ++tran) { - if (m_tranTimes.at(tran).atMSecsSinceEpoch > afterMSecsSinceEpoch) - break; - } - // If after the last transition time then we need to use the posix rule if available - if (tran >= lastTran && !m_posixRule.isEmpty()) { - QDateTime dt = QDateTime::fromMSecsSinceEpoch(afterMSecsSinceEpoch); - int year = dt.date().year(); - QList posixTrans = calculatePosixTransitions(m_posixRule, year - 1, year + 1); - for (int i = 0; i < posixTrans.size() - 1; ++i) { + // If the required time is after the last transition and we have a POSIX rule then use it + if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < afterMSecsSinceEpoch + &&!m_posixRule.isEmpty() && afterMSecsSinceEpoch >= 0) { + const int year = QDateTime::fromMSecsSinceEpoch(afterMSecsSinceEpoch, Qt::UTC).date().year(); + const int lastMSecs = (m_tranTimes.size() > 0) ? m_tranTimes.last().atMSecsSinceEpoch : 0; + QList posixTrans = calculatePosixTransitions(m_posixRule, year - 1, + year + 1, lastMSecs); + for (int i = 0; i < posixTrans.size(); ++i) { if (posixTrans.at(i).atMSecsSinceEpoch > afterMSecsSinceEpoch) return posixTrans.at(i); } } - // Otherwise use the transition we found - QTimeZonePrivate::Data data; - data.atMSecsSinceEpoch = m_tranTimes.at(tran).atMSecsSinceEpoch; - QTzTransitionRule rule = m_tranRules.at(m_tranTimes.at(tran).ruleIndex); - data.standardTimeOffset = rule.stdOffset; - data.daylightTimeOffset = rule.dstOffset; - data.offsetFromUtc = rule.stdOffset + rule.dstOffset; - data.abbreviation = QString::fromUtf8(m_abbreviations.at(rule.abbreviationIndex)); - return data; + + // Otherwise if we can find a valid tran then use its rule + for (int i = 0; i < m_tranTimes.size(); ++i) { + if (m_tranTimes.at(i).atMSecsSinceEpoch > afterMSecsSinceEpoch) { + return dataForTzTransition(m_tranTimes.at(i)); + } + } + + // Otherwise we have no rule, or there is no next transition, so return invalid data + return invalidData(); } QTimeZonePrivate::Data QTzTimeZonePrivate::previousTransition(qint64 beforeMSecsSinceEpoch) const { - int lastTran = m_tranTimes.size() - 1; - int tran; - for (tran = lastTran; tran > 0; --tran) { - if (m_tranTimes.at(tran).atMSecsSinceEpoch < beforeMSecsSinceEpoch) - break; - } - // If after the last transition time then we need to use the posix rule if available - if (tran >= lastTran && !m_posixRule.isEmpty()) { - QDateTime dt = QDateTime::fromMSecsSinceEpoch(beforeMSecsSinceEpoch); - int year = dt.date().year(); - QList posixTrans = calculatePosixTransitions(m_posixRule, year - 1, year + 1); - for (int i = posixTrans.size() - 1; i > 0; --i) { + // If the required time is after the last transition and we have a POSIX rule then use it + if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < beforeMSecsSinceEpoch + &&!m_posixRule.isEmpty() && beforeMSecsSinceEpoch > 0) { + const int year = QDateTime::fromMSecsSinceEpoch(beforeMSecsSinceEpoch, Qt::UTC).date().year(); + const int lastMSecs = (m_tranTimes.size() > 0) ? m_tranTimes.last().atMSecsSinceEpoch : 0; + QList posixTrans = calculatePosixTransitions(m_posixRule, year - 1, + year + 1, lastMSecs); + for (int i = posixTrans.size() - 1; i >= 0; --i) { if (posixTrans.at(i).atMSecsSinceEpoch < beforeMSecsSinceEpoch) return posixTrans.at(i); } } - // Otherwise use the transition we found - QTimeZonePrivate::Data data; - data.atMSecsSinceEpoch = m_tranTimes.at(tran).atMSecsSinceEpoch; - QTzTransitionRule rule = m_tranRules.at(m_tranTimes.at(tran).ruleIndex); - data.standardTimeOffset = rule.stdOffset; - data.daylightTimeOffset = rule.dstOffset; - data.offsetFromUtc = rule.stdOffset + rule.dstOffset; - data.abbreviation = QString::fromUtf8(m_abbreviations.at(rule.abbreviationIndex)); - return data; + + // Otherwise if we can find a valid tran then use its rule + for (int i = m_tranTimes.size() - 1; i >= 0; --i) { + if (m_tranTimes.at(i).atMSecsSinceEpoch < beforeMSecsSinceEpoch) { + return dataForTzTransition(m_tranTimes.at(i)); + } + } + + // Otherwise we have no rule, so return invalid data + return invalidData(); } // TODO Could cache the value and monitor the required files for any changes -- cgit v1.2.3 From 6ad97bfa736c97b50019d0192f55959848e7067a Mon Sep 17 00:00:00 2001 From: John Layt Date: Sat, 2 Nov 2013 18:53:32 +0100 Subject: QTimeZone - Fix dateForLocalTime() to check validity of next transition The private method dateForLocalTime() was not checking that transitions were valid, resulting in infinite looping when a time zone didn't have any future transitions. Change-Id: I0e5d07063861778dd86056a80c36fdd9f9d36133 Reviewed-by: Lars Knoll --- src/corelib/tools/qtimezoneprivate.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp index dd4e18e01f..08a5ce0861 100644 --- a/src/corelib/tools/qtimezoneprivate.cpp +++ b/src/corelib/tools/qtimezoneprivate.cpp @@ -264,7 +264,8 @@ QTimeZonePrivate::Data QTimeZonePrivate::dataForLocalTime(qint64 forLocalMSecs) // If the local msecs is less than the real local time of the transition // then get the previous transition to use instead if (forLocalMSecs < tran.atMSecsSinceEpoch + (tran.offsetFromUtc * 1000)) { - while (forLocalMSecs < tran.atMSecsSinceEpoch + (tran.offsetFromUtc * 1000)) { + while (tran.atMSecsSinceEpoch != invalidMSecs() + && forLocalMSecs < tran.atMSecsSinceEpoch + (tran.offsetFromUtc * 1000)) { nextTran = tran; tran = previousTransition(tran.atMSecsSinceEpoch); } @@ -272,7 +273,8 @@ QTimeZonePrivate::Data QTimeZonePrivate::dataForLocalTime(qint64 forLocalMSecs) // The zone msecs is after the transition, so check it is before the next tran // If not try use the next transition instead nextTran = nextTransition(tran.atMSecsSinceEpoch); - while (forLocalMSecs >= nextTran.atMSecsSinceEpoch + (nextTran.offsetFromUtc * 1000)) { + while (nextTran.atMSecsSinceEpoch != invalidMSecs() + && forLocalMSecs >= nextTran.atMSecsSinceEpoch + (nextTran.offsetFromUtc * 1000)) { tran = nextTran; nextTran = nextTransition(tran.atMSecsSinceEpoch); } @@ -292,7 +294,8 @@ QTimeZonePrivate::Data QTimeZonePrivate::dataForLocalTime(qint64 forLocalMSecs) // then use the prev tran as we default to the FirstOccurrence // TODO Check if faster to just always get prev tran, or if faster using 6 hour check. Data dstTran = previousTransition(tran.atMSecsSinceEpoch); - if (dstTran.daylightTimeOffset > 0 && diffPrevTran < (dstTran.daylightTimeOffset * 1000)) + if (dstTran.atMSecsSinceEpoch != invalidMSecs() + && dstTran.daylightTimeOffset > 0 && diffPrevTran < (dstTran.daylightTimeOffset * 1000)) tran = dstTran; } else if (diffNextTran >= 0 && diffNextTran <= (nextTran.daylightTimeOffset * 1000)) { // If time falls within last hour of standard time then is actually the missing hour -- cgit v1.2.3 From e6d13c7f00aeeb1e52245f4f8350a665a2d50e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 18 Nov 2013 22:37:59 +0100 Subject: Add QSysInfo::MacVersion enum values and parsing for iOS Change-Id: I82e425e3cd06e0f515aa6edfb25ef9895956a5c6 Reviewed-by: Jake Petroules Reviewed-by: Richard Moe Gustavsen --- src/corelib/global/qglobal.cpp | 26 ++++++++++++++++++-------- src/corelib/global/qsysinfo.h | 13 ++++++++++++- src/corelib/kernel/qcore_mac_objc.mm | 25 +++++++++++++++++++++++++ src/corelib/kernel/qcore_mac_p.h | 4 ++++ 4 files changed, 59 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index b27d0bf53f..0c72bd7022 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -985,8 +985,7 @@ bool qSharedBuild() Q_DECL_NOTHROW /*! \fn QSysInfo::MacVersion QSysInfo::macVersion() - Returns the version of Mac OS X on which the application is run (Mac OS X - Only). + Returns the version of Darwin (OS X or iOS) on which the application is run. */ /*! @@ -1056,7 +1055,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \enum QSysInfo::MacVersion This enum provides symbolic names for the various versions of the - OS X operating system. On OS X, the + Darwin operating system, covering both OS X and iOS. The QSysInfo::MacintoshVersion variable gives the version of the system on which the application is run. @@ -1084,6 +1083,15 @@ bool qSharedBuild() Q_DECL_NOTHROW \value MV_MOUNTAINLION Apple codename for MV_10_8 \value MV_MAVERICKS Apple codename for MV_10_9 + \value MV_IOS iOS (any) + \value MV_IOS_4_3 iOS 4.3 + \value MV_IOS_5_0 iOS 5.0 + \value MV_IOS_5_1 iOS 5.1 + \value MV_IOS_6_0 iOS 6.0 + \value MV_IOS_6_1 iOS 6.1 + \value MV_IOS_7_0 iOS 7.0 + \value MV_IOS_7_1 iOS 7.1 + \sa WinVersion */ @@ -1706,13 +1714,15 @@ static const unsigned int qt_one = 1; const int QSysInfo::ByteOrder = ((*((unsigned char *) &qt_one) == 0) ? BigEndian : LittleEndian); #endif -#if defined(Q_OS_MACX) +#if defined(Q_OS_MAC) QT_BEGIN_INCLUDE_NAMESPACE #include "private/qcore_mac_p.h" #include "qnamespace.h" QT_END_INCLUDE_NAMESPACE +#if defined(Q_OS_OSX) + Q_CORE_EXPORT OSErr qt_mac_create_fsref(const QString &file, FSRef *fsref) { return FSPathMakeRef(reinterpret_cast(file.toUtf8().constData()), fsref, 0); @@ -1728,17 +1738,17 @@ Q_CORE_EXPORT void qt_mac_to_pascal_string(QString s, Str255 str, TextEncoding e Q_CORE_EXPORT QString qt_mac_from_pascal_string(const Str255 pstr) { return QCFString(CFStringCreateWithPascalString(0, pstr, CFStringGetSystemEncoding())); } -#endif // defined(Q_OS_MACX) - -#if defined(Q_OS_MAC) +#endif // defined(Q_OS_OSX) QSysInfo::MacVersion QSysInfo::macVersion() { -#ifdef Q_OS_MACX +#if defined(Q_OS_OSX) SInt32 gestalt_version; if (Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) { return QSysInfo::MacVersion(((gestalt_version & 0x00F0) >> 4) + 2); } +#elif defined(Q_OS_IOS) + return qt_ios_version(); // qtcore_mac_objc.mm #endif return QSysInfo::MV_Unknown; } diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h index bd76f908e7..38735c12de 100644 --- a/src/corelib/global/qsysinfo.h +++ b/src/corelib/global/qsysinfo.h @@ -120,6 +120,7 @@ public: #endif #ifdef Q_OS_MAC +# define Q_MV_IOS(major, minor) (QSysInfo::MV_IOS | major << 4 | minor) enum MacVersion { MV_Unknown = 0x0000, @@ -146,7 +147,17 @@ public: MV_SNOWLEOPARD = MV_10_6, MV_LION = MV_10_7, MV_MOUNTAINLION = MV_10_8, - MV_MAVERICKS = MV_10_9 + MV_MAVERICKS = MV_10_9, + + /* iOS */ + MV_IOS = 1 << 8, + MV_IOS_4_3 = Q_MV_IOS(4, 3), + MV_IOS_5_0 = Q_MV_IOS(5, 0), + MV_IOS_5_1 = Q_MV_IOS(5, 1), + MV_IOS_6_0 = Q_MV_IOS(6, 0), + MV_IOS_6_1 = Q_MV_IOS(6, 1), + MV_IOS_7_0 = Q_MV_IOS(7, 0), + MV_IOS_7_1 = Q_MV_IOS(7, 1) }; static const MacVersion MacintoshVersion; static MacVersion macVersion(); diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm index 7b9eb67969..8ea318073b 100644 --- a/src/corelib/kernel/qcore_mac_objc.mm +++ b/src/corelib/kernel/qcore_mac_objc.mm @@ -41,6 +41,10 @@ #include +#ifdef Q_OS_IOS +#import +#endif + QT_BEGIN_NAMESPACE NSString *QCFString::toNSString(const QString &string) @@ -54,5 +58,26 @@ QString QCFString::toQString(const NSString *nsstr) return toQString(reinterpret_cast(nsstr)); } +#ifdef Q_OS_IOS +QSysInfo::MacVersion qt_ios_version() +{ + int major = 0, minor = 0; + NSArray *components = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."]; + switch ([components count]) { + case 3: + // We don't care about the patch version + case 2: + minor = [[components objectAtIndex:1] intValue]; + // fall through + case 1: + major = [[components objectAtIndex:0] intValue]; + break; + default: + Q_UNREACHABLE(); + } + return QSysInfo::MacVersion(Q_MV_IOS(major, minor)); +} +#endif + QT_END_NAMESPACE diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index fa911fb967..f491be9768 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -143,6 +143,10 @@ private: QString string; }; +#ifdef Q_OS_IOS +QSysInfo::MacVersion qt_ios_version(); +#endif + QT_END_NAMESPACE #endif // QCORE_MAC_P_H -- cgit v1.2.3 From c62efb52b538063ab561cd5c8fceab206de7c427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 20 Nov 2013 17:33:48 +0100 Subject: iOS: Use custom method to lay out windows instead of resizeMaximizedWindows() Since we guard against overriding the geometry in setGeometry() when a window has a window state, we need to use a custom method to lay out windows that calls applyGeometry() instead. Change-Id: I6508e6aac6746c024a6172f709b8339b35b40994 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosscreen.h | 1 + src/plugins/platforms/ios/qiosscreen.mm | 28 +++++++++++++++++++++++++++- src/plugins/platforms/ios/qioswindow.h | 4 ++++ src/plugins/platforms/ios/qioswindow.mm | 16 +++++++++------- 4 files changed, 41 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosscreen.h b/src/plugins/platforms/ios/qiosscreen.h index e70ff4b1a9..9de62c5646 100644 --- a/src/plugins/platforms/ios/qiosscreen.h +++ b/src/plugins/platforms/ios/qiosscreen.h @@ -73,6 +73,7 @@ public: UIScreen *uiScreen() const; void updateProperties(); + void layoutWindows(); private: UIScreen *m_uiScreen; diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index de6585fd19..3c054b4b04 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -182,7 +182,33 @@ void QIOSScreen::updateProperties() } if (screen()) - resizeMaximizedWindows(); + layoutWindows(); +} + +void QIOSScreen::layoutWindows() +{ + QList windows = QGuiApplication::topLevelWindows(); + + const QRect oldGeometry = screen()->geometry(); + const QRect oldAvailableGeometry = screen()->availableGeometry(); + const QRect newGeometry = geometry(); + const QRect newAvailableGeometry = availableGeometry(); + + for (int i = 0; i < windows.size(); ++i) { + QWindow *window = windows.at(i); + + if (platformScreenForWindow(window) != this) + continue; + + QIOSWindow *platformWindow = static_cast(window->handle()); + if (!platformWindow) + continue; + + if (window->windowState() & Qt::WindowFullScreen || window->geometry() == oldGeometry) + platformWindow->applyGeometry(newGeometry); + else if (window->windowState() & Qt::WindowMaximized || window->geometry() == oldAvailableGeometry) + platformWindow->applyGeometry(newAvailableGeometry); + } } QRect QIOSScreen::geometry() const diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index 6e8683af00..4ebdd4635c 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -86,6 +86,8 @@ public: WId winId() const { return WId(m_view); }; private: + void applyGeometry(const QRect &rect); + QUIView *m_view; QRect m_normalGeometry; @@ -97,6 +99,8 @@ private: inline Qt::WindowType windowType() { return static_cast(int(window()->flags() & Qt::WindowType_Mask)); } inline bool windowIsPopup() { return windowType() & Qt::Popup & ~Qt::Window; } + + friend class QIOSScreen; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 2413a45e11..52851439b1 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -435,6 +435,11 @@ void QIOSWindow::setGeometry(const QRect &rect) if (window()->windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen)) return; + applyGeometry(rect); +} + +void QIOSWindow::applyGeometry(const QRect &rect) +{ // Since we don't support transformations on the UIView, we can set the frame // directly and let UIKit deal with translating that into bounds and center. // Changing the size of the view will end up in a call to -[QUIView layoutSubviews] @@ -448,21 +453,18 @@ void QIOSWindow::setWindowState(Qt::WindowState state) // Perhaps setting QWindow to maximized should also mean that we'll show // the statusbar, and vice versa for fullscreen? - if (state != Qt::WindowNoState) - m_normalGeometry = geometry(); - switch (state) { case Qt::WindowNoState: - setGeometry(m_normalGeometry); + applyGeometry(m_normalGeometry); break; case Qt::WindowMaximized: - setGeometry(screen()->availableGeometry()); + applyGeometry(screen()->availableGeometry()); break; case Qt::WindowFullScreen: - setGeometry(screen()->geometry()); + applyGeometry(screen()->geometry()); break; case Qt::WindowMinimized: - setGeometry(QRect()); + applyGeometry(QRect()); break; case Qt::WindowActive: Q_UNREACHABLE(); -- cgit v1.2.3 From 0ac9ea83f82ebf00c469d6f91a5ec12cb9306ac6 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 20 Nov 2013 20:02:21 +0100 Subject: Handle the Qt::FramelessWindowHint correctly in Cocoa This fixes a regression introduced by be405c86f8efac7c6bc8b749725d6d0e0499314d. Task-number: QTBUG-34988 Change-Id: Id825b51d4d94826819d2405bb711886db3db8bc8 Reviewed-by: Christoph Schleifenbaum Reviewed-by: Shawn Rutledge --- src/plugins/platforms/cocoa/qcocoawindow.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index c22f254aef..4da47f4f1f 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -465,8 +465,10 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags) { Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); NSInteger styleMask = NSBorderlessWindowMask; + if (flags & Qt::FramelessWindowHint) + return styleMask; if ((type & Qt::Popup) == Qt::Popup) { - if (!windowIsPopupType(type) && !(flags & Qt::FramelessWindowHint)) + if (!windowIsPopupType(type)) styleMask = (NSUtilityWindowMask | NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask); } else { @@ -485,7 +487,7 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags) } else { styleMask = NSResizableWindowMask | NSClosableWindowMask | NSTitledWindowMask; } - } else if (!(flags & Qt::FramelessWindowHint)) { + } else { if (flags & Qt::WindowMaximizeButtonHint) styleMask |= NSResizableWindowMask; if (flags & Qt::WindowTitleHint) -- cgit v1.2.3 From b4bb70973328d251ecf33ec58722bdb5d32366ed Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 15 Nov 2013 13:38:03 +0100 Subject: Remove QMacStyle titlebar height + 4 adjustment and consequences This was a tweak to fix a bug in 2005 which has probably outlived its usefulness, plus an accumulation of workarounds on top. (started as 48b5266e8ff9b472a16290dd923fe24dd0b6989b in the historical repo) Task-number: QTBUG-34760 Change-Id: I2c01269e43636385ee5c89305c6b90f4a7f2c537 Reviewed-by: Gabriel de Dietrich --- src/widgets/graphicsview/qgraphicswidget_p.cpp | 5 ----- src/widgets/styles/qmacstyle_mac.mm | 1 - src/widgets/widgets/qdockwidget.cpp | 8 -------- src/widgets/widgets/qmdiarea.cpp | 5 ----- src/widgets/widgets/qmdisubwindow.cpp | 5 ----- 5 files changed, 24 deletions(-) (limited to 'src') diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp index 14cd7007ba..e1dd23f177 100644 --- a/src/widgets/graphicsview/qgraphicswidget_p.cpp +++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp @@ -90,11 +90,6 @@ qreal QGraphicsWidgetPrivate::titleBarHeight(const QStyleOptionTitleBar &options { Q_Q(const QGraphicsWidget); int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options); -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) - if (qobject_cast(q->style())) { - height -=4; - } -#endif return (qreal)height; } diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 0b860450d1..503055e32f 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -2191,7 +2191,6 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW HIRect rect; ptrHIShapeGetBounds(region, &rect); ret = int(rect.size.height); - ret += 4; } break; case PM_TabBarTabVSpace: diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 8b151e65bd..46929397a0 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -455,14 +455,6 @@ int QDockWidgetLayout::titleHeight() const perp(verticalTitleBar, floatSize)); QFontMetrics titleFontMetrics = q->fontMetrics(); -#ifdef Q_WS_MAC - if (qobject_cast(q->style())) { - //### this breaks on proxy styles. (But is this code still called?) - QFont font = qt_app_fonts_hash()->value("QToolButton", q->font()); - titleFontMetrics = QFontMetrics(font); - } -#endif - int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, 0, q); return qMax(buttonHeight + 2, titleFontMetrics.height() + 2*mw); diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 5c1d7a6c05..349d8c3423 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -354,11 +354,6 @@ void SimpleCascader::rearrange(QList &widgets, const QRect &domain) c QStyleOptionTitleBar options; options.initFrom(widgets.at(0)); int titleBarHeight = widgets.at(0)->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, widgets.at(0)); -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) - // ### Remove this after the mac style has been fixed - if (qobject_cast(widgets.at(0)->style())) - titleBarHeight -= 4; -#endif const QFontMetrics fontMetrics = QFontMetrics(QApplication::font("QMdiSubWindowTitleBar")); const int dy = qMax(titleBarHeight - (titleBarHeight - fontMetrics.height()) / 2, 1); diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index b80eb069e2..8e1dcbee18 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -1710,11 +1710,6 @@ int QMdiSubWindowPrivate::titleBarHeight(const QStyleOptionTitleBar &options) co } int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, q); -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) - // ### Fix mac style, the +4 pixels hack is not necessary anymore - if (qobject_cast(q->style())) - height -= 4; -#endif if (hasBorder(options)) height += q->isMinimized() ? 8 : 4; return height; -- cgit v1.2.3 From 52fc0a95a109d2e9fa279eeb0284a8178563080b Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Mon, 9 Sep 2013 13:57:37 +0200 Subject: Look at locale aliases if initial search in compose.dir fails The file "locale.alias" (located in the same directory as "compose.dir"), contains following text: "This file contains alias name of locale. Each alias name is described within one line. The first word is the alias name (simplified locale name) the second word is full locale name." Therefore, if initial search in the compose.dir fails to find a match we make sure that a 'full locale name' was used in the initial search, if not, we try again. Task-number: QTBUG-32461 Change-Id: Ie7766658f22433524bd6e4bc829e32c6e3a0cbd0 Reviewed-by: Olivier Goffart Reviewed-by: Lars Knoll --- .../compose/generator/qtablegenerator.cpp | 64 ++++++++++++++++++---- .../compose/generator/qtablegenerator.h | 1 + 2 files changed, 55 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index b5e3aa741e..dad34e121b 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -100,7 +100,6 @@ void TableGenerator::findComposeFile() qDebug() << "Using Compose file from: " << composeFile; #endif } - // check if user’s home directory has a file named .XCompose if (!found && cleanState()) { QString composeFile = qgetenv("HOME") + QStringLiteral("/.XCompose"); @@ -111,10 +110,12 @@ void TableGenerator::findComposeFile() qDebug() << "Using Compose file from: " << composeFile; #endif } - // check for the system provided compose files if (!found && cleanState()) { - QString table = readLocaleMappings(locale().toUpper().toUtf8()); + QByteArray loc = locale().toUpper().toUtf8(); + QString table = readLocaleMappings(loc); + if (table.isEmpty()) + table = readLocaleMappings(readLocaleAliases(loc)); if (cleanState()) { if (table.isEmpty()) @@ -177,8 +178,11 @@ QString TableGenerator::locale() const QString TableGenerator::readLocaleMappings(const QByteArray &locale) { - QFile mappings(systemComposeDir() + QLatin1String("/compose.dir")); QString file; + if (locale.isEmpty()) + return file; + + QFile mappings(systemComposeDir() + QLatin1String("/compose.dir")); if (mappings.open(QIODevice::ReadOnly)) { const int localeNameLength = locale.size(); const char * const localeData = locale.constData(); @@ -208,9 +212,8 @@ QString TableGenerator::readLocaleMappings(const QByteArray &locale) while (*line && *line != ' ' && *line != '\t' && *line != '\n') ++line; *line = '\0'; - if (localeNameLength == (line - lc) && !strncasecmp(lc, localeData, line - lc)) { - file = QString::fromUtf8(l, composeFileNameEnd - l); + file = QString::fromLocal8Bit(l, composeFileNameEnd - l); break; } } @@ -220,6 +223,47 @@ QString TableGenerator::readLocaleMappings(const QByteArray &locale) return file; } +QByteArray TableGenerator::readLocaleAliases(const QByteArray &locale) +{ + QFile aliases(systemComposeDir() + QLatin1String("/locale.alias")); + QByteArray fullLocaleName; + if (aliases.exists()) { + aliases.open(QIODevice::ReadOnly); + while (!aliases.atEnd()) { + char l[1024]; + int read = aliases.readLine(l, sizeof(l)); + char *line = l; + if (read && ((*line >= 'a' && *line <= 'z') || + (*line >= 'A' && *line <= 'Z'))) { + const char *alias = line; + while (*line && *line != ':' && *line != ' ' && *line != '\t') + ++line; + if (!*line) + continue; + *line = 0; + if (locale.size() == (line - alias) + && !strncasecmp(alias, locale.constData(), line - alias)) { + // found a match for alias, read the real locale name + ++line; + while (*line && (*line == ' ' || *line == '\t')) + ++line; + const char *fullName = line; + while (*line && *line != ' ' && *line != '\t' && *line != '\n') + ++line; + *line = 0; + fullLocaleName = fullName; +#ifdef DEBUG_GENERATOR + qDebug() << "Alias for: " << alias << "is: " << fullLocaleName; + break; +#endif + } + } + } + aliases.close(); + } + return fullLocaleName; +} + bool TableGenerator::processFile(QString composeFileName) { QFile composeFile(composeFileName); @@ -254,7 +298,7 @@ void TableGenerator::parseComposeFile(QFile *composeFile) if (*line == '<') parseKeySequence(line); else if (!strncmp(line, "include", 7)) - parseIncludeInstruction(QString::fromUtf8(line)); + parseIncludeInstruction(QString::fromLocal8Bit(line)); } composeFile->close(); @@ -308,7 +352,7 @@ ushort TableGenerator::keysymToUtf8(quint32 sym) qDebug() << QString("keysym - 0x%1 : utf8 - %2").arg(QString::number(sym, 16)) .arg(codec->toUnicode(chars)); #endif - return QString::fromUtf8(chars).at(0).unicode(); + return QString::fromLocal8Bit(chars).at(0).unicode(); } static inline int fromBase8(const char *s, const char *end) @@ -377,13 +421,13 @@ void TableGenerator::parseKeySequence(char *line) // handle direct text encoded in the locale if (*composeValue == '\\') ++composeValue; - elem.value = QString::fromUtf8(composeValue).at(0).unicode(); + elem.value = QString::fromLocal8Bit(composeValue).at(0).unicode(); ++composeValue; } #ifdef DEBUG_GENERATOR // find the comment - elem.comment = QString::fromUtf8(composeValueEnd + 1).trimmed(); + elem.comment = QString::fromLocal8Bit(composeValueEnd + 1).trimmed(); #endif // find the key sequence and convert to X11 keysym diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h index aa65b7b895..248c09f3ea 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h @@ -122,6 +122,7 @@ protected: ushort keysymToUtf8(quint32 sym); QString readLocaleMappings(const QByteArray &locale); + QByteArray readLocaleAliases(const QByteArray &locale); void initPossibleLocations(); bool cleanState() const { return ((m_state & NoErrors) == NoErrors); } QString locale() const; -- cgit v1.2.3 From 55a4db4f47013662970144bb0657e1686186ce05 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 19 Nov 2013 11:52:18 +0100 Subject: Report input method hints for QGraphicsTextItem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-34893 Change-Id: Iabf3b8be4896dadf07e4440f2cffc40aede4a85b Reviewed-by: Jan Arve Sæther Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/widgets/graphicsview/qgraphicsitem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 7cab132a2e..a4adb3d20b 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -10307,7 +10307,9 @@ void QGraphicsTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) QVariant QGraphicsTextItem::inputMethodQuery(Qt::InputMethodQuery query) const { QVariant v; - if (dd->control) + if (query == Qt::ImHints) + v = int(inputMethodHints()); + else if (dd->control) v = dd->control->inputMethodQuery(query); if (v.type() == QVariant::RectF) v = v.toRectF().translated(-dd->controlOffset()); -- cgit v1.2.3 From 773610cc451bb2b4319da6567b21510022d08014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 21 Nov 2013 14:43:40 +0100 Subject: Revert "Ensure Qt::WA_Mapped is set in case of obscured native windows." Qt::WA_Mapped maps (sic) to windowHandle()->isExposed(), and we set/update it in QWidgetWindow::handleExposeEvent(). Setting it directly in show_sys shortcuts QPA and assumes showing a window is synchronous on all platforms, resulting in trying to flush the widget backingstore when the window was not exposed yet (due to discardSyncRequest starting to return false). This reverts commit 829b1d13b225e87b8a385397e2b53c7a9f8cda9e. Change-Id: I0bd700d4939bc69ba184d8586435b68ec3dd72fb Reviewed-by: Gunnar Sletta --- src/widgets/kernel/qwidget_qpa.cpp | 2 +- src/widgets/kernel/qwidgetwindow.cpp | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 3c4985591e..93234f3958 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -510,9 +510,9 @@ void QWidgetPrivate::show_sys() QWindow *window = q->windowHandle(); - q->setAttribute(Qt::WA_Mapped); if (q->testAttribute(Qt::WA_DontShowOnScreen)) { invalidateBuffer(q->rect()); + q->setAttribute(Qt::WA_Mapped); if (q->isWindow() && q->windowModality() != Qt::NonModal && window) { // add our window to the modal window list QGuiApplicationPrivate::showModalWindow(window); diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 22e15e23fe..e977ab3d6f 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -713,10 +713,6 @@ void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event break; } - // Note that widgetState == m_widget->data->window_state when triggered by QWidget::setWindowState(). - if (!(widgetState & Qt::WindowMinimized)) - m_widget->setAttribute(Qt::WA_Mapped); - // Sent event if the state changed (that is, it is not triggered by // QWidget::setWindowState(), which also sends an event to the widget). if (widgetState != int(m_widget->data->window_state)) { -- cgit v1.2.3 From 36e9e08dcc5a09b23d9231ed7b6c25ceff9eb4d0 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Thu, 21 Nov 2013 19:38:28 +0200 Subject: QOpenGLTextureHelper (Windows): Don't load desktop DLL when GLES2 is used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GL functions should come from the context, not the desktop GL lib, when Qt is configured for OpenGL ES 2 (e.g. ANGLE). Change-Id: I794e1d5989ac72d2e98070d20e91f9c2c4cb7183 Reviewed-by: Jørgen Lind --- src/gui/opengl/qopengltexturehelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/opengl/qopengltexturehelper.cpp b/src/gui/opengl/qopengltexturehelper.cpp index 7cd7ca54b2..676c0802de 100644 --- a/src/gui/opengl/qopengltexturehelper.cpp +++ b/src/gui/opengl/qopengltexturehelper.cpp @@ -148,7 +148,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) } #endif -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(QT_OPENGL_ES_2) HMODULE handle = GetModuleHandleA("opengl32.dll"); // OpenGL 1.0 -- cgit v1.2.3 From bb090fa76e352a253805749894f4ee1676481f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 21 Nov 2013 15:32:38 +0100 Subject: iOS: Fix linking against QtCore After introducing support for QSysInfo::macVersion() for iOS we need clients to link to UIKit when using QtCore, as that's where the UIDevice class lives. Change-Id: I0a9c2e2506c61ac5619fd000ebd10c2ab9e037cf Reviewed-by: Oswald Buddenhagen Reviewed-by: Jake Petroules Reviewed-by: Thiago Macieira --- src/corelib/kernel/kernel.pri | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 26ad9f488c..7625a74381 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -98,6 +98,9 @@ mac:!nacl { kernel/qcore_mac.cpp OBJECTIVE_SOURCES += \ kernel/qcore_mac_objc.mm + + # We need UIKit for UIDevice + ios: LIBS_PRIVATE += -framework UIKit } nacl { -- cgit v1.2.3 From 3f97e3844064fb3ecf8881067cec095df25c9782 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 21 Nov 2013 15:22:53 +0100 Subject: Fix race condition between destruction of QObjects If the two QObjecs are connected and destroyed at the same time, it is possible to hit a case where QObject::metaObject and QObject::disconnectNotify is called on a destroyed object. This patch moves the calls up before the removal of the connection. This ensure the sender object will have to block on the receivers connection mutex and can not finish destruction before disconnectNotify is called. Task-number: QTBUG-34131 Change-Id: I398116fe7bc6a195991aff9961d89a8b0ac8d53c Reviewed-by: Olivier Goffart --- src/corelib/kernel/qobject.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index c19c3fcbb5..282672ddc7 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -868,6 +868,10 @@ QObject::~QObject() QObjectPrivate::Connection *node = d->senders; while (node) { QObject *sender = node->sender; + // Send disconnectNotify before removing the connection from sender's connection list. + // This ensures any eventual destructor of sender will block on getting receiver's lock + // and not finish until we release it. + sender->disconnectNotify(QMetaObjectPrivate::signal(sender->metaObject(), node->signal_index)); QMutex *m = signalSlotLock(sender); node->prev = &node; bool needToUnlock = QOrderedMutexLocker::relock(signalSlotMutex, m); @@ -881,8 +885,6 @@ QObject::~QObject() if (senderLists) senderLists->dirty = true; - int signal_index = node->signal_index; - QtPrivate::QSlotObjectBase *slotObj = Q_NULLPTR; if (node->isSlotObject) { slotObj = node->slotObj; @@ -899,7 +901,6 @@ QObject::~QObject() locker.relock(); } - sender->disconnectNotify(QMetaObjectPrivate::signal(sender->metaObject(), signal_index)); } } -- cgit v1.2.3 From f7d6df8710b376845a139e6270c65264a43403cb Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 1 Nov 2013 11:11:06 +0100 Subject: CMake: Add defines for disabled features. Change-Id: I883291dc72eef82aaea2e2b039dfb33c7f56e98b Reviewed-by: Oswald Buddenhagen Reviewed-by: Stephen Kelly --- src/corelib/Qt5CoreConfigExtras.cmake.in | 6 ++++++ src/corelib/corelib.pro | 3 +++ 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index 1e00c74aa6..9bda70ec07 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -81,6 +81,12 @@ list(APPEND Qt5Core_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE) set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE) !!ENDIF +!!IF !isEmpty(CMAKE_DISABLED_FEATURES) +set(Qt5_DISABLED_FEATURES + $$CMAKE_DISABLED_FEATURES +) +!!ENDIF + set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$>:QT_NO_DEBUG>) !!IF contains(QT_CONFIG, reduce_exports) diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 2e4181efb1..b513149e7c 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -79,6 +79,9 @@ cmake_umbrella_config_version_file.input = $$PWD/../../mkspecs/features/data/cma cmake_umbrella_config_version_file.output = $$DESTDIR/cmake/Qt5/Qt5ConfigVersion.cmake load(cmake_functions) +load(qfeatures) + +CMAKE_DISABLED_FEATURES = $$join(QT_DISABLED_FEATURES, "$$escape_expand(\\n) ") CMAKE_HOST_DATA_DIR = $$cmakeRelativePath($$[QT_HOST_DATA/src], $$[QT_INSTALL_PREFIX]) contains(CMAKE_HOST_DATA_DIR, "^\\.\\./.*"):!isEmpty(CMAKE_HOST_DATA_DIR) { -- cgit v1.2.3 From 7879fbe4b8e6396fff199476494c1e05fb4c16e9 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 22 Nov 2013 07:38:26 +0100 Subject: Disable threaded GL for nouveau drivers. Task-number: QTCREATORBUG-10875 Change-Id: I25f3abc6ef15bba78fa9ec27de2c1e5e0bcc7fae Reviewed-by: Lars Knoll Reviewed-by: Kai Koehne --- src/plugins/platforms/xcb/qglxintegration.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index e6fa8fc898..e504d93fba 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -415,12 +415,17 @@ bool QGLXContext::m_supportsThreading = true; // If this list grows to any significant size, change it a // proper string table and make the implementation below use // binary search. -static const char *qglx_threadedgl_blacklist[] = { +static const char *qglx_threadedgl_blacklist_renderer[] = { "Chromium", // QTBUG-32225 (initialization fails) "Mesa DRI Intel(R) Sandybridge Mobile", // QTBUG-34492 (flickering in fullscreen) 0 }; +static const char *qglx_threadedgl_blacklist_vendor[] = { + "nouveau", // QTCREATORBUG-10875 (crash in creator) + 0 +}; + void QGLXContext::queryDummyContext() { if (m_queriedDummyContext) @@ -437,8 +442,8 @@ void QGLXContext::queryDummyContext() oldSurface = oldContext->surface(); QScopedPointer surface; - const char *vendor = glXGetClientString(glXGetCurrentDisplay(), GLX_VENDOR); - if (vendor && !strcmp(vendor, "ATI")) { + const char *glxvendor = glXGetClientString(glXGetCurrentDisplay(), GLX_VENDOR); + if (glxvendor && !strcmp(glxvendor, "ATI")) { QWindow *window = new QWindow; window->resize(64, 64); window->setSurfaceType(QSurface::OpenGLSurface); @@ -454,11 +459,19 @@ void QGLXContext::queryDummyContext() context.create(); context.makeCurrent(surface.data()); + m_supportsThreading = true; + const char *renderer = (const char *) glGetString(GL_RENDERER); + for (int i = 0; qglx_threadedgl_blacklist_renderer[i]; ++i) { + if (strstr(renderer, qglx_threadedgl_blacklist_renderer[i]) != 0) { + m_supportsThreading = false; + break; + } + } - m_supportsThreading = true; - for (int i = 0; qglx_threadedgl_blacklist[i]; ++i) { - if (strstr(renderer, qglx_threadedgl_blacklist[i]) != 0) { + const char *vendor = (const char *) glGetString(GL_VENDOR); + for (int i = 0; qglx_threadedgl_blacklist_vendor[i]; ++i) { + if (strstr(vendor, qglx_threadedgl_blacklist_vendor[i]) != 0) { m_supportsThreading = false; break; } -- cgit v1.2.3 From a474b1d13511858df9b99564f8b443131eb5966a Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 21 Nov 2013 15:00:01 +0100 Subject: Android: make the default font size bigger The default font size turned out to be slightly too small for comfort on touch devices. This tweaks the size from a 12-point equivalent to a 14-point equivalent. (Point sizes aren't real point sizes because of compatibility with iOS.) Change-Id: I6d970fdd5bba8199cabdf1aaaaac10d19c53c654 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Jens Bache-Wiig --- src/plugins/platforms/android/src/qandroidplatformtheme.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/android/src/qandroidplatformtheme.cpp b/src/plugins/platforms/android/src/qandroidplatformtheme.cpp index 0ceac97e35..308bb70faf 100644 --- a/src/plugins/platforms/android/src/qandroidplatformtheme.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformtheme.cpp @@ -125,7 +125,7 @@ const QFont *QAndroidPlatformTheme::font(Font type) const return &(it.value()); // default in case the style has not set a font - static QFont systemFont("Roboto", 12.0 * 100 / 72); // keep default size the same after changing from 100 dpi to 72 dpi + static QFont systemFont("Roboto", 14.0 * 100 / 72); // keep default size the same after changing from 100 dpi to 72 dpi if (type == QPlatformTheme::SystemFont) return &systemFont; return 0; -- cgit v1.2.3 From 0a170be576153b84ee6249f1a2b7cbce1ef10d84 Mon Sep 17 00:00:00 2001 From: Josh Faust Date: Mon, 10 Jun 2013 11:42:01 -0700 Subject: Fix OpenType fonts with cmap tables on Windows Task-number: QTBUG-31656 Change-Id: I5405d80f3ac1de488c44c9f1ac9ed9942ceab6b8 Reviewed-by: Konstantin Ritt Reviewed-by: Lars Knoll --- src/plugins/platforms/windows/qwindowsfontengine.cpp | 13 ++++++++++--- src/plugins/platforms/windows/qwindowsfontengine.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index ac57a1b396..6c928119b3 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -161,12 +161,18 @@ bool QWindowsFontEngine::hasCFFTable() const return GetFontData(hdc, MAKE_TAG('C', 'F', 'F', ' '), 0, 0, 0) != GDI_ERROR; } +bool QWindowsFontEngine::hasCMapTable() const +{ + HDC hdc = m_fontEngineData->hdc; + SelectObject(hdc, hfont); + return GetFontData(hdc, MAKE_TAG('c', 'm', 'a', 'p'), 0, 0, 0) != GDI_ERROR; +} + void QWindowsFontEngine::getCMap() { - ttf = (bool)(tm.tmPitchAndFamily & TMPF_TRUETYPE); + ttf = (bool)(tm.tmPitchAndFamily & TMPF_TRUETYPE) || hasCMapTable(); - // TMPF_TRUETYPE is not set for fonts with CFF tables - cffTable = !ttf && hasCFFTable(); + cffTable = hasCFFTable(); HDC hdc = m_fontEngineData->hdc; SelectObject(hdc, hfont); @@ -374,6 +380,7 @@ HGDIOBJ QWindowsFontEngine::selectDesignFont() const { LOGFONT f = m_logfont; f.lfHeight = unitsPerEm; + f.lfWidth = 0; HFONT designFont = CreateFontIndirect(&f); return SelectObject(m_fontEngineData->hdc, designFont); } diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h index d783b6048c..acf84d270c 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.h +++ b/src/plugins/platforms/windows/qwindowsfontengine.h @@ -140,6 +140,7 @@ private: QWindowsNativeImage *drawGDIGlyph(HFONT font, glyph_t, int margin, const QTransform &xform, QImage::Format mask_format); bool hasCFFTable() const; + bool hasCMapTable() const; const QSharedPointer m_fontEngineData; -- cgit v1.2.3 From 06ff9c9ec0e75eca2f06c177f16c52e42f41befd Mon Sep 17 00:00:00 2001 From: Kurt Pattyn Date: Mon, 18 Nov 2013 00:07:39 +0100 Subject: Replace deprecated method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace deprecated CFPropertyListCreateXMLData with CFPropertyListCreateData Change-Id: I284f1906cfb3da7692f04e2924c989c572efce30 Reviewed-by: Tor Arne Vestbø --- src/corelib/io/qsettings_mac.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp index f6b14c3027..23cff6af27 100644 --- a/src/corelib/io/qsettings_mac.cpp +++ b/src/corelib/io/qsettings_mac.cpp @@ -691,7 +691,8 @@ bool QConfFileSettingsPrivate::writePlistFile(const QString &fileName, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - QCFType xmlData = CFPropertyListCreateXMLData(kCFAllocatorDefault, propertyList); + QCFType xmlData = CFPropertyListCreateData( + kCFAllocatorDefault, propertyList, kCFPropertyListXMLFormat_v1_0, 0, 0); SInt32 code; return CFURLWriteDataAndPropertiesToResource(urlFromFileName(fileName), xmlData, 0, &code); -- cgit v1.2.3 From b6ad2621aa25e94a7caeff9e66ec0064bb8ff260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 21 Nov 2013 12:48:12 +0100 Subject: Add convenience macros for checking OS X and iOS platform SDK and target Allows us to skip passing __MAC_NA and __IPHONE_NA when we don't care about that platform. Change-Id: Ie265beb457d057de06ae64970684d67e59062b1c Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qglobal.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 1629339fd1..6d0500f08d 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -520,6 +520,16 @@ Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max # define QT_MAC_DEPLOYMENT_TARGET_BELOW(osx, ios) \ (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && osx != __MAC_NA && __MAC_OS_X_VERSION_MIN_REQUIRED < osx) || \ (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MIN_REQUIRED < ios) + +# define QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(ios) \ + QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, ios) +# define QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(osx) \ + QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(osx, __IPHONE_NA) + +# define QT_IOS_DEPLOYMENT_TARGET_BELOW(ios) \ + QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_NA, ios) +# define QT_OSX_DEPLOYMENT_TARGET_BELOW(osx) \ + QT_MAC_DEPLOYMENT_TARGET_BELOW(osx, __IPHONE_NA) #endif /* -- cgit v1.2.3 From 1ca27d38bc065b124a8fda6548e41f79c351e17d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 15 Nov 2013 19:36:40 +0100 Subject: iOS: Fix when and how we send geometry and expose events Geometry changes may come from Qt itself, or spontaneously from the windowing system. In both cases we deal with them through the layoutSubviews callback, which we now ensure gets called after we set a new geometry on the UIView frame, by using the setNeedsLayout message. We take care to persist the requested geometry from Qt immediately in our setGeometry() function, so that subsequent calls to QWindow::geometry() will report back the requested geometry. Clients can however not rely on this geometry until they've received a corresponding resize event, which we trigger from layoutSubviews. Since the new geometry reported in layoutSubviews may be different from what the user requested, we ensure to pass on both the new and the "old" geometry, so that Qt will send the appropriate resize and move events. Instead of building expose events on top of the existing layout mechanism provided by iOS, we hook into the more logical point, which is the display-phase. Since a EAGL view normally doesn't need to "display" anything this takes a few overrides on UIView. Once we have the hooks we need, we can distinguish between a QWindow backing needing layout, and needing displaying. Finally, we flush both the resize and expose events, as that's what iOS expects of us when asking us to layout or display. The result is that Qt is able to synchronously resize subwindows and prepare new GL rendering for the next frame. Change-Id: I4c03e3db3fe886163284ba1a342699e217e88cbb Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioswindow.mm | 85 ++++++++++++++++++++++++++++----- 1 file changed, 72 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 52851439b1..14220f1139 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -153,6 +153,15 @@ self.clipsToBounds = NO; } +- (void)setNeedsDisplay +{ + [super setNeedsDisplay]; + + // We didn't implement drawRect: so we have to manually + // mark the layer as needing display. + [self.layer setNeedsDisplay]; +} + - (void)layoutSubviews { // This method is the de facto way to know that view has been resized, @@ -165,15 +174,39 @@ qWarning() << m_qioswindow->window() << "is backed by a UIView that has a transform set. This is not supported."; - QRect geometry = fromCGRect(self.frame); - m_qioswindow->QPlatformWindow::setGeometry(geometry); - QWindowSystemInterface::handleGeometryChange(m_qioswindow->window(), geometry); - QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), QRect(QPoint(), geometry.size())); + // The original geometry requested by setGeometry() might be different + // from what we end up with after applying window constraints. + QRect requestedGeometry = m_qioswindow->geometry(); + + // Persist the actual/new geometry so that QWindow::geometry() can + // be queried on the resize event. + QRect actualGeometry = fromCGRect(self.frame); + m_qioswindow->QPlatformWindow::setGeometry(actualGeometry); + + QRect previousGeometry = requestedGeometry != actualGeometry ? + requestedGeometry : qt_window_private(m_qioswindow->window())->geometry; - // If we have a new size here we need to resize the FBO's corresponding buffers, - // but we defer that to when the application calls makeCurrent. + QWindowSystemInterface::handleGeometryChange(m_qioswindow->window(), actualGeometry, previousGeometry); + QWindowSystemInterface::flushWindowSystemEvents(); + + if (actualGeometry.size() != previousGeometry.size()) { + // Trigger expose event on resize + [self setNeedsDisplay]; - [super layoutSubviews]; + // A new size means we also need to resize the FBO's corresponding buffers, + // but we defer that to when the application calls makeCurrent. + } +} + +- (void)displayLayer:(CALayer *)layer +{ + QRect geometry = fromCGRect(layer.frame); + Q_ASSERT(m_qioswindow->geometry() == geometry); + Q_ASSERT(self.hidden == !m_qioswindow->window()->isVisible()); + + QRegion region = self.hidden ? QRegion() : QRect(QPoint(), geometry.size()); + QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), region); + QWindowSystemInterface::flushWindowSystemEvents(); } - (void)updateTouchList:(NSSet *)touches withState:(Qt::TouchPointState)state @@ -393,8 +426,8 @@ bool QIOSWindow::blockedByModal() void QIOSWindow::setVisible(bool visible) { - QPlatformWindow::setVisible(visible); m_view.hidden = !visible; + [m_view setNeedsDisplay]; if (!isQtApplication()) return; @@ -429,22 +462,48 @@ void QIOSWindow::setVisible(bool visible) void QIOSWindow::setGeometry(const QRect &rect) { - // If the window is in fullscreen, just bookkeep the requested - // geometry in case the window goes into Qt::WindowNoState later: m_normalGeometry = rect; - if (window()->windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen)) + + if (window()->windowState() != Qt::WindowNoState) { + QPlatformWindow::setGeometry(rect); + + // The layout will realize the requested geometry was not applied, and + // send geometry-change events that match the actual geometry. + [m_view setNeedsLayout]; + + if (window()->inherits("QWidgetWindow")) { + // QWidget wrongly assumes that setGeometry resets the window + // state back to Qt::NoWindowState, so we need to inform it that + // that his is not the case by re-issuing the current window state. + QWindowSystemInterface::handleWindowStateChanged(window(), window()->windowState()); + + // It also needs to be told immediately that the geometry it requested + // did not apply, otherwise it will continue on as if it did, instead + // of waiting for a resize event. + [m_view layoutIfNeeded]; + } + return; + } applyGeometry(rect); } void QIOSWindow::applyGeometry(const QRect &rect) { + // Geometry changes are asynchronous, but QWindow::geometry() is + // expected to report back the 'requested geometry' until we get + // a callback with the updated geometry from the window system. + // The baseclass takes care of persisting this for us. + QPlatformWindow::setGeometry(rect); + // Since we don't support transformations on the UIView, we can set the frame // directly and let UIKit deal with translating that into bounds and center. - // Changing the size of the view will end up in a call to -[QUIView layoutSubviews] - // which will update QWindowSystemInterface with the new size. m_view.frame = toCGRect(rect); + + // iOS will automatically trigger -[layoutSubviews:] for resize, + // but not for move, so we force it just in case. + [m_view setNeedsLayout]; } void QIOSWindow::setWindowState(Qt::WindowState state) -- cgit v1.2.3 From ae5392a00bdd5a569250cd4e387868141cbd68e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 20 Nov 2013 17:48:49 +0100 Subject: iOS: Take position of root viewcontroller into account for geometry changes When setting the geometry on our UIView, or when reporting it back to Qt in our layoutSubviews callback, we need to take into account that the root viewcontroller may be not be positioned at 0,0 in the screen's window. Even when using the wantsFullScreenLayout property of the view controller this may be the case on iOS7 when the in-call status-bar is visible. Change-Id: I0ca706c1c9aff8ba4f3b4ccdf83dba713bd5c9c2 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioswindow.mm | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 14220f1139..e835b829a8 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -178,9 +178,20 @@ // from what we end up with after applying window constraints. QRect requestedGeometry = m_qioswindow->geometry(); + QRect actualGeometry; + if (m_qioswindow->window()->isTopLevel()) { + UIWindow *uiWindow = self.window; + CGRect rootViewPositionInRelationToRootViewController = + [uiWindow.rootViewController.view convertRect:uiWindow.bounds fromView:uiWindow]; + + actualGeometry = fromCGRect(CGRectOffset([self.superview convertRect:self.frame toView:uiWindow.rootViewController.view], + -rootViewPositionInRelationToRootViewController.origin.x, -rootViewPositionInRelationToRootViewController.origin.y)); + } else { + actualGeometry = fromCGRect(self.frame); + } + // Persist the actual/new geometry so that QWindow::geometry() can // be queried on the resize event. - QRect actualGeometry = fromCGRect(self.frame); m_qioswindow->QPlatformWindow::setGeometry(actualGeometry); QRect previousGeometry = requestedGeometry != actualGeometry ? @@ -497,9 +508,20 @@ void QIOSWindow::applyGeometry(const QRect &rect) // The baseclass takes care of persisting this for us. QPlatformWindow::setGeometry(rect); - // Since we don't support transformations on the UIView, we can set the frame - // directly and let UIKit deal with translating that into bounds and center. - m_view.frame = toCGRect(rect); + if (window()->isTopLevel()) { + // The QWindow is in QScreen coordinates, which maps to a possibly rotated root-view-controller. + // Since the root-view-controller might be translated in relation to the UIWindow, we need to + // check specifically for that and compensate. + UIWindow *uiWindow = m_view.window; + CGRect rootViewPositionInRelationToRootViewController = + [uiWindow.rootViewController.view convertRect:uiWindow.bounds fromView:uiWindow]; + + m_view.frame = CGRectOffset([m_view.superview convertRect:toCGRect(rect) fromView:m_view.window.rootViewController.view], + rootViewPositionInRelationToRootViewController.origin.x, rootViewPositionInRelationToRootViewController.origin.y); + } else { + // Easy, in parent's coordinates + m_view.frame = toCGRect(rect); + } // iOS will automatically trigger -[layoutSubviews:] for resize, // but not for move, so we force it just in case. -- cgit v1.2.3 From f441d8e52360fe5c03887fa0bbce8bfda2c8ff2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 21 Nov 2013 11:25:48 +0100 Subject: iOS: Change show() to imply maximize, and showFullScreen() to hide status bar Matches the Android behavior, and gives an easy and predictable way to show true fullscreen windows that is similar to how one would do it on a desktop platform. We keep the statusbar visibility in sync with the window state of the active window. Change-Id: Ia4b99e03f83e19f9ef56cc99b9d477cc6da4c734 Reviewed-by: Richard Moe Gustavsen --- .../platforms/ios/qiosapplicationdelegate.mm | 16 +++++++++++ src/plugins/platforms/ios/qiosintegration.mm | 2 +- src/plugins/platforms/ios/qiosscreen.h | 7 ++++- src/plugins/platforms/ios/qiosscreen.mm | 29 +++++++++++++++++++ src/plugins/platforms/ios/qiosviewcontroller.h | 1 + src/plugins/platforms/ios/qiosviewcontroller.mm | 25 ++++++++++++++++ src/plugins/platforms/ios/qioswindow.h | 2 ++ src/plugins/platforms/ios/qioswindow.mm | 33 +++++++++++++++++++--- 8 files changed, 109 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm index 775074baae..e325666f69 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm @@ -58,6 +58,22 @@ self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; self.window.rootViewController = [[[QIOSViewController alloc] init] autorelease]; + QSysInfo::MacVersion iosVersion = QSysInfo::MacintoshVersion; + + // We prefer to keep the root viewcontroller in fullscreen layout, so that + // we don't have to compensate for the viewcontroller position. This also + // gives us the same behavior on iOS 5/6 as on iOS 7, where full screen layout + // is the only way. + if (iosVersion < QSysInfo::MV_IOS_7_0) + self.window.rootViewController.wantsFullScreenLayout = YES; + + // Use translucent statusbar by default on iOS6 (unless the user changed the + // default in the Info.plist), so that windows placed under the stausbar are + // still visible, just like on iOS7. + if (iosVersion >= QSysInfo::MV_IOS_6_0 && iosVersion < QSysInfo::MV_IOS_7_0 + && [UIApplication sharedApplication].statusBarStyle == UIStatusBarStyleDefault) + [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent]; + self.window.hidden = NO; return YES; diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index 44ac749454..5c8f67bda2 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -160,7 +160,7 @@ QPlatformServices *QIOSIntegration::services() const QVariant QIOSIntegration::styleHint(StyleHint hint) const { switch (hint) { - case ShowIsFullScreen: + case ShowIsMaximized: return true; case SetFocusOnTouchRelease: return true; diff --git a/src/plugins/platforms/ios/qiosscreen.h b/src/plugins/platforms/ios/qiosscreen.h index 9de62c5646..173bd11719 100644 --- a/src/plugins/platforms/ios/qiosscreen.h +++ b/src/plugins/platforms/ios/qiosscreen.h @@ -50,8 +50,10 @@ QT_BEGIN_NAMESPACE -class QIOSScreen : public QPlatformScreen +class QIOSScreen : public QObject, public QPlatformScreen { + Q_OBJECT + public: QIOSScreen(unsigned int screenIndex); ~QIOSScreen(); @@ -75,6 +77,9 @@ public: void updateProperties(); void layoutWindows(); +public slots: + void updateStatusBarVisibility(); + private: UIScreen *m_uiScreen; QRect m_geometry; diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 3c054b4b04..42c3e13e7e 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -139,6 +139,8 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex) m_unscaledDpi = 163; // Regular iPhone DPI } + connect(qGuiApp, &QGuiApplication::focusWindowChanged, this, &QIOSScreen::updateStatusBarVisibility); + updateProperties(); } @@ -185,6 +187,31 @@ void QIOSScreen::updateProperties() layoutWindows(); } +void QIOSScreen::updateStatusBarVisibility() +{ + QWindow *focusWindow = QGuiApplication::focusWindow(); + + // If we don't have a focus window we leave the status + // bar as is, so that the user can activate a new window + // with the same window state without the status bar jumping + // back and forth. + if (!focusWindow) + return; + + UIView *view = reinterpret_cast(focusWindow->handle()->winId()); +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0) + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0) { + [view.viewController setNeedsStatusBarAppearanceUpdate]; + } else +#endif + { + QIOSViewController *viewController = static_cast(view.viewController); + [[UIApplication sharedApplication] + setStatusBarHidden:[viewController prefersStatusBarHidden] + withAnimation:UIStatusBarAnimationNone]; + } +} + void QIOSScreen::layoutWindows() { QList windows = QGuiApplication::topLevelWindows(); @@ -273,4 +300,6 @@ UIScreen *QIOSScreen::uiScreen() const return m_uiScreen; } +#include "moc_qiosscreen.cpp" + QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qiosviewcontroller.h b/src/plugins/platforms/ios/qiosviewcontroller.h index d5a61cb3f4..a0017808d3 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.h +++ b/src/plugins/platforms/ios/qiosviewcontroller.h @@ -42,5 +42,6 @@ #import @interface QIOSViewController : UIViewController +- (BOOL)prefersStatusBarHidden; @end diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 1d5e69beac..11ac92fea5 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -42,9 +42,11 @@ #import "qiosviewcontroller.h" #include +#include #include #include "qiosscreen.h" #include "qiosglobal.h" +#include "qioswindow.h" @implementation QIOSViewController @@ -74,5 +76,28 @@ qiosScreen->updateProperties(); } +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0) +- (UIStatusBarStyle)preferredStatusBarStyle +{ + // Since we don't place anything behind the status bare by default, we + // end up with a black area, so we have to enable the white text mode + // of the iOS7 statusbar. + return UIStatusBarStyleLightContent; + + // FIXME: Try to detect the content underneath the statusbar and choose + // an appropriate style, and/or expose Qt APIs to control the style. +} +#endif + +- (BOOL)prefersStatusBarHidden +{ + QWindow *focusWindow = QGuiApplication::focusWindow(); + if (!focusWindow) + return [UIApplication sharedApplication].statusBarHidden; + + QIOSWindow *topLevel = static_cast(focusWindow->handle())->topLevelWindow(); + return topLevel->window()->windowState() == Qt::WindowFullScreen; +} + @end diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index 4ebdd4635c..a5e122bda1 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -85,6 +85,8 @@ public: WId winId() const { return WId(m_view); }; + QIOSWindow *topLevelWindow() const; + private: void applyGeometry(const QRect &rect); diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index e835b829a8..d4e656c390 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -456,6 +456,10 @@ void QIOSWindow::setVisible(bool visible) if (visible) { requestActivateWindow(); + + if (window()->isTopLevel()) + static_cast(screen())->updateStatusBarVisibility(); + } else { // Activate top-most visible QWindow: NSArray *subviews = m_view.viewController.view.subviews; @@ -530,10 +534,6 @@ void QIOSWindow::applyGeometry(const QRect &rect) void QIOSWindow::setWindowState(Qt::WindowState state) { - // FIXME: Figure out where or how we should disable/enable the statusbar. - // Perhaps setting QWindow to maximized should also mean that we'll show - // the statusbar, and vice versa for fullscreen? - switch (state) { case Qt::WindowNoState: applyGeometry(m_normalGeometry); @@ -552,6 +552,14 @@ void QIOSWindow::setWindowState(Qt::WindowState state) default: Q_UNREACHABLE(); } + + if (window()->isTopLevel() && window()->isVisible() && window()->isActive()) { + // The window state of the QWindow is not updated until after + // we return from this method, so we have to defer any updates + // of the statusbar that depend on the current window state. + QMetaObject::invokeMethod(static_cast(screen()), + "updateStatusBarVisibility", Qt::QueuedConnection); + } } void QIOSWindow::setParent(const QPlatformWindow *parentWindow) @@ -569,6 +577,23 @@ void QIOSWindow::setParent(const QPlatformWindow *parentWindow) } } +QIOSWindow *QIOSWindow::topLevelWindow() const +{ + QWindow *window = this->window(); + while (window) { + QWindow *parent = window->parent(); + if (!parent) + parent = window->transientParent(); + + if (!parent) + break; + + window = parent; + } + + return static_cast(window->handle()); +} + void QIOSWindow::requestActivateWindow() { // Note that several windows can be active at the same time if they exist in the same -- cgit v1.2.3 From 03cd5b3563e796fbab8ebe1c055b309c7f3fee1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 21 Nov 2013 16:32:00 +0100 Subject: iOS: Use separate release pool for qt_ios_version() QSysInfo::MacintoshVersion is initialized before the main thread's release pool has been set up, so we have to wrap the UIKit usage in our own pool. Change-Id: I80e2c068339e0251f38ecf55fcfb764594eb3ad7 Reviewed-by: Richard Moe Gustavsen --- src/corelib/kernel/qcore_mac_objc.mm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm index 8ea318073b..73f8296021 100644 --- a/src/corelib/kernel/qcore_mac_objc.mm +++ b/src/corelib/kernel/qcore_mac_objc.mm @@ -61,6 +61,8 @@ QString QCFString::toQString(const NSString *nsstr) #ifdef Q_OS_IOS QSysInfo::MacVersion qt_ios_version() { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + int major = 0, minor = 0; NSArray *components = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."]; switch ([components count]) { @@ -75,6 +77,9 @@ QSysInfo::MacVersion qt_ios_version() default: Q_UNREACHABLE(); } + + [pool release]; + return QSysInfo::MacVersion(Q_MV_IOS(major, minor)); } #endif -- cgit v1.2.3 From c25385ae1e3da0848c2718a002ae7d037f25db94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 21 Nov 2013 15:26:32 +0100 Subject: iOS: Fix build against iOS 5 SDK and auto-rotation on iOS 5 Change-Id: I3acc2d3780a9440bedf48db3fed0046b06300b9e Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosviewcontroller.mm | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 11ac92fea5..2e7e44d32c 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -57,12 +57,22 @@ return YES; } +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_6_0) -(NSUInteger)supportedInterfaceOrientations { // We need to tell iOS that we support all orientations in order to set // status bar orientation when application content orientation changes. return UIInterfaceOrientationMaskAll; } +#endif + +#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0) +-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + Q_UNUSED(interfaceOrientation); + return YES; +} +#endif - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration { -- cgit v1.2.3 From c38225229d047eeb52a09150dff9985f0547b13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 21 Nov 2013 17:16:27 +0100 Subject: iOS: Allow QBackingStore::flush() without beginPaint() The QBackingStore API doesn't require clients to precede flush() with a beginPaint() call, but our backingstore is backed by a GL context, so it's up to us to ensure it's current before swapping. Change-Id: Ia6119bf0e835448b1fd383d933df6f88fa4f298a Reviewed-by: Gunnar Sletta --- src/plugins/platforms/ios/qiosbackingstore.mm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosbackingstore.mm b/src/plugins/platforms/ios/qiosbackingstore.mm index 2dadc5672b..80b603bb8e 100644 --- a/src/plugins/platforms/ios/qiosbackingstore.mm +++ b/src/plugins/platforms/ios/qiosbackingstore.mm @@ -56,6 +56,9 @@ QIOSBackingStore::QIOSBackingStore(QWindow *window) fmt.setDepthBufferSize(16); fmt.setStencilBufferSize(8); + // Needed to prevent QOpenGLContext::makeCurrent() from failing + window->setSurfaceType(QSurface::OpenGLSurface); + m_context->setFormat(fmt); m_context->setScreen(window->screen()); m_context->create(); @@ -69,9 +72,6 @@ QIOSBackingStore::~QIOSBackingStore() void QIOSBackingStore::beginPaint(const QRegion &) { - // Needed to prevent QOpenGLContext::makeCurrent() from failing - window()->setSurfaceType(QSurface::OpenGLSurface); - m_context->makeCurrent(window()); QIOSWindow *iosWindow = static_cast(window()->handle()); @@ -102,6 +102,8 @@ void QIOSBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoin // the child window overlaps a sibling window that's draws using a separate QOpenGLContext. return; } + + m_context->makeCurrent(window); m_context->swapBuffers(window); } -- cgit v1.2.3 From a4e1c15b16ef263f908ae1b5d9d8b2b8c1e21ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 21 Nov 2013 17:28:53 +0100 Subject: iOS: Deliver resize events synchronously after setGeometry for QtWidgets QWidget::show_sys() assumes synchronous geometry behavior by trying to resize both the platform window and the backing store if the widget's view of what the geometry is doesn't match the platform window's. The problem with that is that it's the widget which is not up to date, not the window, as the widget is not waiting for resize events before applying any resize logic. Instead of trying to fix widgets, we throw our hands in the air and give QtWidgets the synchronous behavior it assumes from the platform. Change-Id: I1b9241b9b13df661dc7f41c4cb8ecd02f5572256 Reviewed-by: Gunnar Sletta Reviewed-by: Friedemann Kleint Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioswindow.mm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index d4e656c390..d453058b10 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -530,6 +530,9 @@ void QIOSWindow::applyGeometry(const QRect &rect) // iOS will automatically trigger -[layoutSubviews:] for resize, // but not for move, so we force it just in case. [m_view setNeedsLayout]; + + if (window()->inherits("QWidgetWindow")) + [m_view layoutIfNeeded]; } void QIOSWindow::setWindowState(Qt::WindowState state) -- cgit v1.2.3 From 28c5c74c9b37fdf650810cebcd93944e0078cbd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 21 Nov 2013 17:38:50 +0100 Subject: iOS: Re-enable kEAGLDrawablePropertyRetainedBacking Having it disabled caused issues with our backing-store implementation, which assumes that the backing store is retained, but for us is backed by a GL context. Change-Id: I18d05e226c7cf949adcd3b71801ffd845fa6d83d Reviewed-by: Gunnar Sletta Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioswindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index d453058b10..af51218654 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -105,7 +105,7 @@ CAEAGLLayer *eaglLayer = static_cast(self.layer); eaglLayer.opaque = TRUE; eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, + [NSNumber numberWithBool:YES], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil]; // Set up text input -- cgit v1.2.3 From 376ccedd1a04c196ba3cefb7d4e7d6acbceb66e8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 21 Nov 2013 19:21:25 +0100 Subject: Avoid incorrect warning when painting onto a QImage Change Ia8ef48f3 introduced a regression: Trying to paint onto a QImage, QPicture or QPrinter from outside the main thread incorrectly shows a warning saying that it is not supported. The patch was incorrect because 'extraCondition' was used in the non-default branches of the switch and thus not passing extraCondition==true caused the message appear even when it shouldn't have. Let's just remove the extraCondition parameter altogether since it is not used in practice anyway. Change-Id: Id2e56c585d1f1013f24942cbcd53305fbb66aeba Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll Reviewed-by: Konstantin Ritt --- src/gui/painting/qpainter.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 4c02abdfd5..424ed554a2 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -146,17 +146,16 @@ static inline uint line_emulation(uint emulation) } #ifndef QT_NO_DEBUG -static bool qt_painter_thread_test(int devType, const char *what, bool extraCondition = false) +static bool qt_painter_thread_test(int devType, const char *what) { switch (devType) { case QInternal::Image: case QInternal::Printer: case QInternal::Picture: // can be drawn onto these devices safely from any thread - if (extraCondition) - break; + break; default: - if (!extraCondition && QThread::currentThread() != qApp->thread()) { + if (QThread::currentThread() != qApp->thread()) { qWarning("QPainter: It is not safe to use %s outside the GUI thread", what); return false; } -- cgit v1.2.3 From 88728897a69275299d53a094d3a5745cc6a90c6d Mon Sep 17 00:00:00 2001 From: Arvid Nilsson Date: Thu, 21 Nov 2013 11:37:31 +0100 Subject: BlackBerry: Fixed root window size, continued The previous patch removed a call to setGeometry, and now only calls setGeometryHelper. This means the screen window will be resized, but Qt won't know about our new window size. The scene graph of a QtQuick2 application would layout and render to the wrong target size. Fixed by adding a call to QWindowSystemInterface::handleGeometryChange if we decide to use a different geometry than suggested by the window. Task-number: QTBUG-34930 Change-Id: Ie91c2edc45c47f5bf1d45aed981b969fcc3f40dd Reviewed-by: Bernd Weimer Reviewed-by: Fabian Bumberger Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qqnxwindow.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 731e0e5ea7..b25c0b5b29 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -609,9 +609,12 @@ void QQnxWindow::initWindow() if (window()->parent() && window()->parent()->handle()) setParent(window()->parent()->handle()); - const QRect &initialGeometry = screen()->rootWindow() == this ? - screen()->geometry() : window()->geometry(); - setGeometryHelper(initialGeometry); + if (screen()->rootWindow() == this) { + setGeometryHelper(screen()->geometry()); + QWindowSystemInterface::handleGeometryChange(window(), screen()->geometry()); + } else { + setGeometryHelper(window()->geometry()); + } } void QQnxWindow::createWindowGroup() -- cgit v1.2.3 From a18daa8793ea6b2e9405e854f4b0fef66f8ceb16 Mon Sep 17 00:00:00 2001 From: Frank Osterfeld Date: Wed, 20 Nov 2013 19:06:23 +0100 Subject: QNX: Only link libclipboard when building with clipboard support In QNX 6.6, libclipboard isn't part of the base SDP, and QT_NO_CLIPBOARD is set unconditionally on plain QNX anyway. The clipboard-based implementation isn't compiled when QT_NO_CLIPBOARD is set, so only try to link libclipboard when actually building with clipboard support (BB10). Change-Id: I54eb4fadb6bf239a83884796f5758cb79a5677ef Reviewed-by: Andreas Holzammer Reviewed-by: Fabian Bumberger Reviewed-by: Rafael Roquetto Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> --- src/plugins/platforms/qnx/qnx.pro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index aeacbeef69..92c8fc183a 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -132,7 +132,8 @@ CONFIG(qqnx_pps) { qqnxclipboard.h \ qqnxbuttoneventnotifier.h - LIBS += -lpps -lclipboard + LIBS += -lpps + !contains(DEFINES, QT_NO_CLIPBOARD): LIBS += -lclipboard CONFIG(qqnx_imf) { DEFINES += QQNX_IMF -- cgit v1.2.3 From ca2440e2b10368c7d8b849ee1b504a7d587dd1a9 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Thu, 21 Nov 2013 12:58:22 +0100 Subject: Add PPS configure check Plain QNX 6.5.0 does not have a libpps, the new QNX has a libpps and BlackBerry has it as well. So we need a configure check to not open another mkspec for this platform. This fixes the plain QNX 6.5.0 build. Change-Id: Id4b3876f2385bcb5f3df426945532e7e26133f24 Reviewed-by: Oswald Buddenhagen Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qnx.pro | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index 92c8fc183a..bc7219de5c 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -2,9 +2,6 @@ TARGET = qqnx QT += platformsupport-private core-private gui-private -# The PPS based platform integration is currently used for both BB10 and plain QNX -CONFIG += qqnx_pps - # Uncomment this to build with support for IMF once it becomes available in the BBNDK #CONFIG += qqnx_imf -- cgit v1.2.3 From d4c548ce5c0bd8a70c82ed082bc69fd41e9c47ed Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 19 Nov 2013 12:47:03 +0100 Subject: Fixed assert in Windows key handling Certain key sequences (like press alt, press left, release left, release alt) can cause an assert in qwindowskeymapper. This behavior was introduced in change I4f7709a90906b03f4504deea1ff5c361e9f94b3f (Fix virtual key mapping on MS Windows). The place that seems to cause the new behavior is changing the bitmask for obtaining the event's scancode. With the changed bitmask releasing the alt key in the given key sequence causes the WM_KEYUP event to trigger a WM_CHAR event which should not happen there. To be honest I don't know how having the extended bit inside the scancode fixes the behavior but it seems to do and I could not find another place which might cause the breakage. Task-number: QTBUG-35005 Change-Id: Ia18c2681ea311196441a5cd15017e220ac095674 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowskeymapper.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index e2594207fe..2743ef029d 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -86,6 +86,10 @@ QWindowsKeyMapper::~QWindowsKeyMapper() #define VK_OEM_3 0xC0 #endif +// We not only need the scancode itself but also the extended bit of key messages. Thus we need +// the additional bit when masking the scancode. +enum { scancodeBitmask = 0x1ff }; + // Key recorder ------------------------------------------------------------------------[ start ] -- struct KeyRecord { KeyRecord(int c, int a, int s, const QString &t) : code(c), ascii(a), state(s), text(t) {} @@ -567,7 +571,7 @@ void QWindowsKeyMapper::updateKeyMap(const MSG &msg) { unsigned char kbdBuffer[256]; // Will hold the complete keyboard state GetKeyboardState(kbdBuffer); - const quint32 scancode = (msg.lParam >> 16) & 0xff; + const quint32 scancode = (msg.lParam >> 16) & scancodeBitmask; updatePossibleKeyCodes(kbdBuffer, scancode, msg.wParam); } @@ -754,7 +758,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms { const int msgType = msg.message; - const quint32 scancode = (msg.lParam >> 16) & 0xff; + const quint32 scancode = (msg.lParam >> 16) & scancodeBitmask; const quint32 vk_key = msg.wParam; quint32 nModifiers = 0; -- cgit v1.2.3 From eafa224c3bfff86839581536d832cbaf8045a264 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Sun, 17 Nov 2013 01:32:24 +0100 Subject: iOS: decouple QIOSWindow and QIOSInputContext Change-Id: I85dda6fc0c6d2d11709b8bcdc0de6c0cef42d40f Reviewed-by: Lars Knoll --- src/plugins/platforms/ios/qiosinputcontext.h | 4 ++-- src/plugins/platforms/ios/qiosinputcontext.mm | 4 +++- src/plugins/platforms/ios/qioswindow.mm | 2 -- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosinputcontext.h b/src/plugins/platforms/ios/qiosinputcontext.h index 78c1b260e6..f03b13d002 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.h +++ b/src/plugins/platforms/ios/qiosinputcontext.h @@ -61,11 +61,11 @@ public: void hideInputPanel(); bool isInputPanelVisible() const; - void focusViewChanged(UIView *view); + void focusWindowChanged(QWindow *focusWindow); private: QIOSKeyboardListener *m_keyboardListener; - UIView *m_focusView; + UIView *m_focusView; bool m_hasPendingHideRequest; }; diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index d430589037..ed17dee0c9 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -101,6 +101,7 @@ QIOSInputContext::QIOSInputContext() , m_focusView(0) , m_hasPendingHideRequest(false) { + connect(qGuiApp, &QGuiApplication::focusWindowChanged, this, &QIOSInputContext::focusWindowChanged); } QIOSInputContext::~QIOSInputContext() @@ -142,8 +143,9 @@ bool QIOSInputContext::isInputPanelVisible() const return m_keyboardListener->m_keyboardVisible; } -void QIOSInputContext::focusViewChanged(UIView *view) +void QIOSInputContext::focusWindowChanged(QWindow *focusWindow) { + UIView *view = reinterpret_cast *>(focusWindow->handle()->winId()); if ([m_focusView isFirstResponder]) [view becomeFirstResponder]; [m_focusView release]; diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index af51218654..8124d8ffb9 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -610,8 +610,6 @@ void QIOSWindow::requestActivateWindow() if (window()->isTopLevel()) raise(); - QPlatformInputContext *context = QGuiApplicationPrivate::platformIntegration()->inputContext(); - static_cast(context)->focusViewChanged(m_view); QWindowSystemInterface::handleWindowActivated(window()); } -- cgit v1.2.3 From 7b6253efbf28b43c8b2a561c188670466ac3d916 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Wed, 20 Nov 2013 16:56:07 +0200 Subject: EGL convenience: deal with DefaultRenderableType when appropriate When encountering QSurfaceFormat::DefaultRenderableType, the surface format choosers should not default to OpenGL ES, but rather desktop OpenGL when Qt has been configured without ES2 support. Change-Id: I57aa7cfe63ebe0ffb32f4ba32808e62b0a4589f8 Reviewed-by: Gunnar Sletta --- .../eglconvenience/qeglconvenience.cpp | 29 ++++++++++++++++------ .../eglconvenience/qeglplatformcontext.cpp | 15 ++++++++--- 2 files changed, 34 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp index b711a2aebd..32f553a3f5 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience.cpp +++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp @@ -232,17 +232,28 @@ EGLConfig QEglConfigChooser::chooseConfig() configureAttributes.append(surfaceType()); configureAttributes.append(EGL_RENDERABLE_TYPE); - if (m_format.renderableType() == QSurfaceFormat::OpenVG) + switch (m_format.renderableType()) { + case QSurfaceFormat::OpenVG: configureAttributes.append(EGL_OPENVG_BIT); + break; #ifdef EGL_VERSION_1_4 - else if (m_format.renderableType() == QSurfaceFormat::OpenGL) +# if !defined(QT_OPENGL_ES_2) + case QSurfaceFormat::DefaultRenderableType: +# endif + case QSurfaceFormat::OpenGL: configureAttributes.append(EGL_OPENGL_BIT); + break; #endif - else if (m_format.majorVersion() == 1) - configureAttributes.append(EGL_OPENGL_ES_BIT); - else + case QSurfaceFormat::OpenGLES: + if (m_format.majorVersion() == 1) { + configureAttributes.append(EGL_OPENGL_ES_BIT); + break; + } + // fall through + default: configureAttributes.append(EGL_OPENGL_ES2_BIT); - + break; + } configureAttributes.append(EGL_NONE); EGLConfig cfg = 0; @@ -336,7 +347,11 @@ QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, if (referenceFormat.renderableType() == QSurfaceFormat::OpenVG && (renderableType & EGL_OPENVG_BIT)) format.setRenderableType(QSurfaceFormat::OpenVG); #ifdef EGL_VERSION_1_4 - else if (referenceFormat.renderableType() == QSurfaceFormat::OpenGL && (renderableType & EGL_OPENGL_BIT)) + else if ((referenceFormat.renderableType() == QSurfaceFormat::OpenGL +# if !defined(QT_OPENGL_ES_2) + || referenceFormat.renderableType() == QSurfaceFormat::DefaultRenderableType +# endif + ) && (renderableType & EGL_OPENGL_BIT)) format.setRenderableType(QSurfaceFormat::OpenGL); #endif else diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp index 34ba21afdc..714ad8a17e 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -49,14 +49,23 @@ static inline void bindApi(const QSurfaceFormat &format) { - if (format.renderableType() == QSurfaceFormat::OpenVG) + switch (format.renderableType()) { + case QSurfaceFormat::OpenVG: eglBindAPI(EGL_OPENVG_API); + break; #ifdef EGL_VERSION_1_4 - else if (format.renderableType() == QSurfaceFormat::OpenGL) +# if !defined(QT_OPENGL_ES_2) + case QSurfaceFormat::DefaultRenderableType: +# endif + case QSurfaceFormat::OpenGL: eglBindAPI(EGL_OPENGL_API); + break; #endif - else + case QSurfaceFormat::OpenGLES: + default: eglBindAPI(EGL_OPENGL_ES_API); + break; + } } QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, -- cgit v1.2.3 From ab76593f18396e693f24066592244ca95e135ea2 Mon Sep 17 00:00:00 2001 From: Chris Colbert Date: Mon, 18 Nov 2013 21:49:21 -0500 Subject: Fix the ignored Qt::WA_StaticContents on Windows This restores the ability from the Qt 4.x series to honor the static contents region in the backbuffer when resizing a widget. The fix only applies when running under Windows. Task-number: QTBUG-34799 [ChangeLog][QtWidgets][Windows] Update QWidgetBackingStore and QWindowsBackingStore to support Qt::WA_StaticContents QWidgetBackingStore::staticContents() was updated for windows to *not* unconditionally return false. It now returns true if it has a non-empty static widgets list. QWindowsBackingStore::resize(...) was updated to honor the provided static contents region. It now copies the static region into the new backbuffer in a manner similar to what was done in Qt4. The difference is that this version accounts for the possibility of the new buffer having a smaller region than the old buffer. In Qt4 the ::prepareBuffer method was only called when the buffer was resized larger. Change-Id: I135ff8fb16f52759089f1e7353426303c4504db3 Reviewed-by: Gunnar Sletta --- src/plugins/platforms/windows/qwindowsbackingstore.cpp | 18 +++++++++++++++++- src/widgets/kernel/qwidgetbackingstore_p.h | 8 +++++++- 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index 26205eb146..55e7b85d96 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -149,7 +149,23 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion ®ion) QImage::Format format = QWindowsNativeImage::systemFormat(); if (format == QImage::Format_RGB32 && rasterWindow()->window()->format().hasAlpha()) format = QImage::Format_ARGB32_Premultiplied; - m_image.reset(new QWindowsNativeImage(size.width(), size.height(), format)); + + QWindowsNativeImage *oldwni = m_image.data(); + QWindowsNativeImage *newwni = new QWindowsNativeImage(size.width(), size.height(), format); + + if (oldwni && !region.isEmpty()) { + const QImage &oldimg(oldwni->image()); + QImage &newimg(newwni->image()); + QRegion staticRegion(region); + staticRegion &= QRect(0, 0, oldimg.width(), oldimg.height()); + staticRegion &= QRect(0, 0, newimg.width(), newimg.height()); + QPainter painter(&newimg); + painter.setCompositionMode(QPainter::CompositionMode_Source); + foreach (const QRect &rect, staticRegion.rects()) + painter.drawImage(rect, oldimg, rect); + } + + m_image.reset(newwni); } } diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h index 39583c8caa..b6c3e13cb0 100644 --- a/src/widgets/kernel/qwidgetbackingstore_p.h +++ b/src/widgets/kernel/qwidgetbackingstore_p.h @@ -240,7 +240,13 @@ private: } inline bool hasStaticContents() const - { return !staticWidgets.isEmpty() && false; } + { +#if defined(Q_OS_WIN) + return !staticWidgets.isEmpty(); +#else + return !staticWidgets.isEmpty() && false; +#endif + } friend QRegion qt_dirtyRegion(QWidget *); friend class QWidgetPrivate; -- cgit v1.2.3 From 2f87fde9bb4bad6787101c0d135419b350b201a5 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 25 Nov 2013 09:52:02 +0100 Subject: Allow for QtDeclarative and QtQml to co-exist at run-time Qml has a bunch of hooks in QObject, that are callbacks as function pointers when things happen in QObject. QtDeclarative (Qml1) only needs one callback, for object destruction. In preparation for allowing both run-times to co-exist, this patch forks the callback, keeping the "default" variant for QtQml and having a *_qml1 variant for QtDeclarative. QtQml continues to set the callback variable for the default and QtDeclarative will set the _qml1 variant. It is however a limitation that a QObject instance can only be exposed to _one_ engine at a time, and it is not possible to make a transfer. Double exposure will result in crashes. This patch alone is not sufficient to fix the bug, the QQmlData/QDeclarativeData structures in Qml1 and Qml2 need to be extended to allow distinction at run-time. Task-number: QTBUG-35006 Change-Id: I3bac023873b5656a8a4f117fe816bafcda77b67d Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/corelib/kernel/qobject.cpp | 11 ++++++++--- src/corelib/kernel/qobject_p.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 282672ddc7..6ed3b30917 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -177,6 +177,7 @@ private: void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = 0; +void (*QAbstractDeclarativeData::destroyed_qml1)(QAbstractDeclarativeData *, QObject *) = 0; void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = 0; void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = 0; int (*QAbstractDeclarativeData::receivers)(QAbstractDeclarativeData *, const QObject *, int) = 0; @@ -805,8 +806,12 @@ QObject::~QObject() } } - if (d->declarativeData) - QAbstractDeclarativeData::destroyed(d->declarativeData, this); + if (d->declarativeData) { + if (QAbstractDeclarativeData::destroyed) + QAbstractDeclarativeData::destroyed(d->declarativeData, this); + if (QAbstractDeclarativeData::destroyed_qml1) + QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this); + } // set ref to zero to indicate that this object has been deleted if (d->currentSender != 0) @@ -1859,7 +1864,7 @@ void QObjectPrivate::setParent_helper(QObject *o) } } } - if (!isDeletingChildren && declarativeData) + if (!isDeletingChildren && declarativeData && QAbstractDeclarativeData::parentChanged) QAbstractDeclarativeData::parentChanged(declarativeData, q, o); } diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index f5745515c9..cd2d592cec 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -90,6 +90,7 @@ class Q_CORE_EXPORT QAbstractDeclarativeData { public: static void (*destroyed)(QAbstractDeclarativeData *, QObject *); + static void (*destroyed_qml1)(QAbstractDeclarativeData *, QObject *); static void (*parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *); static void (*signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **); static int (*receivers)(QAbstractDeclarativeData *, const QObject *, int); -- cgit v1.2.3 From f6cd378e2451823a30601f8942227a0ec0854dc4 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 21 Nov 2013 13:34:44 +0100 Subject: Mac style: Fix selected tab text color on 10.6 This is a regression introduced by 65b39b3cdcdfe175d80ccf9428168ed51be77fd8. Task-number: QTBUG-34540 Change-Id: I1f78337b13c806f6b6794b769cfe99206445ce7a Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qmacstyle_mac.mm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 503055e32f..d8922882eb 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -3865,8 +3865,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter ThemeTabDirection ttd = getTabDirection(myTab.shape); bool verticalTabs = ttd == kThemeTabWest || ttd == kThemeTabEast; bool selected = (myTab.state & QStyle::State_Selected); + bool usingModernOSX = QSysInfo::MacintoshVersion > QSysInfo::MV_10_6; - if (selected && !myTab.documentMode) + if (usingModernOSX && selected && !myTab.documentMode) myTab.palette.setColor(QPalette::WindowText, QColor(Qt::white)); // Check to see if we use have the same as the system font @@ -3874,7 +3875,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // outside world, unless they read the source, in which case, it's // their own fault). bool nonDefaultFont = p->font() != qt_app_fonts_hash()->value("QComboMenuItem"); - if (selected || verticalTabs || nonDefaultFont || !tab->icon.isNull() + if ((usingModernOSX && selected) || verticalTabs || nonDefaultFont || !tab->icon.isNull() || !myTab.leftButtonSize.isNull() || !myTab.rightButtonSize.isNull()) { int heightOffset = 0; if (verticalTabs) { @@ -3885,7 +3886,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } myTab.rect.setHeight(myTab.rect.height() + heightOffset); - if (myTab.documentMode || selected) { + if (myTab.documentMode || (usingModernOSX && selected)) { p->save(); rotateTabPainter(p, myTab.shape, myTab.rect); -- cgit v1.2.3 From 7e5bd5edfc204a493c00643ff885369a0ea459aa Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 21 Nov 2013 18:15:12 +0100 Subject: Mac style: Fix pressed tab appearance Change-Id: Ib2bfc5afcb4d1a9fa20f5b1ec90c4c239a97954e Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qmacstyle_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index d8922882eb..5db4801c37 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -3790,7 +3790,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } else if (!(tabOpt->state & State_Enabled)) { tdi.style = kThemeTabNonFrontInactive; } else if (tabOpt->state & State_Sunken) { - tdi.style = kThemeTabFrontInactive; // (should be kThemeTabNonFrontPressed) + tdi.style = kThemeTabNonFrontPressed; } if (tabOpt->state & State_HasFocus) tdi.adornment = kHIThemeTabAdornmentFocus; -- cgit v1.2.3 From 953d85e049786ddb5666d03b96da57fd546b9368 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 14 Nov 2013 09:58:25 +0100 Subject: iOS: scroll screen when keyboard opens MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change will let QIOSInputContext scroll the root view when the virtual keyboard is open, so that the input cursor is not obscured. Change-Id: If0758f4bf04c2b8e554e0196451154def7e3cb86 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosinputcontext.h | 1 + src/plugins/platforms/ios/qiosinputcontext.mm | 123 ++++++++++++++++++++++++-- src/plugins/platforms/ios/qioswindow.mm | 21 +++-- 3 files changed, 131 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosinputcontext.h b/src/plugins/platforms/ios/qiosinputcontext.h index f03b13d002..6ad2a808a6 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.h +++ b/src/plugins/platforms/ios/qiosinputcontext.h @@ -62,6 +62,7 @@ public: bool isInputPanelVisible() const; void focusWindowChanged(QWindow *focusWindow); + void scrollRootView(); private: QIOSKeyboardListener *m_keyboardListener; diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index ed17dee0c9..7aee1f9bd6 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -48,7 +48,12 @@ @public QIOSInputContext *m_context; BOOL m_keyboardVisible; + BOOL m_keyboardVisibleAndDocked; QRectF m_keyboardRect; + QRectF m_keyboardEndRect; + NSTimeInterval m_duration; + UIViewAnimationCurve m_curve; + UIViewController *m_viewController; } @end @@ -60,8 +65,30 @@ if (self) { m_context = context; m_keyboardVisible = NO; - // After the keyboard became undockable (iOS5), UIKeyboardWillShow/UIKeyboardWillHide - // no longer works for all cases. So listen to keyboard frame changes instead: + m_keyboardVisibleAndDocked = NO; + m_duration = 0; + m_curve = UIViewAnimationCurveEaseOut; + m_viewController = 0; + + if (isQtApplication()) { + // Get the root view controller that is on the same screen as the keyboard: + for (UIWindow *uiWindow in [[UIApplication sharedApplication] windows]) { + if (uiWindow.screen == [UIScreen mainScreen]) { + m_viewController = [uiWindow.rootViewController retain]; + break; + } + } + Q_ASSERT(m_viewController); + } + + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(keyboardWillShow:) + name:@"UIKeyboardWillShowNotification" object:nil]; + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(keyboardWillHide:) + name:@"UIKeyboardWillHideNotification" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidChangeFrame:) @@ -72,25 +99,68 @@ - (void) dealloc { + [m_viewController release]; + [[NSNotificationCenter defaultCenter] + removeObserver:self + name:@"UIKeyboardWillShowNotification" object:nil]; + [[NSNotificationCenter defaultCenter] + removeObserver:self + name:@"UIKeyboardWillHideNotification" object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:@"UIKeyboardDidChangeFrameNotification" object:nil]; [super dealloc]; } -- (void) keyboardDidChangeFrame:(NSNotification *)notification +- (QRectF) getKeyboardRect:(NSNotification *)notification { - CGRect frame; - [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&frame]; + // For Qt applications we rotate the keyboard rect to align with the screen + // orientation (which is the interface orientation of the root view controller). + // For hybrid apps we follow native behavior, and return the rect unmodified: + CGRect keyboardFrame = [[notification userInfo][UIKeyboardFrameEndUserInfoKey] CGRectValue]; + if (isQtApplication()) { + UIView *view = m_viewController.view; + return fromCGRect(CGRectOffset([view convertRect:keyboardFrame fromView:view.window], 0, -view.bounds.origin.y)); + } else { + return fromCGRect(keyboardFrame); + } +} - m_keyboardRect = fromPortraitToPrimary(fromCGRect(frame), QGuiApplication::primaryScreen()->handle()); +- (void) keyboardDidChangeFrame:(NSNotification *)notification +{ + m_keyboardRect = [self getKeyboardRect:notification]; m_context->emitKeyboardRectChanged(); - BOOL visible = CGRectIntersectsRect(frame, [UIScreen mainScreen].bounds); + BOOL visible = m_keyboardRect.intersects(fromCGRect([UIScreen mainScreen].bounds)); if (m_keyboardVisible != visible) { m_keyboardVisible = visible; m_context->emitInputPanelVisibleChanged(); } + + // If the keyboard was visible and docked from before, this is just a geometry + // change (normally caused by an orientation change). In that case, update scroll: + if (m_keyboardVisibleAndDocked) + m_context->scrollRootView(); +} + +- (void) keyboardWillShow:(NSNotification *)notification +{ + // Note that UIKeyboardWillShowNotification is only sendt when the keyboard is docked. + m_keyboardVisibleAndDocked = YES; + m_keyboardEndRect = [self getKeyboardRect:notification]; + if (!m_duration) { + m_duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; + m_curve = [notification.userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue] << 16; + } + m_context->scrollRootView(); +} + +- (void) keyboardWillHide:(NSNotification *)notification +{ + // Note that UIKeyboardWillHideNotification is also sendt when the keyboard is undocked. + m_keyboardVisibleAndDocked = NO; + m_keyboardEndRect = [self getKeyboardRect:notification]; + m_context->scrollRootView(); } @end @@ -101,6 +171,8 @@ QIOSInputContext::QIOSInputContext() , m_focusView(0) , m_hasPendingHideRequest(false) { + if (isQtApplication()) + connect(qGuiApp->inputMethod(), &QInputMethod::cursorRectangleChanged, this, &QIOSInputContext::scrollRootView); connect(qGuiApp, &QGuiApplication::focusWindowChanged, this, &QIOSInputContext::focusWindowChanged); } @@ -151,3 +223,40 @@ void QIOSInputContext::focusWindowChanged(QWindow *focusWindow) [m_focusView release]; m_focusView = [view retain]; } + +void QIOSInputContext::scrollRootView() +{ + // Scroll the root view (screen) if: + // - our backend controls the root view controller on the main screen (no hybrid app) + // - the focus object is on the same screen as the keyboard. + // - the first responder is a QUIView, and not some other foreign UIView. + // - the keyboard is docked. Otherwise the user can move the keyboard instead. + if (!isQtApplication() || !m_focusView) + return; + + UIView *view = m_keyboardListener->m_viewController.view; + qreal scrollTo = 0; + + if (m_focusView.isFirstResponder + && m_keyboardListener->m_keyboardVisibleAndDocked + && m_focusView.window == view.window) { + QRectF cursorRect = qGuiApp->inputMethod()->cursorRectangle(); + cursorRect.translate(qGuiApp->focusWindow()->geometry().topLeft()); + qreal keyboardY = m_keyboardListener->m_keyboardEndRect.y(); + int statusBarY = qGuiApp->primaryScreen()->availableGeometry().y(); + const int margin = 20; + + if (cursorRect.bottomLeft().y() > keyboardY - margin) + scrollTo = qMin(view.bounds.size.height - keyboardY, cursorRect.y() - statusBarY - margin); + } + + if (scrollTo != view.bounds.origin.y) { + // Scroll the view the same way a UIScrollView works: by changing bounds.origin: + CGRect newBounds = view.bounds; + newBounds.origin.y = scrollTo; + [UIView animateWithDuration:m_keyboardListener->m_duration delay:0 + options:m_keyboardListener->m_curve + animations:^{ view.bounds = newBounds; } + completion:0]; + } +} diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 8124d8ffb9..7030df5d32 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -181,11 +181,14 @@ QRect actualGeometry; if (m_qioswindow->window()->isTopLevel()) { UIWindow *uiWindow = self.window; + UIView *rootView = uiWindow.rootViewController.view; CGRect rootViewPositionInRelationToRootViewController = - [uiWindow.rootViewController.view convertRect:uiWindow.bounds fromView:uiWindow]; + [rootView convertRect:uiWindow.bounds fromView:uiWindow]; - actualGeometry = fromCGRect(CGRectOffset([self.superview convertRect:self.frame toView:uiWindow.rootViewController.view], - -rootViewPositionInRelationToRootViewController.origin.x, -rootViewPositionInRelationToRootViewController.origin.y)); + actualGeometry = fromCGRect(CGRectOffset([self.superview convertRect:self.frame toView:rootView], + -rootViewPositionInRelationToRootViewController.origin.x, + -rootViewPositionInRelationToRootViewController.origin.y + + rootView.bounds.origin.y)); } else { actualGeometry = fromCGRect(self.frame); } @@ -515,13 +518,17 @@ void QIOSWindow::applyGeometry(const QRect &rect) if (window()->isTopLevel()) { // The QWindow is in QScreen coordinates, which maps to a possibly rotated root-view-controller. // Since the root-view-controller might be translated in relation to the UIWindow, we need to - // check specifically for that and compensate. + // check specifically for that and compensate. Also check if the root view has been scrolled + // as a result of the keyboard being open. UIWindow *uiWindow = m_view.window; + UIView *rootView = uiWindow.rootViewController.view; CGRect rootViewPositionInRelationToRootViewController = - [uiWindow.rootViewController.view convertRect:uiWindow.bounds fromView:uiWindow]; + [rootView convertRect:uiWindow.bounds fromView:uiWindow]; - m_view.frame = CGRectOffset([m_view.superview convertRect:toCGRect(rect) fromView:m_view.window.rootViewController.view], - rootViewPositionInRelationToRootViewController.origin.x, rootViewPositionInRelationToRootViewController.origin.y); + m_view.frame = CGRectOffset([m_view.superview convertRect:toCGRect(rect) fromView:rootView], + rootViewPositionInRelationToRootViewController.origin.x, + rootViewPositionInRelationToRootViewController.origin.y + + rootView.bounds.origin.y); } else { // Easy, in parent's coordinates m_view.frame = toCGRect(rect); -- cgit v1.2.3 From 0bfc1c8647c0137de08c5f9b44b1c7be44a44c7d Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 20 Nov 2013 22:14:40 +0100 Subject: iOS: don't scroll after inputItem has moved MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the inputItem moves, it typically means that the user scrolls or flicks the focus item around. In that case we should avoid scrolling the screen, otherwise they will "cancel out" each other. Besides, when the user flicks, he takes control over the whereabouts on the screen anyway. Change-Id: Iad0762965f9dcdbcca934ce6d90a8c1413ce3ca2 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosinputcontext.h | 3 +++ src/plugins/platforms/ios/qiosinputcontext.mm | 13 +++++++++++++ 2 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosinputcontext.h b/src/plugins/platforms/ios/qiosinputcontext.h index 6ad2a808a6..3caadac29d 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.h +++ b/src/plugins/platforms/ios/qiosinputcontext.h @@ -44,6 +44,7 @@ #include +#include #include QT_BEGIN_NAMESPACE @@ -60,6 +61,7 @@ public: void showInputPanel(); void hideInputPanel(); bool isInputPanelVisible() const; + void setFocusObject(QObject *object); void focusWindowChanged(QWindow *focusWindow); void scrollRootView(); @@ -67,6 +69,7 @@ public: private: QIOSKeyboardListener *m_keyboardListener; UIView *m_focusView; + QTransform m_inputItemTransform; bool m_hasPendingHideRequest; }; diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index 7aee1f9bd6..547f405a01 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -215,6 +215,12 @@ bool QIOSInputContext::isInputPanelVisible() const return m_keyboardListener->m_keyboardVisible; } +void QIOSInputContext::setFocusObject(QObject *) +{ + m_inputItemTransform = qApp->inputMethod()->inputItemTransform(); + scrollRootView(); +} + void QIOSInputContext::focusWindowChanged(QWindow *focusWindow) { UIView *view = reinterpret_cast *>(focusWindow->handle()->winId()); @@ -231,9 +237,16 @@ void QIOSInputContext::scrollRootView() // - the focus object is on the same screen as the keyboard. // - the first responder is a QUIView, and not some other foreign UIView. // - the keyboard is docked. Otherwise the user can move the keyboard instead. + // - the inputItem has not been moved/scrolled if (!isQtApplication() || !m_focusView) return; + if (m_inputItemTransform != qApp->inputMethod()->inputItemTransform()) { + // The inputItem has moved since the last scroll update. To avoid competing + // with the application where the cursor/inputItem should be, we bail: + return; + } + UIView *view = m_keyboardListener->m_viewController.view; qreal scrollTo = 0; -- cgit v1.2.3 From 99474206f4538799f896c9bfc8fce8d676aded26 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 22 Nov 2013 17:41:39 +0100 Subject: iOS: don't loose precision when converting CG types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CGRect and CGPoint consist of CGFloat variables. So we should convert to QRectF and QPointF rather than QRect and QPoint. Change-Id: I76f180e4064f54d5810c49b88fdbbcd914bdb686 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosglobal.h | 9 +++++---- src/plugins/platforms/ios/qiosglobal.mm | 12 ++++++------ src/plugins/platforms/ios/qiosscreen.mm | 2 +- src/plugins/platforms/ios/qioswindow.mm | 8 ++++---- 4 files changed, 16 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosglobal.h b/src/plugins/platforms/ios/qiosglobal.h index 41b0d7f93a..1c76d29389 100644 --- a/src/plugins/platforms/ios/qiosglobal.h +++ b/src/plugins/platforms/ios/qiosglobal.h @@ -53,10 +53,11 @@ class QPlatformScreen; bool isQtApplication(); -CGRect toCGRect(const QRect &rect); -QRect fromCGRect(const CGRect &rect); -CGPoint toCGPoint(const QPoint &point); -QPoint fromCGPoint(const CGPoint &point); +CGRect toCGRect(const QRectF &rect); +QRectF fromCGRect(const CGRect &rect); +CGPoint toCGPoint(const QPointF &point); +QPointF fromCGPoint(const CGPoint &point); + Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientation); UIDeviceOrientation fromQtScreenOrientation(Qt::ScreenOrientation qtOrientation); QRect fromPortraitToPrimary(const QRect &rect, QPlatformScreen *screen); diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm index be68e4d7d5..d749b8f514 100644 --- a/src/plugins/platforms/ios/qiosglobal.mm +++ b/src/plugins/platforms/ios/qiosglobal.mm @@ -58,24 +58,24 @@ bool isQtApplication() return isQt; } -CGRect toCGRect(const QRect &rect) +CGRect toCGRect(const QRectF &rect) { return CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()); } -QRect fromCGRect(const CGRect &rect) +QRectF fromCGRect(const CGRect &rect) { - return QRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); + return QRectF(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); } -CGPoint toCGPoint(const QPoint &point) +CGPoint toCGPoint(const QPointF &point) { return CGPointMake(point.x(), point.y()); } -QPoint fromCGPoint(const CGPoint &point) +QPointF fromCGPoint(const CGPoint &point) { - return QPoint(point.x, point.y); + return QPointF(point.x, point.y); } Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientation) diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 42c3e13e7e..b8f4e387ed 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -158,7 +158,7 @@ void QIOSScreen::updateProperties() } bool inPortrait = UIInterfaceOrientationIsPortrait(uiWindow.rootViewController.interfaceOrientation); - QRect geometry = inPortrait ? fromCGRect(m_uiScreen.bounds) + QRect geometry = inPortrait ? fromCGRect(m_uiScreen.bounds).toRect() : QRect(m_uiScreen.bounds.origin.x, m_uiScreen.bounds.origin.y, m_uiScreen.bounds.size.height, m_uiScreen.bounds.size.width); diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 7030df5d32..d03889abb6 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -188,9 +188,9 @@ actualGeometry = fromCGRect(CGRectOffset([self.superview convertRect:self.frame toView:rootView], -rootViewPositionInRelationToRootViewController.origin.x, -rootViewPositionInRelationToRootViewController.origin.y - + rootView.bounds.origin.y)); + + rootView.bounds.origin.y)).toRect(); } else { - actualGeometry = fromCGRect(self.frame); + actualGeometry = fromCGRect(self.frame).toRect(); } // Persist the actual/new geometry so that QWindow::geometry() can @@ -214,7 +214,7 @@ - (void)displayLayer:(CALayer *)layer { - QRect geometry = fromCGRect(layer.frame); + QRect geometry = fromCGRect(layer.frame).toRect(); Q_ASSERT(m_qioswindow->geometry() == geometry); Q_ASSERT(self.hidden == !m_qioswindow->window()->isVisible()); @@ -242,7 +242,7 @@ } else { touchPoint.state = state; touchPoint.pressure = (state == Qt::TouchPointReleased) ? 0.0 : 1.0; - QPoint touchPos = fromCGPoint([uiTouch locationInView:rootView]); + QPoint touchPos = fromCGPoint([uiTouch locationInView:rootView]).toPoint(); touchPoint.area = QRectF(touchPos, QSize(0, 0)); touchPoint.normalPosition = QPointF(touchPos.x() / rootViewSize.width, touchPos.y() / rootViewSize.height); } -- cgit v1.2.3 From bdf0670c0299dbefb0dbd5c5937320574233e551 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 25 Nov 2013 11:30:56 +0100 Subject: iOS: add [QUIView updateTextInputTraits] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Configure QUIView text input traits from IM hints returned by the focus object when the view becomes first responder. This will affect the layout of the virtual keyboard. Change-Id: Ib140ba69d01cc747f3ac3cdd70dd2e7daede26b0 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.mm | 52 +++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index d03889abb6..e53ab189ca 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -108,15 +108,7 @@ [NSNumber numberWithBool:YES], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil]; - // Set up text input - autocapitalizationType = UITextAutocapitalizationTypeNone; - autocorrectionType = UITextAutocorrectionTypeNo; - enablesReturnKeyAutomatically = NO; - keyboardAppearance = UIKeyboardAppearanceDefault; - keyboardType = UIKeyboardTypeDefault; - returnKeyType = UIReturnKeyDone; - secureTextEntry = NO; - m_nextTouchId = 0; + [self updateTextInputTraits]; if (isQtApplication()) self.hidden = YES; @@ -343,6 +335,7 @@ // user cannot type. And since the keyboard will open when a view becomes // the first responder, it's now a good time to inform QPA that the QWindow // this view backs became active: + [self updateTextInputTraits]; QWindowSystemInterface::handleWindowActivated(m_qioswindow->window()); return [super becomeFirstResponder]; } @@ -384,6 +377,47 @@ 0, QEvent::KeyRelease, (int)Qt::Key_Backspace, Qt::NoModifier); } +- (void)updateTextInputTraits +{ + // Ask the current focus object what kind of input it + // expects, and configure the keyboard appropriately: + QObject *focusObject = QGuiApplication::focusObject(); + if (!focusObject) + return; + QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImHints); + if (!QCoreApplication::sendEvent(focusObject, &queryEvent)) + return; + if (!queryEvent.value(Qt::ImEnabled).toBool()) + return; + + Qt::InputMethodHints hints = static_cast(queryEvent.value(Qt::ImHints).toUInt()); + + self.returnKeyType = (hints & Qt::ImhMultiLine) ? UIReturnKeyDefault : UIReturnKeyDone; + self.secureTextEntry = BOOL(hints & Qt::ImhHiddenText); + self.autocorrectionType = (hints & Qt::ImhNoPredictiveText) ? + UITextAutocorrectionTypeNo : UITextAutocorrectionTypeDefault; + + if (hints & Qt::ImhUppercaseOnly) + self.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters; + else if (hints & Qt::ImhNoAutoUppercase) + self.autocapitalizationType = UITextAutocapitalizationTypeNone; + else + self.autocapitalizationType = UITextAutocapitalizationTypeSentences; + + if (hints & Qt::ImhUrlCharactersOnly) + self.keyboardType = UIKeyboardTypeURL; + else if (hints & Qt::ImhEmailCharactersOnly) + self.keyboardType = UIKeyboardTypeEmailAddress; + else if (hints & Qt::ImhDigitsOnly) + self.keyboardType = UIKeyboardTypeNumberPad; + else if (hints & Qt::ImhFormattedNumbersOnly) + self.keyboardType = UIKeyboardTypeDecimalPad; + else if (hints & Qt::ImhDialableCharactersOnly) + self.keyboardType = UIKeyboardTypeNumberPad; + else + self.keyboardType = UIKeyboardTypeDefault; +} + @end @implementation UIView (QIOS) -- cgit v1.2.3 From 484d6ce7764183b6d215310735eeef3e23332d1d Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Sat, 16 Nov 2013 10:59:17 +0100 Subject: iOS: update keyboard layout upon focus transfer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When iOS transfers focus from one view to another, it asks the new view for its UIKeyInput properties before deciding how the keyboard should be configured. For Qt, the same QUIView is used for the whole QWindow which means that UIKit will not change the keyboard configuration just because we change the focus object in Qt, since the UIView does not change. There seems to be no way to tell UIKit that the keyboard needs to change becuse the UIKeyInput properties has changed. To work around this, we briefly resign first responder status, and grabs it again, for the same QUIView. Change-Id: I2d15cc0c928deb023e7da58ad4669b7099dce2cf Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosinputcontext.h | 1 + src/plugins/platforms/ios/qiosinputcontext.mm | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosinputcontext.h b/src/plugins/platforms/ios/qiosinputcontext.h index 3caadac29d..533ba686e1 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.h +++ b/src/plugins/platforms/ios/qiosinputcontext.h @@ -71,6 +71,7 @@ private: UIView *m_focusView; QTransform m_inputItemTransform; bool m_hasPendingHideRequest; + bool m_inSetFocusObject; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index 547f405a01..0e43429015 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -170,6 +170,7 @@ QIOSInputContext::QIOSInputContext() , m_keyboardListener([[QIOSKeyboardListener alloc] initWithQIOSInputContext:this]) , m_focusView(0) , m_hasPendingHideRequest(false) + , m_inSetFocusObject(false) { if (isQtApplication()) connect(qGuiApp->inputMethod(), &QInputMethod::cursorRectangleChanged, this, &QIOSInputContext::scrollRootView); @@ -218,7 +219,22 @@ bool QIOSInputContext::isInputPanelVisible() const void QIOSInputContext::setFocusObject(QObject *) { m_inputItemTransform = qApp->inputMethod()->inputItemTransform(); - scrollRootView(); + + if (!m_focusView || !m_focusView.isFirstResponder) + return; + + // Since m_focusView is the first responder, it means that the keyboard is open and we + // should update keyboard layout. But there seem to be no way to tell it to reread the + // UITextInputTraits from m_focusView. To work around that, we quickly resign first + // responder status just to reassign it again. To not remove the focusObject in the same + // go, we need to call the super implementation of resignFirstResponder. Since the call + // will cause a 'keyboardWillHide' notification to be sendt, we also block scrollRootView + // to avoid artifacts: + m_inSetFocusObject = true; + SEL sel = @selector(resignFirstResponder); + [[m_focusView superclass] instanceMethodForSelector:sel](m_focusView, sel); + m_inSetFocusObject = false; + [m_focusView becomeFirstResponder]; } void QIOSInputContext::focusWindowChanged(QWindow *focusWindow) @@ -238,7 +254,7 @@ void QIOSInputContext::scrollRootView() // - the first responder is a QUIView, and not some other foreign UIView. // - the keyboard is docked. Otherwise the user can move the keyboard instead. // - the inputItem has not been moved/scrolled - if (!isQtApplication() || !m_focusView) + if (!isQtApplication() || !m_focusView || m_inSetFocusObject) return; if (m_inputItemTransform != qApp->inputMethod()->inputItemTransform()) { -- cgit v1.2.3 From b61928e646fbcdbc8367f9231e23b22cebf2e4fb Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 25 Nov 2013 16:53:20 +0100 Subject: iOS: close keyboard upon hitting key 'done' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0098cc4d51ca600ba48baa15ed9c16e56529b947 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index e53ab189ca..66552fae4f 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -358,8 +358,11 @@ { QString string = QString::fromUtf8([text UTF8String]); int key = 0; - if ([text isEqualToString:@"\n"]) + if ([text isEqualToString:@"\n"]) { key = (int)Qt::Key_Return; + if (self.returnKeyType == UIReturnKeyDone) + [self resignFirstResponder]; + } // Send key event to window system interface QWindowSystemInterface::handleKeyEvent( -- cgit v1.2.3 From 7201148be075632124db3d6a4046b590dad09884 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 25 Nov 2013 13:13:11 +0100 Subject: Revert "Android: Use native platform menus." This reverts commit 98f0b4668999d677d8bf91d57ac095d96e7a661c. The native menu popup would never exit its event loop, because there's no listener for the closing of the menu. Since this is very last minute and the change is not ready, we revert it and use the widget menus instead. Change-Id: Ie9ae707300a265130a90d1ccb5f093f50cc0b2fb Reviewed-by: Paul Olav Tvete --- src/widgets/widgets/qmenu.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 0cbd1c720c..3a4fd449c8 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1834,14 +1834,6 @@ QSize QMenu::sizeHint() const void QMenu::popup(const QPoint &p, QAction *atAction) { Q_D(QMenu); - -#ifdef Q_OS_ANDROID - if (!d->platformMenu.isNull() && !testAttribute(Qt::WA_SetStyle)) { - d->platformMenu->showPopup(window()->windowHandle(), p, 0); - return; - } -#endif - if (d->scroll) { // reset scroll state from last popup if (d->scroll->scrollOffset) d->itemsDirty = 1; // sizeHint will be incorrect if there is previous scroll -- cgit v1.2.3 From 6318a6879db56e804108b1bea08fc3dee7d3b62a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 22 Nov 2013 13:15:35 +0100 Subject: iOS: Don't enable translucent statusbar for iOS6 on iPads It's only available on iPhone/iPods. Change-Id: I61b45c84ddb2b3db46fff36286a6582406fa7d26 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosapplicationdelegate.mm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm index e325666f69..cf702c82af 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm @@ -58,6 +58,7 @@ self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; self.window.rootViewController = [[[QIOSViewController alloc] init] autorelease]; +#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_7_0) QSysInfo::MacVersion iosVersion = QSysInfo::MacintoshVersion; // We prefer to keep the root viewcontroller in fullscreen layout, so that @@ -67,12 +68,14 @@ if (iosVersion < QSysInfo::MV_IOS_7_0) self.window.rootViewController.wantsFullScreenLayout = YES; - // Use translucent statusbar by default on iOS6 (unless the user changed the - // default in the Info.plist), so that windows placed under the stausbar are + // Use translucent statusbar by default on iOS6 iPhones (unless the user changed + // the default in the Info.plist), so that windows placed under the stausbar are // still visible, just like on iOS7. if (iosVersion >= QSysInfo::MV_IOS_6_0 && iosVersion < QSysInfo::MV_IOS_7_0 + && [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone && [UIApplication sharedApplication].statusBarStyle == UIStatusBarStyleDefault) [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent]; +#endif self.window.hidden = NO; -- cgit v1.2.3 From 8f324765425fdc4d2ecd9c82ec505d22f057358f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 22 Nov 2013 13:16:14 +0100 Subject: iOS: Don't warn about QBackingStore::resize() != window.size() for widgets QtWidgets uses stale geometry data to do its backingstore resizes in a lot of places, eg QWidgetPrivate::setGeometry_sys() and show_sys(). As the resize doesn't have any effect for our GL backingstore anyways we can skip the warning to keep console noise down. Change-Id: Ie578f7faf35985708fddd0bfca4a7080820192c5 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Gunnar Sletta --- src/plugins/platforms/ios/qiosbackingstore.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosbackingstore.mm b/src/plugins/platforms/ios/qiosbackingstore.mm index 80b603bb8e..5ea5fbd8d1 100644 --- a/src/plugins/platforms/ios/qiosbackingstore.mm +++ b/src/plugins/platforms/ios/qiosbackingstore.mm @@ -117,7 +117,7 @@ void QIOSBackingStore::resize(const QSize &size, const QRegion &staticContents) // backing store and always keep the paint device's size in sync with the // window size in beginPaint(). - if (size != window()->size()) + if (size != window()->size() && !window()->inherits("QWidgetWindow")) qWarning() << "QIOSBackingStore needs to have the same size as its window"; } -- cgit v1.2.3 From 6820ac594af949527d17d0b32205377fc767f527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 25 Nov 2013 15:07:21 +0100 Subject: iOS: Prefer window states over geometry-heuristics when laying out windows A window that was resized to the full screen size of the screen would otherwise always stay in full screen, even if the window state was maximized. Change-Id: I4720f7b6ad1d85658ea96c6da0515693e8c827f3 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosscreen.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index b8f4e387ed..7746163357 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -231,9 +231,13 @@ void QIOSScreen::layoutWindows() if (!platformWindow) continue; - if (window->windowState() & Qt::WindowFullScreen || window->geometry() == oldGeometry) + // FIXME: Handle more complex cases of no-state and/or child windows when rotating + + if (window->windowState() & Qt::WindowFullScreen + || (window->windowState() & Qt::WindowNoState && window->geometry() == oldGeometry)) platformWindow->applyGeometry(newGeometry); - else if (window->windowState() & Qt::WindowMaximized || window->geometry() == oldAvailableGeometry) + else if (window->windowState() & Qt::WindowMaximized + || (window->windowState() & Qt::WindowNoState && window->geometry() == oldAvailableGeometry)) platformWindow->applyGeometry(newAvailableGeometry); } } -- cgit v1.2.3 From c2f08598e1cc3089505dd8037d333071da0f231f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 25 Nov 2013 15:45:43 +0100 Subject: iOS: Update statusbar visibility and screen properties before window geometry When setting a new window state. Otherwise we set the geometry based on the old screen properties, and then rely on the properties causing another window layout, which may not always happen. We also need to explicitly update the screen properties when the statusbar changes visibility, as there are no callbacks from iOS that consistently gives us that information. Change-Id: I1c3328aa3f34d294bc7db8884e611d205fd2c761 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosscreen.mm | 4 ++++ src/plugins/platforms/ios/qioswindow.mm | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 7746163357..57522cb1a3 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -205,10 +205,14 @@ void QIOSScreen::updateStatusBarVisibility() } else #endif { + bool wasHidden = [UIApplication sharedApplication].statusBarHidden; QIOSViewController *viewController = static_cast(view.viewController); [[UIApplication sharedApplication] setStatusBarHidden:[viewController prefersStatusBarHidden] withAnimation:UIStatusBarAnimationNone]; + + if ([UIApplication sharedApplication].statusBarHidden != wasHidden) + updateProperties(); } } diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 66552fae4f..0dd810bdf6 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -581,6 +581,14 @@ void QIOSWindow::applyGeometry(const QRect &rect) void QIOSWindow::setWindowState(Qt::WindowState state) { + // Update the QWindow representation straight away, so that + // we can update the statusbar visibility based on the new + // state before applying geometry changes. + qt_window_private(window())->windowState = state; + + if (window()->isTopLevel() && window()->isVisible() && window()->isActive()) + static_cast(screen())->updateStatusBarVisibility(); + switch (state) { case Qt::WindowNoState: applyGeometry(m_normalGeometry); @@ -599,14 +607,6 @@ void QIOSWindow::setWindowState(Qt::WindowState state) default: Q_UNREACHABLE(); } - - if (window()->isTopLevel() && window()->isVisible() && window()->isActive()) { - // The window state of the QWindow is not updated until after - // we return from this method, so we have to defer any updates - // of the statusbar that depend on the current window state. - QMetaObject::invokeMethod(static_cast(screen()), - "updateStatusBarVisibility", Qt::QueuedConnection); - } } void QIOSWindow::setParent(const QPlatformWindow *parentWindow) -- cgit v1.2.3 From 41ecf56cf70a2f02473e02e7332aa1f2d45caf02 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 24 Nov 2013 13:40:37 +0100 Subject: src/gui/text: whitespace fixes Change-Id: Idd0e0673d76a23593b03558e18bc6afbdb9b38ab Reviewed-by: Oswald Buddenhagen --- src/gui/text/qfontengine_ft.cpp | 2 +- src/gui/text/qtextdocument.cpp | 2 +- src/gui/text/qtextdocument_p.cpp | 76 ++++++++++----------- src/gui/text/qtextdocument_p.h | 2 +- src/gui/text/qtextlist.cpp | 4 +- src/gui/text/qtexttable.cpp | 14 ++-- src/gui/text/text.pri | 144 +++++++++++++++++++-------------------- 7 files changed, 122 insertions(+), 122 deletions(-) (limited to 'src') diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 6af97145d6..42cf15ee3b 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -112,7 +112,7 @@ QT_BEGIN_NAMESPACE #endif #define FLOOR(x) ((x) & -64) -#define CEIL(x) (((x)+63) & -64) +#define CEIL(x) (((x)+63) & -64) #define TRUNC(x) ((x) >> 6) #define ROUND(x) (((x)+32) & -64) diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 30e0f32547..4a34f0d3c3 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -2491,7 +2491,7 @@ static bool isOrderedList(int style) || style == QTextListFormat::ListUpperAlpha || style == QTextListFormat::ListUpperRoman || style == QTextListFormat::ListLowerRoman - ; + ; } void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block) diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index f0910dd52d..4b6ce667fa 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -632,7 +632,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O blockRevision); if (key+1 != blocks.position(b)) { -// qDebug("remove_string from %d length %d", key, X->size_array[0]); +// qDebug("remove_string from %d length %d", key, X->size_array[0]); Q_ASSERT(noBlockInString(text.mid(X->stringPosition, X->size_array[0]))); w = remove_string(key, X->size_array[0], op); @@ -641,7 +641,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O dstKey += X->size_array[0]; } } else { -// qDebug("remove_block at %d", key); +// qDebug("remove_block at %d", key); Q_ASSERT(X->size_array[0] == 1 && isValidBlockSeparator(text.at(X->stringPosition))); b = blocks.previous(b); B = 0; @@ -779,7 +779,7 @@ void QTextDocumentPrivate::setCharFormat(int pos, int length, const QTextCharFor } void QTextDocumentPrivate::setBlockFormat(const QTextBlock &from, const QTextBlock &to, - const QTextBlockFormat &newFormat, FormatChangeMode mode) + const QTextBlockFormat &newFormat, FormatChangeMode mode) { beginEditBlock(); @@ -795,7 +795,7 @@ void QTextDocumentPrivate::setBlockFormat(const QTextBlock &from, const QTextBlo QTextBlock it = from; QTextBlock end = to; if (end.isValid()) - end = end.next(); + end = end.next(); for (; it != end; it = it.next()) { int oldFormat = block(it)->format; @@ -820,8 +820,8 @@ void QTextDocumentPrivate::setBlockFormat(const QTextBlock &from, const QTextBlo if (group) group->blockInserted(it); } else if (group) { - group->blockFormatChanged(it); - } + group->blockFormatChanged(it); + } } documentChange(from.position(), to.position() + to.length() - from.position()); @@ -892,14 +892,14 @@ int QTextDocumentPrivate::undoRedo(bool undo) QTextUndoCommand &c = undoStack[undoState]; int resetBlockRevision = c.pos; - switch(c.command) { + switch (c.command) { case QTextUndoCommand::Inserted: remove(c.pos, c.length, (QTextUndoCommand::Operation)c.operation); PMDEBUG(" erase: from %d, length %d", c.pos, c.length); c.command = QTextUndoCommand::Removed; editPos = c.pos; editLength = 0; - break; + break; case QTextUndoCommand::Removed: PMDEBUG(" insert: format %d (from %d, length %d, strpos=%d)", c.format, c.pos, c.length, c.strPos); insert_string(c.pos, c.strPos, c.length, c.format, (QTextUndoCommand::Operation)c.operation); @@ -908,33 +908,33 @@ int QTextDocumentPrivate::undoRedo(bool undo) editLength = 0; editPos = c.pos; editLength += c.length; - break; - case QTextUndoCommand::BlockInserted: - case QTextUndoCommand::BlockAdded: + break; + case QTextUndoCommand::BlockInserted: + case QTextUndoCommand::BlockAdded: remove_block(c.pos, &c.blockFormat, c.command, (QTextUndoCommand::Operation)c.operation); PMDEBUG(" blockremove: from %d", c.pos); - if (c.command == QTextUndoCommand::BlockInserted) - c.command = QTextUndoCommand::BlockRemoved; - else - c.command = QTextUndoCommand::BlockDeleted; + if (c.command == QTextUndoCommand::BlockInserted) + c.command = QTextUndoCommand::BlockRemoved; + else + c.command = QTextUndoCommand::BlockDeleted; editPos = c.pos; editLength = 0; - break; - case QTextUndoCommand::BlockRemoved: - case QTextUndoCommand::BlockDeleted: + break; + case QTextUndoCommand::BlockRemoved: + case QTextUndoCommand::BlockDeleted: PMDEBUG(" blockinsert: charformat %d blockformat %d (pos %d, strpos=%d)", c.format, c.blockFormat, c.pos, c.strPos); insert_block(c.pos, c.strPos, c.format, c.blockFormat, (QTextUndoCommand::Operation)c.operation, c.command); resetBlockRevision += 1; - if (c.command == QTextUndoCommand::BlockRemoved) - c.command = QTextUndoCommand::BlockInserted; - else - c.command = QTextUndoCommand::BlockAdded; + if (c.command == QTextUndoCommand::BlockRemoved) + c.command = QTextUndoCommand::BlockInserted; + else + c.command = QTextUndoCommand::BlockAdded; if (editPos != (int)c.pos) editLength = 0; editPos = c.pos; editLength += 1; - break; - case QTextUndoCommand::CharFormatChanged: { + break; + case QTextUndoCommand::CharFormatChanged: { resetBlockRevision = -1; // ## TODO PMDEBUG(" charFormat: format %d (from %d, length %d)", c.format, c.pos, c.length); FragmentIterator it = find(c.pos); @@ -947,9 +947,9 @@ int QTextDocumentPrivate::undoRedo(bool undo) editLength = 0; editPos = c.pos; editLength += c.length; - break; - } - case QTextUndoCommand::BlockFormatChanged: { + break; + } + case QTextUndoCommand::BlockFormatChanged: { resetBlockRevision = -1; // ## TODO PMDEBUG(" blockformat: format %d pos %d", c.format, c.pos); QTextBlock it = blocksFind(c.pos); @@ -970,9 +970,9 @@ int QTextDocumentPrivate::undoRedo(bool undo) } documentChange(it.position(), it.length()); editPos = -1; - break; - } - case QTextUndoCommand::GroupFormatChange: { + break; + } + case QTextUndoCommand::GroupFormatChange: { resetBlockRevision = -1; // ## TODO PMDEBUG(" group format change"); QTextObject *object = objectForIndex(c.objectIndex); @@ -980,22 +980,22 @@ int QTextDocumentPrivate::undoRedo(bool undo) changeObjectFormat(object, c.format); c.format = oldFormat; editPos = -1; - break; - } + break; + } case QTextUndoCommand::CursorMoved: editPos = c.pos; editLength = 0; break; - case QTextUndoCommand::Custom: + case QTextUndoCommand::Custom: resetBlockRevision = -1; // ## TODO if (undo) c.custom->undo(); else c.custom->redo(); editPos = -1; - break; - default: - Q_ASSERT(false); + break; + default: + Q_ASSERT(false); } if (resetBlockRevision >= 0) { @@ -1315,9 +1315,9 @@ void QTextDocumentPrivate::adjustDocumentChangesAndCursors(int from, int addedOr int removed = qMax(0, -addedOrRemoved); int diff = 0; - if(from + removed < docChangeFrom) + if (from + removed < docChangeFrom) diff = docChangeFrom - from - removed; - else if(from > docChangeFrom + docChangeLength) + else if (from > docChangeFrom + docChangeLength) diff = from - (docChangeFrom + docChangeLength); int overlap_start = qMax(from, docChangeFrom); diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h index 1394e88465..8d4cab30ae 100644 --- a/src/gui/text/qtextdocument_p.h +++ b/src/gui/text/qtextdocument_p.h @@ -194,7 +194,7 @@ public: void setCharFormat(int pos, int length, const QTextCharFormat &newFormat, FormatChangeMode mode = SetFormat); void setBlockFormat(const QTextBlock &from, const QTextBlock &to, - const QTextBlockFormat &newFormat, FormatChangeMode mode = SetFormat); + const QTextBlockFormat &newFormat, FormatChangeMode mode = SetFormat); void emitUndoAvailable(bool available); void emitRedoAvailable(bool available); diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp index f969f66006..15c16f1ec0 100644 --- a/src/gui/text/qtextlist.cpp +++ b/src/gui/text/qtextlist.cpp @@ -265,8 +265,8 @@ QString QTextList::itemText(const QTextBlock &blockIt) const result = QLatin1String("?"); } - } - break; + } + break; default: Q_ASSERT(false); } diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index d77cbf9671..045fe7f957 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -355,12 +355,12 @@ QTextTable *QTextTablePrivate::createTable(QTextDocumentPrivate *pieceTable, int for (int i = 1; i < rows*cols; ++i) { d->cells.append(pieceTable->insertBlock(QTextBeginningOfFrame, pos, cellIdx, charIdx)); -// qDebug(" addCell at %d", pos); +// qDebug(" addCell at %d", pos); ++pos; } d->fragment_end = pieceTable->insertBlock(QTextEndOfFrame, pos, cellIdx, charIdx); -// qDebug(" addEOR at %d", pos); +// qDebug(" addEOR at %d", pos); ++pos; d->blockFragmentUpdates = false; @@ -482,7 +482,7 @@ void QTextTablePrivate::update() const for (int jj = 0; jj < colspan; ++jj) { Q_ASSERT(grid[(r+ii)*nCols + c+jj] == 0); grid[(r+ii)*nCols + c+jj] = fragment; -// qDebug(" setting cell %d span=%d/%d at %d/%d", fragment, rowspan, colspan, r+ii, c+jj); +// qDebug(" setting cell %d span=%d/%d at %d/%d", fragment, rowspan, colspan, r+ii, c+jj); } } } @@ -654,7 +654,7 @@ void QTextTable::resize(int rows, int cols) int nCols = this->columns(); if (rows == nRows && cols == nCols) - return; + return; d->pieceTable->beginEditBlock(); @@ -682,7 +682,7 @@ void QTextTable::insertRows(int pos, int num) { Q_D(QTextTable); if (num <= 0) - return; + return; if (d->dirty) d->update(); @@ -744,7 +744,7 @@ void QTextTable::insertColumns(int pos, int num) { Q_D(QTextTable); if (num <= 0) - return; + return; if (d->dirty) d->update(); @@ -932,7 +932,7 @@ void QTextTable::removeColumns(int pos, int num) // qDebug() << "-------- removeCols" << pos << num; if (num <= 0 || pos < 0) - return; + return; if (d->dirty) d->update(); if (pos >= d->nCols) diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri index 59a6f346e2..2a0e4eff32 100644 --- a/src/gui/text/text.pri +++ b/src/gui/text/text.pri @@ -1,89 +1,89 @@ # Qt kernel module HEADERS += \ - text/qfont.h \ - text/qfontdatabase.h \ - text/qfontengine_p.h \ - text/qfontengineglyphcache_p.h \ - text/qfontinfo.h \ - text/qfontmetrics.h \ - text/qfont_p.h \ - text/qfontsubset_p.h \ - text/qtextengine_p.h \ - text/qtextlayout.h \ - text/qtextformat.h \ - text/qtextformat_p.h \ - text/qtextobject.h \ - text/qtextobject_p.h \ - text/qtextoption.h \ - text/qfragmentmap_p.h \ - text/qtextdocument.h \ - text/qtextdocument_p.h \ - text/qtexthtmlparser_p.h \ - text/qabstracttextdocumentlayout.h \ - text/qtextdocumentlayout_p.h \ - text/qtextcursor.h \ - text/qtextcursor_p.h \ - text/qtextdocumentfragment.h \ - text/qtextdocumentfragment_p.h \ - text/qtextimagehandler_p.h \ - text/qtexttable.h \ - text/qtextlist.h \ - text/qsyntaxhighlighter.h \ - text/qtextdocumentwriter.h \ - text/qcssparser_p.h \ - text/qtexttable_p.h \ - text/qzipreader_p.h \ - text/qzipwriter_p.h \ - text/qtextodfwriter_p.h \ - text/qstatictext_p.h \ - text/qstatictext.h \ - text/qrawfont.h \ - text/qrawfont_p.h \ + text/qfont.h \ + text/qfontdatabase.h \ + text/qfontengine_p.h \ + text/qfontengineglyphcache_p.h \ + text/qfontinfo.h \ + text/qfontmetrics.h \ + text/qfont_p.h \ + text/qfontsubset_p.h \ + text/qtextengine_p.h \ + text/qtextlayout.h \ + text/qtextformat.h \ + text/qtextformat_p.h \ + text/qtextobject.h \ + text/qtextobject_p.h \ + text/qtextoption.h \ + text/qfragmentmap_p.h \ + text/qtextdocument.h \ + text/qtextdocument_p.h \ + text/qtexthtmlparser_p.h \ + text/qabstracttextdocumentlayout.h \ + text/qtextdocumentlayout_p.h \ + text/qtextcursor.h \ + text/qtextcursor_p.h \ + text/qtextdocumentfragment.h \ + text/qtextdocumentfragment_p.h \ + text/qtextimagehandler_p.h \ + text/qtexttable.h \ + text/qtextlist.h \ + text/qsyntaxhighlighter.h \ + text/qtextdocumentwriter.h \ + text/qcssparser_p.h \ + text/qtexttable_p.h \ + text/qzipreader_p.h \ + text/qzipwriter_p.h \ + text/qtextodfwriter_p.h \ + text/qstatictext_p.h \ + text/qstatictext.h \ + text/qrawfont.h \ + text/qrawfont_p.h \ text/qglyphrun.h \ text/qglyphrun_p.h \ text/qdistancefield_p.h SOURCES += \ - text/qfont.cpp \ - text/qfontengine.cpp \ - text/qfontsubset.cpp \ - text/qfontmetrics.cpp \ - text/qfontdatabase.cpp \ - text/qtextengine.cpp \ - text/qtextlayout.cpp \ - text/qtextformat.cpp \ - text/qtextobject.cpp \ - text/qtextoption.cpp \ - text/qfragmentmap.cpp \ - text/qtextdocument.cpp \ - text/qtextdocument_p.cpp \ - text/qtexthtmlparser.cpp \ - text/qabstracttextdocumentlayout.cpp \ - text/qtextdocumentlayout.cpp \ - text/qtextcursor.cpp \ - text/qtextdocumentfragment.cpp \ - text/qtextimagehandler.cpp \ - text/qtexttable.cpp \ - text/qtextlist.cpp \ - text/qtextdocumentwriter.cpp \ - text/qsyntaxhighlighter.cpp \ - text/qcssparser.cpp \ - text/qzip.cpp \ - text/qtextodfwriter.cpp \ - text/qstatictext.cpp \ - text/qrawfont.cpp \ + text/qfont.cpp \ + text/qfontengine.cpp \ + text/qfontsubset.cpp \ + text/qfontmetrics.cpp \ + text/qfontdatabase.cpp \ + text/qtextengine.cpp \ + text/qtextlayout.cpp \ + text/qtextformat.cpp \ + text/qtextobject.cpp \ + text/qtextoption.cpp \ + text/qfragmentmap.cpp \ + text/qtextdocument.cpp \ + text/qtextdocument_p.cpp \ + text/qtexthtmlparser.cpp \ + text/qabstracttextdocumentlayout.cpp \ + text/qtextdocumentlayout.cpp \ + text/qtextcursor.cpp \ + text/qtextdocumentfragment.cpp \ + text/qtextimagehandler.cpp \ + text/qtexttable.cpp \ + text/qtextlist.cpp \ + text/qtextdocumentwriter.cpp \ + text/qsyntaxhighlighter.cpp \ + text/qcssparser.cpp \ + text/qzip.cpp \ + text/qtextodfwriter.cpp \ + text/qstatictext.cpp \ + text/qrawfont.cpp \ text/qglyphrun.cpp \ text/qdistancefield.cpp SOURCES += \ - text/qfont_qpa.cpp \ - text/qfontengine_qpa.cpp \ - text/qplatformfontdatabase.cpp \ - text/qrawfont_qpa.cpp + text/qfont_qpa.cpp \ + text/qfontengine_qpa.cpp \ + text/qplatformfontdatabase.cpp \ + text/qrawfont_qpa.cpp HEADERS += \ - text/qplatformfontdatabase.h + text/qplatformfontdatabase.h contains(QT_CONFIG, harfbuzz)|contains(QT_CONFIG, system-harfbuzz) { DEFINES += QT_ENABLE_HARFBUZZ_NG -- cgit v1.2.3 From 25b2b682d616dd52c3515f443e3d25fc0224f3a2 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 22 Nov 2013 16:00:36 +0100 Subject: Evdev keyboard handler emits keyevents with QString(0xffff) Key events that have no text representation are by the evdevkeyboard emitted as a QString(0xffff). Other keyboard event handlers appear to all emit key events with null strings for these events. Change-Id: If6b5c61a8cb76a6843238f834ce4feb4b73aa199 Reviewed-by: Gunnar Sletta --- src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp index b97923c4b6..0841544208 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp @@ -224,7 +224,7 @@ void QEvdevKeyboardHandler::processKeyEvent(int nativecode, int unicode, int qtc { QWindowSystemInterface::handleExtendedKeyEvent(0, (isPress ? QEvent::KeyPress : QEvent::KeyRelease), qtcode, modifiers, nativecode + 8, 0, int(modifiers), - QString(unicode), autoRepeat); + (unicode != 0xffff ) ? QString(unicode) : QString(), autoRepeat); } QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint16 keycode, bool pressed, bool autorepeat) -- cgit v1.2.3 From f805020410c8ccb0cd223988565bcabde1c5806b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 15 Nov 2013 09:46:02 +0100 Subject: Fix a race that occurred as we unlock the mutex to destroy the functor in ~QObject When we unlock the mutex, we need to take in account that the Connection pointed by 'node' may be destroyed in another thread while it is unlocked Doing 'node->prev = &node' will make sure that 'node' is actually updated when it is destroyed. Setting isSlotObject under the mutex is safer and ensure that no other thread will attempt to deref the object. The regression was introduced in 5885b8f775998c30d53f40b7f368c5f6364e6df4 tst_qobjectrace was updated to catch races arising when we are connecting with function pointers. Change-Id: Ia0d11ae8df563dad97eb86993a786b579b28cd03 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Lars Knoll --- src/corelib/kernel/qobject.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 6ed3b30917..777f95ef6d 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2013 Olivier Goffart ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -852,9 +853,9 @@ QObject::~QObject() // The destroy operation must happen outside the lock if (c->isSlotObject) { + c->isSlotObject = false; locker.unlock(); c->slotObj->destroyIfLastRef(); - c->isSlotObject = false; locker.relock(); } c->deref(); @@ -869,7 +870,15 @@ QObject::~QObject() d->connectionLists = 0; } - // disconnect all senders + /* Disconnect all senders: + * This loop basically just does + * for (node = d->senders; node; node = node->next) { ... } + * + * We need to temporarily unlock the receiver mutex to destroy the functors or to lock the + * sender's mutex. And when the mutex is released, node->next might be destroyed by another + * thread. That's why we set node->prev to &node, that way, if node is destroyed, node will + * be updated. + */ QObjectPrivate::Connection *node = d->senders; while (node) { QObject *sender = node->sender; @@ -882,6 +891,8 @@ QObject::~QObject() bool needToUnlock = QOrderedMutexLocker::relock(signalSlotMutex, m); //the node has maybe been removed while the mutex was unlocked in relock? if (!node || node->sender != sender) { + // We hold the wrong mutex + Q_ASSERT(needToUnlock); m->unlock(); continue; } @@ -901,11 +912,12 @@ QObject::~QObject() m->unlock(); if (slotObj) { + if (node) + node->prev = &node; locker.unlock(); slotObj->destroyIfLastRef(); locker.relock(); } - } } @@ -3186,9 +3198,9 @@ bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::Connection *c, c->receiver = 0; if (c->isSlotObject) { + c->isSlotObject = false; senderMutex->unlock(); c->slotObj->destroyIfLastRef(); - c->isSlotObject = false; senderMutex->lock(); } -- cgit v1.2.3 From 9b8570c4e9359eb8b45b39c28aa9d8c140f3fc44 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 21 Nov 2013 18:37:36 +0100 Subject: Fix deadlock when disconnecting connections made with function pointers The regression was introduced in 5885b8f775998c30d53f40b7f368c5f6364e6df4 QMetaObjectPrivate::disconnectHelper may unlock the sender mutex. And while relocking it, we need to make sure to lock the sender and receiver mutex in the right order. So don't lock the receiver mutex in advance, but re-lock it for each connection. Change-Id: I4f6d19791cdcce3693d7f45e7beb6b564fd69277 Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- src/corelib/kernel/qobject.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 777f95ef6d..e062a38185 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3181,7 +3181,7 @@ bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::Connection *c, && (slot == 0 || (c->isSlotObject && c->slotObj->compare(slot)))))) { bool needToUnlock = false; QMutex *receiverMutex = 0; - if (!receiver) { + if (c->receiver) { receiverMutex = signalSlotLock(c->receiver); // need to relock this receiver and sender in the correct order needToUnlock = QOrderedMutexLocker::relock(senderMutex, receiverMutex); @@ -3229,8 +3229,7 @@ bool QMetaObjectPrivate::disconnect(const QObject *sender, QObject *s = const_cast(sender); QMutex *senderMutex = signalSlotLock(sender); - QMutex *receiverMutex = receiver ? signalSlotLock(receiver) : 0; - QOrderedMutexLocker locker(senderMutex, receiverMutex); + QMutexLocker locker(senderMutex); QObjectConnectionListVector *connectionLists = QObjectPrivate::get(s)->connectionLists; if (!connectionLists) -- cgit v1.2.3 From b84072a431c83d61298b43d8669bb21d00c14f68 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 22 Nov 2013 13:02:23 +0100 Subject: Fix compiler warnings. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As seen with Xcode 5.0.2. qmacclipboard.mm:108:30: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast] promiseKeeper(paste, (PasteboardItemID)promise.itemId, flavor, this); ^ qmacclipboard.mm:316:56: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast] PasteboardPutItemFlavor(paste, (PasteboardItemID)itemID, QCFString(flavor), 0, kPasteboardFlavorNoFlags); ^ Change-Id: I94b8ea2ff32d606d4cab28981b26c2ef516035dc Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qmacclipboard.mm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm index 95143fd8ea..b5c50d676f 100644 --- a/src/plugins/platforms/cocoa/qmacclipboard.mm +++ b/src/plugins/platforms/cocoa/qmacclipboard.mm @@ -105,7 +105,8 @@ QMacPasteboard::~QMacPasteboard() for (int i = 0; i < promises.count(); ++i) { const Promise &promise = promises.at(i); QCFString flavor = QCFString(promise.convertor->flavorFor(promise.mime)); - promiseKeeper(paste, (PasteboardItemID)promise.itemId, flavor, this); + NSInteger pbItemId = promise.itemId; + promiseKeeper(paste, reinterpret_cast(pbItemId), flavor, this); } if (paste) @@ -311,9 +312,9 @@ QMacPasteboard::setMimeData(QMimeData *mime_src) int numItems = c->count(mime_src); for (int item = 0; item < numItems; ++item) { - const int itemID = item+1; //id starts at 1 + const NSInteger itemID = item+1; //id starts at 1 promises.append(QMacPasteboard::Promise(itemID, c, mimeType, mimeData, item)); - PasteboardPutItemFlavor(paste, (PasteboardItemID)itemID, QCFString(flavor), 0, kPasteboardFlavorNoFlags); + PasteboardPutItemFlavor(paste, reinterpret_cast(itemID), QCFString(flavor), 0, kPasteboardFlavorNoFlags); #ifdef DEBUG_PASTEBOARD qDebug(" - adding %d %s [%s] <%s> [%d]", itemID, qPrintable(mimeType), qPrintable(flavor), qPrintable(c->convertorName()), item); -- cgit v1.2.3 From 0da841bc337faa00d947cc2e3c273bf87e7cc700 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 20 Nov 2013 13:37:48 +0100 Subject: Windows: Close handle to thread checking for adopted threads. Task-number: QTBUG-34840 [ChangeLog][QtCore][QThread][Windows][QTBUG-34840] Fix handle leak. Change-Id: I537c1c81a43907f01a81be740746582266969c6f Reviewed-by: Andy Shaw Reviewed-by: Joerg Bornemann --- src/corelib/thread/qthread_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index d49a6a9a8e..9d90583a28 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -182,7 +182,7 @@ void qt_watch_adopted_thread(const HANDLE adoptedThreadHandle, QThread *qthread) qt_adopted_thread_handles.prepend(qt_adopted_thread_wakeup); } - CreateThread(0, 0, qt_adopted_thread_watcher_function, 0, 0, &qt_adopted_thread_watcher_id); + CloseHandle(CreateThread(0, 0, qt_adopted_thread_watcher_function, 0, 0, &qt_adopted_thread_watcher_id)); } else { SetEvent(qt_adopted_thread_wakeup); } -- cgit v1.2.3 From 42fa59b151eb4a6fecbe5b5672112c9f78b856a9 Mon Sep 17 00:00:00 2001 From: John Layt Date: Mon, 25 Nov 2013 23:15:55 +0100 Subject: QPrintDialog - Fix casting print engine We want to cast the print engine, not the paint engine. Change-Id: Ia8f11f0215fa066417118fbfbcc921a60282d713 Reviewed-by: Gunnar Sletta --- src/printsupport/dialogs/qprintdialog_win.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/printsupport/dialogs/qprintdialog_win.cpp b/src/printsupport/dialogs/qprintdialog_win.cpp index 96a201ae45..6f96a499e5 100644 --- a/src/printsupport/dialogs/qprintdialog_win.cpp +++ b/src/printsupport/dialogs/qprintdialog_win.cpp @@ -187,7 +187,7 @@ QPrintDialog::QPrintDialog(QPrinter *printer, QWidget *parent) Q_D(QPrintDialog); if (!warnIfNotNative(d->printer)) return; - d->ep = static_cast(d->printer->paintEngine())->d_func(); + d->ep = static_cast(d->printer->printEngine())->d_func(); setAttribute(Qt::WA_DontShowOnScreen); } @@ -197,7 +197,7 @@ QPrintDialog::QPrintDialog(QWidget *parent) Q_D(QPrintDialog); if (!warnIfNotNative(d->printer)) return; - d->ep = static_cast(d->printer->paintEngine())->d_func(); + d->ep = static_cast(d->printer->printEngine())->d_func(); setAttribute(Qt::WA_DontShowOnScreen); } -- cgit v1.2.3 From db4afbef7d1e2405a3b8f007e9009f509b4a3eac Mon Sep 17 00:00:00 2001 From: John Layt Date: Mon, 25 Nov 2013 20:36:58 +0100 Subject: QPrinterInfo - Fix isNull() by fixing constructors The QPrinterInfo copy and QPrinter constructors and the assignment operator were not taking the shared_null into account, and so any use of them resulted in a new null QPrinterInfo different to shared_null, which lead to isNull() always returning true in anything other than the simplest use case. While fixing this also make the shared_null a Q_GLOBAL_STATIC. Task-number: QTBUG-21087 Change-Id: I0beb24088208e9ed58d21ca26b0c8d00b02e5b8f Reviewed-by: Gunnar Sletta --- src/printsupport/kernel/qprinterinfo.cpp | 29 ++++++++++++++++++++++------- src/printsupport/kernel/qprinterinfo_p.h | 13 ------------- 2 files changed, 22 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/printsupport/kernel/qprinterinfo.cpp b/src/printsupport/kernel/qprinterinfo.cpp index f863b23e34..e02617fe93 100644 --- a/src/printsupport/kernel/qprinterinfo.cpp +++ b/src/printsupport/kernel/qprinterinfo.cpp @@ -35,8 +35,17 @@ QT_BEGIN_NAMESPACE -QPrinterInfoPrivate QPrinterInfoPrivate::shared_null; +Q_GLOBAL_STATIC(QPrinterInfoPrivate, shared_null); +class QPrinterInfoPrivateDeleter +{ +public: + static inline void cleanup(QPrinterInfoPrivate *d) + { + if (d != shared_null) + delete d; + } +}; /*! \class QPrinterInfo @@ -83,7 +92,7 @@ QPrinterInfoPrivate QPrinterInfoPrivate::shared_null; \sa isNull() */ QPrinterInfo::QPrinterInfo() - : d_ptr(&QPrinterInfoPrivate::shared_null) + : d_ptr(shared_null) { } @@ -91,7 +100,7 @@ QPrinterInfo::QPrinterInfo() Constructs a copy of \a other. */ QPrinterInfo::QPrinterInfo(const QPrinterInfo &other) - : d_ptr(new QPrinterInfoPrivate(*other.d_ptr)) + : d_ptr((other.d_ptr.data() == shared_null) ? shared_null : new QPrinterInfoPrivate(*other.d_ptr)) { } @@ -99,12 +108,15 @@ QPrinterInfo::QPrinterInfo(const QPrinterInfo &other) Constructs a QPrinterInfo object from \a printer. */ QPrinterInfo::QPrinterInfo(const QPrinter &printer) - : d_ptr(&QPrinterInfoPrivate::shared_null) + : d_ptr(shared_null) { QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); if (ps) { QPrinterInfo pi = ps->printerInfo(printer.printerName()); - d_ptr.reset(new QPrinterInfoPrivate(*pi.d_ptr)); + if (pi.d_ptr.data() == shared_null) + d_ptr.reset(shared_null); + else + d_ptr.reset(new QPrinterInfoPrivate(*pi.d_ptr)); } } @@ -130,7 +142,10 @@ QPrinterInfo::~QPrinterInfo() QPrinterInfo &QPrinterInfo::operator=(const QPrinterInfo &other) { Q_ASSERT(d_ptr); - d_ptr.reset(new QPrinterInfoPrivate(*other.d_ptr)); + if (other.d_ptr.data() == shared_null) + d_ptr.reset(shared_null); + else + d_ptr.reset(new QPrinterInfoPrivate(*other.d_ptr)); return *this; } @@ -191,7 +206,7 @@ QString QPrinterInfo::makeAndModel() const bool QPrinterInfo::isNull() const { Q_D(const QPrinterInfo); - return d == &QPrinterInfoPrivate::shared_null; + return d == shared_null || d->name.isEmpty(); } /*! diff --git a/src/printsupport/kernel/qprinterinfo_p.h b/src/printsupport/kernel/qprinterinfo_p.h index d4bb08f1f5..6ae64b5653 100644 --- a/src/printsupport/kernel/qprinterinfo_p.h +++ b/src/printsupport/kernel/qprinterinfo_p.h @@ -72,8 +72,6 @@ public: ~QPrinterInfoPrivate() {} - static QPrinterInfoPrivate shared_null; - QString name; QString description; QString location; @@ -87,17 +85,6 @@ public: mutable QList > paperNames; }; - -class QPrinterInfoPrivateDeleter -{ -public: - static inline void cleanup(QPrinterInfoPrivate *d) - { - if (d != &QPrinterInfoPrivate::shared_null) - delete d; - } -}; - QT_END_NAMESPACE #endif // QT_NO_PRINTER -- cgit v1.2.3 From 75a75624913a41274ff94aa5b491b303367c6a20 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 22 Nov 2013 14:31:05 +0100 Subject: QCoreApplication: Add static setter for application file path. In cases where QGuiApplication is instantiated by a library embedded into another application via some plugin mechanism (for example, Active X controls built using Qt), the QPA platform plugin and other plugins cannot be found next to the application executable. In this case, the library should set the application file path to its deployment location such that plugin paths are set accordingly, the directory is added to the path and qt.conf is found, should it exist. Task-number: QTBUG-34989 Change-Id: I4a53104b5121a8d26751129912f999228be45dfd Reviewed-by: Robin Burchell --- src/corelib/kernel/qcoreapplication.cpp | 60 ++++++++++++++++++++++----------- src/corelib/kernel/qcoreapplication_p.h | 4 ++- 2 files changed, 43 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 61ad4f9be1..e77d6894d0 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -160,6 +160,8 @@ QString QCoreApplicationPrivate::appName() const } #endif +QString *QCoreApplicationPrivate::cachedApplicationFilePath = 0; + bool QCoreApplicationPrivate::checkInstance(const char *function) { bool b = (QCoreApplication::self != 0); @@ -425,6 +427,7 @@ QCoreApplicationPrivate::~QCoreApplicationPrivate() #ifdef Q_OS_WIN delete [] origArgv; #endif + QCoreApplicationPrivate::clearApplicationFilePath(); } #ifndef QT_NO_QOBJECT @@ -1884,6 +1887,20 @@ QString QCoreApplication::translate(const char *context, const char *sourceText, #endif //QT_NO_TRANSLATE +// Makes it possible to point QCoreApplication to a custom location to ensure +// the directory is added to the patch, and qt.conf and deployed plugins are +// found from there. This is for use cases in which QGuiApplication is +// instantiated by a library and not by an application executable, for example, +// Active X servers. + +void QCoreApplicationPrivate::setApplicationFilePath(const QString &path) +{ + if (QCoreApplicationPrivate::cachedApplicationFilePath) + *QCoreApplicationPrivate::cachedApplicationFilePath = path; + else + QCoreApplicationPrivate::cachedApplicationFilePath = new QString(path); +} + /*! Returns the directory that contains the application executable. @@ -1943,24 +1960,24 @@ QString QCoreApplication::applicationFilePath() static char *procName = d->argv[0]; if (qstrcmp(procName, d->argv[0]) != 0) { // clear the cache if the procname changes, so we reprocess it. - d->cachedApplicationFilePath = QString(); + QCoreApplicationPrivate::clearApplicationFilePath(); procName = d->argv[0]; } - if (!d->cachedApplicationFilePath.isNull()) - return d->cachedApplicationFilePath; + if (QCoreApplicationPrivate::cachedApplicationFilePath) + return *QCoreApplicationPrivate::cachedApplicationFilePath; #if defined(Q_OS_WIN) - d->cachedApplicationFilePath = QFileInfo(qAppFileName()).filePath(); - return d->cachedApplicationFilePath; + QCoreApplicationPrivate::setApplicationFilePath(QFileInfo(qAppFileName()).filePath()); + return *QCoreApplicationPrivate::cachedApplicationFilePath; #elif defined(Q_OS_BLACKBERRY) if (!arguments().isEmpty()) { // args is never empty, but the navigator can change behaviour some day QFileInfo fileInfo(arguments().at(0)); const bool zygotized = fileInfo.exists(); if (zygotized) { // Handle the zygotized case: - d->cachedApplicationFilePath = QDir::cleanPath(fileInfo.absoluteFilePath()); - return d->cachedApplicationFilePath; + QCoreApplicationPrivate::setApplicationFilePath(QDir::cleanPath(fileInfo.absoluteFilePath())); + return *QCoreApplicationPrivate::cachedApplicationFilePath; } } @@ -1968,7 +1985,7 @@ QString QCoreApplication::applicationFilePath() const size_t maximum_path = static_cast(pathconf("/",_PC_PATH_MAX)); char buff[maximum_path+1]; if (_cmdname(buff)) { - d->cachedApplicationFilePath = QDir::cleanPath(QString::fromLocal8Bit(buff)); + QCoreApplicationPrivate::setApplicationFilePath(QDir::cleanPath(QString::fromLocal8Bit(buff))); } else { qWarning("QCoreApplication::applicationFilePath: _cmdname() failed"); // _cmdname() won't fail, but just in case, fallback to the old method @@ -1976,18 +1993,19 @@ QString QCoreApplication::applicationFilePath() QStringList executables = dir.entryList(QDir::Executable | QDir::Files); if (!executables.empty()) { //We assume that there is only one executable in the folder - d->cachedApplicationFilePath = dir.absoluteFilePath(executables.first()); - } else { - d->cachedApplicationFilePath = QString(); + QCoreApplicationPrivate::setApplicationFilePath(dir.absoluteFilePath(executables.first())); } } - return d->cachedApplicationFilePath; + return *QCoreApplicationPrivate::cachedApplicationFilePath; #elif defined(Q_OS_MAC) QString qAppFileName_str = qAppFileName(); if(!qAppFileName_str.isEmpty()) { QFileInfo fi(qAppFileName_str); - d->cachedApplicationFilePath = fi.exists() ? fi.canonicalFilePath() : QString(); - return d->cachedApplicationFilePath; + if (fi.exists()) { + QCoreApplicationPrivate::setApplicationFilePath(fi.canonicalFilePath()); + return *QCoreApplicationPrivate::cachedApplicationFilePath; + } + return QString(); } #endif #if defined( Q_OS_UNIX ) @@ -1996,8 +2014,8 @@ QString QCoreApplication::applicationFilePath() // the absolute path of the executable QFileInfo pfi(QString::fromLatin1("/proc/%1/exe").arg(getpid())); if (pfi.exists() && pfi.isSymLink()) { - d->cachedApplicationFilePath = pfi.canonicalFilePath(); - return d->cachedApplicationFilePath; + QCoreApplicationPrivate::setApplicationFilePath(pfi.canonicalFilePath()); + return *QCoreApplicationPrivate::cachedApplicationFilePath; } # endif if (!arguments().isEmpty()) { @@ -2027,13 +2045,15 @@ QString QCoreApplication::applicationFilePath() absPath = QDir::cleanPath(absPath); QFileInfo fi(absPath); - d->cachedApplicationFilePath = fi.exists() ? fi.canonicalFilePath() : QString(); - } else { - d->cachedApplicationFilePath = QString(); + if (fi.exists()) { + QCoreApplicationPrivate::setApplicationFilePath(fi.canonicalFilePath()); + return *QCoreApplicationPrivate::cachedApplicationFilePath; + } } - return d->cachedApplicationFilePath; + return QString(); #endif + Q_UNREACHABLE(); } /*! diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index ad0449f02c..0c00f396b5 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -139,7 +139,9 @@ public: QCoreApplicationPrivate::Type application_type; QString cachedApplicationDirPath; - QString cachedApplicationFilePath; + static QString *cachedApplicationFilePath; + static void setApplicationFilePath(const QString &path); + static inline void clearApplicationFilePath() { delete cachedApplicationFilePath; cachedApplicationFilePath = 0; } #ifndef QT_NO_QOBJECT bool in_exec; -- cgit v1.2.3