forked from qt-creator/qt-creator
Core: Introduce a IOptionsPage::setLayout(const LayoutItem)
Helps to move the lambda setup off the user code. Change-Id: I0de43f53fc9018913340e81b5c1e8e69df067bd6 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/aspects.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
@@ -204,6 +205,14 @@ void IOptionsPage::setLayouter(const std::function<void(QWidget *w)> &layouter)
|
||||
m_layouter = layouter;
|
||||
}
|
||||
|
||||
void IOptionsPage::setLayout(const Layouting::LayoutItem &layout)
|
||||
{
|
||||
using namespace Layouting;
|
||||
m_layouter = [layout](QWidget *widget) {
|
||||
Column { Row { Column { layout, st }, st } }.attachTo(widget);
|
||||
};
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void Core::IOptionsPage::setId(Utils::Id id)
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace Layouting { class LayoutItem; };
|
||||
|
||||
namespace Utils { class AspectContainer; };
|
||||
|
||||
namespace Core {
|
||||
@@ -73,6 +75,7 @@ protected:
|
||||
void setCategoryIconPath(const Utils::FilePath &categoryIconPath);
|
||||
void setSettings(Utils::AspectContainer *settings);
|
||||
void setLayouter(const std::function<void(QWidget *w)> &layouter);
|
||||
void setLayout(const Layouting::LayoutItem &layout);
|
||||
|
||||
// Used in FontSettingsPage. FIXME?
|
||||
QPointer<QWidget> m_widget; // Used in conjunction with m_widgetCreator
|
||||
|
||||
Reference in New Issue
Block a user