add missing API that is asked for often enough
svn path=/trunk/KDE/kdelibs/; revision=1161784
This commit is contained in:
parent
b1f9c62c1e
commit
84233ee261
@ -157,6 +157,8 @@ void ComboBox::setNativeWidget(KComboBox *nativeWidget)
|
||||
}
|
||||
|
||||
connect(nativeWidget, SIGNAL(activated(const QString &)), this, SIGNAL(activated(const QString &)));
|
||||
connect(nativeWidget, SIGNAL(currentIndexChanged(int)),
|
||||
this, SIGNAL(currentIndexChanged(int)));
|
||||
connect(nativeWidget, SIGNAL(currentIndexChanged(const QString &)),
|
||||
this, SIGNAL(textChanged(const QString &)));
|
||||
|
||||
@ -320,6 +322,16 @@ void ComboBox::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
QGraphicsProxyWidget::mousePressEvent(event);
|
||||
}
|
||||
|
||||
int ComboBox::count() const
|
||||
{
|
||||
return nativeWidget()->count();
|
||||
}
|
||||
|
||||
int ComboBox::currentIndex() const
|
||||
{
|
||||
return nativeWidget()->currentIndex();
|
||||
}
|
||||
|
||||
} // namespace Plasma
|
||||
|
||||
#include <combobox.moc>
|
||||
|
@ -44,6 +44,8 @@ class PLASMA_EXPORT ComboBox : public QGraphicsProxyWidget
|
||||
Q_PROPERTY(QString text READ text NOTIFY textChanged)
|
||||
Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
|
||||
Q_PROPERTY(KComboBox *nativeWidget READ nativeWidget WRITE setNativeWidget)
|
||||
Q_PROPERTY(int count READ count)
|
||||
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
|
||||
|
||||
public:
|
||||
explicit ComboBox(QGraphicsWidget *parent = 0);
|
||||
@ -85,6 +87,18 @@ public:
|
||||
*/
|
||||
Q_INVOKABLE void addItem(const QString &text);
|
||||
|
||||
/**
|
||||
* Returns the number of items in the combo box
|
||||
* @since 4.6
|
||||
*/
|
||||
int count() const;
|
||||
|
||||
/**
|
||||
* Returns the current index of the combobox
|
||||
* @since 4.6
|
||||
*/
|
||||
int currentIndex() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void clear();
|
||||
|
||||
@ -102,6 +116,12 @@ Q_SIGNALS:
|
||||
*/
|
||||
void textChanged(const QString &text);
|
||||
|
||||
/**
|
||||
* This signal is sent whenever the currentIndex in the combobox changes
|
||||
* either through user interaction or programmatically.
|
||||
*/
|
||||
void currentIndexChanged(int index);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QGraphicsSceneResizeEvent *event);
|
||||
void paint(QPainter *painter,
|
||||
|
Loading…
x
Reference in New Issue
Block a user