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
{
if (!index.isValid())
return 0;
return Qt::ItemFlags();
Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled;

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

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

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

@ -33,7 +33,7 @@
#include "cameracontroller.hpp"
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)
, mRun(0)
, mDocument(document)

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

@ -41,9 +41,9 @@ class GLWidget : public QGLWidget
public:
GLWidget( QWidget* parent = NULL, const QGLWidget* shareWidget = NULL, Qt::WindowFlags f = 0);
GLWidget( QGLContext* context, QWidget* parent = NULL, const QGLWidget* shareWidget = NULL, Qt::WindowFlags f = 0);
GLWidget( const QGLFormat& format, 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 = nullptr, const QGLWidget* shareWidget = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
GLWidget( const QGLFormat& format, QWidget* parent = nullptr, const QGLWidget* shareWidget = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
virtual ~GLWidget();
inline void setGraphicsWindow( GraphicsWindowQt* gw ) { _gw = gw; }
@ -93,7 +93,7 @@ protected:
class GraphicsWindowQt : public osgViewer::GraphicsWindow
{
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 );
virtual ~GraphicsWindowQt();
@ -107,7 +107,7 @@ public:
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;
QWidget* _parent;
};

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

Loading…
Cancel
Save