Results 1 to 5 of 5

Thread: QSignalMapper question

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: QSignalMapper question

    1. Please use code tags in the future.
    2. What is the question?
    3. Define "working".
    4. What is it that you are trying to achieve?
    5. If I understand your code correctly the use of a signal mapper is not needed.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3
    Thanked 127 Times in 126 Posts

    Default Re: QSignalMapper question

    showing the header would be useful - is void clicked(const QString &text) defined as a slot?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Nov 2012
    Posts
    24
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: QSignalMapper question

    No void clicked(const QString &text) is defined as a signal

    Qt Code:
    1. #ifndef MAINWINDOW_H
    2. #define MAINWINDOW_H
    3.  
    4. #include <QtGui/QMainWindow>
    5. #include <QtGui>
    6. #include <QGridLayout>
    7. #include <QSignalMapper>
    8.  
    9. namespace Ui {
    10. class MainWindow;
    11. }
    12.  
    13. class MainWindow : public QMainWindow
    14. {
    15. Q_OBJECT
    16.  
    17. public:
    18. explicit MainWindow(QWidget *parent = 0);
    19. ~MainWindow();
    20.  
    21. signals:
    22. void clicked(const QString &text);
    23.  
    24. protected:
    25. void changeEvent(QEvent *e);
    26.  
    27. private:
    28. Ui::MainWindow *ui;
    29. QPushButton *theButton;
    30. QGridLayout *theLayout;
    31. QSignalMapper *theMapper;
    32. };
    33.  
    34. #endif // MAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 26th November 2012 at 15:05.

Similar Threads

  1. QSignalMapper
    By Ali Reza in forum Newbie
    Replies: 35
    Last Post: 30th November 2012, 09:12
  2. QSignalMapper
    By axisdj in forum Newbie
    Replies: 6
    Last Post: 16th September 2010, 01:52
  3. help with QSignalMapper and actions
    By andreime in forum Newbie
    Replies: 1
    Last Post: 9th August 2009, 18:24
  4. ? about QSignalMapper
    By JimDaniel in forum Qt Programming
    Replies: 1
    Last Post: 13th January 2008, 21:21
  5. QSignalMapper question: SIGNAL 2 int's
    By vonCZ in forum Newbie
    Replies: 5
    Last Post: 20th July 2007, 10:02

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.