Compile with QT_NO_CURSOR.

Mostly straightforward, the a11y changes might look a bit drastic, but the
base class QAccessibleTextWidget was already disabled in this case, so we
have to obviously take out its sub-classes as well.

Change-Id: I682ace20d6938688ddb1da23c3463f3c025fab8e
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Tasuku Suzuki <stasuku@gmail.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
This commit is contained in:
Volker Krause 2012-12-05 11:42:58 +01:00 committed by The Qt Project
parent 425367f892
commit 0c5e232828
14 changed files with 43 additions and 9 deletions

View File

@ -92,7 +92,9 @@ public:
// input methods
virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); }
#ifndef QT_NO_CURSOR
virtual void changeCursor(QCursor * windowCursor, QWindow * window) = 0;
#endif
virtual QPoint pos() const;
virtual void setPos(const QPoint &pos);

View File

@ -237,6 +237,7 @@ void QBasicDrag::exitDndEventLoop()
void QBasicDrag::updateCursor(Qt::DropAction action)
{
#ifndef QT_NO_CURSOR
Qt::CursorShape cursorShape = Qt::ForbiddenCursor;
if (canDrop()) {
switch (action) {
@ -267,6 +268,7 @@ void QBasicDrag::updateCursor(Qt::DropAction action)
}
}
}
#endif
updateAction(action);
}

View File

@ -116,6 +116,7 @@ void QFbCursor::setCursor(const uchar *data, const uchar *mask, int width, int h
mGraphic->set(data, mask, width, height, hotX, hotY);
}
#ifndef QT_NO_CURSOR
void QFbCursor::changeCursor(QCursor * widgetCursor, QWindow *window)
{
Q_UNUSED(window);
@ -134,6 +135,7 @@ void QFbCursor::changeCursor(QCursor * widgetCursor, QWindow *window)
if (mOnScreen || mScreen->geometry().intersects(mCurrentRect.translated(mScreenOffset)))
setDirty();
}
#endif
QT_END_NAMESPACE

View File

@ -59,7 +59,9 @@ public:
// input methods
virtual void pointerEvent(const QMouseEvent &event);
#ifndef QT_NO_CURSOR
virtual void changeCursor(QCursor *widgetCursor, QWindow *window);
#endif
virtual void setDirty() { mDirty = true; /* screen->setDirty(QRect()); */ }
virtual bool isDirty() const { return mDirty; }

View File

@ -199,7 +199,7 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
} else if (classname == QLatin1String("QSplitterHandle")) {
iface = new QAccessibleWidget(widget, QAccessible::Grip);
#endif
#ifndef QT_NO_TEXTEDIT
#if !defined(QT_NO_TEXTEDIT) && !defined(QT_NO_CURSOR)
} else if (classname == QLatin1String("QTextEdit")) {
iface = new QAccessibleTextEdit(widget);
} else if (classname == QLatin1String("QPlainTextEdit")) {
@ -233,7 +233,7 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
} else if (classname == QLatin1String("QRubberBand")) {
iface = new QAccessibleWidget(widget, QAccessible::Border);
#endif
#ifndef QT_NO_TEXTBROWSER
#if !defined(QT_NO_TEXTBROWSER) && !defined(QT_NO_CURSOR)
} else if (classname == QLatin1String("QTextBrowser")) {
iface = new QAccessibleTextBrowser(widget);
#endif

View File

@ -99,7 +99,7 @@ QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel)
return widgets;
}
#ifndef QT_NO_TEXTEDIT
#if !defined(QT_NO_TEXTEDIT) && !defined(QT_NO_CURSOR)
QAccessiblePlainTextEdit::QAccessiblePlainTextEdit(QWidget* o)
:QAccessibleTextWidget(o)
@ -292,7 +292,7 @@ void QAccessibleTextEdit::scrollToSubstring(int startIndex, int endIndex)
qWarning("AccessibleTextEdit::scrollToSubstring failed!");
}
#endif // QT_NO_TEXTEDIT
#endif // QT_NO_TEXTEDIT && QT_NO_CURSOR
#ifndef QT_NO_STACKEDWIDGET
// ======================= QAccessibleStackedWidget ======================
@ -488,7 +488,7 @@ QAccessibleDialogButtonBox::QAccessibleDialogButtonBox(QWidget *widget)
#endif // QT_NO_DIALOGBUTTONBOX
#ifndef QT_NO_TEXTBROWSER
#if !defined(QT_NO_TEXTBROWSER) && !defined(QT_NO_CURSOR)
QAccessibleTextBrowser::QAccessibleTextBrowser(QWidget *widget)
: QAccessibleTextEdit(widget)
{
@ -499,7 +499,7 @@ QAccessible::Role QAccessibleTextBrowser::role() const
{
return QAccessible::StaticText;
}
#endif // QT_NO_TEXTBROWSER
#endif // QT_NO_TEXTBROWSER && QT_NO_CURSOR
#ifndef QT_NO_CALENDARWIDGET
// ===================== QAccessibleCalendarWidget ========================

View File

@ -122,7 +122,6 @@ protected:
virtual QTextDocument *textDocument() const = 0;
virtual QWidget *viewport() const = 0;
};
#endif //QT_NO_CURSOR
#ifndef QT_NO_TEXTEDIT
class QAccessiblePlainTextEdit : public QAccessibleTextWidget
@ -177,6 +176,7 @@ protected:
QWidget *viewport() const;
};
#endif // QT_NO_TEXTEDIT
#endif //QT_NO_CURSOR
class QAccessibleStackedWidget : public QAccessibleWidget
{
@ -245,7 +245,7 @@ public:
explicit QAccessibleDialogButtonBox(QWidget *widget);
};
#ifndef QT_NO_TEXTBROWSER
#if !defined(QT_NO_TEXTBROWSER) && !defined(QT_NO_CURSOR)
class QAccessibleTextBrowser : public QAccessibleTextEdit
{
public:
@ -253,7 +253,7 @@ public:
QAccessible::Role role() const;
};
#endif // QT_NO_TEXTBROWSER
#endif // QT_NO_TEXTBROWSER && QT_NO_CURSOR
#ifndef QT_NO_CALENDARWIDGET
class QAccessibleCalendarWidget : public QAccessibleWidget

