mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-24 07:16:53 -06:00
#2813 Origin import dialog. Add text '+ xxx more files' if number of origin files exceedes 4
This commit is contained in:
parent
39cfc687bd
commit
b34deb1038
@ -476,15 +476,23 @@ void RicSummaryCaseRestartDialog::updateFileListWidget(QGridLayout* gridLayout,
|
||||
delete item;
|
||||
}
|
||||
|
||||
if (m_fileLists[listIndex].empty())
|
||||
if (m_fileLists[listIndex].empty())
|
||||
{
|
||||
QWidget* parent = gridLayout->parentWidget();
|
||||
if (parent) parent->setVisible(false);
|
||||
}
|
||||
|
||||
int maxFilesToDisplay = 4;
|
||||
int currFiles = 0;
|
||||
for (const auto& fileInfo : m_fileLists[listIndex])
|
||||
{
|
||||
appendFileInfoToGridLayout(gridLayout, fileInfo.first, fileInfo.second);
|
||||
if (++currFiles == maxFilesToDisplay)
|
||||
{
|
||||
size_t remainingFileCount = m_fileLists[listIndex].size() - maxFilesToDisplay;
|
||||
appendTextToGridLayout(gridLayout, QString("+ %1 more files").arg(remainingFileCount));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -518,6 +526,22 @@ void RicSummaryCaseRestartDialog::appendFileInfoToGridLayout(QGridLayout* gridLa
|
||||
fileNameLabel->setToolTip(fullPathFileName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCaseRestartDialog::appendTextToGridLayout(QGridLayout* gridLayout, const QString& text)
|
||||
{
|
||||
CVF_ASSERT(gridLayout);
|
||||
|
||||
int rowCount = gridLayout->rowCount();
|
||||
|
||||
QLabel* textLabel = new QLabel();
|
||||
textLabel->setText(text);
|
||||
|
||||
textLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
gridLayout->addWidget(textLabel, rowCount, 0, 1, 2);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -77,6 +77,7 @@ public:
|
||||
private:
|
||||
void updateFileListWidget(QGridLayout* gridLayout, int listIndex);
|
||||
void appendFileInfoToGridLayout(QGridLayout* gridLayout, const RifRestartFileInfo& fileInfo, const QString& fullPathFileName);
|
||||
void appendTextToGridLayout(QGridLayout* gridLayout, const QString& text);
|
||||
RifRestartFileInfo getFileInfo(const QString& summaryHeaderFile);
|
||||
void displayWarningsIfAny(const QStringList& warnings);
|
||||
QString fullFileName(const QString& shortOrFullFileName);
|
||||
|
Loading…
Reference in New Issue
Block a user