code shifted to qmlexport
This commit is contained in:
parent
18bea9a46f
commit
6113667976
|
@ -0,0 +1,51 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QSK_LAYOUT_QML_H
|
||||
#define QSK_LAYOUT_QML_H
|
||||
|
||||
#include "QskQmlGlobal.h"
|
||||
|
||||
#include <QskStackBox.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskGridBox.h>
|
||||
|
||||
template< typename LayoutBox >
|
||||
class QskLayoutBoxQml : public LayoutBox
|
||||
{
|
||||
public:
|
||||
|
||||
Q_INVOKABLE bool isEmpty() const
|
||||
{
|
||||
return LayoutBox::isEmpty();
|
||||
}
|
||||
|
||||
Q_INVOKABLE QQuickItem* itemAtIndex( int index ) const
|
||||
{
|
||||
return LayoutBox::itemAtIndex( index );
|
||||
}
|
||||
|
||||
Q_INVOKABLE int indexOf( const QQuickItem* item ) const
|
||||
{
|
||||
return LayoutBox::indexOf( item );
|
||||
}
|
||||
|
||||
Q_INVOKABLE void removeAt( int index )
|
||||
{
|
||||
return LayoutBox::removeAt( index );
|
||||
}
|
||||
|
||||
Q_INVOKABLE void removeItem( QQuickItem* item )
|
||||
{
|
||||
// QML does not like a const version
|
||||
LayoutBox::removeItem( item );
|
||||
}
|
||||
};
|
||||
|
||||
class QskStackBoxQml : public QskLayoutBoxQml< QskLinearBox > { Q_OBJECT };
|
||||
class QskLinearBoxQml : public QskLayoutBoxQml< QskLinearBox > { Q_OBJECT };
|
||||
class QskGridBoxQml : public QskLayoutBoxQml< QskGridBox > { Q_OBJECT };
|
||||
|
||||
#endif
|
|
@ -4,44 +4,43 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "QskQml.h"
|
||||
#include "QskLayoutQml.h"
|
||||
#include "QskShortcutQml.h"
|
||||
|
||||
#include <QskCorner.h>
|
||||
#include <QskDialog.h>
|
||||
#include <QskDialogButton.h>
|
||||
#include <QskDialogButtonBox.h>
|
||||
#include <QskDialogSubWindow.h>
|
||||
#include <QskDialogWindow.h>
|
||||
#include <QskFocusIndicator.h>
|
||||
#include <QskGradient.h>
|
||||
#include <QskGraphicLabel.h>
|
||||
#include <QskMessageWindow.h>
|
||||
#include <QskPopup.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskRgbValue.h>
|
||||
#include <QskScrollArea.h>
|
||||
#include <QskScrollView.h>
|
||||
#include <QskSelectionWindow.h>
|
||||
#include <QskSeparator.h>
|
||||
#include <QskSetup.h>
|
||||
#include <QskSimpleListBox.h>
|
||||
#include <QskSkin.h>
|
||||
#include <QskSkinManager.h>
|
||||
#include <QskSlider.h>
|
||||
#include <QskStandardSymbol.h>
|
||||
#include <QskStatusIndicator.h>
|
||||
#include <QskSubWindow.h>
|
||||
#include <QskSubWindowArea.h>
|
||||
#include <QskTabBar.h>
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskTextOptions.h>
|
||||
#include <QskVirtualKeyboard.h>
|
||||
#include <QskWindow.h>
|
||||
|
||||
#include "QskCorner.h"
|
||||
#include "QskDialog.h"
|
||||
#include "QskDialogButton.h"
|
||||
#include "QskDialogButtonBox.h"
|
||||
#include "QskDialogSubWindow.h"
|
||||
#include "QskDialogWindow.h"
|
||||
#include "QskFocusIndicator.h"
|
||||
#include "QskGradient.h"
|
||||
#include "QskGraphicLabel.h"
|
||||
#include "QskGridBox.h"
|
||||
#include "QskLinearBox.h"
|
||||
#include "QskMessageWindow.h"
|
||||
#include "QskPopup.h"
|
||||
#include "QskPushButton.h"
|
||||
#include "QskRgbValue.h"
|
||||
#include "QskScrollArea.h"
|
||||
#include "QskScrollView.h"
|
||||
#include "QskSelectionWindow.h"
|
||||
#include "QskSeparator.h"
|
||||
#include "QskSetup.h"
|
||||
#include "QskShortcut.h"
|
||||
#include "QskSimpleListBox.h"
|
||||
#include "QskSkin.h"
|
||||
#include "QskSkinManager.h"
|
||||
#include "QskSlider.h"
|
||||
#include "QskStackBox.h"
|
||||
#include "QskStandardSymbol.h"
|
||||
#include "QskStatusIndicator.h"
|
||||
#include "QskSubWindow.h"
|
||||
#include "QskSubWindowArea.h"
|
||||
#include "QskTabBar.h"
|
||||
#include "QskTabButton.h"
|
||||
#include "QskTabView.h"
|
||||
#include "QskTextLabel.h"
|
||||
#include "QskTextOptions.h"
|
||||
#include "QskVirtualKeyboard.h"
|
||||
#include "QskWindow.h"
|
||||
|
||||
#include <qjsvalueiterator.h>
|
||||
#include <qmargins.h>
|
||||
|
@ -233,7 +232,7 @@ void QskQml::registerTypes()
|
|||
qRegisterMetaType< QskSkin* >();
|
||||
|
||||
QSK_REGISTER( QskMain, "Main" );
|
||||
QSK_REGISTER( QskShortcut, "Shortcut" );
|
||||
QSK_REGISTER( QskShortcutQml, "Shortcut" );
|
||||
|
||||
QSK_REGISTER( QskWindow, "Window" );
|
||||
|
||||
|
@ -241,9 +240,13 @@ void QskQml::registerTypes()
|
|||
QSK_REGISTER( QskMessageWindow, "MessageWindow" );
|
||||
QSK_REGISTER( QskSelectionWindow, "SelectionWindow" );
|
||||
|
||||
QSK_REGISTER( QskGridBox, "GridBox" );
|
||||
QSK_REGISTER( QskLinearBox, "LinearBox" );
|
||||
QSK_REGISTER( QskStackBox, "StackBox" );
|
||||
#if 1
|
||||
QSK_REGISTER( QskGridBoxQml, "GridBox" );
|
||||
QSK_REGISTER( QskLinearBoxQml, "LinearBox" );
|
||||
QSK_REGISTER( QskStackBoxQml, "StackBox" );
|
||||
#else
|
||||
QskGridBoxQml gridBox;
|
||||
#endif
|
||||
|
||||
QSK_REGISTER( QskControl, "Control" );
|
||||
QSK_REGISTER( QskGraphicLabel, "GraphicLabel" );
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskShortcut.h"
|
||||
#include "QskShortcutMap.h"
|
||||
#include "QskShortcutQml.h"
|
||||
#include <QskShortcutMap.h>
|
||||
|
||||
#include <qquickitem.h>
|
||||
#include <qquickwindow.h>
|
||||
|
@ -25,14 +25,14 @@ static bool qskContextMatcher( QObject* object, Qt::ShortcutContext context )
|
|||
|
||||
if ( context == Qt::WindowShortcut )
|
||||
{
|
||||
if ( const auto shortcut = qobject_cast< const QskShortcut* >( object ) )
|
||||
if ( const auto shortcut = qobject_cast< const QskShortcutQml* >( object ) )
|
||||
return shortcut->isFocusInScope();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
class QskShortcut::PrivateData
|
||||
class QskShortcutQml::PrivateData
|
||||
{
|
||||
public:
|
||||
PrivateData()
|
||||
|
@ -50,7 +50,7 @@ class QskShortcut::PrivateData
|
|||
qskShortcutMap().removeShortcut( id, nullptr );
|
||||
}
|
||||
|
||||
void resetShortcut( QskShortcut* shortcut )
|
||||
void resetShortcut( QskShortcutQml* shortcut )
|
||||
{
|
||||
if ( !isComplete )
|
||||
return;
|
||||
|
@ -92,18 +92,18 @@ class QskShortcut::PrivateData
|
|||
bool isComplete : 1;
|
||||
};
|
||||
|
||||
QskShortcut::QskShortcut( QObject* parent )
|
||||
QskShortcutQml::QskShortcutQml( QObject* parent )
|
||||
: Inherited( parent )
|
||||
, m_data( new PrivateData )
|
||||
{
|
||||
}
|
||||
|
||||
QskShortcut::QskShortcut( const QKeySequence& sequence, QObject* parent )
|
||||
: QskShortcut( sequence, Qt::WindowShortcut, parent )
|
||||
QskShortcutQml::QskShortcutQml( const QKeySequence& sequence, QObject* parent )
|
||||
: QskShortcutQml( sequence, Qt::WindowShortcut, parent )
|
||||
{
|
||||
}
|
||||
|
||||
QskShortcut::QskShortcut( const QKeySequence& sequence,
|
||||
QskShortcutQml::QskShortcutQml( const QKeySequence& sequence,
|
||||
Qt::ShortcutContext context, QObject* parent )
|
||||
: Inherited( parent )
|
||||
, m_data( new PrivateData )
|
||||
|
@ -113,22 +113,22 @@ QskShortcut::QskShortcut( const QKeySequence& sequence,
|
|||
m_data->resetShortcut( this );
|
||||
}
|
||||
|
||||
QskShortcut::~QskShortcut()
|
||||
QskShortcutQml::~QskShortcutQml()
|
||||
{
|
||||
}
|
||||
|
||||
int QskShortcut::shortcutId() const
|
||||
int QskShortcutQml::shortcutId() const
|
||||
{
|
||||
return m_data->id;
|
||||
}
|
||||
|
||||
Qt::ShortcutContext QskShortcut::context() const
|
||||
Qt::ShortcutContext QskShortcutQml::context() const
|
||||
{
|
||||
return m_data->isWindowContext
|
||||
? Qt::WindowShortcut : Qt::ApplicationShortcut;
|
||||
}
|
||||
|
||||
void QskShortcut::setContext( Qt::ShortcutContext context )
|
||||
void QskShortcutQml::setContext( Qt::ShortcutContext context )
|
||||
{
|
||||
if ( context == Qt::ApplicationShortcut ||
|
||||
context == Qt::WindowShortcut )
|
||||
|
@ -145,7 +145,7 @@ void QskShortcut::setContext( Qt::ShortcutContext context )
|
|||
}
|
||||
}
|
||||
|
||||
void QskShortcut::setSequence( const QKeySequence& sequence )
|
||||
void QskShortcutQml::setSequence( const QKeySequence& sequence )
|
||||
{
|
||||
if ( sequence != m_data->sequence )
|
||||
{
|
||||
|
@ -156,12 +156,12 @@ void QskShortcut::setSequence( const QKeySequence& sequence )
|
|||
}
|
||||
}
|
||||
|
||||
QKeySequence QskShortcut::sequence() const
|
||||
QKeySequence QskShortcutQml::sequence() const
|
||||
{
|
||||
return m_data->sequence;
|
||||
}
|
||||
|
||||
void QskShortcut::setSequenceVariant( const QVariant& sequence )
|
||||
void QskShortcutQml::setSequenceVariant( const QVariant& sequence )
|
||||
{
|
||||
if ( sequence.type() == QVariant::Int )
|
||||
setSequence( static_cast< QKeySequence::StandardKey >( sequence.toInt() ) );
|
||||
|
@ -169,12 +169,12 @@ void QskShortcut::setSequenceVariant( const QVariant& sequence )
|
|||
setSequence( QKeySequence::fromString( sequence.toString() ) );
|
||||
}
|
||||
|
||||
QVariant QskShortcut::sequenceVariant() const
|
||||
QVariant QskShortcutQml::sequenceVariant() const
|
||||
{
|
||||
return m_data->sequence.toString();
|
||||
}
|
||||
|
||||
void QskShortcut::setEnabled( bool on )
|
||||
void QskShortcutQml::setEnabled( bool on )
|
||||
{
|
||||
if ( on != m_data->enabled )
|
||||
{
|
||||
|
@ -187,12 +187,12 @@ void QskShortcut::setEnabled( bool on )
|
|||
}
|
||||
}
|
||||
|
||||
bool QskShortcut::isEnabled() const
|
||||
bool QskShortcutQml::isEnabled() const
|
||||
{
|
||||
return m_data->enabled;
|
||||
}
|
||||
|
||||
void QskShortcut::setAutoRepeat( bool on )
|
||||
void QskShortcutQml::setAutoRepeat( bool on )
|
||||
{
|
||||
if ( on != m_data->autoRepeat )
|
||||
{
|
||||
|
@ -205,12 +205,12 @@ void QskShortcut::setAutoRepeat( bool on )
|
|||
}
|
||||
}
|
||||
|
||||
bool QskShortcut::autoRepeat() const
|
||||
bool QskShortcutQml::autoRepeat() const
|
||||
{
|
||||
return m_data->autoRepeat;
|
||||
}
|
||||
|
||||
bool QskShortcut::event( QEvent* event )
|
||||
bool QskShortcutQml::event( QEvent* event )
|
||||
{
|
||||
if ( event->type() == QEvent::Shortcut )
|
||||
{
|
||||
|
@ -230,7 +230,7 @@ bool QskShortcut::event( QEvent* event )
|
|||
return false;
|
||||
}
|
||||
|
||||
bool QskShortcut::isFocusInScope() const
|
||||
bool QskShortcutQml::isFocusInScope() const
|
||||
{
|
||||
if ( !m_data->isWindowContext )
|
||||
return true;
|
||||
|
@ -258,12 +258,12 @@ bool QskShortcut::isFocusInScope() const
|
|||
}
|
||||
}
|
||||
|
||||
void QskShortcut::classBegin()
|
||||
void QskShortcutQml::classBegin()
|
||||
{
|
||||
m_data->isComplete = false;
|
||||
}
|
||||
|
||||
void QskShortcut::componentComplete()
|
||||
void QskShortcutQml::componentComplete()
|
||||
{
|
||||
if ( m_data->isComplete == false )
|
||||
{
|
||||
|
@ -272,4 +272,4 @@ void QskShortcut::componentComplete()
|
|||
}
|
||||
}
|
||||
|
||||
#include "moc_QskShortcut.cpp"
|
||||
#include "moc_QskShortcutQml.cpp"
|
|
@ -3,8 +3,8 @@
|
|||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QSK_SHORTCUT_H
|
||||
#define QSK_SHORTCUT_H
|
||||
#ifndef QSK_SHORTCUT_QML_H
|
||||
#define QSK_SHORTCUT_QML_H
|
||||
|
||||
#include "QskQmlGlobal.h"
|
||||
|
||||
|
@ -20,7 +20,7 @@ class QKeySequence;
|
|||
For QML, with C++ there is also QskShortcutMap that does
|
||||
not need to create QObjects per shortcut
|
||||
*/
|
||||
class QSK_QML_EXPORT QskShortcut : public QObject, public QQmlParserStatus
|
||||
class QskShortcutQml : public QObject, public QQmlParserStatus
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES( QQmlParserStatus )
|
||||
|
@ -43,12 +43,12 @@ class QSK_QML_EXPORT QskShortcut : public QObject, public QQmlParserStatus
|
|||
using Inherited = QObject;
|
||||
|
||||
public:
|
||||
QskShortcut( QObject* parent = nullptr );
|
||||
QskShortcutQml( QObject* parent = nullptr );
|
||||
|
||||
QskShortcut( const QKeySequence&, QObject* = nullptr );
|
||||
QskShortcut( const QKeySequence&, Qt::ShortcutContext, QObject* = nullptr );
|
||||
QskShortcutQml( const QKeySequence&, QObject* = nullptr );
|
||||
QskShortcutQml( const QKeySequence&, Qt::ShortcutContext, QObject* = nullptr );
|
||||
|
||||
~QskShortcut() override;
|
||||
~QskShortcutQml() override;
|
||||
|
||||
int shortcutId() const;
|
||||
|
|
@ -8,11 +8,12 @@ contains(QSK_CONFIG, QskDll): DEFINES += QSK_QML_MAKEDLL
|
|||
|
||||
HEADERS += \
|
||||
QskQmlGlobal.h \
|
||||
QskShortcut.h \
|
||||
QskShortcutQml.h \
|
||||
QskLayoutQml.h \
|
||||
QskQml.h
|
||||
|
||||
SOURCES += \
|
||||
QskShortcut.cpp \
|
||||
QskShortcutQml.cpp \
|
||||
QskQml.cpp
|
||||
|
||||
target.path = $${QSK_INSTALL_LIBS}
|
||||
|
|
|
@ -52,6 +52,8 @@ void QskLayoutBox::setActive( bool on )
|
|||
resetImplicitSize();
|
||||
polish();
|
||||
}
|
||||
|
||||
Q_EMIT activeChanged( m_data->isActive );
|
||||
}
|
||||
|
||||
bool QskLayoutBox::isActive() const
|
||||
|
@ -161,7 +163,7 @@ void QskLayoutBox::removeAt( int index )
|
|||
}
|
||||
}
|
||||
|
||||
void QskLayoutBox::removeItem( QQuickItem* item )
|
||||
void QskLayoutBox::removeItem( const QQuickItem* item )
|
||||
{
|
||||
removeAt( indexOf( item ) );
|
||||
}
|
||||
|
|
|
@ -15,26 +15,30 @@ class QSK_EXPORT QskLayoutBox : public QskBox
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
// signals ???
|
||||
Q_PROPERTY( int itemCount READ itemCount() )
|
||||
Q_PROPERTY( bool empty READ isEmpty() )
|
||||
|
||||
Q_PROPERTY( bool active READ isActive
|
||||
WRITE setActive NOTIFY activeChanged )
|
||||
|
||||
using Inherited = QskBox;
|
||||
|
||||
public:
|
||||
explicit QskLayoutBox( QQuickItem* parent = 0 );
|
||||
explicit QskLayoutBox( QQuickItem* parent = nullptr );
|
||||
~QskLayoutBox() override;
|
||||
|
||||
Q_INVOKABLE bool isEmpty() const;
|
||||
bool isEmpty() const;
|
||||
|
||||
Q_INVOKABLE int itemCount() const;
|
||||
Q_INVOKABLE QQuickItem* itemAtIndex( int index ) const;
|
||||
Q_INVOKABLE int indexOf( const QQuickItem* ) const;
|
||||
int itemCount() const;
|
||||
QQuickItem* itemAtIndex( int index ) const;
|
||||
int indexOf( const QQuickItem* ) const;
|
||||
|
||||
void removeItem( const QQuickItem* );
|
||||
Q_INVOKABLE void removeItem( QQuickItem* );
|
||||
Q_INVOKABLE void removeAt( int index );
|
||||
void removeAt( int index );
|
||||
|
||||
Q_INVOKABLE void clear( bool autoDelete = false );
|
||||
|
||||
Q_INVOKABLE void setActive( bool );
|
||||
Q_INVOKABLE bool isActive() const;
|
||||
void setActive( bool );
|
||||
bool isActive() const;
|
||||
|
||||
void adjustItem( const QQuickItem* );
|
||||
void adjustItemAt( int index );
|
||||
|
@ -44,9 +48,13 @@ class QSK_EXPORT QskLayoutBox : public QskBox
|
|||
qreal heightForWidth( qreal width ) const override;
|
||||
qreal widthForHeight( qreal height ) const override;
|
||||
|
||||
Q_SIGNALS:
|
||||
void activeChanged( bool );
|
||||
|
||||
public Q_SLOTS:
|
||||
void activate();
|
||||
void invalidate();
|
||||
void clear( bool autoDelete = false );
|
||||
|
||||
protected:
|
||||
bool event( QEvent* ) override;
|
||||
|
@ -79,9 +87,4 @@ inline bool QskLayoutBox::isEmpty() const
|
|||
return itemCount() <= 0;
|
||||
}
|
||||
|
||||
inline void QskLayoutBox::removeItem( const QQuickItem* item )
|
||||
{
|
||||
removeItem( const_cast< QQuickItem* >( item ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue