Commit 1a1e2545 authored by Christoph Cullmann's avatar Christoph Cullmann 🍨
Browse files

adapt to addWidget KTextEditor::MainWindow API

parent d8d757c5
Pipeline #226877 passed with stage
in 6 minutes and 48 seconds
......@@ -53,7 +53,7 @@ void CEPluginView::openANewTab()
QWidget *mw = m_mainWindow->window();
// clang-format off
QMetaObject::invokeMethod(mw, "addWidgetAsTab", Q_ARG(QWidget*, m_mainWidget));
QMetaObject::invokeMethod(mw, "addWidget", Q_ARG(QWidget*, m_mainWidget));
// clang-format on
}
......
......@@ -1302,10 +1302,11 @@ QObject *KateMainWindow::pluginView(const QString &name)
return m_pluginViews.contains(plugin) ? m_pluginViews.value(plugin) : nullptr;
}
void KateMainWindow::addWidgetAsTab(QWidget *widget)
bool KateMainWindow::addWidget(QWidget *widget)
{
auto vs = m_viewManager->activeViewSpace();
vs->addWidgetAsTab(widget);
return true;
}
void KateMainWindow::showDiff(const QByteArray &wordDiff, const DiffParams &params)
......@@ -1319,7 +1320,7 @@ void KateMainWindow::showDiff(const QByteArray &wordDiff, const DiffParams &para
else
w->setWindowTitle(i18n("Diff %1..%2", Utils::fileNameFromPath(params.srcFile), Utils::fileNameFromPath(params.destFile)));
}
addWidgetAsTab(w);
addWidget(w);
w->openDiff(wordDiff);
}
......
......@@ -511,7 +511,16 @@ public Q_SLOTS:
*/
QObject *pluginView(const QString &name);
void addWidgetAsTab(QWidget *widget);
/**
* Add a widget to the main window.
* This is useful to show non-KTextEditor::View widgets in the main window.
* The host application should try to manage this like some KTextEditor::View (e.g. as a tab) and provide
* the means to close it.
* \param widget widget to add
* \return success, if false, the plugin needs to take care to show the widget itself, otherwise
* the main window will take ownership of the widget
*/
bool addWidget(QWidget *widget);
void showDiff(const QByteArray &wordDiff, const DiffParams &params);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment