diff options
Diffstat (limited to 'src/widgets')
52 files changed, 190 insertions, 184 deletions
diff --git a/src/widgets/accessible/accessible.pri b/src/widgets/accessible/accessible.pri index ac8205b1e3..e63ae28d30 100644 --- a/src/widgets/accessible/accessible.pri +++ b/src/widgets/accessible/accessible.pri @@ -1,6 +1,6 @@ # Qt accessibility module -contains(QT_CONFIG, accessibility) { +qtConfig(accessibility) { HEADERS += \ accessible/qaccessiblewidget.h \ accessible/qaccessiblewidgetfactory_p.h \ diff --git a/src/widgets/accessible/widgets.pro b/src/widgets/accessible/widgets.pro index da8607c637..d04d0da3cc 100644 --- a/src/widgets/accessible/widgets.pro +++ b/src/widgets/accessible/widgets.pro @@ -2,7 +2,7 @@ TARGET = qtaccessiblewidgets QT += core-private gui-private widgets-private -QTDIR_build:REQUIRES += "contains(QT_CONFIG, accessibility)" +QTDIR_build:REQUIRES += "qtConfig(accessibility)" SOURCES += main.cpp \ simplewidgets.cpp \ diff --git a/src/widgets/dialogs/images/qtlogo-64.png b/src/widgets/dialogs/images/qtlogo-64.png Binary files differindex af87e98cf5..39a4a26f39 100644 --- a/src/widgets/dialogs/images/qtlogo-64.png +++ b/src/widgets/dialogs/images/qtlogo-64.png diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index f3652c09da..d4764c019e 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -541,8 +541,8 @@ QColor QColorDialog::customColor(int index) /*! Sets the custom color at \a index to the QColor \a color value. - \note This function does not apply to the Native Color Dialog on the Mac - OS X platform. If you still require this function, use the + \note This function does not apply to the Native Color Dialog on the + \macos platform. If you still require this function, use the QColorDialog::DontUseNativeDialog option. */ void QColorDialog::setCustomColor(int index, QColor color) @@ -563,8 +563,8 @@ QColor QColorDialog::standardColor(int index) /*! Sets the standard color at \a index to the QColor \a color value. - \note This function does not apply to the Native Color Dialog on the Mac - OS X platform. If you still require this function, use the + \note This function does not apply to the Native Color Dialog on the + \macos platform. If you still require this function, use the QColorDialog::DontUseNativeDialog option. */ void QColorDialog::setStandardColor(int index, QColor color) diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index e5f11e78da..b4ca853c5d 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -2068,7 +2068,7 @@ QString QFileDialog::labelText(DialogLabel label) const The dialog's caption is set to \a caption. If \a caption is not specified then a default caption will be used. - On Windows, and OS X, this static function will use the + On Windows, and \macos, this static function will use the native file dialog and not a QFileDialog. On Windows the dialog will spin a blocking modal event loop that will not @@ -2179,7 +2179,7 @@ QUrl QFileDialog::getOpenFileUrl(QWidget *parent, The dialog's caption is set to \a caption. If \a caption is not specified then a default caption will be used. - On Windows, and OS X, this static function will use the + On Windows, and \macos, this static function will use the native file dialog and not a QFileDialog. On Windows the dialog will spin a blocking modal event loop that will not @@ -2302,12 +2302,12 @@ QList<QUrl> QFileDialog::getOpenFileUrls(QWidget *parent, The dialog's caption is set to \a caption. If \a caption is not specified, a default caption will be used. - On Windows, and OS X, this static function will use the + On Windows, and \macos, this static function will use the native file dialog and not a QFileDialog. On Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if \a parent is not 0 then it will position the - dialog just below the parent's title bar. On OS X, with its native file + dialog just below the parent's title bar. On \macos, with its native file dialog, the filter argument is ignored. On Unix/X11, the normal behavior of the file dialog is to resolve and @@ -2410,7 +2410,7 @@ QUrl QFileDialog::getSaveFileUrl(QWidget *parent, pass. To ensure a native file dialog, \l{QFileDialog::}{ShowDirsOnly} must be set. - On Windows and OS X, this static function will use the + On Windows and \macos, this static function will use the native file dialog and not a QFileDialog. However, the native Windows file dialog does not support displaying files in the directory chooser. You need to pass \l{QFileDialog::}{DontUseNativeDialog} to display files using a diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 96046b7ff4..57b3f47863 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -550,7 +550,7 @@ void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button This is the approach recommended in the \l{http://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/Windows/Windows.html#//apple_ref/doc/uid/20000961-BABCAJID} - {OS X Guidelines}. Similar guidelines apply for the other + {\macos Guidelines}. Similar guidelines apply for the other platforms, but note the different ways the \l{QMessageBox::informativeText} {informative text} is handled for different platforms. @@ -667,7 +667,7 @@ void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button If the \l{QMessageBox::StandardButtons} {standard buttons} are not flexible enough for your message box, you can use the addButton() - overload that takes a text and a ButtonRoleto to add custom + overload that takes a text and a ButtonRole to add custom buttons. The ButtonRole is used by QMessageBox to determine the ordering of the buttons on screen (which varies according to the platform). You can test the value of clickedButton() after calling @@ -765,7 +765,7 @@ void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button Constructs a message box with no text and no buttons. \a parent is passed to the QDialog constructor. - On OS X, if you want your message box to appear + On \macos, if you want your message box to appear as a Qt::Sheet of its \a parent, set the message box's \l{setWindowModality()} {window modality} to Qt::WindowModal or use open(). Otherwise, the message box will be a standard dialog. @@ -787,7 +787,7 @@ QMessageBox::QMessageBox(QWidget *parent) The message box is an \l{Qt::ApplicationModal} {application modal} dialog box. - On OS X, if \a parent is not 0 and you want your message box + On \macos, if \a parent is not 0 and you want your message box to appear as a Qt::Sheet of that parent, set the message box's \l{setWindowModality()} {window modality} to Qt::WindowModal (default). Otherwise, the message box will be a standard dialog. @@ -955,7 +955,7 @@ QAbstractButton *QMessageBox::button(StandardButton which) const \list 1 \li If there is only one button, it is made the escape button. \li If there is a \l Cancel button, it is made the escape button. - \li On OS X only, if there is exactly one button with the role + \li On \macos only, if there is exactly one button with the role QMessageBox::RejectRole, it is made the escape button. \endlist @@ -1732,7 +1732,7 @@ QMessageBox::StandardButton QMessageBox::critical(QWidget *parent, const QString \li As a last resort it uses the Information icon. \endlist - The about box has a single button labelled "OK". On OS X, the + The about box has a single button labelled "OK". On \macos, the about box is popped up as a modeless window; on other platforms, it is currently application modal. @@ -1786,7 +1786,7 @@ void QMessageBox::about(QWidget *parent, const QString &title, const QString &te QApplication provides this functionality as a slot. - On OS X, the about box is popped up as a modeless window; on + On \macos, the about box is popped up as a modeless window; on other platforms, it is currently application modal. \sa QApplication::aboutQt() @@ -2545,8 +2545,8 @@ void QMessageBox::setInformativeText(const QString &text) This function shadows QWidget::setWindowTitle(). - Sets the title of the message box to \a title. On OS X, - the window title is ignored (as required by the OS X + Sets the title of the message box to \a title. On \macos, + the window title is ignored (as required by the \macos Guidelines). */ void QMessageBox::setWindowTitle(const QString &title) @@ -2567,7 +2567,7 @@ void QMessageBox::setWindowTitle(const QString &title) Sets the modality of the message box to \a windowModality. - On OS X, if the modality is set to Qt::WindowModal and the message box + On \macos, if the modality is set to Qt::WindowModal and the message box has a parent, then the message box will be a Qt::Sheet, otherwise the message box will be a standard dialog. */ diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index f3d27ff77f..bcad069b50 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -1819,7 +1819,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *) \inmodule QtWidgets - A wizard (also called an assistant on OS X) is a special type + A wizard (also called an assistant on \macos) is a special type of input dialog that consists of a sequence of pages. A wizard's purpose is to guide the user through a process step by step. Wizards are useful for complex or infrequent tasks that users may @@ -2117,10 +2117,10 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *) This enum specifies the buttons in a wizard. - \value BackButton The \uicontrol Back button (\uicontrol {Go Back} on OS X) - \value NextButton The \uicontrol Next button (\uicontrol Continue on OS X) + \value BackButton The \uicontrol Back button (\uicontrol {Go Back} on \macos) + \value NextButton The \uicontrol Next button (\uicontrol Continue on \macos) \value CommitButton The \uicontrol Commit button - \value FinishButton The \uicontrol Finish button (\uicontrol Done on OS X) + \value FinishButton The \uicontrol Finish button (\uicontrol Done on \macos) \value CancelButton The \uicontrol Cancel button (see also NoCancelButton) \value HelpButton The \uicontrol Help button (see also HaveHelpButton) \value CustomButton1 The first user-defined button (see also HaveCustomButton1) @@ -2160,7 +2160,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *) \value ClassicStyle Classic Windows look \value ModernStyle Modern Windows look - \value MacStyle OS X look + \value MacStyle \macos look \value AeroStyle Windows Aero look \omitvalue NStyles @@ -2629,7 +2629,7 @@ bool QWizard::testOption(WizardOption option) const \list \li Windows: HelpButtonOnRight. - \li OS X: NoDefaultButton and NoCancelButton. + \li \macos: NoDefaultButton and NoCancelButton. \li X11 and QWS (Qt for Embedded Linux): none. \endlist @@ -2673,7 +2673,7 @@ QWizard::WizardOptions QWizard::options() const Sets the text on button \a which to be \a text. By default, the text on buttons depends on the wizardStyle. For - example, on OS X, the \uicontrol Next button is called \uicontrol + example, on \macos, the \uicontrol Next button is called \uicontrol Continue. To add extra buttons to the wizard (e.g., a \uicontrol Print button), @@ -2705,7 +2705,7 @@ void QWizard::setButtonText(WizardButton which, const QString &text) If a text has ben set using setButtonText(), this text is returned. By default, the text on buttons depends on the wizardStyle. For - example, on OS X, the \uicontrol Next button is called \uicontrol + example, on \macos, the \uicontrol Next button is called \uicontrol Continue. \sa button(), setButton(), setButtonText(), QWizardPage::buttonText(), @@ -2891,7 +2891,7 @@ void QWizard::setPixmap(WizardPixmap which, const QPixmap &pixmap) Returns the pixmap set for role \a which. By default, the only pixmap that is set is the BackgroundPixmap on - OS X. + \macos. \sa QWizardPage::pixmap(), {Elements of a Wizard Page} */ @@ -3802,7 +3802,7 @@ void QWizardPage::setButtonText(QWizard::WizardButton which, const QString &text this text is returned. By default, the text on buttons depends on the QWizard::wizardStyle. - For example, on OS X, the \uicontrol Next button is called \uicontrol + For example, on \macos, the \uicontrol Next button is called \uicontrol Continue. \sa setButtonText(), QWizard::buttonText(), QWizard::setButtonText() diff --git a/src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp b/src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp index cb5a74fa15..c40152ff49 100644 --- a/src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp +++ b/src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp @@ -49,7 +49,7 @@ ****************************************************************************/ //! [0] -setCellWidget(index, new QLineEdit); +setCellWidget(row, column, new QLineEdit); ... -setCellWidget(index, new QTextEdit); +setCellWidget(row, column, new QTextEdit); //! [0] diff --git a/src/widgets/doc/src/graphicsview.qdoc b/src/widgets/doc/src/graphicsview.qdoc index c49f233001..33f480b0bf 100644 --- a/src/widgets/doc/src/graphicsview.qdoc +++ b/src/widgets/doc/src/graphicsview.qdoc @@ -491,7 +491,7 @@ not supported. For example, you can create decorated windows by passing the Qt::Window window flag to QGraphicsWidget's constructor, but Graphics View currently doesn't support the Qt::Sheet and - Qt::Drawer flags that are common on OS X. + Qt::Drawer flags that are common on \macos. \section3 QGraphicsLayout diff --git a/src/widgets/doc/src/widgets-and-layouts/focus.qdoc b/src/widgets/doc/src/widgets-and-layouts/focus.qdoc index ed56e37c78..9ce3c8472f 100644 --- a/src/widgets/doc/src/widgets-and-layouts/focus.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/focus.qdoc @@ -162,13 +162,13 @@ \section2 The User Rotates the Mouse Wheel On Microsoft Windows, mouse wheel usage is always handled by the - widget that has keyboard focus. On OS X and X11, it's handled by + widget that has keyboard focus. On \macos and X11, it's handled by the widget that gets other mouse events. The way Qt handles this platform difference is by letting widgets move the keyboard focus when the wheel is used. With the right focus policy on each widget, applications can work idiomatically correctly on - Windows, OS X, and X11. + Windows, \macos, and X11. \section2 The User Moves the Focus to This Window diff --git a/src/widgets/doc/src/widgets-and-layouts/styles.qdoc b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc index 1e0ed66b13..6e697a97df 100644 --- a/src/widgets/doc/src/widgets-and-layouts/styles.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc @@ -115,7 +115,7 @@ The widget is passed as the last argument in case the style needs it to perform special effects (such as animated default buttons on - OS X), but it isn't mandatory. + \macos), but it isn't mandatory. In the course of this section, we will look at the style elements, the style options, and the functions of QStyle. Finally, we describe diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc index 6a4e870cb1..61379fb2f0 100644 --- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -80,7 +80,7 @@ the QPalette::Button role to red for a QPushButton to obtain a red push button. However, this wasn't guaranteed to work for all styles, because style authors are restricted by the different - platforms' guidelines and (on Windows XP and OS X) by the + platforms' guidelines and (on Windows XP and \macos) by the native theme engine. Style sheets let you perform all kinds of customizations that are @@ -121,7 +121,7 @@ \row \li \inlineimage stylesheet-coffee-cleanlooks.png \li \inlineimage stylesheet-pagefold-mac.png \row \li Coffee theme running on Ubuntu Linux - \li Pagefold theme running on OS X + \li Pagefold theme running on \macos \endtable When a style sheet is active, the QStyle returned by QWidget::style() @@ -130,7 +130,7 @@ otherwise forwards the drawing operations to the underlying, platform-specific style (e.g., QWindowsXPStyle on Windows XP). - Since Qt 4.5, Qt style sheets fully supports OS X. + Since Qt 4.5, Qt style sheets fully supports \macos. */ @@ -3807,7 +3807,7 @@ \snippet code/doc_src_stylesheet.qdoc 135 If you want the scroll buttons of the scroll bar to be placed together - (instead of the edges) like on OS X, you can use the following + (instead of the edges) like on \macos, you can use the following stylesheet: \snippet code/doc_src_stylesheet.qdoc 136 diff --git a/src/widgets/doc/src/widgets-tutorial.qdoc b/src/widgets/doc/src/widgets-tutorial.qdoc index 693377c972..d7b68a6f67 100644 --- a/src/widgets/doc/src/widgets-tutorial.qdoc +++ b/src/widgets/doc/src/widgets-tutorial.qdoc @@ -110,7 +110,7 @@ make sure that the executable is on your path, or enter its full location. - \li On Linux/Unix and OS X, type \c make and press + \li On Linux/Unix and \macos, type \c make and press \uicontrol{Return}; on Windows with Visual Studio, type \c nmake and press \uicontrol{Return}. diff --git a/src/widgets/graphicsview/qgraphicssceneevent.cpp b/src/widgets/graphicsview/qgraphicssceneevent.cpp index 49f252e49a..763688191d 100644 --- a/src/widgets/graphicsview/qgraphicssceneevent.cpp +++ b/src/widgets/graphicsview/qgraphicssceneevent.cpp @@ -149,7 +149,7 @@ platforms, this means the right mouse button was clicked. \value Keyboard The keyboard caused this event to be sent. On - Windows and OS X, this means the menu button was pressed. + Windows and \macos, this means the menu button was pressed. \value Other The event was sent by some other means (i.e. not by the mouse or keyboard). diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 221511f38d..42b35ac644 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -788,8 +788,10 @@ void QAbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel) QModelIndex oldCurrentIndex; if (d->selectionModel) { - oldSelection = d->selectionModel->selection(); - oldCurrentIndex = d->selectionModel->currentIndex(); + if (d->selectionModel->model() == selectionModel->model()) { + oldSelection = d->selectionModel->selection(); + oldCurrentIndex = d->selectionModel->currentIndex(); + } disconnect(d->selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(selectionChanged(QItemSelection,QItemSelection))); @@ -3871,7 +3873,7 @@ void QAbstractItemView::doAutoScroll() int horizontalValue = horizontalScroll->value(); QPoint pos = d->viewport->mapFromGlobal(QCursor::pos()); - QRect area = static_cast<QAbstractItemView*>(d->viewport)->d_func()->clipRect(); // access QWidget private by bending C++ rules + QRect area = QWidgetPrivate::get(d->viewport)->clipRect(); // do the scrolling if we are in the scroll margins if (pos.y() - area.top() < margin) diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h index b080f84e90..d6c5d58934 100644 --- a/src/widgets/itemviews/qabstractitemview.h +++ b/src/widgets/itemviews/qabstractitemview.h @@ -46,6 +46,9 @@ #include <QtCore/qitemselectionmodel.h> #include <QtWidgets/qabstractitemdelegate.h> +class tst_QAbstractItemView; +class tst_QTreeView; + QT_BEGIN_NAMESPACE @@ -368,6 +371,8 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_scrollerStateChanged()) #endif + friend class ::tst_QAbstractItemView; + friend class ::tst_QTreeView; friend class QTreeViewPrivate; // needed to compile with MSVC friend class QListModeViewBase; friend class QListViewPrivate; diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp index 4bf7406f92..b213a0859c 100644 --- a/src/widgets/itemviews/qdatawidgetmapper.cpp +++ b/src/widgets/itemviews/qdatawidgetmapper.cpp @@ -205,20 +205,6 @@ void QDataWidgetMapperPrivate::_q_commitData(QWidget *w) commit(widgetMap.at(idx)); } -class QFocusHelper: public QWidget -{ -public: - bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE - { - return QWidget::focusNextPrevChild(next); - } - - static inline void focusNextPrevChild(QWidget *w, bool next) - { - static_cast<QFocusHelper *>(w)->focusNextPrevChild(next); - } -}; - void QDataWidgetMapperPrivate::_q_closeEditor(QWidget *w, QAbstractItemDelegate::EndEditHint hint) { int idx = findWidget(w); @@ -230,10 +216,10 @@ void QDataWidgetMapperPrivate::_q_closeEditor(QWidget *w, QAbstractItemDelegate: populate(widgetMap[idx]); break; } case QAbstractItemDelegate::EditNextItem: - QFocusHelper::focusNextPrevChild(w, true); + w->focusNextChild(); break; case QAbstractItemDelegate::EditPreviousItem: - QFocusHelper::focusNextPrevChild(w, false); + w->focusPreviousChild(); break; case QAbstractItemDelegate::SubmitModelCache: case QAbstractItemDelegate::NoHint: diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 6f1e301d4f..85bd3003e1 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -3465,6 +3465,7 @@ void QHeaderViewPrivate::clear() sectionSelected.clear(); hiddenSectionSize.clear(); sectionItems.clear(); + lastSectionLogicalIdx = -1; invalidateCachedSizeHint(); } } diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h index b3a88db005..3c7cbddfbb 100644 --- a/src/widgets/itemviews/qtreeview.h +++ b/src/widgets/itemviews/qtreeview.h @@ -43,6 +43,8 @@ #include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractitemview.h> +class tst_QTreeView; + QT_BEGIN_NAMESPACE @@ -220,6 +222,7 @@ protected: void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) Q_DECL_OVERRIDE; private: + friend class ::tst_QTreeView; friend class QAccessibleTable; friend class QAccessibleTree; friend class QAccessibleTableCell; diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 5e0f13277c..1338ce4585 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -146,6 +146,7 @@ QTreeModel::QTreeModel(QTreeModelPrivate &dd, QTreeWidget *parent) QTreeModel::~QTreeModel() { clear(); + headerItem->view = Q_NULLPTR; delete headerItem; rootItem->view = 0; delete rootItem; diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri index b40a33b2af..ad2180bbfd 100644 --- a/src/widgets/kernel/kernel.pri +++ b/src/widgets/kernel/kernel.pri @@ -80,7 +80,7 @@ wince { kernel/qwidgetsfunctions_wince.cpp } -contains(QT_CONFIG, opengl) { +qtConfig(opengl) { HEADERS += kernel/qopenglwidget.h SOURCES += kernel/qopenglwidget.cpp } diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index 88b29e9147..e5bf606901 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -255,7 +255,7 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) /*! \enum QAction::MenuRole - This enum describes how an action should be moved into the application menu on OS X. + This enum describes how an action should be moved into the application menu on \macos. \value NoRole This action should not be put into the application menu \value TextHeuristicRole This action should be put in the application menu based on the action's text @@ -264,7 +264,7 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) \value AboutQtRole This action handles the "About Qt" menu item. \value AboutRole This action should be placed where the "About" menu item is in the application menu. The text of the menu item will be set to "About <application name>". The application name is fetched from the - \c{Info.plist} file in the application's bundle (See \l{Qt for OS X - Deployment}). + \c{Info.plist} file in the application's bundle (See \l{Qt for macOS - Deployment}). \value PreferencesRole This action should be placed where the "Preferences..." menu item is in the application menu. \value QuitRole This action should be placed where the Quit menu item is in the application menu. @@ -1226,12 +1226,12 @@ void QAction::activate(ActionEvent event) \brief the action's menu role \since 4.2 - This indicates what role the action serves in the application menu on Mac - OS X. By default all actions have the TextHeuristicRole, which means that + This indicates what role the action serves in the application menu on + \macos. By default all actions have the TextHeuristicRole, which means that the action is added based on its text (see QMenuBar for more information). The menu role can only be changed before the actions are put into the menu - bar in OS X (usually just before the first application window is + bar in \macos (usually just before the first application window is shown). */ void QAction::setMenuRole(MenuRole menuRole) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index df467505d9..afc1be7458 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1477,7 +1477,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* \note Some styles do not use the palette for all drawing, for instance, if they make use of native theme engines. This is the case for the Windows XP, - Windows Vista, and OS X styles. + Windows Vista, and \macos styles. \sa QWidget::setPalette(), palette(), QStyle::polish() */ @@ -3958,7 +3958,7 @@ bool QApplication::keypadNavigationEnabled() Currently this function does nothing on Qt for Embedded Linux. - On OS X, this works more at the application level and will cause the + On \macos, this works more at the application level and will cause the application icon to bounce in the dock. On Windows, this causes the window's taskbar entry to flash for a time. If diff --git a/src/widgets/kernel/qdesktopwidget.qdoc b/src/widgets/kernel/qdesktopwidget.qdoc index c23e942eec..27d05ece8c 100644 --- a/src/widgets/kernel/qdesktopwidget.qdoc +++ b/src/widgets/kernel/qdesktopwidget.qdoc @@ -149,7 +149,7 @@ Returns the available geometry of the screen with index \a screen. What is available will be subrect of screenGeometry() based on what the platform decides is available (for example excludes the dock and menu bar - on OS X, or the task bar on Windows). The default screen is used if + on \macos, or the task bar on Windows). The default screen is used if \a screen is -1. \sa screenNumber(), screenGeometry() diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index 0bc1c029fe..73e82c577c 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -1033,7 +1033,7 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem) \li \b{Adherence to the different platform's look and feel guidelines.} For example, the - \l{http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html}{Mac OS X Aqua} and KDE guidelines specify that the + \l{http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html}{\macos Aqua} and KDE guidelines specify that the labels should be right-aligned, whereas Windows and GNOME applications normally use left-alignment. @@ -1076,7 +1076,7 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem) corresponds to what we would get using a two-column QGridLayout.) \li Style based on the - \l{http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html}{Mac OS X Aqua} guidelines. Labels are right-aligned, + \l{http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html}{\macos Aqua} guidelines. Labels are right-aligned, the fields don't grow beyond their size hint, and the form is horizontally centered. \li Recommended style for diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index 124c8c000a..147e0774e7 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -112,7 +112,7 @@ QT_BEGIN_NAMESPACE \note Calling QSurfaceFormat::setDefaultFormat() before constructing the QApplication instance is mandatory on some platforms (for example, - OS X) when an OpenGL core profile context is requested. This is to + \macos) when an OpenGL core profile context is requested. This is to ensure that resource sharing between contexts stays functional as all internal contexts are created using the correct version and profile. @@ -467,7 +467,7 @@ QT_BEGIN_NAMESPACE recommended to limit the usage of this approach to cases where there is no other choice. Note that this option is not suitable for most embedded and mobile platforms, and it is known to have issues on - certain desktop platforms (e.g. OS X) too. The stable, + certain desktop platforms (e.g. \macos) too. The stable, cross-platform solution is always QOpenGLWidget. \e{OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other diff --git a/src/widgets/kernel/qsizepolicy.cpp b/src/widgets/kernel/qsizepolicy.cpp index 66fa350f81..e902bb522c 100644 --- a/src/widgets/kernel/qsizepolicy.cpp +++ b/src/widgets/kernel/qsizepolicy.cpp @@ -247,7 +247,7 @@ QSizePolicy::ControlType QSizePolicy::controlType() const The control type specifies the type of the widget for which this size policy applies. It is used by some styles, notably QMacStyle, to insert proper spacing between widgets. For example, - the Mac OS X Aqua guidelines specify that push buttons should be + the \macos Aqua guidelines specify that push buttons should be separated by 12 pixels, whereas vertically stacked radio buttons only require 6 pixels. diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index e0b8024f9a..d0971443ba 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -2516,7 +2516,7 @@ QWidget *QWidget::find(WId id) If a widget is non-native (alien) and winId() is invoked on it, that widget will be provided a native handle. - On OS X, the type returned depends on which framework Qt was linked + On \macos, the type returned depends on which framework Qt was linked against. If Qt is using Carbon, the {WId} is actually an HIViewRef. If Qt is using Cocoa, {WId} is a pointer to an NSView. @@ -2643,7 +2643,7 @@ QWindow *QWidget::windowHandle() const The style sheet contains a textual description of customizations to the widget's style, as described in the \l{Qt Style Sheets} document. - Since Qt 4.5, Qt style sheets fully supports OS X. + Since Qt 4.5, Qt style sheets fully supports \macos. \warning Qt style sheets are currently not supported for custom QStyle subclasses. We plan to address this in some future release. @@ -5136,7 +5136,7 @@ void QWidget::render(QPaintDevice *target, const QPoint &targetOffset, Transformations and settings applied to the \a painter will be used when rendering. - \note The \a painter must be active. On OS X the widget will be + \note The \a painter must be active. On \macos the widget will be rendered into a QPixmap and then drawn by the \a painter. \sa QPainter::device() @@ -6280,7 +6280,7 @@ QString QWidget::windowIconText() const If the window title is set at any point, then the window title takes precedence and will be shown instead of the file path string. - Additionally, on OS X, this has an added benefit that it sets the + Additionally, on \macos, this has an added benefit that it sets the \l{http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGWindows/chapter_17_section_3.html}{proxy icon} for the window, assuming that the file path exists. @@ -11319,7 +11319,7 @@ bool QWidget::testAttribute_helper(Qt::WidgetAttribute attribute) const By default the value of this property is 1.0. - This feature is available on Embedded Linux, OS X, Windows, + This feature is available on Embedded Linux, \macos, Windows, and X11 platforms that support the Composite extension. This feature is not available on Windows CE. @@ -11382,7 +11382,7 @@ void QWidgetPrivate::setWindowOpacity_sys(qreal level) A modified window is a window whose content has changed but has not been saved to disk. This flag will have different effects - varied by the platform. On OS X the close button will have a + varied by the platform. On \macos the close button will have a modified look; on other platforms, the window title will have an '*' (asterisk). @@ -12531,7 +12531,7 @@ static void releaseMouseGrabOfWidget(QWidget *widget) \note On Windows, grabMouse() only works when the mouse is inside a window owned by the process. - On OS X, grabMouse() only works when the mouse is inside the frame of that widget. + On \macos, grabMouse() only works when the mouse is inside the frame of that widget. \sa releaseMouse(), grabKeyboard(), releaseKeyboard() */ @@ -13003,7 +13003,7 @@ QDebug operator<<(QDebug debug, const QWidget *widget) This function will return 0 if no painter context can be established, or if the handle could not be created. - \warning This function is only available on OS X. + \warning This function is only available on \macos. */ /*! \fn Qt::HANDLE QWidget::macQDHandle() const \internal @@ -13012,7 +13012,7 @@ QDebug operator<<(QDebug debug, const QWidget *widget) This function will return 0 if QuickDraw is not supported, or if the handle could not be created. - \warning This function is only available on OS X. + \warning This function is only available on \macos. */ /*! \fn const QX11Info &QWidget::x11Info() const \internal diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index 2a71710143..bca89fe2c5 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -676,6 +676,7 @@ protected: void destroy(bool destroyWindow = true, bool destroySubWindows = true); + friend class QDataWidgetMapperPrivate; // for access to focusNextPrevChild virtual bool focusNextPrevChild(bool next); inline bool focusNextChild() { return focusNextPrevChild(true); } inline bool focusPreviousChild() { return focusNextPrevChild(false); } diff --git a/src/widgets/kernel/qwidgetaction.cpp b/src/widgets/kernel/qwidgetaction.cpp index ce91116c4d..6eebaca42c 100644 --- a/src/widgets/kernel/qwidgetaction.cpp +++ b/src/widgets/kernel/qwidgetaction.cpp @@ -85,8 +85,8 @@ QT_BEGIN_NAMESPACE Note that it is up to the widget to activate the action, for example by reimplementing mouse event handlers and calling QAction::trigger(). - \b {OS X}: If you add a widget to a menu in the application's menu - bar on OS X, the widget will be added and it will function but with some + \b {\macos}: If you add a widget to a menu in the application's menu + bar on \macos, the widget will be added and it will function but with some limitations: \list 1 \li The widget is reparented away from the QMenu to the native menu @@ -96,7 +96,7 @@ QT_BEGIN_NAMESPACE \li Due to Apple's design, mouse tracking on the widget currently does not work. \li Connecting the triggered() signal to a slot that opens a modal - dialog will cause a crash in Mac OS X 10.4 (known bug acknowledged + dialog will cause a crash in \macos 10.4 (known bug acknowledged by Apple), a workaround is to use a QueuedConnection instead of a DirectConnection. \endlist diff --git a/src/widgets/styles/qmacstyle.qdoc b/src/widgets/styles/qmacstyle.qdoc index 5d597b53a4..f8bd1f57a9 100644 --- a/src/widgets/styles/qmacstyle.qdoc +++ b/src/widgets/styles/qmacstyle.qdoc @@ -28,7 +28,7 @@ /*! \class QMacStyle - \brief The QMacStyle class provides a OS X style using the Apple Appearance Manager. + \brief The QMacStyle class provides a \macos style using the Apple Appearance Manager. \ingroup appearance \inmodule QtWidgets @@ -36,10 +36,10 @@ This class is implemented as a wrapper to the HITheme APIs, allowing applications to be styled according to the current - theme in use on OS X. This is done by having primitives - in QStyle implemented in terms of what OS X would normally theme. + theme in use on \macos. This is done by having primitives + in QStyle implemented in terms of what \macos would normally theme. - \warning This style is only available on OS X because it relies on the + \warning This style is only available on \macos because it relies on the HITheme APIs. There are additional issues that should be taken @@ -56,7 +56,7 @@ involve horizontal and vertical widget alignment and widget size (covered below). - \li Widget size - OS X allows widgets to have specific fixed sizes. Qt + \li Widget size - \macos allows widgets to have specific fixed sizes. Qt does not fully implement this behavior so as to maintain cross-platform compatibility. As a result some widgets sizes may be inappropriate (and subsequently not rendered correctly by the HITheme APIs).The @@ -75,7 +75,7 @@ There are other issues that need to be considered in the feel of your application (including the general color scheme to match the Aqua colors). The Guidelines mentioned above will remain current - with new advances and design suggestions for OS X. + with new advances and design suggestions for \macos. Note that the functions provided by QMacStyle are reimplementations of QStyle functions; see QStyle for their diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 5b455a4e5c..47a6156662 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -7194,7 +7194,7 @@ static CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintD returned if it can't be obtained. It is the caller's responsibility to CGContextRelease the context when finished using it. - \warning This function is only available on OS X. + \warning This function is only available on \macos. \warning This function is duplicated in the Cocoa platform plugin. */ diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 93bc00f662..01d972af65 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -104,7 +104,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C The style gets all the information it needs to render the graphical element from the QStyleOption class. The widget is passed as the last argument in case the style needs it to perform - special effects (such as animated default buttons on OS X), + special effects (such as animated default buttons on \macos), but it isn't mandatory. In fact, QStyle can be used to draw on any paint device (not just widgets), in which case the widget argument is a zero pointer. @@ -203,7 +203,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C QStyle gets all the information it needs to render the graphical element from QStyleOption. The widget is passed as the last argument in case the style needs it to perform special effects - (such as animated default buttons on OS X), but it isn't + (such as animated default buttons on \macos), but it isn't mandatory. In fact, you can use QStyle to draw on any paint device, not just widgets, by setting the QPainter properly. @@ -1736,7 +1736,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, desktop platforms. \value SH_Menu_SubMenuUniDirection Since Qt 5.5. If the cursor has - to move towards the submenu (like it is on OS X), or if the + to move towards the submenu (like it is on \macos), or if the cursor can move in any direction as long as it reaches the submenu before the sloppy timeout. diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index 73e6f69041..71cf2fb267 100644 --- a/src/widgets/styles/qstyleoption.cpp +++ b/src/widgets/styles/qstyleoption.cpp @@ -1750,7 +1750,7 @@ QStyleOptionMenuItem::QStyleOptionMenuItem(int version) \value DefaultItem A menu item that is the default action as specified with \l QMenu::defaultAction(). \value Separator A menu separator. \value SubMenu Indicates the menu item points to a sub-menu. - \value Scroller A popup menu scroller (currently only used on OS X). + \value Scroller A popup menu scroller (currently only used on \macos). \value TearOff A tear-off handle for the menu. \value Margin The margin of the menu. \value EmptyArea The empty area of the menu. diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri index 1805e4a8af..7b9497172c 100644 --- a/src/widgets/styles/styles.pri +++ b/src/widgets/styles/styles.pri @@ -35,12 +35,6 @@ SOURCES += \ RESOURCES += styles/qstyle.qrc -contains( styles, all ) { - styles = fusion mac windows windowsxp windowsvista -} - -!macx:styles -= mac - contains( styles, mac ) { HEADERS += \ styles/qmacstyle_mac_p.h \ @@ -55,10 +49,6 @@ contains( styles, windowsvista ) { HEADERS += styles/qwindowsvistastyle_p.h HEADERS += styles/qwindowsvistastyle_p_p.h SOURCES += styles/qwindowsvistastyle.cpp - !contains( styles, windowsxp ) { - message( windowsvista requires windowsxp ) - styles += windowsxp - } } else { DEFINES += QT_NO_STYLE_WINDOWSVISTA } @@ -67,10 +57,6 @@ contains( styles, windowsxp ) { HEADERS += styles/qwindowsxpstyle_p.h HEADERS += styles/qwindowsxpstyle_p_p.h SOURCES += styles/qwindowsxpstyle.cpp - !contains( styles, windows ) { - message( windowsxp requires windows ) - styles += windows - } } else { DEFINES += QT_NO_STYLE_WINDOWSXP } diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp index f3b442928a..9973940c16 100644 --- a/src/widgets/util/qscroller.cpp +++ b/src/widgets/util/qscroller.cpp @@ -564,7 +564,7 @@ void QScroller::stop() \note Please note that this value should be physically correct. The actual DPI settings that Qt returns for the display may be reported wrongly on purpose by the underlying - windowing system, for example on OS X. + windowing system, for example on \macos. */ QPointF QScroller::pixelPerMeter() const { diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 7b0ecc6972..2a418167f1 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -82,9 +82,9 @@ QT_BEGIN_NAMESPACE \li All X11 desktop environments that implement the D-Bus \l{http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem} specification, including recent versions of KDE and Unity. - \li All supported versions of OS X. Note that the Growl + \li All supported versions of \macos. Note that the Growl notification system must be installed for - QSystemTrayIcon::showMessage() to display messages on Mac OS X prior to 10.8 (Mountain Lion). + QSystemTrayIcon::showMessage() to display messages on \macos prior to 10.8 (Mountain Lion). \endlist To check whether a system tray is present on the user's desktop, @@ -163,7 +163,7 @@ QSystemTrayIcon::~QSystemTrayIcon() The menu will pop up when the user requests the context menu for the system tray icon by clicking the mouse button. - On OS X, this is currenly converted to a NSMenu, so the + On \macos, this is currenly converted to a NSMenu, so the aboutToHide() signal is not emitted. \note The system tray icon does not take ownership of the menu. You must @@ -323,7 +323,7 @@ bool QSystemTrayIcon::event(QEvent *e) This signal is emitted when the message displayed using showMessage() was clicked by the user. - Currently this signal is not sent on OS X. + Currently this signal is not sent on \macos. \note We follow Microsoft Windows XP/Vista behavior, so the signal is also emitted when the user clicks on a tray icon with @@ -374,7 +374,7 @@ bool QSystemTrayIcon::supportsMessages() On Windows, the \a millisecondsTimeoutHint is usually ignored by the system when the application has focus. - On OS X, the Growl notification system must be installed for this function to + On \macos, the Growl notification system must be installed for this function to display messages. Has been turned into a slot in Qt 5.2. @@ -731,9 +731,8 @@ void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const // The recursion depth is the same as menu depth, so should not // be higher than 3 levels. - QListIterator<QAction *> it(menu->actions()); - while (it.hasNext()) { - QAction *action = it.next(); + const auto actions = menu->actions(); + for (QAction *action : actions) { if (action->menu()) addPlatformMenu(action->menu()); } diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri index 700831771d..cb19c1fc95 100644 --- a/src/widgets/util/util.pri +++ b/src/widgets/util/util.pri @@ -29,7 +29,7 @@ SOURCES += \ win32:!winrt { SOURCES += util/qsystemtrayicon_win.cpp -} else:contains(QT_CONFIG, xcb) { +} else: qtConfig(xcb) { SOURCES += util/qsystemtrayicon_x11.cpp } else { SOURCES += util/qsystemtrayicon_qpa.cpp diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index 0d369eb28c..657eda3c68 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -124,7 +124,7 @@ QT_BEGIN_NAMESPACE \endtable Additionally, button boxes that contain only buttons with ActionRole or - HelpRole can be considered modeless and have an alternate look on OS X: + HelpRole can be considered modeless and have an alternate look on \macos: \table \row \li modeless horizontal MacLayout @@ -579,7 +579,7 @@ QDialogButtonBox::~QDialogButtonBox() contained in the button box. \value WinLayout Use a policy appropriate for applications on Windows. - \value MacLayout Use a policy appropriate for applications on OS X. + \value MacLayout Use a policy appropriate for applications on \macos. \value KdeLayout Use a policy appropriate for applications on KDE. \value GnomeLayout Use a policy appropriate for applications on GNOME. diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm index 2d19780461..725cc637d6 100644 --- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm +++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm @@ -49,7 +49,7 @@ \class QMacCocoaViewContainer \since 4.5 - \brief The QMacCocoaViewContainer class provides a widget for OS X that can be used to wrap arbitrary + \brief The QMacCocoaViewContainer class provides a widget for \macos that can be used to wrap arbitrary Cocoa views (i.e., NSView subclasses) and insert them into Qt hierarchies. \ingroup advanced @@ -64,10 +64,10 @@ of the underlying NSView. QMacCocoaViewContainer works regardless if Qt is built against Carbon or - Cocoa. However, QCocoaContainerView requires Mac OS X 10.5 or better to be + Cocoa. However, QCocoaContainerView requires \macos 10.5 or better to be used with Carbon. - It should be also noted that at the low level on OS X, there is a + It should be also noted that at the low level on \macos, there is a difference between windows (top-levels) and view (widgets that are inside a window). For this reason, make sure that the NSView that you are wrapping doesn't end up as a top-level. The best way to ensure this is to make sure diff --git a/src/widgets/widgets/qmacnativewidget_mac.h b/src/widgets/widgets/qmacnativewidget_mac.h index 44e793f174..84389f16df 100644 --- a/src/widgets/widgets/qmacnativewidget_mac.h +++ b/src/widgets/widgets/qmacnativewidget_mac.h @@ -47,7 +47,6 @@ Q_FORWARD_DECLARE_OBJC_CLASS(NSView); QT_BEGIN_NAMESPACE -class QMacNativeWidgetPrivate; class Q_WIDGETS_EXPORT QMacNativeWidget : public QWidget { Q_OBJECT @@ -60,9 +59,6 @@ public: protected: bool event(QEvent *ev); - -private: - Q_DECLARE_PRIVATE(QMacNativeWidget) }; QT_END_NAMESPACE diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm index b6c5179989..936bd35187 100644 --- a/src/widgets/widgets/qmacnativewidget_mac.mm +++ b/src/widgets/widgets/qmacnativewidget_mac.mm @@ -48,13 +48,13 @@ /*! \class QMacNativeWidget \since 4.5 - \brief The QMacNativeWidget class provides a widget for OS X that provides + \brief The QMacNativeWidget class provides a widget for \macos that provides a way to put Qt widgets into Cocoa hierarchies. \ingroup advanced \inmodule QtWidgets - On OS X, there is a difference between a window and view; + On \macos, there is a difference between a window and view; normally expressed as widgets in Qt. Qt makes assumptions about its parent-child hierarchy that make it complex to put an arbitrary Qt widget into a hierarchy of "normal" views from Apple frameworks. QMacNativeWidget diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index c31e9750bf..2477510520 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -1559,7 +1559,7 @@ bool QMainWindow::event(QEvent *event) /*! \property QMainWindow::unifiedTitleAndToolBarOnMac - \brief whether the window uses the unified title and toolbar look on OS X + \brief whether the window uses the unified title and toolbar look on \macos Note that the Qt 5 implementation has several limitations compared to Qt 4: \list diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 2131025c8d..5cea9a9ea2 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1441,7 +1441,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) do not support the signals: aboutToHide (), aboutToShow () and hovered (). It is not possible to display an icon in a native menu on Windows Mobile. - \section1 QMenu on OS X with Qt Build Against Cocoa + \section1 QMenu on \macos with Qt Build Against Cocoa QMenu can be inserted only once in a menu/menubar. Subsequent insertions will have no effect or will result in a disabled menu item. diff --git a/src/widgets/widgets/qmenu_mac.mm b/src/widgets/widgets/qmenu_mac.mm index d48041b385..fef1eb2cf4 100644 --- a/src/widgets/widgets/qmenu_mac.mm +++ b/src/widgets/widgets/qmenu_mac.mm @@ -73,7 +73,7 @@ inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePla /*! \since 5.2 - Returns the native NSMenu for this menu. Available on OS X only. + Returns the native NSMenu for this menu. Available on \macos only. \note Qt sets the delegate on the native menu. If you need to set your own delegate, make sure you save the original one and forward any calls to it. @@ -94,7 +94,7 @@ NSMenu *QMenu::toNSMenu() \since 5.2 Set this menu to be the dock menu available by option-clicking - on the application dock icon. Available on OS X only. + on the application dock icon. Available on \macos only. */ void QMenu::setAsDockMenu() { @@ -112,7 +112,7 @@ void QMenu::setAsDockMenu() \deprecated Sets this \a menu to be the dock menu available by option-clicking - on the application dock icon. Available on OS X only. + on the application dock icon. Available on \macos only. Deprecated; use \l QMenu::setAsDockMenu() instead. */ @@ -142,7 +142,7 @@ void QMenuPrivate::moveWidgetToPlatformItem(QWidget *widget, QPlatformMenuItem* /*! \since 5.2 - Returns the native NSMenu for this menu bar. Available on OS X only. + Returns the native NSMenu for this menu bar. Available on \macos only. \note Qt may set the delegate on the native menu bar. If you need to set your own delegate, make sure you save the original one and forward any calls to it. diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 3a90e14655..45b7b3091a 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -612,15 +612,15 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti for items in the menu bar are only shown when the \uicontrol{Alt} key is pressed. - \section1 QMenuBar on OS X + \section1 QMenuBar on \macos - QMenuBar on OS X is a wrapper for using the system-wide menu bar. + QMenuBar on \macos is a wrapper for using the system-wide menu bar. If you have multiple menu bars in one dialog the outermost menu bar (normally inside a widget with widget flag Qt::Window) will be used for the system-wide menu bar. - Qt for OS X also provides a menu bar merging feature to make - QMenuBar conform more closely to accepted OS X menu bar layout. + Qt for \macos also provides a menu bar merging feature to make + QMenuBar conform more closely to accepted \macos menu bar layout. The merging functionality is based on string matching the title of a QMenu entry. These strings are translated (using QObject::tr()) in the "QMenuBar" context. If an entry is moved its slots will still @@ -659,7 +659,7 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti \b{Note:} The text used for the application name in the menu bar is obtained from the value set in the \c{Info.plist} file in - the application's bundle. See \l{Qt for OS X - Deployment} + the application's bundle. See \l{Qt for macOS - Deployment} for more information. \section1 QMenuBar on Windows CE @@ -889,7 +889,7 @@ void QMenuBar::setActiveAction(QAction *act) /*! Removes all the actions from the menu bar. - \note On OS X, menu items that have been merged to the system + \note On \macos, menu items that have been merged to the system menu bar are not removed by this function. One way to handle this would be to remove the extra actions yourself. You can set the \l{QAction::MenuRole}{menu role} on the different menus, so that @@ -1794,7 +1794,7 @@ QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const \since 4.6 This property specifies whether or not the menubar should be used as a native menubar on platforms - that support it. The currently supported platforms are OS X and Windows CE. On these platforms + that support it. The currently supported platforms are \macos and Windows CE. On these platforms if this property is \c true, the menubar is used in the native menubar and is not in the window of its parent, if false the menubar remains in the window. On other platforms the value of this attribute has no effect. diff --git a/src/widgets/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp index 13aa66dec7..123c955684 100644 --- a/src/widgets/widgets/qrubberband.cpp +++ b/src/widgets/widgets/qrubberband.cpp @@ -132,7 +132,7 @@ void QRubberBand::initStyleOption(QStyleOptionRubberBand *option) const By default a rectangular rubber band (\a s is \c Rectangle) will use a mask, so that a small border of the rectangle is all - that is visible. Some styles (e.g., native OS X) will + that is visible. Some styles (e.g., native \macos) will change this and call QWidget::setWindowOpacity() to make a semi-transparent filled selection rectangle. */ diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index fe04299b92..d56c6b39d1 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -140,60 +140,59 @@ void QTabBarPrivate::updateMacBorderMetrics() } /*! - Initialize \a option with the values from the tab at \a tabIndex. This method - is useful for subclasses when they need a QStyleOptionTab, - but don't want to fill in all the information themselves. - - \sa QStyleOption::initFrom(), QTabWidget::initStyleOption() + \internal + This is basically QTabBar::initStyleOption() but + without the expensive QFontMetrics::elidedText() call. */ -void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const + +void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex) const { - Q_D(const QTabBar); - int totalTabs = d->tabList.size(); + Q_Q(const QTabBar); + const int totalTabs = tabList.size(); if (!option || (tabIndex < 0 || tabIndex >= totalTabs)) return; - const QTabBarPrivate::Tab &tab = d->tabList.at(tabIndex); - option->initFrom(this); + const QTabBarPrivate::Tab &tab = tabList.at(tabIndex); + option->initFrom(q); option->state &= ~(QStyle::State_HasFocus | QStyle::State_MouseOver); - option->rect = tabRect(tabIndex); - bool isCurrent = tabIndex == d->currentIndex; + option->rect = q->tabRect(tabIndex); + const bool isCurrent = tabIndex == currentIndex; option->row = 0; - if (tabIndex == d->pressedIndex) + if (tabIndex == pressedIndex) option->state |= QStyle::State_Sunken; if (isCurrent) option->state |= QStyle::State_Selected; - if (isCurrent && hasFocus()) + if (isCurrent && q->hasFocus()) option->state |= QStyle::State_HasFocus; if (!tab.enabled) option->state &= ~QStyle::State_Enabled; - if (isActiveWindow()) + if (q->isActiveWindow()) option->state |= QStyle::State_Active; - if (!d->dragInProgress && option->rect == d->hoverRect) + if (!dragInProgress && option->rect == hoverRect) option->state |= QStyle::State_MouseOver; - option->shape = d->shape; + option->shape = shape; option->text = tab.text; if (tab.textColor.isValid()) - option->palette.setColor(foregroundRole(), tab.textColor); + option->palette.setColor(q->foregroundRole(), tab.textColor); option->icon = tab.icon; - option->iconSize = iconSize(); // Will get the default value then. + option->iconSize = q->iconSize(); // Will get the default value then. option->leftButtonSize = tab.leftWidget ? tab.leftWidget->size() : QSize(); option->rightButtonSize = tab.rightWidget ? tab.rightWidget->size() : QSize(); - option->documentMode = d->documentMode; + option->documentMode = documentMode; - if (tabIndex > 0 && tabIndex - 1 == d->currentIndex) + if (tabIndex > 0 && tabIndex - 1 == currentIndex) option->selectedPosition = QStyleOptionTab::PreviousIsSelected; - else if (tabIndex + 1 < totalTabs && tabIndex + 1 == d->currentIndex) + else if (tabIndex + 1 < totalTabs && tabIndex + 1 == currentIndex) option->selectedPosition = QStyleOptionTab::NextIsSelected; else option->selectedPosition = QStyleOptionTab::NotAdjacent; - bool paintBeginning = (tabIndex == 0) || (d->dragInProgress && tabIndex == d->pressedIndex + 1); - bool paintEnd = (tabIndex == totalTabs - 1) || (d->dragInProgress && tabIndex == d->pressedIndex - 1); + const bool paintBeginning = (tabIndex == 0) || (dragInProgress && tabIndex == pressedIndex + 1); + const bool paintEnd = (tabIndex == totalTabs - 1) || (dragInProgress && tabIndex == pressedIndex - 1); if (paintBeginning) { if (paintEnd) option->position = QStyleOptionTab::OnlyOneTab; @@ -206,7 +205,7 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const } #ifndef QT_NO_TABWIDGET - if (const QTabWidget *tw = qobject_cast<const QTabWidget *>(parentWidget())) { + if (const QTabWidget *tw = qobject_cast<const QTabWidget *>(q->parentWidget())) { option->features |= QStyleOptionTab::HasFrame; if (tw->cornerWidget(Qt::TopLeftCorner) || tw->cornerWidget(Qt::BottomLeftCorner)) option->cornerWidgets |= QStyleOptionTab::LeftCornerWidget; @@ -214,6 +213,19 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const option->cornerWidgets |= QStyleOptionTab::RightCornerWidget; } #endif +} + +/*! + Initialize \a option with the values from the tab at \a tabIndex. This method + is useful for subclasses when they need a QStyleOptionTab, + but don't want to fill in all the information themselves. + + \sa QStyleOption::initFrom(), QTabWidget::initStyleOption() +*/ +void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const +{ + Q_D(const QTabBar); + d->initBasicStyleOption(option, tabIndex); QRect textRect = style()->subElementRect(QStyle::SE_TabBarTabText, option, this); option->text = fontMetrics().elidedText(option->text, d->elideMode, textRect.width(), @@ -1094,6 +1106,7 @@ void QTabBar::setTabText(int index, const QString &text) { Q_D(QTabBar); if (QTabBarPrivate::Tab *tab = d->at(index)) { + d->textSizes.remove(tab->text); tab->text = text; #ifndef QT_NO_SHORTCUT releaseShortcut(tab->shortcutId); @@ -1453,7 +1466,7 @@ QSize QTabBar::tabSizeHint(int index) const Q_D(const QTabBar); if (const QTabBarPrivate::Tab *tab = d->at(index)) { QStyleOptionTab opt; - initStyleOption(&opt, index); + d->initBasicStyleOption(&opt, index); opt.text = d->tabList.at(index).text; QSize iconSize = tab->icon.isNull() ? QSize(0, 0) : opt.iconSize; int hframe = style()->pixelMetric(QStyle::PM_TabBarTabHSpace, &opt, this); @@ -1479,13 +1492,16 @@ QSize QTabBar::tabSizeHint(int index) const if (!opt.icon.isNull()) padding += 4; + QHash<QString, QSize>::iterator it = d->textSizes.find(tab->text); + if (it == d->textSizes.end()) + it = d->textSizes.insert(tab->text, fm.size(Qt::TextShowMnemonic, tab->text)); + const int textWidth = it.value().width(); QSize csz; if (verticalTabs(d->shape)) { csz = QSize( qMax(maxWidgetWidth, qMax(fm.height(), iconSize.height())) + vframe, - fm.size(Qt::TextShowMnemonic, tab->text).width() + iconSize.width() + hframe + widgetHeight + padding); + textWidth + iconSize.width() + hframe + widgetHeight + padding); } else { - csz = QSize(fm.size(Qt::TextShowMnemonic, tab->text).width() + iconSize.width() + hframe - + widgetWidth + padding, + csz = QSize(textWidth + iconSize.width() + hframe + widgetWidth + padding, qMax(maxWidgetHeight, qMax(fm.height(), iconSize.height())) + vframe); } @@ -2157,15 +2173,21 @@ void QTabBarPrivate::setCurrentNextEnabledIndex(int offset) void QTabBar::changeEvent(QEvent *event) { Q_D(QTabBar); - if (event->type() == QEvent::StyleChange) { + switch (event->type()) { + case QEvent::StyleChange: if (!d->elideModeSetByUser) d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this)); if (!d->useScrollButtonsSetByUser) d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this); + // fallthrough + case QEvent::FontChange: + d->textSizes.clear(); d->refresh(); - } else if (event->type() == QEvent::FontChange) { - d->refresh(); + break; + default: + break; } + QWidget::changeEvent(event); } @@ -2208,6 +2230,7 @@ void QTabBar::setElideMode(Qt::TextElideMode mode) Q_D(QTabBar); d->elideMode = mode; d->elideModeSetByUser = true; + d->textSizes.clear(); d->refresh(); } @@ -2398,7 +2421,7 @@ void QTabBar::setMovable(bool movable) \since 4.5 This property is used as a hint for styles to draw the tabs in a different - way then they would normally look in a tab widget. On OS X this will + way then they would normally look in a tab widget. On \macos this will look similar to the tabs in Safari or Leopard's Terminal.app. \sa QTabWidget::documentMode diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h index 04adf96881..0e9dce84b3 100644 --- a/src/widgets/widgets/qtabbar_p.h +++ b/src/widgets/widgets/qtabbar_p.h @@ -169,6 +169,7 @@ public: #endif //QT_NO_ANIMATION }; QList<Tab> tabList; + mutable QHash<QString, QSize> textSizes; int calculateNewPosition(int from, int to, int index) const; void slide(int from, int to); @@ -202,6 +203,8 @@ public: void autoHideTabs(); QRect normalizedScrollRect(int index = -1); + void initBasicStyleOption(QStyleOptionTab *option, int tabIndex) const; + void makeVisible(int index); QSize iconSize; Qt::TextElideMode elideMode; diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index 3ddf4df624..5dce76056c 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -1322,7 +1322,7 @@ void QTabWidget::setUsesScrollButtons(bool useButtons) /*! \property QTabWidget::documentMode \brief Whether or not the tab widget is rendered in a mode suitable for document - pages. This is the same as document mode on OS X. + pages. This is the same as document mode on \macos. \since 4.5 When this property is set the tab widget frame is not rendered. This mode is useful diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp index b93cefd867..61bc6d19cf 100644 --- a/src/widgets/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -405,7 +405,7 @@ void QToolBarPrivate::plug(const QRect &r) When a toolbar is resized in such a way that it is too small to show all the items it contains, an extension button will appear as the last item in the toolbar. Pressing the extension button will - pop up a menu containing the items that does not currently fit in + pop up a menu containing the items that do not currently fit in the toolbar. When a QToolBar is not a child of a QMainWindow, it loses the ability diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index aef4634a9a..8b40325a24 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -876,7 +876,7 @@ QToolButton::ToolButtonPopupMode QToolButton::popupMode() const The default is disabled (i.e. false). - This property is currently ignored on OS X when using QMacStyle. + This property is currently ignored on \macos when using QMacStyle. */ void QToolButton::setAutoRaise(bool enable) { |