Results 1 to 8 of 8

Thread: slot won´t be called (d3lphin debugging)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default slot won´t be called (d3lphin debugging)

    hello!
    since i found some serious and annoying bugs in dolphin (kde3) and nobody seems to work on them i decided to do it myself.
    the problem i have right now is that one slot (updateNavigatorURL()) that is connected to a signal (clicked()) won´t be executed, although the connect statement returns true.
    in the original code this worked of course, but since i had to change the (quite poor) design i couldn´t work out the problem by comparing the codes (although i tried). well actually i couldn´t even find out what exactly the problem is...
    so hopefully here´s someone who´s able to help me out with this one, since i´m new to qt/kde development.
    should not be too hard to find for someone with more experience than me.
    great thanks in advance, witti

    urlnavigatorbutton.h:
    Qt Code:
    1. ...
    2. class URLNavigatorButton : public URLButton
    3. {
    4. Q_OBJECT
    5.  
    6. public:
    7. URLNavigatorButton(URLNavigator* parent = 0);
    8. URLNavigatorButton(int index, URLNavigator* parent = 0);
    9. virtual ~URLNavigatorButton();
    10. void setIndex(int index);
    11. int index() const;
    12. bool isLastButton();
    13.  
    14. protected:
    15. virtual void drawButton(QPainter* painter);
    16. virtual void enterEvent(QEvent* event);
    17. virtual void leaveEvent(QEvent* event);
    18. //drag
    19. void mousePressEvent( QMouseEvent *event );
    20. void mouseMoveEvent( QMouseEvent *event );
    21. //drop
    22. virtual void dropEvent(QDropEvent* event);
    23. virtual void dragEnterEvent(QDragEnterEvent* event);
    24. virtual void dragLeaveEvent(QDragLeaveEvent* event);
    25.  
    26. private slots:
    27. void updateNavigatorURL();
    28. void startPopupDelay();
    29. void stopPopupDelay();
    30. void startListJob();
    31. void entriesList(KIO::Job* job, const KIO::UDSEntryList& entries);
    32. void listJobFinished(KIO::Job* job);
    33. ...
    To copy to clipboard, switch view to plain text mode 


    urlnavigatorbutton.cpp:
    Qt Code:
    1. ...
    2. URLNavigatorButton::URLNavigatorButton(int index, URLNavigator* parent) :
    3. URLButton(parent),
    4. m_index(-1),
    5. m_listJob(0)
    6. {
    7. setAcceptDrops(true);
    8. setMinimumWidth(arrowWidth());
    9. setIndex(index);
    10. connect(this, SIGNAL(clicked()), this, SLOT(updateNavigatorURL()));
    11.  
    12. m_popupDelay = new QTimer(this);
    13. connect(m_popupDelay, SIGNAL(timeout()), this, SLOT(startListJob()));
    14. connect(this, SIGNAL(pressed()), this, SLOT(startPopupDelay()));
    15. }
    16. ...
    17. void URLNavigatorButton::updateNavigatorURL()
    18. {
    19. URLNavigator* navigator = urlNavigator();
    20. assert(navigator != 0);
    21. navigator->setURL(navigator->url(m_index));
    22. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: slot won´t be called (d3lphin debugging)

    You have reimplemented the mousePressEvent(). Are you sure that the clicked() signal is emitted?

  3. #3

    Default Re: slot won´t be called (d3lphin debugging)

    hm, the connect(...) returns true. is there another way of testing, whether the clicked() signal is emitted?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: slot won´t be called (d3lphin debugging)

    Quote Originally Posted by sirwitti View Post
    hm, the connect(...) returns true. is there another way of testing, whether the clicked() signal is emitted?
    Checking the return value of connect() doesn't test whether the signal is emitter or not. It just says whether the connection was succesful or not. Connect that signal to QApplication::about() or set a breakpoint on URLNavigatorButton::clicked().

  5. #5

    Default Re: slot won´t be called (d3lphin debugging)

    nothing happens when connecting it to QApplication:about() and another custom slot i tried is not called either.
    so the clicked() signal is not called i guess?!
    well as it seems i have to go the hard way, meaning that i´ll start over with the original source and step by step apply my changes.
    or is theren anything else i could do?
    btw thanks a lot jacek
    witti

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: slot won´t be called (d3lphin debugging)

    Quote Originally Posted by sirwitti View Post
    or is theren anything else i could do?
    Check URLNavigatorButton::mousePressEvent(). If you don't call the base class implementation (or QPushButton::mousePressEvent()), QPushButton isn't going to know it has been clicked.

  7. #7

    Default Re: slot won´t be called (d3lphin debugging)

    i checked this already, it seems ok to me. URLButton is the parent class of URLNavigatorbutton and is a direct child of QPushbutton.
    In the URLButton class the mouspressedEvent() is not implemented, so the implementation of QPushbutton should be called.
    URLNavigatorButton::mousePressEvent is being called...

    Qt Code:
    1. void URLNavigatorButton::mousePressEvent(QMouseEvent * event)
    2. {
    3. if (event->button() == LeftButton)
    4. dragPos = event->pos();
    5. URLButton::mousePressEvent(event);
    6. }
    To copy to clipboard, switch view to plain text mode 

    so thats not the problem i think.
    any other options?
    thx, witti

  8. #8

    Default Re: slot won´t be called (d3lphin debugging)

    omg it was just that "qApp" instead of "this" in the connect statement.
    its always the simple things that aren´t simple at all. ;-)
    thank you very much jacek
    witti

Similar Threads

  1. Program crashes with assert error in xcb_lock.c
    By Valheru in forum Qt Programming
    Replies: 3
    Last Post: 18th November 2007, 19:56
  2. KDE 3.5.0 crash while opening project
    By MarkoSan in forum KDE Forum
    Replies: 2
    Last Post: 19th October 2007, 16:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.