[Qt-interest] doubleClick signal for QLineEdit

M. Bashir Al-Noimi mbnoimi at gmx.com
Wed Jul 22 23:26:03 CEST 2009


Donal O'Connor wrote:
> I don't think there is a double click signal?
>
> This is an event.
As I know in Qt's world "Event" terminology means "Signal" so you 
surprised me when you've used "Event" terminology!
For that could you tell me What's the different between "Event" and 
"Signal" ?

>
> You could inherit the QLineEdit and over ride/reimplement the 
> ::mouseDoubleClickEvent event.
I think this isn't suitable option because it's not compatible with 
rapid developing.
>
> Or maybe install an event filter
>
>
by using event filter I could catch mouse doubleClick by using this code:

bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
    if (obj == ui->lineEdit)
    {
        if (event->type() == QEvent::MouseButtonDblClick)
        {
            QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
            return true;
        }
        else
            return false;
    }
    else
        return QMainWindow::eventFilter(obj, event);
}


but this way is absolutely annoying because I've to write these line and 
modify them everytime I add/modify/delete gui component. So I'm looking 
for practical way just like "Go to slot..." in Qt Designer.


-----
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090723/7837c10d/attachment.html 


More information about the Qt-interest-old mailing list