dismiss dialog close if we are over the dialog at button release

This commit is contained in:
Marco Martin 2012-01-18 14:08:41 +01:00
parent 3f73928cf9
commit 4dca0e4d12
2 changed files with 11 additions and 1 deletions

View File

@ -71,11 +71,15 @@ public:
void mousePressEvent(QMouseEvent *event)
{
event->accept();
m_dialog->view()->winId();
KWindowSystem::forceActiveWindow(m_dialog->view()->winId());
}
void mouseReleaseEvent(QMouseEvent *event)
{
m_dialog->close();
if (!m_dialog->view()->geometry().contains(event->globalPos())) {
m_dialog->close();
}
}
private:
@ -260,6 +264,11 @@ void FullScreenDialog::setVisible(const bool visible)
}
}
QGraphicsView *FullScreenDialog::view() const
{
return m_view;
}
QDeclarativeListProperty<QGraphicsObject> FullScreenDialog::title()
{
if (m_rootObject) {

View File

@ -54,6 +54,7 @@ public:
bool isVisible() const;
void setVisible(const bool visible);
QGraphicsView *view() const;
//QML properties
QDeclarativeListProperty<QGraphicsObject> title();