diff options
author | wm4 <wm4@nowhere> | 2015-01-06 11:55:19 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-06 11:56:10 +0100 |
commit | 048882918575ed2060929c75f922712a219e0b33 (patch) | |
tree | 6da9f4acf44b8ac7f85da4b1306a71b36694000d /DOCS/client_api_examples | |
parent | 31e9630788776479b582e65d84c43e372db9dc20 (diff) | |
download | mpv-048882918575ed2060929c75f922712a219e0b33.tar.bz2 mpv-048882918575ed2060929c75f922712a219e0b33.tar.xz |
DOCS/client_api_examples: qtexample: demonstrate multiple mpv instances
Multiple client API contexts can exist in the same process.
Diffstat (limited to 'DOCS/client_api_examples')
-rw-r--r-- | DOCS/client_api_examples/qt/qtexample.cpp | 9 | ||||
-rw-r--r-- | DOCS/client_api_examples/qt/qtexample.h | 1 |
2 files changed, 10 insertions, 0 deletions
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: |