[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [colord-kde] colord-kcm: Make sure we respect the tab orders
From:       Daniel Nicoletti <dantti12 () gmail ! com>
Date:       2012-03-31 19:02:21
Message-ID: 20120331190221.7322DA60C4 () git ! kde ! org
[Download RAW message or body]

Git commit 2221a6946c4e6d8a24d66294d1c54abfc10478d0 by Daniel Nicoletti.
Committed on 31/03/2012 at 03:45.
Pushed by dantti into branch 'master'.

Make sure we respect the tab orders

M  +14   -1    colord-kcm/Description.cpp

http://commits.kde.org/colord-kde/2221a6946c4e6d8a24d66294d1c54abfc10478d0

diff --git a/colord-kcm/Description.cpp b/colord-kcm/Description.cpp
index 89ec0c7..b7b3def 100644
--- a/colord-kcm/Description.cpp
+++ b/colord-kcm/Description.cpp
@@ -369,7 +369,20 @@ void Description::insertTab(int index, QWidget *widget, const QString &label)
 {
     int pos = ui->tabWidget->indexOf(widget);
     if (pos == -1) {
-        ui->tabWidget->insertTab(index, widget, label);
+        // if the widget was not found set the desired ORDER
+        widget->setProperty("ORDER", index);
+        pos = index;
+        for (int i = 1; i < ui->tabWidget->count(); ++i) {
+            QWidget *widget = ui->tabWidget->widget(i);
+            // Check if the tab widget in greater than our desired position
+            if (widget->property("ORDER").toInt() > index) {
+                // if so make sure the new widget is inserted in the
+                // same position of this widget, pushing it further
+                pos = i;
+                break;
+            }
+        }
+        ui->tabWidget->insertTab(pos, widget, label);
     }
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic