diff --git a/example/src/helper/SettingsHelper.cpp b/example/src/helper/SettingsHelper.cpp index 0604d018..5a5497e3 100644 --- a/example/src/helper/SettingsHelper.cpp +++ b/example/src/helper/SettingsHelper.cpp @@ -19,10 +19,10 @@ void SettingsHelper::save(const QString& key,QVariant val) m_settings->setValue(key, data); } -QVariant SettingsHelper::get(const QString& key){ +QVariant SettingsHelper::get(const QString& key,QVariant def){ const QByteArray data = m_settings->value(key).toByteArray(); if (data.isEmpty()) { - return {}; + return def; } QDataStream stream(data); stream.setVersion(QDataStream::Qt_5_6); diff --git a/example/src/helper/SettingsHelper.h b/example/src/helper/SettingsHelper.h index 5f426b7f..f0d843e9 100644 --- a/example/src/helper/SettingsHelper.h +++ b/example/src/helper/SettingsHelper.h @@ -19,15 +19,15 @@ public: SINGLETONG(SettingsHelper) ~SettingsHelper() override; void init(char *argv[]); - Q_INVOKABLE void saveRender(const QString& render){save("render",render);} - Q_INVOKABLE QString getRender(){return get("render").toString();} + Q_INVOKABLE void saveRender(const QVariant& render){save("render",render);} + Q_INVOKABLE QVariant getRender(){return get("render");} Q_INVOKABLE void saveDarkMode(int darkModel){save("darkMode",darkModel);} - Q_INVOKABLE int getDarkMode(){return get("darkMode").toInt(0);} + Q_INVOKABLE QVariant getDarkMode(){return get("darkMode",QVariant(0));} Q_INVOKABLE void saveVsync(bool vsync){save("vsync",vsync);} - Q_INVOKABLE bool getVsync(){return get("vsync").toBool();} + Q_INVOKABLE QVariant getVsync(){return get("vsync",QVariant(true));} private: void save(const QString& key,QVariant val); - QVariant get(const QString& key); + QVariant get(const QString& key,QVariant def={}); private: QScopedPointer m_settings; }; diff --git a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml index 2f6a6513..3c8d40c8 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml @@ -154,13 +154,16 @@ Rectangle { bottomMargin: 6 } verticalAlignment: Text.AlignVCenter - HoverHandler{ + MouseArea{ + acceptedButtons: Qt.NoButton id: hover_handler + hoverEnabled: true + anchors.fill: parent } FluTooltip{ text: item_text.text delay: 500 - visible: item_text.contentWidth < item_text.implicitWidth && item_text.contentHeight < item_text.implicitHeight && hover_handler.hovered + visible: item_text.contentWidth < item_text.implicitWidth && item_text.contentHeight < item_text.implicitHeight && hover_handler.containsMouse } } } @@ -193,6 +196,9 @@ Rectangle { } ScrollBar.vertical: FluScrollBar{ id:scroll_bar_v + onVisualPositionChanged: { + table_view.forceLayout() + } } columnWidthProvider: function(column) { var w = columnSource[column].width @@ -322,8 +328,6 @@ Rectangle { } } } - - } MouseArea{ property var cellItem @@ -529,15 +533,14 @@ Rectangle { return [] } } - onContentYChanged: { - forceLayout() - } delegate: Rectangle{ id:item_control readonly property real cellPadding: 8 property bool canceled: false implicitWidth: Math.max(30, row_text.implicitWidth + (cellPadding * 2)) implicitHeight: row_text.implicitHeight + (cellPadding * 2) + width: implicitWidth + height: implicitHeight color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1) Rectangle{ border.color: control.borderColor diff --git a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml index d913d61e..d51855bc 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml @@ -155,13 +155,16 @@ Rectangle { bottomMargin: 6 } verticalAlignment: Text.AlignVCenter - HoverHandler{ + MouseArea{ + acceptedButtons: Qt.NoButton id: hover_handler + hoverEnabled: true + anchors.fill: parent } FluTooltip{ text: item_text.text delay: 500 - visible: item_text.contentWidth < item_text.implicitWidth && item_text.contentHeight < item_text.implicitHeight && hover_handler.hovered + visible: item_text.contentWidth < item_text.implicitWidth && item_text.contentHeight < item_text.implicitHeight && hover_handler.containsMouse } } } @@ -194,6 +197,9 @@ Rectangle { } ScrollBar.vertical: FluScrollBar{ id:scroll_bar_v + onVisualPositionChanged: { + table_view.forceLayout() + } } columnWidthProvider: function(column) { var w = columnSource[column].width @@ -323,8 +329,6 @@ Rectangle { } } } - - } MouseArea{ property var cellItem @@ -530,15 +534,14 @@ Rectangle { return [] } } - onContentYChanged: { - forceLayout() - } delegate: Rectangle{ id:item_control readonly property real cellPadding: 8 property bool canceled: false implicitWidth: Math.max(30, row_text.implicitWidth + (cellPadding * 2)) implicitHeight: row_text.implicitHeight + (cellPadding * 2) + width: implicitWidth + height: implicitHeight color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1) Rectangle{ border.color: control.borderColor