Results 1 to 6 of 6

Thread: Qt 5.11 QMainWindow signal not seen by custom widget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2007
    Location
    Louisiana
    Posts
    77
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Qt 5.11 QMainWindow signal not seen by custom widget

    UPDATED:

    I have created a custom edit widget that is a promoted widget in the QMainWindow. The problem is that the custom edit widget is unable to connect to a created signal emitted by the app in QMainWindow.

    mainwindow.h
    Qt Code:
    1. class MainWindow : public QMainWindow
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. explicit MainWindow();
    7. ~MainWindow();
    8.  
    9. signals:
    10. void signalRowSelected(QVariant rowdata);
    11. ...
    12. };
    To copy to clipboard, switch view to plain text mode 

    mainwindow.cpp
    Qt Code:
    1. emit signalRowSelected(QVariant(vals));
    To copy to clipboard, switch view to plain text mode 

    editwidget.hpp
    Qt Code:
    1. EditWidget:public QWdiget
    2. {
    3. ...
    4. private:
    5. QWidget *mw;
    6. }
    To copy to clipboard, switch view to plain text mode 

    editwidget.cpp
    Qt Code:
    1. EditWidget::EditWidget()
    2. {
    3. ...
    4. mw = parent;
    5. connect(mw, SIGNAL(signalRowSelected(QVariant rowdata)), this, SLOT(slotDisplayRow(QVariant rowdata))); // (similar problem when only parent is used)
    6. }
    To copy to clipboard, switch view to plain text mode 

    As I mentioned before the editwidget is a promoted QWidget in the QMainwindow form so they are in the same GUI QThread.

    The chages above now connects to QMainWindow but still does not know of the signal emitted.

    What am I missing here?
    Last edited by ad5xj; 7th November 2018 at 19:16.

Similar Threads

  1. Replies: 7
    Last Post: 27th January 2012, 07:30
  2. Replies: 2
    Last Post: 29th June 2011, 15:45
  3. Replies: 2
    Last Post: 20th March 2010, 18:22
  4. QMainWindow and custom widget doesn't show
    By Peppy in forum Qt Programming
    Replies: 9
    Last Post: 26th December 2009, 15:09
  5. Custom Widget - clicked() signal
    By ak in forum Newbie
    Replies: 3
    Last Post: 13th November 2006, 08:35

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.