[rkward-cvs] SF.net SVN: rkward: [878] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Oct 17 15:35:10 UTC 2006


Revision: 878
          http://svn.sourceforge.net/rkward/?rev=878&view=rev
Author:   tfry
Date:     2006-10-17 08:34:57 -0700 (Tue, 17 Oct 2006)

Log Message:
-----------
Use KTabBar to provide close buttons for tabs in RKWorkplaceView

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/windows/rkworkplaceview.cpp
    trunk/rkward/rkward/windows/rkworkplaceview.h

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2006-10-17 15:20:33 UTC (rev 877)
+++ trunk/rkward/ChangeLog	2006-10-17 15:34:57 UTC (rev 878)
@@ -1,3 +1,5 @@
+- provide close buttons in tab bar
+
 --- Version 0.4.0 - Oct-17-2006
 - many new distribution plugins
 - all distribution plugins now use a free-text field, allowing you to enter a vector of probabilties / quantiles

Modified: trunk/rkward/rkward/windows/rkworkplaceview.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkworkplaceview.cpp	2006-10-17 15:20:33 UTC (rev 877)
+++ trunk/rkward/rkward/windows/rkworkplaceview.cpp	2006-10-17 15:34:57 UTC (rev 878)
@@ -17,7 +17,8 @@
 
 #include "rkworkplaceview.h"
 
-#include <qtabbar.h>
+#include <ktabbar.h>
+
 #include <qwidgetstack.h>
 #include <qapplication.h>
 #include <qevent.h>
@@ -32,9 +33,11 @@
 	RK_TRACE (APP);
 
 	QVBoxLayout *vbox = new QVBoxLayout (this);
-	tabs = new QTabBar (this);
+	tabs = new KTabBar (this);
+	tabs->setHoverCloseButton (true);
 	tabs->hide ();
 	connect (tabs, SIGNAL (selected (int)), this, SLOT (setPage (int)));
+	connect (tabs, SIGNAL (closeRequest (int)), this, SLOT (closePage (int)));
 	vbox->addWidget (tabs);
 
 	widgets = new QWidgetStack (this);
@@ -123,6 +126,15 @@
 	return window->shortCaption ();
 }
 
+void RKWorkplaceView::closePage (int index) {
+	RK_TRACE (APP);
+	int page = tabs->tabAt (index)->identifier ();
+	RK_ASSERT (pages.find (page) != pages.end ());
+
+	RKMDIWindow *window = pages[page];
+	window->close (true);
+}
+
 void RKWorkplaceView::setPage (int page) {
 	RK_TRACE (APP);
 	RK_ASSERT (pages.find (page) != pages.end ());

Modified: trunk/rkward/rkward/windows/rkworkplaceview.h
===================================================================
--- trunk/rkward/rkward/windows/rkworkplaceview.h	2006-10-17 15:20:33 UTC (rev 877)
+++ trunk/rkward/rkward/windows/rkworkplaceview.h	2006-10-17 15:34:57 UTC (rev 878)
@@ -21,7 +21,7 @@
 #include <qwidget.h>
 #include <qmap.h>
 
-class QTabBar;
+class KTabBar;
 class QWidgetStack;
 class RKMDIWindow;
 
@@ -61,8 +61,9 @@
 	void setPage (int page);
 /** called when the caption of a window changes. Updates the tab-label, and - if appropriate - the caption of this widget */
 	void childCaptionChanged (RKMDIWindow *widget);
+	void closePage (int index);
 private:
-	QTabBar *tabs;
+	KTabBar *tabs;
 	QWidgetStack *widgets;
 	typedef QMap<int, RKMDIWindow*> PageMap;
 	PageMap pages;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list