C++ (Qt)class VideoWidget: public QVideoWidget { Q_OBJECT public: VideoWidget() : QVideoWidget() { setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); auto p = palette(); p.setColor(QPalette::Window, Qt::black); setPalette(p); setAttribute(Qt::WA_OpaquePaintEvent); auto player = new QMediaPlayer(); player->setVideoOutput(this); player->setMedia(QUrl("C:/Users/ipetrash/Desktop/7f_Gravity.Falls.S01E01.rus.vo.sienduk.a1.08.12.15.mp4")); player->play(); } void keyPressEvent(QKeyEvent* event) { if (event->key() == Qt::Key_Escape && isFullScreen()) { setFullScreen(false); event->accept(); } else { QVideoWidget::keyPressEvent(event); } } void mouseDoubleClickEvent(QMouseEvent* event) { setFullScreen(!isFullScreen()); event->accept(); }};
C++ (Qt)layout->setContentsMargins(0, 0, 0, 5);
C++ (Qt)VideoWidget w; QWidget ww;auto layout = new QVBoxLayout();layout->addWidget(&w);ww.setLayout(layout);ww.show(); QMainWindow ww;ww.setCentralWidget(&w);ww.show();