Vladimir Prus wrote:
> I attach the complete source, maybe that will help.

Fantastic! Thanks, Volodya. It works perfectly.

Jean-Marc, any objection to me committing the attached code to both
repositories?

-- 
Angus
Index: status.13x
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/Attic/status.13x,v
retrieving revision 1.1.2.267
diff -u -p -r1.1.2.267 status.13x
--- status.13x	7 Sep 2005 09:01:36 -0000	1.1.2.267
+++ status.13x	9 Sep 2005 10:37:05 -0000
@@ -44,6 +44,9 @@ What's new
 
 - Enable TeXFiles.sh to run when its path contains spaces.
 
+- The toolbar now stretches across the screen in similar fashion to KDE's
+  toolbars. Prettier look and feel.
+
 * Configuration/Installation:
 
 - compile without STL compatibilty support, since some systems do that
Index: src/frontends/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/ChangeLog,v
retrieving revision 1.148.2.4
diff -u -p -r1.148.2.4 ChangeLog
--- src/frontends/ChangeLog	24 Feb 2005 11:47:35 -0000	1.148.2.4
+++ src/frontends/ChangeLog	9 Sep 2005 10:37:05 -0000
@@ -1,3 +1,9 @@
+2005-09-09  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* Toolbar.C (terminate_toolbars): call Pimpl::terminate_toolbars()
+	to enable toolbars in the Qt frontend to stretch across the entire
+	screen in similar fashion to KDE apps.
+
 2005-02-23  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* Dialogs.h (showForks): removed.
Index: src/frontends/Toolbar.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/Attic/Toolbar.C,v
retrieving revision 1.18.2.1
diff -u -p -r1.18.2.1 Toolbar.C
--- src/frontends/Toolbar.C	7 Dec 2004 10:48:59 -0000	1.18.2.1
+++ src/frontends/Toolbar.C	9 Sep 2005 10:37:06 -0000
@@ -29,6 +29,8 @@ Toolbar::Toolbar(LyXView * o, int x, int
 		pimpl_->add((*cit));
 		lyxerr[Debug::GUI] << "tool action: " << (*cit) << endl;
 	}
+
+	pimpl_->terminate_toolbars();
 }
 
 
Index: src/frontends/qt2/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ChangeLog,v
retrieving revision 1.389.2.81
diff -u -p -r1.389.2.81 ChangeLog
--- src/frontends/qt2/ChangeLog	22 Jul 2005 13:46:04 -0000	1.389.2.81
+++ src/frontends/qt2/ChangeLog	9 Sep 2005 10:37:09 -0000
@@ -1,3 +1,8 @@
+2005-09-09  Angus Leeming  <[EMAIL PROTECTED]>, Vladimir Prus <[EMAIL PROTECTED]>
+
+	* Toolbar_pimpl.[Ch] (terminate_toolbars): Enable the toolbar to
+	stretch to across the window in similar fashion to KDE apps.
+
 2005-07-22  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* QRef.C (update_contents): disable the OK button when the dialog is
Index: src/frontends/qt2/Toolbar_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/Attic/Toolbar_pimpl.C,v
retrieving revision 1.30.2.2
diff -u -p -r1.30.2.2 Toolbar_pimpl.C
--- src/frontends/qt2/Toolbar_pimpl.C	7 Dec 2004 10:49:14 -0000	1.30.2.2
+++ src/frontends/qt2/Toolbar_pimpl.C	9 Sep 2005 10:37:10 -0000
@@ -258,3 +258,29 @@ void Toolbar::Pimpl::add(int action)
 	}
 	}
 }
+
+
+namespace {
+
+class ZeroSizeToolButton : public QToolButton {
+public:
+    ZeroSizeToolButton(QWidget* parent) : QToolButton(parent) {}
+    
+    QSize sizeHint() const { return QSize(0, 0); }
+    QSize minimumSizeHint() const { return QSize(0, 0); }
+};
+
+} // namespace anon
+
+
+void Toolbar::Pimpl::terminate_toolbars()
+{
+	typedef std::vector<QToolBar *>::iterator iterator;
+	iterator const end = toolbars_.end();
+	for (iterator it = toolbars_.begin(); it != end; ++it) {
+		QToolBar * const toolbar = *it;
+		QToolButton * const toolbutton = new ZeroSizeToolButton(toolbar);
+		toolbutton->setEnabled(false);
+		toolbar->setStretchableWidget(toolbutton);
+	}
+}
Index: src/frontends/qt2/Toolbar_pimpl.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/Attic/Toolbar_pimpl.h,v
retrieving revision 1.14.2.1
diff -u -p -r1.14.2.1 Toolbar_pimpl.h
--- src/frontends/qt2/Toolbar_pimpl.h	7 Dec 2004 10:49:14 -0000	1.14.2.1
+++ src/frontends/qt2/Toolbar_pimpl.h	9 Sep 2005 10:37:10 -0000
@@ -39,6 +39,9 @@ public:
 	/// add a new button to the toolbar.
 	void add(int action);
 