View File

@ -47,9 +47,12 @@ QT_BEGIN_NAMESPACE
QDirectFBCursor::QDirectFBCursor(QPlatformScreen *screen)
: m_screen(screen)
{
#ifndef QT_NO_CURSOR
m_image.reset(new QPlatformCursorImage(0, 0, 0, 0, 0, 0));
#endif
}
#ifndef QT_NO_CURSOR
void QDirectFBCursor::changeCursor(QCursor *cursor, QWindow *)
{
int xSpot;
@ -82,5 +85,6 @@ void QDirectFBCursor::changeCursor(QCursor *cursor, QWindow *)
layer->SetCursorShape(layer, surface, xSpot, ySpot);
layer->SetCooperativeLevel(layer, DLSCL_SHARED);
}
#endif
QT_END_NAMESPACE

View File

@ -56,10 +56,14 @@ class QDirectFBCursor : public QPlatformCursor
{
public:
QDirectFBCursor(QPlatformScreen *screen);
#ifndef QT_NO_CURSOR
void changeCursor(QCursor *cursor, QWindow *window);
#endif
private:
#ifndef QT_NO_CURSOR
QScopedPointer<QPlatformCursorImage> m_image;
#endif
QPlatformScreen *m_screen;
};

View File

@ -55,8 +55,10 @@ QEglFSCursor::QEglFSCursor(QEglFSScreen *screen)
initCursorAtlas();
// initialize the cursor
#ifndef QT_NO_CURSOR
QCursor cursor(Qt::ArrowCursor);
setCurrentCursor(&cursor);
#endif
}
QEglFSCursor::~QEglFSCursor()
@ -183,6 +185,7 @@ void QEglFSCursor::initCursorAtlas()
m_cursorAtlas.image = image;
}
#ifndef QT_NO_CURSOR
void QEglFSCursor::changeCursor(QCursor *cursor, QWindow *window)
{
Q_UNUSED(window);
@ -221,6 +224,7 @@ bool QEglFSCursor::setCurrentCursor(QCursor *cursor)
return true;
}
#endif
void QEglFSCursor::update(const QRegion &rgn)
{

View File

@ -57,7 +57,9 @@ public:
QEglFSCursor(QEglFSScreen *screen);
~QEglFSCursor();
#ifndef QT_NO_CURSOR
void changeCursor(QCursor *cursor, QWindow *widget) Q_DECL_OVERRIDE;
#endif
void pointerEvent(const QMouseEvent &event) Q_DECL_OVERRIDE;
QPoint pos() const Q_DECL_OVERRIDE;
@ -68,7 +70,9 @@ public:
virtual void paintOnScreen();
protected:
#ifndef QT_NO_CURSOR
bool setCurrentCursor(QCursor *cursor);
#endif
void draw(const QRectF &rect);
void update(const QRegion &region);

View File

@ -291,6 +291,7 @@ QXcbCursor::~QXcbCursor()
xcb_close_font(xcb_connection(), cursorFont);
}
#ifndef QT_NO_CURSOR
void QXcbCursor::changeCursor(QCursor *cursor, QWindow *widget)
{
QXcbWindow *w = 0;
@ -507,6 +508,7 @@ xcb_cursor_t QXcbCursor::createBitmapCursor(QCursor *cursor)
}
return c;
}
#endif
void QXcbCursor::queryPointer(QXcbConnection *c, xcb_window_t *rootWin, QPoint *pos, int *keybMask)
{

View File

@ -52,20 +52,26 @@ class QXcbCursor : public QXcbObject, public QPlatformCursor
public:
QXcbCursor(QXcbConnection *conn, QXcbScreen *screen);
~QXcbCursor();
#ifndef QT_NO_CURSOR
void changeCursor(QCursor *cursor, QWindow *widget);
#endif
QPoint pos() const;
void setPos(const QPoint &pos);
static void queryPointer(QXcbConnection *c, xcb_window_t *rootWin, QPoint *pos, int *keybMask = 0);
private:
#ifndef QT_NO_CURSOR
xcb_cursor_t createFontCursor(int cshape);
xcb_cursor_t createBitmapCursor(QCursor *cursor);
xcb_cursor_t createNonStandardCursor(int cshape);
#endif
QXcbScreen *m_screen;
#ifndef QT_NO_CURSOR
QMap<int, xcb_cursor_t> m_shapeCursorMap;
QMap<qint64, xcb_cursor_t> m_bitmapCursorMap;
#endif
};
QT_END_NAMESPACE

View File

@ -3069,11 +3069,13 @@ void QWidgetPrivate::setEnabled_helper(bool enable)
qt_x11_enforce_cursor(q);
}
#endif
#ifndef QT_NO_CURSOR
if (q->testAttribute(Qt::WA_SetCursor) || q->isWindow()) {
// enforce the windows behavior of clearing the cursor on
// disabled widgets
qt_qpa_set_cursor(q, false);
}
#endif
#if defined(Q_WS_MAC)
setEnabled_helper_sys(enable);
#endif