Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. public slots: - not always works?
Forum Updated to NodeBB v4.3 + New Features

public slots: - not always works?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 432 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AndrzejB
    wrote on last edited by
    #1

    I have

    class ConfigDialog : public QDialog
    {
        void keyPressEvent(QKeyEvent *event);
        QLineEdit *syntaxPath;
        QLineEdit *themesPath;
        void load(Config *config);
        void save(Config *config);
        Config *configRef;
    public slots:
        void browse(QLineEdit *line);
        void applySlot();
        void okSlot();
    public:
        ConfigDialog(Config *config, QWidget *parent);
    };
    

    and in debug directory not exists moc_configdialog.o/cpp nor configdialog.moc whereas exists moc_codeeditor.cpp,moc_tabwindow.cpp ,codeeditor.moc

    connect(btnOk, SIGNAL(clicked()), this, SLOT(okSlot()));
    

    compiled but not works,

    connect(btnOk,  &QAbstractButton::clicked, this, [this]{ okSlot(); });
    

    works

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by dheerendra
      #2

      You missed adding Q_OBJECT macro in private section of your class

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      4
      • A Offline
        A Offline
        AndrzejB
        wrote on last edited by AndrzejB
        #3

        After adding I have:

        undefined reference to `vtable for ConfigDialog'

        undefined reference to `ConfigDialog::staticMetaObject'

        Is Ok, after deleting debug directory, Thanks it is solved.

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          Delete the build directory and build the project again

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved