📄 controlwidget.cpp
字号:
#include <qlayout.h>
#include <qpushbutton.h>
#include <SDL/SDL.h>
#include "controlwidget.h"
#include "renderthread.h"
ControlWidget::ControlWidget() : QWidget( 0L ),
p_btnRunPause( new QPushButton( tr( "Run/Pause" ), this ) ), p_ptrThread( new RenderThread() )
{
QVBoxLayout* ptrLayout = new QVBoxLayout( this );
QPushButton* btnStop = new QPushButton( tr( "Stop" ), this );
ptrLayout->addWidget( p_btnRunPause );
ptrLayout->addWidget( btnStop );
connect( p_btnRunPause, SIGNAL( clicked() ), this, SLOT( runPause() ) );
connect( btnStop, SIGNAL( clicked() ), this, SLOT( stop() ) );
// connect( p_ptrThread, SIGNAL( finished() ), this, SLOT( close() ) );
p_ptrThread->start();
}
void ControlWidget::runPause()
{
SDL_Event event;
event.type = SDL_KEYDOWN;
event.key.keysym.sym = SDLK_SPACE;
SDL_PushEvent( &event );
}
void ControlWidget::stop()
{
SDL_Event event;
event.type = SDL_KEYDOWN;
event.key.keysym.sym = SDLK_ESCAPE;
SDL_PushEvent( &event );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -