Skip to content

Commit

Permalink
fix: current index is incorrect when starting for the first time
Browse files Browse the repository at this point in the history
Log: current index is incorrect when starting for the first time
Signed-off-by: zorowk <[email protected]>
  • Loading branch information
zorowk authored and justforlxz committed Jan 12, 2024
1 parent b9f922f commit 5e739d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/treeland/quick/protocols/qwpersonalizationmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ void QuickPersonalizationManagerPrivate::updateCacheWallpaperPath(uid_t uid)
QString cache_location = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
m_cacheDirectory = cache_location + QString("/wallpaper/%1/").arg(uid);
m_settingFile = m_cacheDirectory + "wallpaper.ini";
m_currentWallpaper = "/usr/share/wallpapers/deepin/desktop.jpg";
}

void QuickPersonalizationManagerPrivate::loadWallpaperSettings()
Expand Down
4 changes: 2 additions & 2 deletions src/treeland/treeland-wallpaper/wallpapercardmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ void WallpaperCardModel::setCurrentIndex(int index)
{
d->currentIndex = index;
Q_EMIT currentIndexChanged(d->currentIndex);
Q_EMIT layoutChanged();
}

int WallpaperCardModel::currentIndex() const {
Expand Down Expand Up @@ -109,11 +110,10 @@ void WallpaperCardModel::append(const QString& path)
{
beginInsertRows(QModelIndex(), 0, 0);
d->wallpapers.push_front("file://" + path);
setCurrentIndex(0);
endInsertRows();

setCurrentIndex(0);
Q_EMIT dataCountChanged(d->wallpapers.length());
Q_EMIT layoutChanged();
}

void WallpaperCardModel::remove(int index)
Expand Down

0 comments on commit 5e739d6

Please sign in to comment.