Merge wxQT branch into the trunk.

This merges in the latest sources from GSoC 2014 wxQt project with just a few
minor corrections, mostly undoing wrong changes to common files in that branch
(results of a previous bad merge?) and getting rid of whitespace-only changes.
Also remove debug logging from wxGrid.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-08-24 01:50:11 +00:00
parent d513d3e2f0
commit df13791078
381 changed files with 24333 additions and 938 deletions

111
src/qt/uiaction.cpp Normal file
View File

@@ -0,0 +1,111 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/qt/uiaction.cpp
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/qt/defs.h"
#include "wx/qt/private/utils.h"
#include "wx/uiaction.h"
#include "wx/qt/private/converter.h"
#include <QtTest/QtTestGui>
#if wxUSE_UIACTIONSIMULATOR
using namespace Qt;
using namespace QTest;
static MouseButton ConvertMouseButton( int button )
{
MouseButton qtButton;
switch ( button )
{
case wxMOUSE_BTN_LEFT:
qtButton = LeftButton;
break;
case wxMOUSE_BTN_MIDDLE:
qtButton = MiddleButton;
break;
case wxMOUSE_BTN_RIGHT:
qtButton = RightButton;
break;
case wxMOUSE_BTN_AUX1:
qtButton = XButton1;
break;
case wxMOUSE_BTN_AUX2:
qtButton = XButton2;
break;
default:
wxFAIL_MSG( "Unsupported mouse button" );
qtButton = NoButton;
break;
}
return qtButton;
}
static bool SimulateMouseButton( MouseAction mouseAction, MouseButton mouseButton )
{
QPoint mousePosition = QCursor::pos();
QWidget *widget = QApplication::widgetAt( mousePosition );
if ( widget != NULL )
mouseEvent( mouseAction, widget, mouseButton, NoModifier, mousePosition );
// If we found a widget then we successfully simulated an event:
return widget != NULL;
}
static bool SimulateKeyboardKey( KeyAction keyAction, Key key )
{
QWidget *widget = QApplication::focusWidget();
if ( widget != NULL )
keyEvent( keyAction, widget, key );
// If we found a widget then we successfully simulated an event:
return widget != NULL;
}
bool wxUIActionSimulator::MouseDown( int button )
{
return SimulateMouseButton( MousePress, ConvertMouseButton( button ));
}
bool wxUIActionSimulator::MouseUp(int button)
{
return SimulateMouseButton( MouseRelease, ConvertMouseButton( button ));
}
bool wxUIActionSimulator::MouseMove(long x, long y)
{
QCursor::setPos( x, y );
return true;
}
bool wxUIActionSimulator::DoKey(int keyCode, int modifiers, bool isDown)
{
Qt::KeyboardModifiers qtmodifiers;
enum Key key;
key = (enum Key) wxQtConvertKeyCode( keyCode, modifiers, qtmodifiers );
wxCHECK_MSG(key, false, wxT("No current key conversion equivalent in Qt"));
KeyAction keyAction = isDown ? Press : Release;
return SimulateKeyboardKey( keyAction, key );
}
#endif // wxUSE_UIACTIONSIMULATOR