Use modern Qt flag declarations

pull/2919/head
Andrei Kortunov 5 years ago
parent 573c630d34
commit 2b4274bca8

@ -116,7 +116,7 @@ bool CSMWorld::IdTable::setData (const QModelIndex &index, const QVariant &value
Qt::ItemFlags CSMWorld::IdTable::flags (const QModelIndex & index) const Qt::ItemFlags CSMWorld::IdTable::flags (const QModelIndex & index) const
{ {
if (!index.isValid()) if (!index.isValid())
return 0; return Qt::ItemFlags();
Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled; Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled;

@ -14,7 +14,7 @@ namespace CSVPrefs
public: public:
ContextMenuList(QWidget* parent = 0); ContextMenuList(QWidget* parent = nullptr);
protected: protected:

@ -21,7 +21,7 @@ namespace CSVRender
public: public:
OrbitCameraMode(WorldspaceWidget* worldspaceWidget, const QIcon& icon, const QString& tooltip = "", OrbitCameraMode(WorldspaceWidget* worldspaceWidget, const QIcon& icon, const QString& tooltip = "",
QWidget* parent = 0); QWidget* parent = nullptr);
~OrbitCameraMode(); ~OrbitCameraMode();
virtual void activate(CSVWidget::SceneToolbar* toolbar); virtual void activate(CSVWidget::SceneToolbar* toolbar);

@ -49,7 +49,7 @@ namespace CSVRender
Q_OBJECT Q_OBJECT
public: public:
RenderWidget(QWidget* parent = 0, Qt::WindowFlags f = 0); RenderWidget(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
virtual ~RenderWidget(); virtual ~RenderWidget();
/// Initiates a request to redraw the view /// Initiates a request to redraw the view
@ -78,8 +78,8 @@ namespace CSVRender
{ {
Q_OBJECT Q_OBJECT
public: public:
SceneWidget(std::shared_ptr<Resource::ResourceSystem> resourceSystem, QWidget* parent = 0, SceneWidget(std::shared_ptr<Resource::ResourceSystem> resourceSystem, QWidget* parent = nullptr,
Qt::WindowFlags f = 0, bool retrieveInput = true); Qt::WindowFlags f = Qt::WindowFlags(), bool retrieveInput = true);
virtual ~SceneWidget(); virtual ~SceneWidget();
CSVWidget::SceneToolMode *makeLightingSelector (CSVWidget::SceneToolbar *parent); CSVWidget::SceneToolMode *makeLightingSelector (CSVWidget::SceneToolbar *parent);

@ -33,7 +33,7 @@
#include "cameracontroller.hpp" #include "cameracontroller.hpp"
CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidget* parent) CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidget* parent)
: SceneWidget (document.getData().getResourceSystem(), parent, 0, false) : SceneWidget (document.getData().getResourceSystem(), parent, Qt::WindowFlags(), false)
, mSceneElements(0) , mSceneElements(0)
, mRun(0) , mRun(0)
, mDocument(document) , mDocument(document)

@ -671,7 +671,7 @@ void CSVWorld::Table::settingChanged (const CSMPrefs::Setting *setting)
{ {
std::string modifierString = setting->getKey().substr (6); std::string modifierString = setting->getKey().substr (6);
Qt::KeyboardModifiers modifiers = 0; Qt::KeyboardModifiers modifiers;
if (modifierString=="-s") if (modifierString=="-s")
modifiers = Qt::ShiftModifier; modifiers = Qt::ShiftModifier;

@ -41,9 +41,9 @@ class GLWidget : public QGLWidget
public: public:
GLWidget( QWidget* parent = NULL, const QGLWidget* shareWidget = NULL, Qt::WindowFlags f = 0); GLWidget( QWidget* parent = nullptr, const QGLWidget* shareWidget = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
GLWidget( QGLContext* context, QWidget* parent = NULL, const QGLWidget* shareWidget = NULL, Qt::WindowFlags f = 0); GLWidget( QGLContext* context, QWidget* parent = nullptr, const QGLWidget* shareWidget = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
GLWidget( const QGLFormat& format, QWidget* parent = NULL, const QGLWidget* shareWidget = NULL, Qt::WindowFlags f = 0); GLWidget( const QGLFormat& format, QWidget* parent = nullptr, const QGLWidget* shareWidget = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
virtual ~GLWidget(); virtual ~GLWidget();
inline void setGraphicsWindow( GraphicsWindowQt* gw ) { _gw = gw; } inline void setGraphicsWindow( GraphicsWindowQt* gw ) { _gw = gw; }
@ -93,7 +93,7 @@ protected:
class GraphicsWindowQt : public osgViewer::GraphicsWindow class GraphicsWindowQt : public osgViewer::GraphicsWindow
{ {
public: public:
GraphicsWindowQt( osg::GraphicsContext::Traits* traits, QWidget* parent = NULL, const QGLWidget* shareWidget = NULL, Qt::WindowFlags f = 0 ); GraphicsWindowQt( osg::GraphicsContext::Traits* traits, QWidget* parent = nullptr, const QGLWidget* shareWidget = nullptr, Qt::WindowFlags f = Qt::WindowFlags() );
GraphicsWindowQt( GLWidget* widget ); GraphicsWindowQt( GLWidget* widget );
virtual ~GraphicsWindowQt(); virtual ~GraphicsWindowQt();
@ -107,7 +107,7 @@ public:
struct WindowData : public osg::Referenced struct WindowData : public osg::Referenced
{ {
WindowData( GLWidget* widget = NULL, QWidget* parent = NULL ): _widget(widget), _parent(parent) {} WindowData( GLWidget* widget = nullptr, QWidget* parent = nullptr ): _widget(widget), _parent(parent) {}
GLWidget* _widget; GLWidget* _widget;
QWidget* _parent; QWidget* _parent;
}; };

@ -24,19 +24,19 @@ using namespace osgQt;
#define GETDEVICEPIXELRATIO() devicePixelRatio() #define GETDEVICEPIXELRATIO() devicePixelRatio()
GLWidget::GLWidget( QWidget* parent, const QGLWidget* shareWidget, Qt::WindowFlags f) GLWidget::GLWidget( QWidget* parent, const QGLWidget* shareWidget, Qt::WindowFlags f)
: QGLWidget(parent, shareWidget, f), _gw( NULL ) : QGLWidget(parent, shareWidget, f), _gw( nullptr )
{ {
_devicePixelRatio = GETDEVICEPIXELRATIO(); _devicePixelRatio = GETDEVICEPIXELRATIO();
} }
GLWidget::GLWidget( QGLContext* context, QWidget* parent, const QGLWidget* shareWidget, Qt::WindowFlags f) GLWidget::GLWidget( QGLContext* context, QWidget* parent, const QGLWidget* shareWidget, Qt::WindowFlags f)
: QGLWidget(context, parent, shareWidget, f), _gw( NULL ) : QGLWidget(context, parent, shareWidget, f), _gw( nullptr )
{ {
_devicePixelRatio = GETDEVICEPIXELRATIO(); _devicePixelRatio = GETDEVICEPIXELRATIO();
} }
GLWidget::GLWidget( const QGLFormat& format, QWidget* parent, const QGLWidget* shareWidget, Qt::WindowFlags f) GLWidget::GLWidget( const QGLFormat& format, QWidget* parent, const QGLWidget* shareWidget, Qt::WindowFlags f)
: QGLWidget(format, parent, shareWidget, f), _gw( NULL ) : QGLWidget(format, parent, shareWidget, f), _gw( nullptr )
{ {
_devicePixelRatio = GETDEVICEPIXELRATIO(); _devicePixelRatio = GETDEVICEPIXELRATIO();
} }
@ -47,8 +47,8 @@ GLWidget::~GLWidget()
if( _gw ) if( _gw )
{ {
_gw->close(); _gw->close();
_gw->_widget = NULL; _gw->_widget = nullptr;
_gw = NULL; _gw = nullptr;
} }
} }
@ -155,7 +155,7 @@ GraphicsWindowQt::GraphicsWindowQt( osg::GraphicsContext::Traits* traits, QWidge
: _realized(false) : _realized(false)
{ {
_widget = NULL; _widget = nullptr;
_traits = traits; _traits = traits;
init( parent, shareWidget, f ); init( parent, shareWidget, f );
} }
@ -165,7 +165,7 @@ GraphicsWindowQt::GraphicsWindowQt( GLWidget* widget )
{ {
_widget = widget; _widget = widget;
_traits = _widget ? createTraits( _widget ) : new osg::GraphicsContext::Traits; _traits = _widget ? createTraits( _widget ) : new osg::GraphicsContext::Traits;
init( NULL, NULL, 0 ); init( nullptr, nullptr, Qt::WindowFlags() );
} }
GraphicsWindowQt::~GraphicsWindowQt() GraphicsWindowQt::~GraphicsWindowQt()
@ -174,20 +174,20 @@ GraphicsWindowQt::~GraphicsWindowQt()
// remove reference from GLWidget // remove reference from GLWidget
if ( _widget ) if ( _widget )
_widget->_gw = NULL; _widget->_gw = nullptr;
} }
bool GraphicsWindowQt::init( QWidget* parent, const QGLWidget* shareWidget, Qt::WindowFlags f ) bool GraphicsWindowQt::init( QWidget* parent, const QGLWidget* shareWidget, Qt::WindowFlags f )
{ {
// update _widget and parent by WindowData // update _widget and parent by WindowData
WindowData* windowData = _traits.get() ? dynamic_cast<WindowData*>(_traits->inheritedWindowData.get()) : 0; WindowData* windowData = _traits.get() ? dynamic_cast<WindowData*>(_traits->inheritedWindowData.get()) : nullptr;
if ( !_widget ) if ( !_widget )
_widget = windowData ? windowData->_widget : NULL; _widget = windowData ? windowData->_widget : nullptr;
if ( !parent ) if ( !parent )
parent = windowData ? windowData->_parent : NULL; parent = windowData ? windowData->_parent : nullptr;
// create widget if it does not exist // create widget if it does not exist
_ownsWidget = _widget == NULL; _ownsWidget = _widget == nullptr;
if ( !_widget ) if ( !_widget )
{ {
// shareWidget // shareWidget
@ -310,7 +310,7 @@ osg::GraphicsContext::Traits* GraphicsWindowQt::createTraits( const QGLWidget* w
bool GraphicsWindowQt::setWindowRectangleImplementation( int x, int y, int width, int height ) bool GraphicsWindowQt::setWindowRectangleImplementation( int x, int y, int width, int height )
{ {
if ( _widget == NULL ) if ( _widget == nullptr )
return false; return false;
_widget->setGeometry( x, y, width, height ); _widget->setGeometry( x, y, width, height );
@ -596,13 +596,13 @@ public:
if (traits->pbuffer) if (traits->pbuffer)
{ {
OSG_WARN << "osgQt: createGraphicsContext - pbuffer not implemented yet." << std::endl; OSG_WARN << "osgQt: createGraphicsContext - pbuffer not implemented yet." << std::endl;
return NULL; return nullptr;
} }
else else
{ {
osg::ref_ptr< GraphicsWindowQt > window = new GraphicsWindowQt( traits ); osg::ref_ptr< GraphicsWindowQt > window = new GraphicsWindowQt( traits );
if (window->valid()) return window.release(); if (window->valid()) return window.release();
else return NULL; else return nullptr;
} }
} }

Loading…
Cancel
Save