Qt4/Qt5 neutral changes:
+ replace Q_WS_WIN with Q_OS_WIN + replace Q_WS_X11 with Q_OS_LINUX + replace Q_WS_MACX with Q_OS_MACX + set explicit cast to HWND
This commit is contained in:
parent
546656867b
commit
1cdee20953
|
@ -1627,7 +1627,7 @@ void Application::runApplication(void)
|
|||
else if (version & QGLFormat::OpenGL_Version_None)
|
||||
Base::Console().Log("No OpenGL is present or no OpenGL context is current\n");
|
||||
|
||||
#if !defined(Q_WS_X11)
|
||||
#if !defined(Q_OS_LINUX)
|
||||
QIcon::setThemeSearchPaths(QIcon::themeSearchPaths() << QString::fromLatin1(":/icons/FreeCAD-default"));
|
||||
QIcon::setThemeName(QLatin1String("FreeCAD-default"));
|
||||
#endif
|
||||
|
|
|
@ -180,7 +180,7 @@ void DlgExpressionInput::setExpressionInputSize(int width, int height)
|
|||
|
||||
void DlgExpressionInput::mouseReleaseEvent(QMouseEvent* ev)
|
||||
{
|
||||
#if 0//defined(Q_WS_WIN)
|
||||
#if 0//defined(Q_OS_WIN)
|
||||
if (QWidget::mouseGrabber() == this) {
|
||||
QList<QWidget*> childs = this->findChildren<QWidget*>();
|
||||
for (QList<QWidget*>::iterator it = childs.begin(); it != childs.end(); ++it) {
|
||||
|
@ -203,7 +203,7 @@ void DlgExpressionInput::mouseReleaseEvent(QMouseEvent* ev)
|
|||
|
||||
void DlgExpressionInput::mousePressEvent(QMouseEvent* ev)
|
||||
{
|
||||
#if 0//defined(Q_WS_WIN)
|
||||
#if 0//defined(Q_OS_WIN)
|
||||
bool handled = false;
|
||||
if (QWidget::mouseGrabber() == this) {
|
||||
QList<QWidget*> childs = this->findChildren<QWidget*>();
|
||||
|
@ -241,7 +241,7 @@ void DlgExpressionInput::showEvent(QShowEvent* ev)
|
|||
{
|
||||
QDialog::showEvent(ev);
|
||||
|
||||
#if 0//defined(Q_WS_WIN)
|
||||
#if 0//defined(Q_OS_WIN)
|
||||
// This way we can fetch click events outside modal dialogs
|
||||
QWidget* widget = QApplication::activeModalWidget();
|
||||
if (widget) {
|
||||
|
|
|
@ -52,7 +52,7 @@ DlgMaterialPropertiesImp::DlgMaterialPropertiesImp(const std::string& mat, QWidg
|
|||
this->diffuseColor->hide();
|
||||
}
|
||||
|
||||
//#if !defined(Q_WS_MAC)
|
||||
//#if !defined(Q_OS_MAC)
|
||||
ambientColor->setAutoChangeColor(true);
|
||||
diffuseColor->setAutoChangeColor(true);
|
||||
emissiveColor->setAutoChangeColor(true);
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
#ifdef _USE_3DCONNEXION_SDK
|
||||
//windows
|
||||
#ifdef Q_WS_WIN
|
||||
#ifdef Q_OS_WIN
|
||||
Gui::GUIApplicationNativeEventAware* Gui::GUIApplicationNativeEventAware::gMouseInput = 0;
|
||||
#endif
|
||||
#endif //_USE_3DCONNEXION_SDK
|
||||
|
@ -66,14 +66,14 @@ Gui::GUIApplicationNativeEventAware::~GUIApplicationNativeEventAware()
|
|||
#endif
|
||||
|
||||
#ifdef _USE_3DCONNEXION_SDK
|
||||
#ifdef Q_WS_WIN
|
||||
#ifdef Q_OS_WIN
|
||||
if (gMouseInput == this) {
|
||||
gMouseInput = 0;
|
||||
Base::Console().Log("3Dconnexion device detached.\n");
|
||||
}
|
||||
#endif
|
||||
//mac
|
||||
#ifdef Q_WS_MACX
|
||||
#ifdef Q_OS_MACX
|
||||
// if 3Dconnexion library was loaded at runtime
|
||||
if (InstallConnexionHandlers) {
|
||||
// Close our connection with the 3dx driver
|
||||
|
@ -103,13 +103,13 @@ void Gui::GUIApplicationNativeEventAware::initSpaceball(QMainWindow *window)
|
|||
#endif
|
||||
|
||||
#ifdef _USE_3DCONNEXION_SDK
|
||||
#ifdef Q_WS_WIN
|
||||
#ifdef Q_OS_WIN
|
||||
spaceballPresent = Is3dmouseAttached();
|
||||
|
||||
if (spaceballPresent) {
|
||||
fLast3dmouseInputTime = 0;
|
||||
|
||||
if (InitializeRawInput(mainWindow->winId())){
|
||||
if (InitializeRawInput((HWND)mainWindow->winId())){
|
||||
gMouseInput = this;
|
||||
qApp->setEventFilter(Gui::GUIApplicationNativeEventAware::RawInputEventFilter);
|
||||
Base::Console().Log("3Dconnexion device initialized.\n");
|
||||
|
@ -119,9 +119,9 @@ void Gui::GUIApplicationNativeEventAware::initSpaceball(QMainWindow *window)
|
|||
} else {
|
||||
Base::Console().Log("3Dconnexion device not attached.\n");
|
||||
}
|
||||
#endif // #ifdef Q_WS_WIN
|
||||
#endif // #ifdef Q_OS_WIN
|
||||
//mac
|
||||
#ifdef Q_WS_MACX
|
||||
#ifdef Q_OS_MACX
|
||||
OSStatus err;
|
||||
/* make sure the framework is installed */
|
||||
if (InstallConnexionHandlers == NULL)
|
||||
|
|
|
@ -32,7 +32,7 @@ class QMainWindow;
|
|||
|
||||
#ifdef _USE_3DCONNEXION_SDK
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#ifdef Q_OS_WIN
|
||||
#include "3Dconnexion/MouseParameters.h"
|
||||
|
||||
#include <vector>
|
||||
|
@ -41,9 +41,9 @@ class QMainWindow;
|
|||
//#define _WIN32_WINNT 0x0501 //target at least windows XP
|
||||
|
||||
#include <Windows.h>
|
||||
#endif // Q_WS_WIN
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
#ifdef Q_WS_MACX
|
||||
#ifdef Q_OS_MACX
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#include <ConnexionClientAPI.h>
|
||||
// Note that InstallConnexionHandlers will be replaced with
|
||||
|
@ -56,7 +56,7 @@ extern UInt16 RegisterConnexionClient(UInt32 signature, UInt8 *name, UInt16 mode
|
|||
UInt32 mask) __attribute__((weak_import));
|
||||
extern void UnregisterConnexionClient(UInt16 clientID) __attribute__((weak_import));
|
||||
extern void CleanupConnexionHandlers(void) __attribute__((weak_import));
|
||||
#endif // Q_WS_MACX
|
||||
#endif // Q_OS_MACX
|
||||
|
||||
#endif // _USE_3DCONNEXION_SDK
|
||||
|
||||
|
@ -87,7 +87,7 @@ namespace Gui
|
|||
|
||||
#ifdef _USE_3DCONNEXION_SDK
|
||||
// For Windows
|
||||
#ifdef Q_WS_WIN
|
||||
#ifdef Q_OS_WIN
|
||||
public:
|
||||
static bool Is3dmouseAttached();
|
||||
|
||||
|
@ -131,8 +131,8 @@ namespace Gui
|
|||
// use to calculate distance traveled since last event
|
||||
DWORD fLast3dmouseInputTime;
|
||||
static Gui::GUIApplicationNativeEventAware* gMouseInput;
|
||||
#endif // Q_WS_WIN
|
||||
#ifdef Q_WS_MACX
|
||||
#endif // Q_OS_WIN
|
||||
#ifdef Q_OS_MACX
|
||||
private:
|
||||
static UInt16 tdxClientID; /* ID assigned by the driver */
|
||||
static uint32_t lastButtons;
|
||||
|
@ -143,7 +143,7 @@ namespace Gui
|
|||
void Move3d();
|
||||
void Button3d(bool buttonDown, int buttonNumber);
|
||||
|
||||
#endif// Q_WS_MACX
|
||||
#endif// Q_OS_MACX
|
||||
#endif // _USE_3DCONNEXION_SDK
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1019,7 +1019,7 @@ void MainWindow::showMainWindow()
|
|||
// starts a timer to check for the visibility of the main window and call
|
||||
// ShowWindow() if needed.
|
||||
// So far, this phenomena only appeared with Qt4.1.4
|
||||
#if defined(Q_WS_WIN) && (QT_VERSION == 0x040104)
|
||||
#if defined(Q_OS_WIN) && (QT_VERSION == 0x040104)
|
||||
WId id = this->winId();
|
||||
ShowWindow(id, SW_SHOW);
|
||||
std::cout << "Force to show main window" << std::endl;
|
||||
|
|
|
@ -33,13 +33,13 @@
|
|||
#include <QGestureRecognizer>
|
||||
#include <QPinchGesture>
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#ifdef Q_OS_WIN
|
||||
#if QT_VERSION < 0x050000
|
||||
#if(WINVER >= 0x0601) // need Windows 7
|
||||
#define GESTURE_MESS
|
||||
#endif
|
||||
#endif // QT_VERSION < 0x050000
|
||||
#endif // Q_WS_WIN
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
#ifdef GESTURE_MESS
|
||||
|
||||
|
|
|
@ -198,14 +198,14 @@ FreeCADGui_embedToWindow(PyObject * /*self*/, PyObject *args)
|
|||
#if defined(Q_OS_WIN)
|
||||
void* window = 0;
|
||||
str >> window;
|
||||
WId winid = (WId)window;
|
||||
HWND winid = (HWND)window;
|
||||
|
||||
LONG oldLong = GetWindowLong(winid, GWL_STYLE);
|
||||
SetWindowLong(winid, GWL_STYLE,
|
||||
oldLong | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
|
||||
//SetWindowLong(widget->winId(), GWL_STYLE,
|
||||
// WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
|
||||
SetParent(widget->winId(), winid);
|
||||
SetParent((HWND)widget->winId(), winid);
|
||||
|
||||
QEvent embeddingEvent(QEvent::EmbeddingControl);
|
||||
QApplication::sendEvent(widget, &embeddingEvent);
|
||||
|
|
|
@ -393,7 +393,7 @@ void ConstraintView::contextMenuEvent (QContextMenuEvent* event)
|
|||
CONTEXT_ITEM("Sketcher_SelectElementsAssociatedWithConstraints","Select Elements","Sketcher_SelectElementsAssociatedWithConstraints",doSelectConstraints,true)
|
||||
|
||||
QAction* rename = menu.addAction(tr("Rename"), this, SLOT(renameCurrentItem())
|
||||
#ifndef Q_WS_MAC // on Mac F2 doesn't seem to trigger an edit signal
|
||||
#ifndef Q_OS_MAC // on Mac F2 doesn't seem to trigger an edit signal
|
||||
,QKeySequence(Qt::Key_F2)
|
||||
#endif
|
||||
);
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#include <QtCore/QEvent>
|
||||
#include <QtGui/QFocusEvent>
|
||||
|
||||
#if defined(Q_WS_WIN)
|
||||
#if defined(Q_OS_WIN)
|
||||
# if !defined(QT_QTCOLORPICKER_EXPORT) && !defined(QT_QTCOLORPICKER_IMPORT)
|
||||
# define QT_QTCOLORPICKER_EXPORT
|
||||
# elif defined(QT_QTCOLORPICKER_IMPORT)
|
||||
|
|
Loading…
Reference in New Issue
Block a user