这是我的班级声明:
class Browser : public QWidget {
Q_OBJECT
public:
Browser(QWidget *parent = 0);
QStringList loadSettings(QString settings_file);
private slots:
void toggleFullscreen();
private:
void createActions();
QAction *aToggleFullscreen;
};
和相关定义:
void Browser::toggleFullscreen() {
out << "fullscreen!" << endl;
}
void Browser::createActions() {
aToggleFullscreen = new QAction(this);
aToggleFullscreen->setShortcut(tr("F11"));
connect(aToggleFullscreen, SIGNAL(triggered()), this, SLOT(toggleFullscreen()));
}
我从 打来createActions()
的Browser::Browser
。
我没有运行时警告说插槽不存在等。但如果我点击F11
.
我也试过:
aToggleFullscreen->setShortcut(QString("F11"));
我的代码有什么问题?