【问题标题】:How to make getter and setter methods in QT creator automatically [duplicate]如何在QT创建者中自动制作getter和setter方法[重复]
【发布时间】:2014-01-15 16:31:34
【问题描述】:

如果我们已经声明了变量,我想知道 Qt creator IDE 中是否有任何方法可以自动生成 getter 和 setter 函数。

【问题讨论】:

  • 您使用的是哪个 Qt 创建器?
  • QT 是 QuickTime,正确的是 Qt

标签: c++ qt ide qt-creator


【解决方案1】:

如果您使用的是 Qt 2.3.x 以上版本,您应该使用以下方法轻松完成。

右键单击您的class member variable。你会看到Refactor 然后是Generate Getter and Setter member function

【讨论】:

    【解决方案2】:

    不用鼠标也能做到。

    Alt+Enter 并选择Create Getter and Setter Member Functions

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-28
      • 2014-12-20
      • 1970-01-01
      • 2023-03-09
      相关资源
      最近更新 更多