!58 FIX History Layout Issues
Merge pull request !58 from likehomedream/fixhistory
This commit is contained in:
commit
5d7093cf35
|
@ -95,7 +95,7 @@ void MainWindow::initUI()
|
|||
m_guideWidget->setLayout(labellayout);
|
||||
|
||||
m_historywidget = new HistoryWidget();
|
||||
m_historywidget->setMinimumHeight(2000);
|
||||
// m_historywidget->setMinimumHeight(2000);
|
||||
QDir builderDir = QDir::homePath()+"/.cache/theme-build/";
|
||||
if(builderDir.isEmpty()){
|
||||
alllayout->addStretch(1);
|
||||
|
@ -201,6 +201,7 @@ void MainWindow::initUI()
|
|||
QFileSystemWatcher* watcher = new QFileSystemWatcher(this);
|
||||
watcher->addPath(builderDir.absolutePath());
|
||||
connect(watcher, &QFileSystemWatcher::directoryChanged, this, [=](const QString& path) {
|
||||
m_historywidget->updateHistoryDir();
|
||||
if (builderDir.isEmpty()) {
|
||||
alllayout->removeWidget(m_guideWidget);
|
||||
alllayout->removeItem(alllayout->itemAt(alllayout->count()-1));
|
||||
|
|
|
@ -142,7 +142,7 @@ void HistoryWidget::updateHistoryDir()
|
|||
QVBoxLayout *alllayout = qobject_cast<QVBoxLayout*>(this->layout());
|
||||
if (alllayout) {
|
||||
// 删除原来的widget
|
||||
while (QWidget* w = alllayout->takeAt(1)->widget()) { // 从索引1开始,因为索引0是textWidget
|
||||
while (QWidget* w = alllayout->takeAt(0)->widget()) { // 从索引0开始,因删除了所有的widget
|
||||
delete w;
|
||||
}
|
||||
alllayout->addWidget(widget);
|
||||
|
|
|
@ -421,15 +421,13 @@ void ImageWidget::updateIcon(const QString& widgetName, const QString& newFilePa
|
|||
newPixmapItem->setData(1, newFilePath);
|
||||
// 设置新的位图的位置为旧位置
|
||||
newPixmapItem->setPos(oldPosition);
|
||||
}
|
||||
}else {
|
||||
qDebug() << "Failed to load image:" << newFilePath;
|
||||
}
|
||||
} else {
|
||||
qDebug() << "Failed to load image:" << newFilePath;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qDebug() << "Failed to load image:" << newFilePath;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue