API extended
This commit is contained in:
parent
48853d38ef
commit
69546707d2
@ -32,6 +32,12 @@ namespace
|
|||||||
class Option
|
class Option
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Option( const QskGraphic& graphic, const QString& text )
|
||||||
|
: text( text )
|
||||||
|
, graphic( graphic )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Option( const QUrl& graphicSource, const QString& text )
|
Option( const QUrl& graphicSource, const QString& text )
|
||||||
: graphicSource( graphicSource )
|
: graphicSource( graphicSource )
|
||||||
, text( text )
|
, text( text )
|
||||||
@ -129,6 +135,11 @@ QPointF QskMenu::origin() const
|
|||||||
return m_data->origin;
|
return m_data->origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QskMenu::addOption( const QString& text )
|
||||||
|
{
|
||||||
|
addOption( QUrl(), text );
|
||||||
|
}
|
||||||
|
|
||||||
void QskMenu::addOption( const QUrl& graphicSource, const QString& text )
|
void QskMenu::addOption( const QUrl& graphicSource, const QString& text )
|
||||||
{
|
{
|
||||||
m_data->options += Option( graphicSource, text );
|
m_data->options += Option( graphicSource, text );
|
||||||
@ -140,6 +151,17 @@ void QskMenu::addOption( const QUrl& graphicSource, const QString& text )
|
|||||||
Q_EMIT countChanged( count() );
|
Q_EMIT countChanged( count() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QskMenu::addOption( const QskGraphic& graphic, const QString& text )
|
||||||
|
{
|
||||||
|
m_data->options += Option( graphic, text );
|
||||||
|
|
||||||
|
resetImplicitSize();
|
||||||
|
update();
|
||||||
|
|
||||||
|
if ( isComponentComplete() )
|
||||||
|
Q_EMIT countChanged( count() );
|
||||||
|
}
|
||||||
|
|
||||||
void QskMenu::addOption( const QString& graphicSource, const QString& text )
|
void QskMenu::addOption( const QString& graphicSource, const QString& text )
|
||||||
{
|
{
|
||||||
addOption( QUrl( graphicSource ), text );
|
addOption( QUrl( graphicSource ), text );
|
||||||
@ -170,8 +192,14 @@ int QskMenu::separatorCount() const
|
|||||||
|
|
||||||
void QskMenu::clear()
|
void QskMenu::clear()
|
||||||
{
|
{
|
||||||
m_data->options.clear();
|
|
||||||
m_data->separators.clear();
|
m_data->separators.clear();
|
||||||
|
|
||||||
|
if ( !m_data->options.isEmpty() )
|
||||||
|
{
|
||||||
|
m_data->options.clear();
|
||||||
|
if ( isComponentComplete() )
|
||||||
|
Q_EMIT countChanged( count() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantList QskMenu::optionAt( int index ) const
|
QVariantList QskMenu::optionAt( int index ) const
|
||||||
@ -225,9 +253,7 @@ int QskMenu::currentIndex() const
|
|||||||
void QskMenu::keyPressEvent( QKeyEvent* event )
|
void QskMenu::keyPressEvent( QKeyEvent* event )
|
||||||
{
|
{
|
||||||
if( m_data->currentIndex < 0 )
|
if( m_data->currentIndex < 0 )
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
int key = event->key();
|
int key = event->key();
|
||||||
|
|
||||||
|
@ -48,9 +48,11 @@ class QSK_EXPORT QskMenu : public QskPopup
|
|||||||
void setTextOptions( const QskTextOptions& );
|
void setTextOptions( const QskTextOptions& );
|
||||||
QskTextOptions textOptions() const;
|
QskTextOptions textOptions() const;
|
||||||
|
|
||||||
// insert, remove, functors, actions, QskGraphic ...
|
// insert, remove, functors, actions
|
||||||
void addOption( const QUrl& graphicSource, const QString& text );
|
void addOption( const QUrl& graphicSource, const QString& text );
|
||||||
void addOption( const QString& graphicSource, const QString& text );
|
void addOption( const QString& graphicSource, const QString& text );
|
||||||
|
void addOption( const QskGraphic&, const QString& text );
|
||||||
|
void addOption( const QString& text );
|
||||||
|
|
||||||
QVariantList optionAt( int ) const;
|
QVariantList optionAt( int ) const;
|
||||||
int count() const;
|
int count() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user