diff --git a/src/FrameworkWidgetFactory.cpp b/src/FrameworkWidgetFactory.cpp index 17f70d9c..849772e1 100644 --- a/src/FrameworkWidgetFactory.cpp +++ b/src/FrameworkWidgetFactory.cpp @@ -123,61 +123,6 @@ QAbstractButton* DefaultWidgetFactory::createTitleBarButton(QWidget *parent, Tit return button; } -QIcon DefaultWidgetFactory::iconForButtonType(TitleBarButtonType type, qreal dpr) const -{ - QString iconName; - switch (type) { - case TitleBarButtonType::AutoHide: - iconName = QStringLiteral("auto-hide"); - break; - case TitleBarButtonType::UnautoHide: - iconName = QStringLiteral("unauto-hide"); - break; - case TitleBarButtonType::Close: - iconName = QStringLiteral("close"); - break; - case TitleBarButtonType::Minimize: - iconName = QStringLiteral("min"); - break; - case TitleBarButtonType::Maximize: - iconName = QStringLiteral("max"); - break; - case TitleBarButtonType::Normal: - // We're using the same icon as dock/float - iconName = QStringLiteral("dock-float"); - break; - case TitleBarButtonType::Float: - iconName = QStringLiteral("dock-float"); - break; - } - - if (iconName.isEmpty()) - return {}; - - QIcon icon(QStringLiteral(":/img/%1.png").arg(iconName)); - -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 2) - const bool isFractional = int(dpr) != dpr; - if (isFractional) { - // We don't support 1.5x yet. - // Linux is the only one affected as Windows and macOS use integral factors. - // Problem with Linux is that rendering is off due to a rounding bug only fixed in 5.15.2 - // Will enable for fractional later. - // QTBUG-86170 - return icon; - } -#else - // Not using Qt's sugar syntax, which doesn't support 1.5x anyway when we need it. - // Simply add the high-res files and Qt will pick them when needed - - icon.addFile(QStringLiteral(":/img/%1-1.5x.png").arg(iconName)); - Q_UNUSED(dpr); -#endif - icon.addFile(QStringLiteral(":/img/%1-2x.png").arg(iconName)); - - return icon; -} - #else Frame *DefaultWidgetFactory::createFrame(QWidgetOrQuick *parent, FrameOptions options) const @@ -239,4 +184,69 @@ QWidgetOrQuick *DefaultWidgetFactory::createRubberBand(QWidgetOrQuick *parent) c return new QWidgetOrQuick(parent); } +SideBar *DefaultWidgetFactory::createSideBar(SideBarLocation loc, MainWindowBase *parent) const +{ + Q_UNUSED(loc); + Q_UNUSED(parent); + + qWarning() << Q_FUNC_INFO << "Not implemented yet"; + return nullptr; +} + +#endif // QtQuick + +// iconForButtonType impl is the same for QtQuick and QtWidgets +QIcon DefaultWidgetFactory::iconForButtonType(TitleBarButtonType type, qreal dpr) const +{ + QString iconName; + switch (type) { + case TitleBarButtonType::AutoHide: + iconName = QStringLiteral("auto-hide"); + break; + case TitleBarButtonType::UnautoHide: + iconName = QStringLiteral("unauto-hide"); + break; + case TitleBarButtonType::Close: + iconName = QStringLiteral("close"); + break; + case TitleBarButtonType::Minimize: + iconName = QStringLiteral("min"); + break; + case TitleBarButtonType::Maximize: + iconName = QStringLiteral("max"); + break; + case TitleBarButtonType::Normal: + // We're using the same icon as dock/float + iconName = QStringLiteral("dock-float"); + break; + case TitleBarButtonType::Float: + iconName = QStringLiteral("dock-float"); + break; + } + + if (iconName.isEmpty()) + return {}; + + QIcon icon(QStringLiteral(":/img/%1.png").arg(iconName)); + +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 2) + const bool isFractional = int(dpr) != dpr; + if (isFractional) { + // We don't support 1.5x yet. + // Linux is the only one affected as Windows and macOS use integral factors. + // Problem with Linux is that rendering is off due to a rounding bug only fixed in 5.15.2 + // Will enable for fractional later. + // QTBUG-86170 + return icon; + } +#else + // Not using Qt's sugar syntax, which doesn't support 1.5x anyway when we need it. + // Simply add the high-res files and Qt will pick them when needed + + icon.addFile(QStringLiteral(":/img/%1-1.5x.png").arg(iconName)); + Q_UNUSED(dpr); #endif + icon.addFile(QStringLiteral(":/img/%1-2x.png").arg(iconName)); + + return icon; +} diff --git a/src/private/quick/MainWindowQuick.cpp b/src/private/quick/MainWindowQuick.cpp index 893eb824..c35b3640 100644 --- a/src/private/quick/MainWindowQuick.cpp +++ b/src/private/quick/MainWindowQuick.cpp @@ -23,3 +23,15 @@ MainWindowQuick::MainWindowQuick(const QString &uniqueName, MainWindowOptions op QWidgetAdapter::makeItemFillParent(this); QWidgetAdapter::makeItemFillParent(dropArea()); } + +SideBar *MainWindowQuick::sideBar(SideBarLocation) const +{ + qWarning() << Q_FUNC_INFO << "SideBar hasn't been implemented yet"; + return nullptr; +} + +QMargins MainWindowQuick::centerWidgetMargins() const +{ + qWarning() << Q_FUNC_INFO << "SideBar hasn't been implemented yet"; + return {}; +} diff --git a/src/private/quick/MainWindowQuick_p.h b/src/private/quick/MainWindowQuick_p.h index 001de443..d75fc4fa 100644 --- a/src/private/quick/MainWindowQuick_p.h +++ b/src/private/quick/MainWindowQuick_p.h @@ -27,6 +27,10 @@ public: explicit MainWindowQuick(const QString &uniqueName, MainWindowOptions options = MainWindowOption_HasCentralFrame, QWidgetAdapter *parent = nullptr); + +protected: + SideBar *sideBar(SideBarLocation) const override; + QMargins centerWidgetMargins() const override; }; }