| | |
| | | #include "widgetwindowagent_p.h" |
| | | |
| | | #include "widgetitemdelegate_p.h" |
| | | #include "widgetwindowcontext_p.h" |
| | | |
| | | namespace QWK { |
| | | |
| | |
| | | } |
| | | |
| | | void WidgetWindowAgentPrivate::init() { |
| | | } |
| | | |
| | | AbstractWindowContext *WidgetWindowAgentPrivate::createContext() const { |
| | | return new WidgetWindowContext(); |
| | | } |
| | | |
| | | WidgetWindowAgent::WidgetWindowAgent(QObject *parent) |
| | |
| | | return false; |
| | | } |
| | | |
| | | std::ignore = w->winId(); // Make sure the window handle is created |
| | | w->setAttribute(Qt::WA_DontCreateNativeAncestors); |
| | | w->setAttribute(Qt::WA_NativeWindow); |
| | | |
| | | if (!d->setup(w, new WidgetItemDelegate())) { |
| | | return false; |
| | | } |
| | |
| | | return true; |
| | | } |
| | | |
| | | QWidget *WidgetWindowAgent::titleBar() const { |
| | | const QWidget *WidgetWindowAgent::titleBar() const { |
| | | Q_D(const WidgetWindowAgent); |
| | | return static_cast<QWidget *>(d->context->titleBar()); |
| | | return static_cast<const QWidget *>(d->context->titleBar()); |
| | | } |
| | | |
| | | void WidgetWindowAgent::setTitleBar(QWidget *w) { |
| | | void WidgetWindowAgent::setTitleBar(const QWidget *w) { |
| | | Q_D(WidgetWindowAgent); |
| | | if (!d->context->setTitleBar(w)) { |
| | | return; |
| | |
| | | Q_EMIT titleBarWidgetChanged(w); |
| | | } |
| | | |
| | | QWidget *WidgetWindowAgent::systemButton(SystemButton button) const { |
| | | const QWidget *WidgetWindowAgent::systemButton(SystemButton button) const { |
| | | Q_D(const WidgetWindowAgent); |
| | | return static_cast<QWidget *>(d->context->systemButton(button)); |
| | | return static_cast<const QWidget *>(d->context->systemButton(button)); |
| | | } |
| | | |
| | | void WidgetWindowAgent::setSystemButton(SystemButton button, QWidget *w) { |
| | | void WidgetWindowAgent::setSystemButton(SystemButton button, const QWidget *w) { |
| | | Q_D(WidgetWindowAgent); |
| | | if (!d->context->setSystemButton(button, w)) { |
| | | return; |
| | |
| | | Q_EMIT systemButtonChanged(button, w); |
| | | } |
| | | |
| | | bool WidgetWindowAgent::isHitTestVisible(QWidget *w) const { |
| | | bool WidgetWindowAgent::isHitTestVisible(const QWidget *w) const { |
| | | Q_D(const WidgetWindowAgent); |
| | | return d->context->isHitTestVisible(w); |
| | | } |
| | | |
| | | void WidgetWindowAgent::setHitTestVisible(QWidget *w, bool visible) { |
| | | void WidgetWindowAgent::setHitTestVisible(const QWidget *w, bool visible) { |
| | | Q_D(WidgetWindowAgent); |
| | | d->context->setHitTestVisible(w, visible); |
| | | } |