ui: fixed QtDirectoryListBox not sized correctly when overwriting list
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <QMimeData>
|
||||
#include <QScrollBar>
|
||||
#include <QSysInfo>
|
||||
#include <QTimer>
|
||||
#include <QTreeView>
|
||||
|
||||
#include "utility/ResourcePaths.h"
|
||||
@@ -243,13 +244,15 @@ std::vector<std::string> QtDirectoryListBox::getStringList()
|
||||
|
||||
void QtDirectoryListBox::setStringList(const std::vector<std::string>& list)
|
||||
{
|
||||
m_list->clear();
|
||||
clear();
|
||||
|
||||
for (const std::string& str : list)
|
||||
{
|
||||
QtListItemWidget* widget = addListBoxItem();
|
||||
widget->setText(QString::fromStdString(str));
|
||||
}
|
||||
|
||||
QTimer::singleShot(1, this, SLOT(resize()));
|
||||
}
|
||||
|
||||
void QtDirectoryListBox::selectItem(QListWidgetItem* item)
|
||||
@@ -292,10 +295,10 @@ QtListItemWidget* QtDirectoryListBox::addListBoxItem()
|
||||
QtListItemWidget* widget = new QtListItemWidget(this, item);
|
||||
m_list->setItemWidget(item, widget);
|
||||
|
||||
resize();
|
||||
|
||||
widget->setFocus();
|
||||
|
||||
resize();
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
@@ -315,12 +318,12 @@ void QtDirectoryListBox::removeListBoxItem()
|
||||
rowIndex -= 1;
|
||||
}
|
||||
|
||||
resize();
|
||||
|
||||
if (rowIndex >= 0)
|
||||
{
|
||||
m_list->setCurrentRow(rowIndex);
|
||||
}
|
||||
|
||||
resize();
|
||||
}
|
||||
|
||||
void QtDirectoryListBox::dragEnterEvent(QDragEnterEvent *event)
|
||||
|
||||
@@ -68,18 +68,18 @@ protected:
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||
|
||||
private:
|
||||
private slots:
|
||||
void resize();
|
||||
|
||||
QtListItemWidget* addListBoxItem();
|
||||
void removeListBoxItem();
|
||||
|
||||
private:
|
||||
QPushButton* m_addButton;
|
||||
QPushButton* m_removeButton;
|
||||
QListWidget* m_list;
|
||||
|
||||
bool m_forStrings;
|
||||
|
||||
private slots:
|
||||
QtListItemWidget* addListBoxItem();
|
||||
void removeListBoxItem();
|
||||
};
|
||||
|
||||
#endif // QT_DIRECTORY_LIST_BOX_H
|
||||
|
||||
@@ -185,7 +185,7 @@ QtProjectWizzardContentPathsSource::QtProjectWizzardContentPathsSource(
|
||||
|
||||
QSize QtProjectWizzardContentPathsSource::preferredWindowSize() const
|
||||
{
|
||||
return QSize(750, 370);
|
||||
return QSize(750, 400);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsSource::load()
|
||||
|
||||
Reference in New Issue
Block a user