mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-26 21:37:04 +08:00
update
This commit is contained in:
parent
ee071ee451
commit
8f9c529153
@ -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);
|
||||
|
@ -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<QSettings> m_settings;
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user