fix: current index is incorrect when starting for the first time
Log: current index is incorrect when starting for the first time Signed-off-by: zorowk <near.kingzero@gmail.com>
This commit is contained in:
parent
b9f922ff53
commit
5e739d6da5
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ void WallpaperCardModel::setCurrentIndex(int index)
|
|||
{
|
||||
d->currentIndex = index;
|
||||
Q_EMIT currentIndexChanged(d->currentIndex);
|
||||
Q_EMIT layoutChanged();
|
||||
}
|
||||
|
||||
int WallpaperCardModel::currentIndex() const {
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue