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);
|
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();
|
const QByteArray data = m_settings->value(key).toByteArray();
|
||||||
if (data.isEmpty()) {
|
if (data.isEmpty()) {
|
||||||
return {};
|
return def;
|
||||||
}
|
}
|
||||||
QDataStream stream(data);
|
QDataStream stream(data);
|
||||||
stream.setVersion(QDataStream::Qt_5_6);
|
stream.setVersion(QDataStream::Qt_5_6);
|
||||||
|
@ -19,15 +19,15 @@ public:
|
|||||||
SINGLETONG(SettingsHelper)
|
SINGLETONG(SettingsHelper)
|
||||||
~SettingsHelper() override;
|
~SettingsHelper() override;
|
||||||
void init(char *argv[]);
|
void init(char *argv[]);
|
||||||
Q_INVOKABLE void saveRender(const QString& render){save("render",render);}
|
Q_INVOKABLE void saveRender(const QVariant& render){save("render",render);}
|
||||||
Q_INVOKABLE QString getRender(){return get("render").toString();}
|
Q_INVOKABLE QVariant getRender(){return get("render");}
|
||||||
Q_INVOKABLE void saveDarkMode(int darkModel){save("darkMode",darkModel);}
|
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 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:
|
private:
|
||||||
void save(const QString& key,QVariant val);
|
void save(const QString& key,QVariant val);
|
||||||
QVariant get(const QString& key);
|
QVariant get(const QString& key,QVariant def={});
|
||||||
private:
|
private:
|
||||||
QScopedPointer<QSettings> m_settings;
|
QScopedPointer<QSettings> m_settings;
|
||||||
};
|
};
|
||||||
|
@ -154,13 +154,16 @@ Rectangle {
|
|||||||
bottomMargin: 6
|
bottomMargin: 6
|
||||||
}
|
}
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
HoverHandler{
|
MouseArea{
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
id: hover_handler
|
id: hover_handler
|
||||||
|
hoverEnabled: true
|
||||||
|
anchors.fill: parent
|
||||||
}
|
}
|
||||||
FluTooltip{
|
FluTooltip{
|
||||||
text: item_text.text
|
text: item_text.text
|
||||||
delay: 500
|
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{
|
ScrollBar.vertical: FluScrollBar{
|
||||||
id:scroll_bar_v
|
id:scroll_bar_v
|
||||||
|
onVisualPositionChanged: {
|
||||||
|
table_view.forceLayout()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
columnWidthProvider: function(column) {
|
columnWidthProvider: function(column) {
|
||||||
var w = columnSource[column].width
|
var w = columnSource[column].width
|
||||||
@ -322,8 +328,6 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
property var cellItem
|
property var cellItem
|
||||||
@ -529,15 +533,14 @@ Rectangle {
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onContentYChanged: {
|
|
||||||
forceLayout()
|
|
||||||
}
|
|
||||||
delegate: Rectangle{
|
delegate: Rectangle{
|
||||||
id:item_control
|
id:item_control
|
||||||
readonly property real cellPadding: 8
|
readonly property real cellPadding: 8
|
||||||
property bool canceled: false
|
property bool canceled: false
|
||||||
implicitWidth: Math.max(30, row_text.implicitWidth + (cellPadding * 2))
|
implicitWidth: Math.max(30, row_text.implicitWidth + (cellPadding * 2))
|
||||||
implicitHeight: row_text.implicitHeight + (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)
|
color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||||
Rectangle{
|
Rectangle{
|
||||||
border.color: control.borderColor
|
border.color: control.borderColor
|
||||||
|
@ -155,13 +155,16 @@ Rectangle {
|
|||||||
bottomMargin: 6
|
bottomMargin: 6
|
||||||
}
|
}
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
HoverHandler{
|
MouseArea{
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
id: hover_handler
|
id: hover_handler
|
||||||
|
hoverEnabled: true
|
||||||
|
anchors.fill: parent
|
||||||
}
|
}
|
||||||
FluTooltip{
|
FluTooltip{
|
||||||
text: item_text.text
|
text: item_text.text
|
||||||
delay: 500
|
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{
|
ScrollBar.vertical: FluScrollBar{
|
||||||
id:scroll_bar_v
|
id:scroll_bar_v
|
||||||
|
onVisualPositionChanged: {
|
||||||
|
table_view.forceLayout()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
columnWidthProvider: function(column) {
|
columnWidthProvider: function(column) {
|
||||||
var w = columnSource[column].width
|
var w = columnSource[column].width
|
||||||
@ -323,8 +329,6 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
property var cellItem
|
property var cellItem
|
||||||
@ -530,15 +534,14 @@ Rectangle {
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onContentYChanged: {
|
|
||||||
forceLayout()
|
|
||||||
}
|
|
||||||
delegate: Rectangle{
|
delegate: Rectangle{
|
||||||
id:item_control
|
id:item_control
|
||||||
readonly property real cellPadding: 8
|
readonly property real cellPadding: 8
|
||||||
property bool canceled: false
|
property bool canceled: false
|
||||||
implicitWidth: Math.max(30, row_text.implicitWidth + (cellPadding * 2))
|
implicitWidth: Math.max(30, row_text.implicitWidth + (cellPadding * 2))
|
||||||
implicitHeight: row_text.implicitHeight + (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)
|
color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||||
Rectangle{
|
Rectangle{
|
||||||
border.color: control.borderColor
|
border.color: control.borderColor
|
||||||
|
Loading…
Reference in New Issue
Block a user