+	/// Enable the toolbar(s) to stretch to fill the space available
+	void terminate_toolbars();
+
 	/// update the state of the icons
 	void update();
 
Index: src/frontends/xforms/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.661.2.34
diff -u -p -r1.661.2.34 ChangeLog
--- src/frontends/xforms/ChangeLog	22 Jul 2005 16:52:04 -0000	1.661.2.34
+++ src/frontends/xforms/ChangeLog	9 Sep 2005 10:37:17 -0000
@@ -1,3 +1,8 @@
+2005-09-09  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* Toolbar_pimpl.h (terminate_toolbars): empty implementation
+	of function invoked by parent Toolbar class.
+
 2005-07-22  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* FormSearch.C (input): do not trim the find and replace strings.
Index: src/frontends/xforms/Toolbar_pimpl.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/Attic/Toolbar_pimpl.h,v
retrieving revision 1.24.2.1
diff -u -p -r1.24.2.1 Toolbar_pimpl.h
--- src/frontends/xforms/Toolbar_pimpl.h	7 Dec 2004 10:49:22 -0000	1.24.2.1
+++ src/frontends/xforms/Toolbar_pimpl.h	9 Sep 2005 10:37:17 -0000
@@ -37,6 +37,9 @@ public:
 	/// add a new button to the toolbar.
 	void add(int action);
 
+	/// Enable the toolbar(s) to stretch to fill the space available
+	void terminate_toolbars() {}
+
 	/// update the state of the icons
 	void update();
 
Index: src/frontends/qt2/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ChangeLog,v
retrieving revision 1.818
diff -u -p -r1.818 ChangeLog
--- src/frontends/qt2/ChangeLog	8 Sep 2005 09:20:15 -0000	1.818
+++ src/frontends/qt2/ChangeLog	9 Sep 2005 10:27:07 -0000
@@ -1,3 +1,8 @@
+2005-09-09  Angus Leeming  <[EMAIL PROTECTED]>, Vladimir Prus <[EMAIL PROTECTED]>
+
+	* QLToolbar.C (c-tor): Enable the toolbar to stretch to across the
+	window in similar fashion to KDE apps.
+
 2005-09-08  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* QPrefsDialog.C:
Index: src/frontends/qt2/QLToolbar.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLToolbar.C,v
retrieving revision 1.17
diff -u -p -r1.17 QLToolbar.C
--- src/frontends/qt2/QLToolbar.C	9 Nov 2004 12:40:33 -0000	1.17
+++ src/frontends/qt2/QLToolbar.C	9 Sep 2005 10:27:08 -0000
@@ -163,6 +163,19 @@ Toolbars::ToolbarPtr make_toolbar(Toolba
 namespace lyx {
 namespace frontend {
 
+namespace {
+
+class ZeroSizeToolButton : public QToolButton {
+public:
+    ZeroSizeToolButton(QWidget* parent) : QToolButton(parent) {}
+    
+    QSize sizeHint() const { return QSize(0, 0); }
+    QSize minimumSizeHint() const { return QSize(0, 0); }
+};
+
+} // namespace anon
+
+
 QLToolbar::QLToolbar(ToolbarBackend::Toolbar const & tbb, LyXView & owner)
 	: owner_(dynamic_cast<QtView &>(owner)),
 	  toolbar_(new QToolBar(qt_(tbb.gui_name), &owner_,
@@ -175,6 +188,11 @@ QLToolbar::QLToolbar(ToolbarBackend::Too
 	ToolbarBackend::item_iterator end = tbb.items.end();
 	for (; it != end; ++it)
 		add(it->first, it->second);
+
+	// Ensure that the toolbar stretches to the end of the line.
+	QToolButton * const toolbutton = new ZeroSizeToolButton(toolbar_);
+	toolbutton->setEnabled(false);
+	toolbar_->setStretchableWidget(toolbutton);
 }
 
 

Reply via email to