Subversion Repositories tpanel

Rev

Rev 310 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 310 Rev 311
Line 1162... Line 1162...
1162
        else
1162
        else
1163
            return false;
1163
            return false;
1164
    }
1164
    }
1165
 
1165
 
1166
    if (event->type() == QEvent::MouseMove)
1166
    if (event->type() == QEvent::MouseMove)
-
 
1167
    {
-
 
1168
        QMouseEvent *mev = dynamic_cast<QMouseEvent *>(event);
-
 
1169
        QWidget *w = childAt(mev->x(), mev->y());
-
 
1170
 
-
 
1171
        if (w)
-
 
1172
        {
-
 
1173
            MSG_DEBUG("Object " << w->objectName().toStdString() << " is under mouse cursor.");
-
 
1174
            QObject *par = w->parent();
-
 
1175
 
-
 
1176
            if (par)
-
 
1177
            {
-
 
1178
                MSG_DEBUG("The parent is " << par->objectName().toStdString());
-
 
1179
 
-
 
1180
                if (par->objectName().startsWith("Item_"))
-
 
1181
                {
-
 
1182
                    QObject *ppar = par->parent();
-
 
1183
 
-
 
1184
                    if (ppar)
-
 
1185
                    {
-
 
1186
                        MSG_DEBUG("The pparent is " << ppar->objectName().toStdString());
-
 
1187
 
-
 
1188
                        if (ppar->objectName().startsWith("View_"))
-
 
1189
                            return false;
-
 
1190
                    }
-
 
1191
                }
-
 
1192
            }
-
 
1193
        }
1167
        return true;    // Filter event out, i.e. stop it being handled further.
1194
        return true;    // Filter event out, i.e. stop it being handled further.
-
 
1195
    }
1168
 
1196
 
1169
//    if (event->type() == QEvent::Gesture)
1197
//    if (event->type() == QEvent::Gesture)
1170
//        return gestureEvent(static_cast<QGestureEvent*>(event));
1198
//        return gestureEvent(static_cast<QGestureEvent*>(event));
1171
 
1199
 
1172
    return QWidget::eventFilter(obj, event);
1200
    return QWidget::eventFilter(obj, event);
Line 1627... Line 1655...
1627
        MSG_DEBUG("Mouse press coords alt.: pos.x: " << event->position().x() << ", pos.y: " << event->position().y() << ", local.x: " << event->localPos().x() << ", local.y: " << event->localPos().y());
1655
        MSG_DEBUG("Mouse press coords alt.: pos.x: " << event->position().x() << ", pos.y: " << event->position().y() << ", local.x: " << event->localPos().x() << ", local.y: " << event->localPos().y());
1628
#endif
1656
#endif
1629
        mLastPressX = x;
1657
        mLastPressX = x;
1630
        mLastPressY = y;
1658
        mLastPressY = y;
1631
 
1659
 
1632
        QWidget *w = childAt(x, y);
1660
        QWidget *w = childAt(event->x(), event->y());
1633
 
1661
 
1634
        if (w)
1662
        if (w)
1635
        {
1663
        {
1636
            MSG_DEBUG("Object " << w->objectName().toStdString() << " is under mouse cursor.");
1664
            MSG_DEBUG("Object " << w->objectName().toStdString() << " is under mouse cursor.");
1637
            QObject *par = w->parent();
1665
            QObject *par = w->parent();
1638
 
1666
 
1639
            if (par)
1667
            if (par)
1640
            {
1668
            {
1641
                MSG_DEBUG("The parent is " << par->objectName().toStdString());
1669
                MSG_DEBUG("The parent is " << par->objectName().toStdString());
-
 
1670
 
-
 
1671
                if (par->objectName().startsWith("Item_"))
-
 
1672
                {
-
 
1673
                    QObject *ppar = par->parent();
-
 
1674
 
-
 
1675
                    if (ppar)
-
 
1676
                    {
-
 
1677
                        MSG_DEBUG("The pparent is " << ppar->objectName().toStdString());
-
 
1678
 
-
 
1679
                        if (ppar->objectName().startsWith("View_"))
-
 
1680
                        {
-
 
1681
                            QMouseEvent *mev = new QMouseEvent(event->type(), event->localPos(), event->globalPos(), event->button(), event->buttons(), event->modifiers());
-
 
1682
                            QApplication::postEvent(ppar, mev);
-
 
1683
                            return;
-
 
1684
                        }
-
 
1685
                    }
-
 
1686
                }
1642
            }
1687
            }
1643
        }
1688
        }
1644
 
1689
 
1645
        if (gPageManager->isSetupActive() && isSetupScaled())
1690
        if (gPageManager->isSetupActive() && isSetupScaled())
