[Development] Qt 5.2 header diff: QtWidgets
Giuseppe D'Angelo
giuseppe.dangelo at kdab.com
Tue Nov 5 11:09:48 CET 2013
Il 05/11/2013 01:07, Thiago Macieira ha scritto:
> Pastebin URL (expires in 24 hours):
> http://paste.fedoraproject.org/51643/61145013
>
> ---
> diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
> index 80a31c4..c7a1d6f 100644
> --- a/src/widgets/dialogs/qcolordialog.h
> +++ b/src/widgets/dialogs/qcolordialog.h
> @@ -112,6 +112,9 @@ Q_SIGNALS:
>
> protected:
> void changeEvent(QEvent *event);
> + virtual void mouseMoveEvent(QMouseEvent *);
> + virtual void mouseReleaseEvent(QMouseEvent *);
> + virtual void keyPressEvent(QKeyEvent *);
> void done(int result);
This is ""dangerous"" -- if a subclass overrode those methods, they
won't be called :(
Need to carefully examine the code (d928dbbc) to figure out if it's OK
to not invoke those methods, or not doing so will break the class. Cf.
> http://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C++#Adding_a_reimplemented_virtual_function
> http://marcmutz.wordpress.com/2010/07/25/bcsc-gotcha-reimplementing-a-virtual-function/
>
> class Q_WIDGETS_EXPORT QFileDialog : public QDialog
> {
> @@ -90,7 +90,8 @@ public:
> DontUseSheet = 0x00000008,
> DontUseNativeDialog = 0x00000010,
> ReadOnly = 0x00000020,
> - HideNameFilterDetails = 0x00000040
> + HideNameFilterDetails = 0x00000040,
> + DontUseCustomDirectoryIcons = 0x00000080
> };
> Q_DECLARE_FLAGS(Options, Option)
>
> @@ -105,9 +106,15 @@ public:
> inline void setDirectory(const QDir &directory);
> QDir directory() const;
>
> + void setDirectoryUrl(const QUrl &directory);
> + QUrl directoryUrl() const;
> +
> void selectFile(const QString &filename);
> QStringList selectedFiles() const;
>
> + void selectUrl(const QUrl &url);
> + QList<QUrl> selectedUrls() const;
Is this by design? Why one is allowed to select *one* URL, but then
retrieve a list of selected ones? Should selectUrl get the same kind of
modifiers of QItemSelectionModel::select?
> +
> + void setCheckBox(QCheckBox *cb);
> + QCheckBox* checkBox() const;
> +
Minor, style violation
> +
> + void setResizeContentsPrecision(int precision, bool resizeNow = true);
> + int resizeContentsPrecision() const;
Boolean trap, and style violation
> diff --git a/src/widgets/itemviews/qtableview.h b/src/widgets/itemviews/qtableview.h
> index 824348d..db95648 100644
> --- a/src/widgets/itemviews/qtableview.h
> +++ b/src/widgets/itemviews/qtableview.h
> @@ -118,6 +118,8 @@ public:
>
> void sortByColumn(int column, Qt::SortOrder order);
>
> + QSize viewportSizeHint() const;
> +
Style violation (Q_DECL_OVERRIDE). Same issue with introducing a virtual
method override in the middle of a hierarchy. Also, this is protected in
QAbstractScrollArea, not public.
> diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h
> index 73f11f1..a29e9b6 100644
> --- a/src/widgets/itemviews/qtreeview.h
> +++ b/src/widgets/itemviews/qtreeview.h
> @@ -128,6 +128,9 @@ public:
> void setWordWrap(bool on);
> bool wordWrap() const;
>
> + void setTreePosition(int logicalIndex);
> + int treePosition() const;
> +
> void keyboardSearch(const QString &search);
>
> QRect visualRect(const QModelIndex &index) const;
> @@ -144,6 +147,8 @@ public:
> void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>());
> void selectAll();
>
> + QSize viewportSizeHint() const;
> +
Ditto
> Q_SIGNALS:
> void expanded(const QModelIndex &index);
> void collapsed(const QModelIndex &index);
> @@ -219,6 +224,7 @@ private:
> friend class QAccessibleTree;
> friend class QAccessibleTableCell;
> int visualIndex(const QModelIndex &index) const;
> + int accessibleTree2Index(const QModelIndex &index) const;
Not happy with the function name. Why is this even here? Can't it go
into the private?
> diff --git a/src/widgets/kernel/qlayout.h b/src/widgets/kernel/qlayout.h
> index 6f43c2b..ca5f6d4 100644
> --- a/src/widgets/kernel/qlayout.h
> +++ b/src/widgets/kernel/qlayout.h
> @@ -130,6 +130,7 @@ public:
> virtual int count() const = 0;
> bool isEmpty() const;
> QSizePolicy::ControlTypes controlTypes() const;
> + QLayoutItem* replaceWidget(QWidget *from, QWidget *to, bool recursive = true);
Style violation + boolean trap
> diff --git a/src/widgets/util/qsystemtrayicon.h b/src/widgets/util/qsystemtrayicon.h
> index 278efae..d6ba553 100644
> --- a/src/widgets/util/qsystemtrayicon.h
> +++ b/src/widgets/util/qsystemtrayicon.h
> @@ -94,8 +94,6 @@ public:
> static bool supportsMessages();
>
> enum MessageIcon { NoIcon, Information, Warning, Critical };
> - void showMessage(const QString &title, const QString &msg,
> - MessageIcon icon = Information, int msecs = 10000);
>
> QRect geometry() const;
> bool isVisible() const;
> @@ -104,6 +102,8 @@ public Q_SLOTS:
> void setVisible(bool visible);
> inline void show() { setVisible(true); }
> inline void hide() { setVisible(false); }
> + void showMessage(const QString &title, const QString &msg,
> + QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information, int msecs = 10000);
Probably more useful as a Q_INVOKABLE rather than a slot? Not sure who's
going to emit signals matching this signature...
> diff --git a/src/widgets/widgets/qdialogbuttonbox.h b/src/widgets/widgets/qdialogbuttonbox.h
> index 6715c59..d8e1a99 100644
> --- a/src/widgets/widgets/qdialogbuttonbox.h
> +++ b/src/widgets/widgets/qdialogbuttonbox.h
> @@ -115,7 +115,8 @@ public:
>
> QDialogButtonBox(QWidget *parent = 0);
> QDialogButtonBox(Qt::Orientation orientation, QWidget *parent = 0);
> - QDialogButtonBox(StandardButtons buttons, Qt::Orientation orientation = Qt::Horizontal,
> + explicit QDialogButtonBox(StandardButtons buttons, QWidget *parent = 0);
> + QDialogButtonBox(StandardButtons buttons, Qt::Orientation orientation,
> QWidget *parent = 0);
> ~QDialogButtonBox();
Change of a default parameter, but totally compatible
> diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h
> index e2b9443..3d52863 100644
> --- a/src/widgets/widgets/qlineedit.h
> +++ b/src/widgets/widgets/qlineedit.h
> @@ -59,12 +59,14 @@ class QCompleter;
> class QStyleOptionFrame;
> class QAbstractSpinBox;
> class QDateTimeEdit;
> +class QIcon;
> +class QToolButton;
>
> class Q_WIDGETS_EXPORT QLineEdit : public QWidget
> {
> Q_OBJECT
>
> - Q_ENUMS(EchoMode)
> + Q_ENUMS(ActionPosition EchoMode)
> Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask)
> Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged USER true)
> Q_PROPERTY(int maxLength READ maxLength WRITE setMaxLength)
> @@ -83,8 +85,13 @@ class Q_WIDGETS_EXPORT QLineEdit : public QWidget
> Q_PROPERTY(bool acceptableInput READ hasAcceptableInput)
> Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText)
> Q_PROPERTY(Qt::CursorMoveStyle cursorMoveStyle READ cursorMoveStyle WRITE setCursorMoveStyle)
> -
> + Q_PROPERTY(bool clearButtonEnabled READ isClearButtonEnabled WRITE setClearButtonEnabled)
> public:
> + enum ActionPosition {
> + LeadingPosition,
> + TrailingPosition
> + };
> +
> explicit QLineEdit(QWidget* parent=0);
> explicit QLineEdit(const QString &, QWidget* parent=0);
> ~QLineEdit();
> @@ -102,6 +109,9 @@ public:
> void setFrame(bool);
> bool hasFrame() const;
>
> + void setClearButtonEnabled(bool enable);
> + bool isClearButtonEnabled() const;
> +
> enum EchoMode { Normal, NoEcho, Password, PasswordEchoOnEdit };
> EchoMode echoMode() const;
> void setEchoMode(EchoMode);
> @@ -164,6 +174,16 @@ public:
> void getTextMargins(int *left, int *top, int *right, int *bottom) const;
> QMargins textMargins() const;
>
> +#ifdef Q_NO_USING_KEYWORD
> + inline void addAction(QAction *action)
> + { QWidget::addAction(action); }
> +#else
> + using QWidget::addAction;
> +#endif
> +
> + void addAction(QAction *action, ActionPosition position);
> + QAction *addAction(const QIcon &icon, ActionPosition position);
> +
See Thiago's comment about Q_NO_USING_KEYWORD, apparently is never
defined any more.
> diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.h b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
> index b89b796..31172cb 100644
> --- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
> +++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
> @@ -44,20 +44,20 @@
>
> #include <QtWidgets/QWidget>
>
> -QT_BEGIN_NAMESPACE
> +Q_FORWARD_DECLARE_OBJC_CLASS(NSView);
>
> +QT_BEGIN_NAMESPACE
>
> class QMacCocoaViewContainerPrivate;
> -
> class Q_WIDGETS_EXPORT QMacCocoaViewContainer : public QWidget
> {
> Q_OBJECT
> public:
> - QMacCocoaViewContainer(void *cocoaViewToWrap, QWidget *parent = 0);
> + QMacCocoaViewContainer(NSView *cocoaViewToWrap, QWidget *parent = 0);
> virtual ~QMacCocoaViewContainer();
>
> - void setCocoaView(void *cocoaViewToWrap);
> - void *cocoaView() const;
> + void setCocoaView(NSView *view);
> + NSView *cocoaView() const;
>
> private:
> Q_DECLARE_PRIVATE(QMacCocoaViewContainer)
Isn't this binary and source incompatible?
> diff --git a/src/widgets/widgets/qmacnativewidget_mac.h b/src/widgets/widgets/qmacnativewidget_mac.h
> index 796d7b3..dd433a4 100644
> --- a/src/widgets/widgets/qmacnativewidget_mac.h
> +++ b/src/widgets/widgets/qmacnativewidget_mac.h
> @@ -44,20 +44,23 @@
>
> #include <QtWidgets/QWidget>
>
> -QT_BEGIN_NAMESPACE
> +Q_FORWARD_DECLARE_OBJC_CLASS(NSView);
>
> +QT_BEGIN_NAMESPACE
>
> class QMacNativeWidgetPrivate;
> class Q_WIDGETS_EXPORT QMacNativeWidget : public QWidget
> {
> Q_OBJECT
> public:
> - QMacNativeWidget(void *parentRef = 0);
> + QMacNativeWidget(NSView *parentView = 0);
> ~QMacNativeWidget();
>
> QSize sizeHint() const;
> + NSView *nativeView() const;
>
> protected:
> + void init(NSView *parentView);
> bool event(QEvent *ev);
>
> private:
Same thing
> --- a/src/widgets/widgets/qmenu.h
> +++ b/src/widgets/widgets/qmenu.h
> @@ -50,6 +50,9 @@
> #ifdef Q_OS_WINCE
> #include <windef.h> // for HMENU
> #endif
> +#ifdef Q_OS_OSX
> +Q_FORWARD_DECLARE_OBJC_CLASS(NSMenu);
> +#endif
>
> QT_BEGIN_NAMESPACE
>
> @@ -141,6 +144,10 @@ public:
> #ifdef Q_OS_WINCE
> HMENU wceMenu();
> #endif
> +#ifdef Q_OS_OSX
> + NSMenu* toNSMenu();
> + void setAsDockMenu();
> +#endif
Is it OK to reintroduce platform specific calls in the APIs? I would've
expected this kind of functionality to be provided by QtMacExtras. (No,
I'm not happy about that wceMenu either).
> @@ -204,6 +211,11 @@ private:
> friend void qt_mac_menu_emit_hovered(QMenu *menu, QAction *action);
> };
>
> +#ifdef Q_OS_OSX
> +// ### Qt 4 compatibility; remove in Qt 6
> +inline QT_DEPRECATED void qt_mac_set_dock_menu(QMenu *menu) { menu->setAsDockMenu(); }
> +#endif
> +
Ditto
> QT_END_NAMESPACE
> diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h
> index e88a0c0..60eebee 100644
> --- a/src/widgets/widgets/qmenubar.h
> +++ b/src/widgets/widgets/qmenubar.h
> @@ -108,6 +108,9 @@ public:
> static void wceCommands(uint command);
> static void wceRefresh();
> #endif
> +#ifdef Q_OS_OSX
> + NSMenu* toNSMenu();
> +#endif
Ditto
>
> bool isNativeMenuBar() const;
> void setNativeMenuBar(bool nativeMenuBar);
> diff --git a/src/widgets/widgets/qscrollarea.h b/src/widgets/widgets/qscrollarea.h
> index 576c9bc..70af5fb 100644
> --- a/src/widgets/widgets/qscrollarea.h
> +++ b/src/widgets/widgets/qscrollarea.h
> @@ -69,6 +69,8 @@ public:
> void setWidgetResizable(bool resizable);
>
> QSize sizeHint() const;
> + QSize viewportSizeHint() const;
> +
Same problems as above (style, override in mid hierarchy, wrong
visibility).
> diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h
> index 72c19ab..1f7b8f6 100644
> --- a/src/widgets/widgets/qtabbar.h
> +++ b/src/widgets/widgets/qtabbar.h
> @@ -173,6 +173,8 @@ Q_SIGNALS:
> void currentChanged(int index);
> void tabCloseRequested(int index);
> void tabMoved(int from, int to);
> + void tabBarClicked(int index);
> + void tabBarDoubleClicked(int index);
>
> protected:
> virtual QSize tabSizeHint(int index) const;
> @@ -186,6 +188,7 @@ protected:
> void showEvent(QShowEvent *);
> void hideEvent(QHideEvent *);
> void paintEvent(QPaintEvent *);
> + void mouseDoubleClickEvent(QMouseEvent *);
> void mousePressEvent (QMouseEvent *);
> void mouseMoveEvent (QMouseEvent *);
> void mouseReleaseEvent (QMouseEvent *);
Same problem with overriding in mid hierarchy.
Thanks,
--
Join us at Qt Developer Days 2013! - https://devdays.kdab.com
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel. UK +44-1738-450410, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4048 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20131105/bd329944/attachment.bin>
More information about the Development
mailing list