summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-06 11:55:19 +0100
committerwm4 <wm4@nowhere>2015-01-06 11:56:10 +0100
commit048882918575ed2060929c75f922712a219e0b33 (patch)
tree6da9f4acf44b8ac7f85da4b1306a71b36694000d
parent31e9630788776479b582e65d84c43e372db9dc20 (diff)
downloadmpv-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.
-rw-r--r--DOCS/client_api_examples/qt/qtexample.cpp9
-rw-r--r--DOCS/client_api_examples/qt/qtexample.h1
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: