fixed integer sorting
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>248</width>
|
<width>248</width>
|
||||||
<height>407</height>
|
<height>437</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
@@ -19,11 +19,7 @@
|
|||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<item rowspan="2" row="0" column="0" >
|
<item rowspan="2" row="0" column="0" >
|
||||||
<widget class="QListWidget" name="listWidget_blinds" >
|
<widget class="QListWidget" name="listWidget_blinds" />
|
||||||
<property name="sortingEnabled" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" >
|
<item row="0" column="1" >
|
||||||
<widget class="QPushButton" name="pushButton_delete" >
|
<widget class="QPushButton" name="pushButton_delete" >
|
||||||
|
|||||||
@@ -43,11 +43,35 @@ void manualBlindsOrderDialogImpl::exec() {
|
|||||||
void manualBlindsOrderDialogImpl::addBlindValueToList() {
|
void manualBlindsOrderDialogImpl::addBlindValueToList() {
|
||||||
|
|
||||||
listWidget_blinds->addItem(QString::number(spinBox_input->value(),10));
|
listWidget_blinds->addItem(QString::number(spinBox_input->value(),10));
|
||||||
listWidget_blinds->sortItems();
|
sortBlindsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void manualBlindsOrderDialogImpl::removeBlindFromList() {
|
void manualBlindsOrderDialogImpl::removeBlindFromList() {
|
||||||
|
|
||||||
listWidget_blinds->removeItemWidget(listWidget_blinds->currentItem());
|
listWidget_blinds->takeItem(listWidget_blinds->currentRow());
|
||||||
listWidget_blinds->sortItems();
|
sortBlindsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void manualBlindsOrderDialogImpl::sortBlindsList() {
|
||||||
|
|
||||||
|
int i;
|
||||||
|
QList<int> tempIntList;
|
||||||
|
QStringList tempStringList;
|
||||||
|
bool ok = TRUE;
|
||||||
|
|
||||||
|
for(i=0; i<listWidget_blinds->count(); i++) {
|
||||||
|
// std::cout << listWidget_blinds->item(i)->text().toInt(&ok,10) << "\n";
|
||||||
|
tempIntList << listWidget_blinds->item(i)->text().toInt(&ok,10);
|
||||||
|
}
|
||||||
|
|
||||||
|
qStableSort(tempIntList.begin(), tempIntList.end());
|
||||||
|
//
|
||||||
|
for(i=0; i<tempIntList.count(); i++) {
|
||||||
|
//
|
||||||
|
// std::cout << tempIntList[i] << "\n";
|
||||||
|
tempStringList << QString::number(tempIntList[i],10);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
listWidget_blinds->clear();
|
||||||
|
listWidget_blinds->addItems(tempStringList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public slots:
|
|||||||
|
|
||||||
void addBlindValueToList();
|
void addBlindValueToList();
|
||||||
void removeBlindFromList();
|
void removeBlindFromList();
|
||||||
|
void sortBlindsList();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user