Bug 552442 - Running against < Qt 4.6 causes build bustages. r=romaxa

--HG--
extra : rebase_source : 20bb0766ecab9ae6ed7af2eee6d62336871a70c6
This commit is contained in:
Doug Turner 2010-03-15 10:54:56 -07:00
parent 260400726a
commit fff30965b7

View File

@ -18,10 +18,9 @@ MozQWidget::MozQWidget(nsWindow* aReceiver, QGraphicsItem* aParent)
: QGraphicsWidget(aParent),
mReceiver(aReceiver)
{
setFlag(QGraphicsItem::ItemAcceptsInputMethod);
// Enable gestures: only available in qt > 4.6
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
setFlag(QGraphicsItem::ItemAcceptsInputMethod);
setAcceptTouchEvents(true);
grabGesture(Qt::PinchGesture);
#endif
@ -265,6 +264,7 @@ QVariant MozQWidget::inputMethodQuery(Qt::InputMethodQuery aQuery) const
void MozQWidget::showVKB()
{
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
QWidget* focusWidget = qApp->focusWidget();
if (focusWidget) {
@ -279,10 +279,14 @@ void MozQWidget::showVKB()
focusWidget->setAttribute(Qt::WA_InputMethodEnabled, true);
inputContext->setFocusWidget(focusWidget);
}
#else
LOG(("VKB not supported in Qt < 4.6\n"));
#endif
}
void MozQWidget::hideVKB()
{
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
QInputContext *inputContext = qApp->inputContext();
if (!inputContext) {
NS_WARNING("Closing SIP: but no input context");
@ -292,6 +296,9 @@ void MozQWidget::hideVKB()
QEvent request(QEvent::CloseSoftwareInputPanel);
inputContext->filterEvent(&request);
inputContext->reset();
#else
LOG(("VKB not supported in Qt < 4.6\n"));
#endif
}
/**
@ -303,6 +310,7 @@ void MozQWidget::hideVKB()
*/
bool MozQWidget::isVKBOpen()
{
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
QVariantList areas;
QInputContext* input_context = qApp->inputContext();
@ -311,5 +319,8 @@ bool MozQWidget::isVKBOpen()
// if it is empty, no VKB visible; otherwise it is
return areas.empty();
#else
return PR_FALSE;
#endif
}