Qt “private slots:” what is this?

后端 未结 3 1339
感情败类
感情败类 2020-12-04 20:46

I understand how to use it, but the syntax of it bothers me. What is \"private slots:\" doing?

I have never seen something between the private keyword and the : in a

3条回答
  •  感情败类
    2020-12-04 21:24

    Slots are a Qt-specific extension of C++. It only compiles after sending the code through Qt's preprocessor, the Meta-Object Compiler (moc). See http://doc.qt.io/qt-5/moc.html for documentation.

    Edit: As Frank points out, moc is only required for linking. The extra keywords are #defined away with the standard preprocessor.

提交回复
热议问题