scripting friendlyness

svn path=/trunk/KDE/kdelibs/; revision=1048880
This commit is contained in:
Aaron J. Seigo 2009-11-14 03:58:33 +00:00
parent 9d90d23d31
commit 642ac28d10
4 changed files with 37 additions and 16 deletions

View File

@ -73,8 +73,8 @@ public:
* @arg content the page content that will be shown by this tab
* @return the index of the inserted tab
*/
int insertTab(int index, const QIcon &icon, const QString &label,
QGraphicsLayoutItem *content = 0);
Q_INVOKABLE int insertTab(int index, const QIcon &icon, const QString &label,
QGraphicsLayoutItem *content = 0);
/**
* Adds a new tab in the desired position
@ -88,7 +88,7 @@ public:
* @arg content the page content that will be shown by this tab
* @return the index of the inserted tab
*/
int insertTab(int index, const QString &label, QGraphicsLayoutItem *content = 0);
Q_INVOKABLE int insertTab(int index, const QString &label, QGraphicsLayoutItem *content = 0);
/**
* Adds a new tab in the last position
@ -98,7 +98,7 @@ public:
* @arg content the page content that will be shown by this tab
* @return the index of the inserted tab
*/
int addTab(const QIcon &icon, const QString &label, QGraphicsLayoutItem *content = 0);
Q_INVOKABLE int addTab(const QIcon &icon, const QString &label, QGraphicsLayoutItem *content = 0);
/**
* Adds a new tab in the last position
@ -109,14 +109,14 @@ public:
* @arg content the page content that will be shown by this tab
* @return the index of the inserted tab
*/
int addTab(const QString &label, QGraphicsLayoutItem *content = 0);
Q_INVOKABLE int addTab(const QString &label, QGraphicsLayoutItem *content = 0);
/**
* Removes a tab, contents are deleted
*
* @arg index the index of the tab to remove
*/
void removeTab(int index);
Q_INVOKABLE void removeTab(int index);
/**
* Removes a tab, the page is reparented to 0 and is returned
@ -124,7 +124,7 @@ public:
* @arg index the index of the tab to remove
* @since 4.4
*/
QGraphicsLayoutItem *takeTab(int index);
Q_INVOKABLE QGraphicsLayoutItem *takeTab(int index);
/**
* Returns the contents of a page
@ -132,7 +132,7 @@ public:
* @arg index the index of the tab to retrieve
* @since 4.4
*/
QGraphicsLayoutItem *tabAt(int index);
Q_INVOKABLE QGraphicsLayoutItem *tabAt(int index);
/**
* @return the index of the tab currently active
@ -150,14 +150,14 @@ public:
* @arg index the index of the tab to modify
* @arg label the new text label of the given tab
*/
void setTabText(int index, const QString &label);
Q_INVOKABLE void setTabText(int index, const QString &label);
/**
* @return the text label of the given tab
*
* @arg index the index of the tab we want to know its label
*/
QString tabText(int index) const;
Q_INVOKABLE QString tabText(int index) const;
/**
* Sets an icon for a given tab
@ -165,14 +165,14 @@ public:
* @arg index the index of the tab to modify
* @arg icon the new icon for the given tab
*/
void setTabIcon(int index, const QIcon &icon);
Q_INVOKABLE void setTabIcon(int index, const QIcon &icon);
/**
* @return the current icon for a given tab
*
* @arg index the index of the tab we want to know its icon
*/
QIcon tabIcon(int index) const;
Q_INVOKABLE QIcon tabIcon(int index) const;
/**
* shows or hides the tabbar, used if you just want to display the

View File

@ -124,8 +124,7 @@ TextBrowser::~TextBrowser()
void TextBrowser::setText(const QString &text)
{
//FIXME I'm not certain about using only the html methods. look at this again later.
static_cast<KTextBrowser*>(widget())->setHtml(text);
static_cast<KTextBrowser*>(widget())->setText(text);
}
QString TextBrowser::text() const

View File

@ -88,8 +88,7 @@ TextEdit::~TextEdit()
void TextEdit::setText(const QString &text)
{
//FIXME I'm not certain about using only the html methods. look at this again later.
static_cast<KTextEdit*>(widget())->setHtml(text);
static_cast<KTextEdit*>(widget())->setText(text);
}
QString TextEdit::text() const
@ -97,6 +96,16 @@ QString TextEdit::text() const
return static_cast<KTextEdit*>(widget())->toHtml();
}
void TextEdit::setReadOnly(bool readOnly)
{
static_cast<KTextEdit*>(widget())->setReadOnly(readOnly);
}
bool TextEdit::isReadOnly() const
{
return static_cast<KTextEdit*>(widget())->isReadOnly();
}
void TextEdit::setStyleSheet(const QString &stylesheet)
{
widget()->setStyleSheet(stylesheet);

View File

@ -45,6 +45,7 @@ class PLASMA_EXPORT TextEdit : public QGraphicsProxyWidget
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
Q_PROPERTY(QString stylesheet READ styleSheet WRITE setStyleSheet)
Q_PROPERTY(KTextEdit *nativeWidget READ nativeWidget WRITE setNativeWidget)
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
public:
explicit TextEdit(QGraphicsWidget *parent = 0);
@ -62,6 +63,18 @@ public:
*/
QString text() const;
/**
* Sets the text area to be read only or interactive
* @arg true to make it read only, false for interactive
* @since 4.4
*/
void setReadOnly(bool readOnly);
/**
* @return true if the text area is non-interacive
*/
bool isReadOnly() const;
/**
* Sets the stylesheet used to control the visual display of this TextEdit
*