Skip to content

Commit

Permalink
Qt4/Qt5 neutral changes:
Browse files Browse the repository at this point in the history
+ 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
  • Loading branch information
wwmayer committed Dec 12, 2016
1 parent 5466568 commit 1cdee20
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/Gui/Application.cpp
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/Gui/DlgExpressionInput.cpp
Expand Up @@ -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) {
Expand All @@ -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*>();
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/DlgMaterialPropertiesImp.cpp
Expand Up @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions src/Gui/GuiApplicationNativeEventAware.cpp
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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");
Expand All @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions src/Gui/GuiApplicationNativeEventAware.h
Expand Up @@ -32,7 +32,7 @@ class QMainWindow;

#ifdef _USE_3DCONNEXION_SDK

#ifdef Q_WS_WIN
#ifdef Q_OS_WIN
#include "3Dconnexion/MouseParameters.h"

#include <vector>
Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -87,7 +87,7 @@ namespace Gui

#ifdef _USE_3DCONNEXION_SDK
// For Windows
#ifdef Q_WS_WIN
#ifdef Q_OS_WIN
public:
static bool Is3dmouseAttached();

Expand Down Expand Up @@ -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;
Expand All @@ -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
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/MainWindow.cpp
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/Gui/WinNativeGestureRecognizers.h
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/Main/FreeCADGuiPy.cpp
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp
Expand Up @@ -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
);
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Spreadsheet/Gui/qtcolorpicker.h
Expand Up @@ -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)
Expand Down

0 comments on commit 1cdee20

Please sign in to comment.