Skip to content

Commit 6e59c8d

Browse files
committed
Remove extra items
1 parent 7b4a05b commit 6e59c8d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Interface/Application/ProvenanceWindow.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ ProvenanceWindow::ProvenanceWindow(ProvenanceManagerHandle provenanceManager, QW
5656
connect(undoAllButton_, SIGNAL(clicked()), this, SLOT(undoAll()));
5757
connect(redoAllButton_, SIGNAL(clicked()), this, SLOT(redoAll()));
5858
connect(clearButton_, SIGNAL(clicked()), this, SLOT(clear()));
59+
connect(itemMaxSpinBox_, SIGNAL(valueChanged(int)), this, SLOT(setMaxItems(int)));
60+
setMaxItems(10);
5961
setUndoEnabled(false);
6062
setRedoEnabled(false);
6163
}
@@ -152,6 +154,14 @@ void ProvenanceWindow::clear()
152154
networkXMLTextEdit_->clear();
153155
}
154156

157+
void ProvenanceWindow::setMaxItems(int max)
158+
{
159+
for (int i = 0; i < provenanceListWidget_->count() - max; ++i)
160+
{
161+
delete provenanceListWidget_->takeItem(0);
162+
}
163+
}
164+
155165
void ProvenanceWindow::setUndoEnabled(bool enable)
156166
{
157167
undoButton_->setEnabled(enable);

src/Interface/Application/ProvenanceWindow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public Q_SLOTS:
5959
void redoAll();
6060
private Q_SLOTS:
6161
void displayInfo(QListWidgetItem* item);
62+
void setMaxItems(int max);
6263
Q_SIGNALS:
6364
void modifyingNetwork(bool modifying);
6465
void undoStateChanged(bool enabled);

0 commit comments

Comments
 (0)