怎么搞得啊
我写button->setFocusPolicy(Qt::NoFocus);编译不过去啊,
写成button->setFocusPolicy(NoFocus);就可以了,而且设置了两个按钮,第一个按钮会出现黑色边框,代码如下
pushButton1 = new QPushButton( this, "pushButton1" );
pushButton1->setGeometry( QRect( 30, 160, 120, 60 ) );
pushButton1->setToggleButton( 1 );//设置为切换按钮
pushButton1->setFocusPolicy(NoFocus); //设置为不接收键盘焦点
pushButton2 = new QPushButton( this, "pushButton2" );
pushButton2->setGeometry( QRect( 200, 160, 120, 60 ) );
pushButton2->setFocusPolicy(NoFocus);