1646
        {
1691
        {
Line 1696... Line 1741...
1696
        int x = ((mLastPressX >= 0) ? mLastPressX : (event->x() - nx));
1741
        int x = ((mLastPressX >= 0) ? mLastPressX : (event->x() - nx));
1697
        int y = ((mLastPressY >= 0) ? mLastPressY : (event->y() - ny));
1742
        int y = ((mLastPressY >= 0) ? mLastPressY : (event->y() - ny));
1698
        MSG_DEBUG("Mouse press coordinates: x: " << event->x() << ", y: " << event->y());
1743
        MSG_DEBUG("Mouse press coordinates: x: " << event->x() << ", y: " << event->y());
1699
        mLastPressX = mLastPressY = -1;
1744
        mLastPressX = mLastPressY = -1;
1700
 
1745
 
-
 
1746
        QWidget *w = childAt(event->x(), event->y());
-
 
1747
 
-
 
1748
        if (w)
-
 
1749
        {
-
 
1750
            MSG_DEBUG("Object " << w->objectName().toStdString() << " is under mouse cursor.");
-
 
1751
            QObject *par = w->parent();
-
 
1752
 
-
 
1753
            if (par)
-
 
1754
            {
-
 
1755
                MSG_DEBUG("The parent is " << par->objectName().toStdString());
-
 
1756
 
-
 
1757
                if (par->objectName().startsWith("Item_"))
-
 
1758
                {
-
 
1759
                    QObject *ppar = par->parent();
-
 
1760
 
-
 
1761
                    if (ppar)
-
 
1762
                    {
-
 
1763
                        MSG_DEBUG("The pparent is " << ppar->objectName().toStdString());
-
 
1764
 
-
 
1765
                        if (ppar->objectName().startsWith("View_"))
-
 
1766
                        {
-
 
1767
                            QMouseEvent *mev = new QMouseEvent(event->type(), event->localPos(), event->globalPos(), event->button(), event->buttons(), event->modifiers());
-
 
1768
                            QApplication::postEvent(ppar, mev);
-
 
1769
                            return;
-
 
1770
                        }
-
 
1771
                    }
-
 
1772
                }
-
 
1773
            }
-
 
1774
        }
-
 
1775
 
1701
        if (gPageManager->isSetupActive() && isSetupScaled())
1776
        if (gPageManager->isSetupActive() && isSetupScaled())
1702
        {
1777
        {
1703
            x = (int)((double)x / mSetupScaleFactor);
1778
            x = (int)((double)x / mSetupScaleFactor);
1704
            y = (int)((double)y / mSetupScaleFactor);
1779
            y = (int)((double)y / mSetupScaleFactor);
1705
        }
1780
        }
Line 1736... Line 1811...
1736
        else if (y < mTouchY && (mTouchY - y) > (height / 3))
1811
        else if (y < mTouchY && (mTouchY - y) > (height / 3))
1737
            gPageManager->onSwipeEvent(TPageManager::SW_UP);
1812
            gPageManager->onSwipeEvent(TPageManager::SW_UP);
1738
    }
1813
    }
1739
}
1814
}
1740
 
1815
 
-
 
1816
void MainWindow::mouseMoveEvent(QMouseEvent* event)
-
 
1817
{
-
 
1818
    DECL_TRACER("MainWindow::mouseMoveEvent(QMouseEvent* event)");
-
 
1819
 
-
 
1820
    QWidget *w = childAt(event->x(), event->y());
-
 
1821
 
-
 
1822
    if (w)
-
 
1823
    {
-
 
1824
        MSG_DEBUG("Object " << w->objectName().toStdString() << " is under mouse cursor.");
-
 
1825
        QObject *par = w->parent();
-
 
1826
 
-
 
1827
        if (par)
-
 
1828
        {
-
 
1829
            MSG_DEBUG("The parent is " << par->objectName().toStdString());
-
 
1830
 
-
 
1831
            if (par->objectName().startsWith("Item_"))
-
 
1832
            {
-
 
1833
                QObject *ppar = par->parent();
-
 
1834
 
-
 
1835
                if (ppar)
-
 
1836
                {
-
 
1837
                    MSG_DEBUG("The pparent is " << ppar->objectName().toStdString());
-
 
1838
 
-
 
1839
                    if (ppar->objectName().startsWith("View_"))
-
 
1840
                    {
-
 
1841
                        QMouseEvent *mev = new QMouseEvent(event->type(), event->localPos(), event->globalPos(), event->button(), event->buttons(), event->modifiers());
-
 
1842
                        QApplication::postEvent(ppar, mev);
-
 
1843
                        return;
-
 
1844
                    }
-
 
1845
                }
-
 
1846
            }
-
 
1847
        }
-
 
1848
    }
-
 
1849
}
-
 
1850
 
1741
/**
1851
/**
1742
 * @brief MainWindow::settings initiates the configuration dialog.
1852
 * @brief MainWindow::settings initiates the configuration dialog.
1743
 */
1853
 */
1744
void MainWindow::settings()
1854
void MainWindow::settings()
1745
{
1855
{