Skip to content

Commit

Permalink
Fix can't use in qml
Browse files Browse the repository at this point in the history
  • Loading branch information
wineee committed Feb 28, 2025
1 parent e0b241d commit 28033a4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/config/treelandconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ void TreelandConfig::setUserId(uint uid)
);
m_userDconfig[uid] = m_currentUserConfig;
}
Q_EMIT currentUserConfigChanged();
}

uint TreelandConfig::workspaceThumbHeight() const
Expand Down
6 changes: 4 additions & 2 deletions src/config/treelandconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ class TreelandConfig
, public DTK_CORE_NAMESPACE::DSingleton<TreelandConfig>
{
Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_PROPERTY(uint workspaceThumbHeight READ workspaceThumbHeight WRITE setWorkspaceThumbHeight NOTIFY workspaceThumbHeightChanged FINAL)
Q_PROPERTY(uint workspaceThumbMargin READ workspaceThumbMargin WRITE setWorkspaceThumbMargin NOTIFY workspaceThumbMarginChanged FINAL)
Q_PROPERTY(uint workspaceDelegateHeight READ workspaceDelegateHeight NOTIFY workspaceDelegateHeightChanged FINAL)
Expand All @@ -39,6 +37,8 @@ class TreelandConfig
Q_PROPERTY(uint multitaskviewHorizontalMargin READ multitaskviewHorizontalMargin WRITE setMultitaskviewHorizontalMargin NOTIFY multitaskviewHorizontalMarginChanged FINAL)
Q_PROPERTY(uint multitaskviewCellPadding READ multitaskviewCellPadding WRITE setMultitaskviewCellPadding NOTIFY multitaskviewCellPaddingChanged FINAL)
Q_PROPERTY(qreal multitaskviewLoadFactor READ multitaskviewLoadFactor WRITE setMultitaskviewLoadFactor NOTIFY multitaskviewLoadFactorChanged FINAL)
Q_PROPERTY(dconfig_org_deepin_treeland_globle *globleConfig READ globleConfig CONSTANT)
Q_PROPERTY(dconfig_org_deepin_treeland_user *currentUserConfig READ currentUserConfig NOTIFY currentUserConfigChanged FINAL)

public:
TreelandConfig();
Expand Down Expand Up @@ -102,6 +102,8 @@ class TreelandConfig


Q_SIGNALS:
void currentUserConfigChanged();

void workspaceThumbMarginChanged();
void workspaceThumbHeightChanged();
void workspaceDelegateHeightChanged();
Expand Down
5 changes: 0 additions & 5 deletions src/core/qml/PrimaryOutput.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ OutputItem {
sourceSize: TreelandConfig.currentUserConfig.cursorSize
}

Component.onCompleted: {
console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@22")
console.log(TreelandConfig.currentUserConfig.cursorThemeName)
}

OutputViewport {
id: outputViewport

Expand Down
6 changes: 6 additions & 0 deletions src/core/treeland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ Treeland::Treeland()

qmlRegisterModule("Treeland.Protocols", 1, 0);

qmlRegisterSingletonInstance("Treeland",
1,
0,
"TreelandConfig",
&TreelandConfig::ref()); // Inject treeland config singleton.

d->init();

if (CmdLine::ref().run().has_value()) {
Expand Down

0 comments on commit 28033a4

Please sign in to comment.