The branch, master, has been updated.

- Log -----------------------------------------------------------------

commit 151960440e89f5afa3bb8cad07ed42f3088b4de3
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Mon May 6 23:50:23 2013 +0200

    Another try at making the source view dock arrange itself.
    
    The idea is to minimize the size of the form that contains the buttons.
    
    Since I do not really know what I am doing, I will revert if problems occur.

diff --git a/src/frontends/qt4/GuiViewSource.cpp 
b/src/frontends/qt4/GuiViewSource.cpp
index 0875c82..edc1dea 100644
--- a/src/frontends/qt4/GuiViewSource.cpp
+++ b/src/frontends/qt4/GuiViewSource.cpp
@@ -228,13 +228,16 @@ void ViewSourceWidget::updateDefaultFormat()
 }
 
 
-void ViewSourceWidget::dockLocationChanged(Qt::DockWidgetArea area)
+void ViewSourceWidget::resizeEvent (QResizeEvent * event)
 {
-       if (area == Qt::RightDockWidgetArea || area == Qt::LeftDockWidgetArea) {
+       QSize const & formSize = formLayout->sizeHint();
+       // minimize the size of the part that contains the buttons
+       if (width() * formSize.height() < height() * formSize.width()) {
                layout_->setDirection(QBoxLayout::TopToBottom);
        } else {
                layout_->setDirection(QBoxLayout::LeftToRight);
        }
+       QWidget::resizeEvent(event);
 }
 
 
@@ -244,8 +247,6 @@ GuiViewSource::GuiViewSource(GuiView & parent,
 {
        widget_ = new ViewSourceWidget;
        setWidget(widget_);
-       connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)),
-               widget_, SLOT(dockLocationChanged(Qt::DockWidgetArea)));
 }
 
 
diff --git a/src/frontends/qt4/GuiViewSource.h 
b/src/frontends/qt4/GuiViewSource.h
index 1722ac9..5e19fe2 100644
--- a/src/frontends/qt4/GuiViewSource.h
+++ b/src/frontends/qt4/GuiViewSource.h
@@ -40,6 +40,10 @@ public:
        ///
        void setBufferView(BufferView const * bv);
 
+protected:
+       ///
+       void resizeEvent (QResizeEvent * event);
+
 public Q_SLOTS:
        /// update content
        void updateView();
@@ -49,8 +53,6 @@ public Q_SLOTS:
        void updateDefaultFormat();
        ///
        void contentsChanged();
-       ///
-       void dockLocationChanged(Qt::DockWidgetArea area);
 
 private:
        ///

-----------------------------------------------------------------------

Summary of changes:
 src/frontends/qt4/GuiViewSource.cpp |    9 +++++----
 src/frontends/qt4/GuiViewSource.h   |    6 ++++--
 2 files changed, 9 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to