只有当我在 Macintosh 上运行而不是在 Windows 浏览器上运行时,我才会收到这个致命错误,这没有意义,因为除了检查浏览器条件之外,条件循环运行相同的代码:
有人可以帮助我了解如何在 php 中停止此错误吗?错误发生在 QEnterKeyEvent 的第一个实例上......而不是第二个实例。这没有意义。
在代码中,第一个实例是第一次被调用,所以据我所知,该类尚未创建。
然而错误说:无法重新声明类 QEnterKeyEvent
// Key-Specific Events (EnterKey, EscapeKey, UpArrowKey, DownArrowKey, etc.)
if (QApplication::IsBrowser(QBrowserType::Macintosh)) {
echo "keyspecific events - macintosh";
class QEnterKeyEvent extends QKeyPressEvent {
protected $strCondition = 'event.keyCode == 13';
}
class QEscapeKeyEvent extends QKeyPressEvent {
protected $strCondition = 'event.keyCode == 27';
}
class QUpArrowKeyEvent extends QKeyPressEvent {
protected $strCondition = 'event.keyCode == 38';
}
class QDownArrowKeyEvent extends QKeyPressEvent {
protected $strCondition = 'event.keyCode == 40';
}
} else {
echo "key specific events - windows";
class QEnterKeyEvent extends QKeyDownEvent {
protected $strCondition = 'event.keyCode == 13';
}
class QEscapeKeyEvent extends QKeyDownEvent {
protected $strCondition = 'event.keyCode == 27';
}
class QUpArrowKeyEvent extends QKeyDownEvent {
protected $strCondition = 'event.keyCode == 38';
}
class QDownArrowKeyEvent extends QKeyDownEvent {
protected $strCondition = 'event.keyCode == 40';
}
}