From 048882918575ed2060929c75f922712a219e0b33 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 6 Jan 2015 11:55:19 +0100 Subject: [PATCH] DOCS/client_api_examples: qtexample: demonstrate multiple mpv instances Multiple client API contexts can exist in the same process. --- DOCS/client_api_examples/qt/qtexample.cpp | 9 +++++++++ DOCS/client_api_examples/qt/qtexample.h | 1 + 2 files changed, 10 insertions(+) diff --git a/DOCS/client_api_examples/qt/qtexample.cpp b/DOCS/client_api_examples/qt/qtexample.cpp index 756c206916..5f4e86e891 100644 --- a/DOCS/client_api_examples/qt/qtexample.cpp +++ b/DOCS/client_api_examples/qt/qtexample.cpp @@ -44,6 +44,10 @@ MainWindow::MainWindow(QWidget *parent) : connect(on_open, &QAction::triggered, this, &MainWindow::on_file_open); menu->addAction(on_open); + QAction *on_new = new QAction(tr("&New window"), this); + connect(on_new, &QAction::triggered, this, &MainWindow::on_new_window); + menu->addAction(on_new); + statusBar(); QMainWindow *log_window = new QMainWindow(this); @@ -187,6 +191,11 @@ void MainWindow::on_file_open() } } +void MainWindow::on_new_window() +{ + (new MainWindow())->show(); +} + void MainWindow::append_log(const QString &text) { QTextCursor cursor = log->textCursor(); diff --git a/DOCS/client_api_examples/qt/qtexample.h b/DOCS/client_api_examples/qt/qtexample.h index f59738cfbd..c3891cf4a7 100644 --- a/DOCS/client_api_examples/qt/qtexample.h +++ b/DOCS/client_api_examples/qt/qtexample.h @@ -17,6 +17,7 @@ public: private slots: void on_file_open(); + void on_new_window(); void on_mpv_events(); signals: