Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <QApplication>
- #include <QComboBox>
- #include <stdio.h>
- void ordenar_combo(QComboBox& combo) {
- size_t size = combo.count();
- printf("%zu\n", size);
- QString t1;
- QString t2;
- for (size_t i = 0; i < size / 2; ++i) {
- t1 = combo.itemText(i);
- t2 = combo.itemText(size - i - 1);
- combo.setItemText(i, t2);
- combo.setItemText(size - i - 1, t1);
- }
- }
- int main(int argc, char* argv[]) {
- QApplication app(argc, argv);
- QComboBox combo;
- combo.addItem("1");
- combo.addItem("2");
- ordenar_combo(combo);
- combo.show();
- return app.exec();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement