forked from qt-creator/qt-creator
Utils: Add MarkdownBrowser to Layouting
And bind it to Lua. Change-Id: I9841a2f7ee5dd5b89f8c19231f9e116b71ae355d Reviewed-by: Artur Twardy <atw@spyro-soft.com> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "fancylineedit.h"
|
||||
#include "filepath.h"
|
||||
#include "icon.h"
|
||||
#include "markdownbrowser.h"
|
||||
#include "qtcassert.h"
|
||||
#include "spinner/spinner.h"
|
||||
|
||||
@@ -1048,6 +1049,24 @@ void addToTabWidget(TabWidget *tabWidget, const Tab &tab)
|
||||
access(tabWidget)->addTab(tab.inner.emerge(), tab.tabName);
|
||||
}
|
||||
|
||||
// MarkdownBrowser
|
||||
|
||||
MarkdownBrowser::MarkdownBrowser(std::initializer_list<I> ps)
|
||||
{
|
||||
ptr = new Implementation;
|
||||
apply(this, ps);
|
||||
}
|
||||
|
||||
void MarkdownBrowser::setMarkdown(const QString &markdown)
|
||||
{
|
||||
access(this)->setMarkdown(markdown);
|
||||
}
|
||||
|
||||
void MarkdownBrowser::setBasePath(const Utils::FilePath &path)
|
||||
{
|
||||
access(this)->setBasePath(path);
|
||||
}
|
||||
|
||||
// Special If
|
||||
|
||||
If::If(
|
||||
|
@@ -41,17 +41,16 @@ class QVBoxLayout;
|
||||
class QWidget;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace SpinnerSolution
|
||||
{
|
||||
namespace SpinnerSolution {
|
||||
class SpinnerWidget;
|
||||
enum class SpinnerState;
|
||||
}
|
||||
} // namespace SpinnerSolution
|
||||
|
||||
namespace Utils
|
||||
{
|
||||
namespace Utils {
|
||||
class FancyLineEdit;
|
||||
class FilePath;
|
||||
} // Utils
|
||||
class MarkdownBrowser;
|
||||
} // namespace Utils
|
||||
|
||||
namespace Layouting {
|
||||
|
||||
@@ -425,6 +424,18 @@ public:
|
||||
void setDecorated(bool on);
|
||||
};
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT MarkdownBrowser : public Widget
|
||||
{
|
||||
public:
|
||||
using Implementation = Utils::MarkdownBrowser;
|
||||
using I = Building::BuilderItem<MarkdownBrowser>;
|
||||
|
||||
MarkdownBrowser(std::initializer_list<I> items);
|
||||
|
||||
void setMarkdown(const QString &);
|
||||
void setBasePath(const Utils::FilePath &);
|
||||
};
|
||||
|
||||
// Special
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT If
|
||||
@@ -509,7 +520,8 @@ QTC_DEFINE_BUILDER_SETTER(windowFlags, setWindowFlags);
|
||||
QTC_DEFINE_BUILDER_SETTER(widgetAttribute, setWidgetAttribute);
|
||||
QTC_DEFINE_BUILDER_SETTER(autoFillBackground, setAutoFillBackground);
|
||||
QTC_DEFINE_BUILDER_SETTER(readOnly, setReadOnly);
|
||||
QTC_DEFINE_BUILDER_SETTER(markdown, setMarkdown)
|
||||
QTC_DEFINE_BUILDER_SETTER(markdown, setMarkdown);
|
||||
QTC_DEFINE_BUILDER_SETTER(basePath, setBasePath);
|
||||
|
||||
// Nesting dispatchers
|
||||
|
||||
|
@@ -478,6 +478,15 @@ void setupGuiModule()
|
||||
sol::base_classes,
|
||||
sol::bases<Widget, Object, Thing>());
|
||||
|
||||
gui.new_usertype<Layouting::MarkdownBrowser>(
|
||||
"MarkdownBrowser",
|
||||
sol::call_constructor,
|
||||
sol::factories([guard](const sol::table &children) {
|
||||
return constructWidgetType<Layouting::MarkdownBrowser>(children, guard);
|
||||
}),
|
||||
sol::base_classes,
|
||||
sol::bases<Widget, Object, Thing>());
|
||||
|
||||
gui.new_usertype<Widget>(
|
||||
"Widget",
|
||||
sol::call_constructor,
|
||||
|
Reference in New Issue
Block a user