Drop more unused TabBox related code

Especially we do no longer need to invoke JavaScript methods from C++.
icc-effect-5.14.5
Martin Gräßlin 2012-01-14 14:48:45 +01:00
parent 28dd3b1353
commit 58725981eb
11 changed files with 0 additions and 89 deletions

View File

@ -271,21 +271,6 @@ void DeclarativeView::setCurrentIndex(const QModelIndex &index)
} }
} }
QModelIndex DeclarativeView::indexAt(const QPoint &pos) const
{
if (QObject *item = rootObject()->findChild<QObject*>("listView")) {
QVariant returnedValue;
QVariant xPos(pos.x());
QVariant yPos(pos.y());
QMetaObject::invokeMethod(item, "indexAtMousePos", Q_RETURN_ARG(QVariant, returnedValue), Q_ARG(QVariant, QVariant(pos)));
if (!returnedValue.canConvert<int>()) {
return QModelIndex();
}
return m_model->index(returnedValue.toInt(), 0);
}
return QModelIndex();
}
void DeclarativeView::currentIndexChanged(int row) void DeclarativeView::currentIndexChanged(int row)
{ {
tabBox->setCurrentIndex(m_model->index(row, 0)); tabBox->setCurrentIndex(m_model->index(row, 0));

View File

@ -57,7 +57,6 @@ public:
virtual void showEvent(QShowEvent *event); virtual void showEvent(QShowEvent *event);
virtual void resizeEvent(QResizeEvent *event); virtual void resizeEvent(QResizeEvent *event);
void setCurrentIndex(const QModelIndex &index); void setCurrentIndex(const QModelIndex &index);
QModelIndex indexAt(const QPoint &pos) const;
protected: protected:
virtual void hideEvent(QHideEvent *event); virtual void hideEvent(QHideEvent *event);

View File

@ -85,12 +85,6 @@ Item {
} }
} }
ListView { ListView {
/**
* Called from C++ to get the index at a mouse pos.
**/
function indexAtMousePos(pos) {
return iconsListView.indexAt(pos.x, pos.y);
}
signal currentIndexChanged(int index) signal currentIndexChanged(int index)
id: iconsListView id: iconsListView
objectName: "listView" objectName: "listView"

View File

@ -166,12 +166,6 @@ Item {
// icon size or two text elements and margins and hoverItem margins // icon size or two text elements and margins and hoverItem margins
return Math.max(16, height + hoverItem.margins.top + hoverItem.margins.bottom); return Math.max(16, height + hoverItem.margins.top + hoverItem.margins.bottom);
} }
/**
* Called from C++ to get the index at a mouse pos.
**/
function indexAtMousePos(pos) {
return compactListView.indexAt(pos.x, pos.y);
}
signal currentIndexChanged(int index) signal currentIndexChanged(int index)
id: compactListView id: compactListView
objectName: "listView" objectName: "listView"

View File

@ -140,12 +140,6 @@ Item {
// icon size or two text elements and margins and hoverItem margins // icon size or two text elements and margins and hoverItem margins
return Math.max(32, height + desktopTabBox.textMargin * 2 + hoverItem.margins.top + hoverItem.margins.bottom); return Math.max(32, height + desktopTabBox.textMargin * 2 + hoverItem.margins.top + hoverItem.margins.bottom);
} }
/**
* Called from C++ to get the index at a mouse pos.
**/
function indexAtMousePos(pos) {
return listView.indexAt(pos.x, pos.y);
}
signal currentIndexChanged(int index) signal currentIndexChanged(int index)
id: listView id: listView
objectName: "listView" objectName: "listView"

View File

@ -182,12 +182,6 @@ Item {
// icon size or two text elements and margins and hoverItem margins // icon size or two text elements and margins and hoverItem margins
return Math.max(32, height*2 + informativeTabBox.textMargin * 3 + hoverItem.margins.top + hoverItem.margins.bottom); return Math.max(32, height*2 + informativeTabBox.textMargin * 3 + hoverItem.margins.top + hoverItem.margins.bottom);
} }
/**
* Called from C++ to get the index at a mouse pos.
**/
function indexAtMousePos(pos) {
return listView.indexAt(pos.x, pos.y);
}
signal currentIndexChanged(int index) signal currentIndexChanged(int index)
id: listView id: listView
objectName: "listView" objectName: "listView"

View File

@ -131,12 +131,6 @@ Item {
// icon size or two text elements and margins and hoverItem margins // icon size or two text elements and margins and hoverItem margins
return height + hoverItem.margins.top + hoverItem.margins.bottom; return height + hoverItem.margins.top + hoverItem.margins.bottom;
} }
/**
* Called from C++ to get the index at a mouse pos.
**/
function indexAtMousePos(pos) {
return textListView.indexAt(pos.x, pos.y);
}
signal currentIndexChanged(int index) signal currentIndexChanged(int index)
id: textListView id: textListView
objectName: "listView" objectName: "listView"

View File

@ -64,12 +64,6 @@ Item {
} }
ListView { ListView {
/**
* Called from C++ to get the index at a mouse pos.
**/
function indexAtMousePos(pos) {
return thumbnailListView.indexAt(pos.x, pos.y);
}
signal currentIndexChanged(int index) signal currentIndexChanged(int index)
id: thumbnailListView id: thumbnailListView
objectName: "listView" objectName: "listView"

View File

@ -55,12 +55,6 @@ Item {
} }
ListView { ListView {
/**
* Called from C++ to get the index at a mouse pos.
**/
function indexAtMousePos(pos) {
return thumbnailListView.indexAt(pos.x, pos.y);
}
signal currentIndexChanged(int index) signal currentIndexChanged(int index)
id: thumbnailListView id: thumbnailListView
objectName: "listView" objectName: "listView"

View File

@ -342,11 +342,6 @@ int TabBoxHandler::desktop(const QModelIndex& index) const
return -1; return -1;
} }
int TabBoxHandler::currentSelectedDesktop() const
{
return desktop(d->index);
}
void TabBoxHandler::setCurrentIndex(const QModelIndex& index) void TabBoxHandler::setCurrentIndex(const QModelIndex& index)
{ {
if (d->index == index) { if (d->index == index) {
@ -440,18 +435,6 @@ bool TabBoxHandler::containsPos(const QPoint& pos) const
return w->geometry().contains(pos); return w->geometry().contains(pos);
} }
QModelIndex TabBoxHandler::indexAt(const QPoint& pos) const
{
if (d->m_declarativeView && d->m_declarativeView->isVisible()) {
QPoint widgetPos = d->m_declarativeView->mapFromGlobal(pos);
return d->m_declarativeView->indexAt(widgetPos);
} else if (d->m_declarativeDesktopView && d->m_declarativeDesktopView->isVisible()) {
QPoint widgetPos = d->m_declarativeDesktopView->mapFromGlobal(pos);
return d->m_declarativeDesktopView->indexAt(widgetPos);
}
return QModelIndex();
}
QModelIndex TabBoxHandler::index(KWin::TabBox::TabBoxClient* client) const QModelIndex TabBoxHandler::index(KWin::TabBox::TabBoxClient* client) const
{ {
return d->clientModel()->index(client); return d->clientModel()->index(client);

View File

@ -256,11 +256,6 @@ public:
* @see DesktopModel::desktopIndex * @see DesktopModel::desktopIndex
*/ */
int desktop(const QModelIndex& index) const; int desktop(const QModelIndex& index) const;
/**
* @return The current selected desktop. If there is no selected desktop
* or TabBoxMode is not TabBoxConfig::DesktopTabBox -1 will be returned.
*/
int currentSelectedDesktop() const;
/** /**
* Handles additional grabbed key events by the TabBox controller. * Handles additional grabbed key events by the TabBox controller.
@ -278,15 +273,6 @@ public:
*/ */
bool containsPos(const QPoint& pos) const; bool containsPos(const QPoint& pos) const;
/** /**
* Returns the index at the given position in global coordinates
* of the view.
* @param pos The position in global coordinates
* @return The model index at given position. If there is no item
* at the position or the position is not in the view an invalid
* model index will be returned;
*/
QModelIndex indexAt(const QPoint& pos) const;
/**
* @param client The TabBoxClient whose index should be returned * @param client The TabBoxClient whose index should be returned
* @return Returns the ModelIndex of given TabBoxClient or an invalid ModelIndex * @return Returns the ModelIndex of given TabBoxClient or an invalid ModelIndex
* if the model does not contain the given TabBoxClient. * if the model does not contain the given TabBoxClient.