KDE/kdelibs/plasma/widgets

Marco Martin notmart at gmail.com
Wed Sep 2 17:54:19 CEST 2009


SVN commit 1019013 by mart:

add tabAt(int) function
actually the correspondent qtabwidget is widget(), but on a
qgraphicsproxywidget it is taken, maybe needs a beter name?
CCMAIL: plasma-devel at kde.org


 M  +19 -0     tabbar.cpp  
 M  +8 -0      tabbar.h  


--- trunk/KDE/kdelibs/plasma/widgets/tabbar.cpp #1019012:1019013
@@ -425,6 +425,25 @@
     return returnItem;
 }
 
+QGraphicsLayoutItem *TabBar::tabAt(int index)
+{
+    if (index > d->pages.count()) {
+        return 0;
+    }
+
+    QGraphicsWidget *page = d->pages.value(index);
+
+    QGraphicsLayoutItem *returnItem = 0;
+    QGraphicsLayout *lay = page->layout();
+    if (lay && lay->count() == 1) {
+        returnItem = lay->itemAt(0);
+    } else {
+        returnItem = lay;
+    }
+    
+    return returnItem;
+}
+
 void TabBar::setTabText(int index, const QString &label)
 {
     if (index > d->pages.count()) {
--- trunk/KDE/kdelibs/plasma/widgets/tabbar.h #1019012:1019013
@@ -125,6 +125,14 @@
      * @since 4.4
      */
     QGraphicsLayoutItem *takeTab(int index);
+    
+    /**
+     * Returns the contents of a page
+     *
+     * @arg index the index of the tab to retrieve
+     * @since 4.4
+     */
+    QGraphicsLayoutItem *tabAt(int index);
 
     /**
      * @return the index of the tab currently active


More information about the Plasma-devel mailing list