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

List:       kde-commits
Subject:    [kate] kate/session: Session chooser: Ensure no unnecessary horizontal scroll bar.
From:       Andreas Hartmetz <ahartmetz () gmail ! com>
Date:       2016-09-30 17:43:42
Message-ID: E1bq1qY-0004HV-Qs () code ! kde ! org
[Download RAW message or body]

Git commit d664483ac5e5e01cf13a3f8d9706cd64229b9d15 by Andreas Hartmetz.
Committed on 30/09/2016 at 17:41.
Pushed by ahartmetz into branch 'master'.

Session chooser: Ensure no unnecessary horizontal scroll bar.

There really is no need to resize any but the first columns.
The manual layout did not take into account the width of the
vertical scroll bar. This here is much easier than fixing that.

M  +3    -11   kate/session/katesessionchooser.cpp
M  +0    -3    kate/session/katesessionchooser.h

http://commits.kde.org/kate/d664483ac5e5e01cf13a3f8d9706cd64229b9d15

diff --git a/kate/session/katesessionchooser.cpp b/kate/session/katesession=
chooser.cpp
index 7acfab0..8e4e46f 100644
--- a/kate/session/katesessionchooser.cpp
+++ b/kate/session/katesessionchooser.cpp
@@ -52,10 +52,10 @@ KateSessionChooser::KateSessionChooser(QWidget *parent,=
 const QString &lastSessi
     header << QString();
     m_sessions->setHeaderLabels(header);
     m_sessions->header()->setStretchLastSection(false);
-    m_sessions->header()->resizeSection(0, (m_sessions->size().width() - 3=
2) * 2 / 3);
-    m_sessions->header()->resizeSection(1, (m_sessions->size().width() - 3=
2) / 3);
+    m_sessions->header()->setSectionResizeMode(0, QHeaderView::Stretch);
+    m_sessions->header()->setSectionResizeMode(1, QHeaderView::ResizeToCon=
tents);
+    m_sessions->header()->setSectionResizeMode(2, QHeaderView::Fixed);
     m_sessions->header()->resizeSection(2, 32);
-    m_sessions->header()->setSectionResizeMode(QHeaderView::Fixed);
     m_sessions->setRootIsDecorated(false);
     m_sessions->setItemsExpandable(false);
     m_sessions->setAllColumnsShowFocus(true);
@@ -117,17 +117,9 @@ KateSessionChooser::KateSessionChooser(QWidget *parent=
, const QString &lastSessi
     connect(newButton, SIGNAL(clicked()), this, SLOT(slotNew()));
 =

     setResult(resultNone);
-    //m_sessions->resizeColumnToContents(0);
     selectionChanged(NULL, NULL);
 }
 =

-void KateSessionChooser::resizeEvent(QResizeEvent *)
-{
-    m_sessions->header()->resizeSection(0, (m_sessions->size().width() - 3=
2) * 2 / 3);
-    m_sessions->header()->resizeSection(1, (m_sessions->size().width() - 3=
2) / 3);
-    m_sessions->header()->resizeSection(2, 32);
-}
-
 KateSessionChooser::~KateSessionChooser()
 {}
 =

diff --git a/kate/session/katesessionchooser.h b/kate/session/katesessionch=
ooser.h
index bc82ee6..c2d1ee2 100644
--- a/kate/session/katesessionchooser.h
+++ b/kate/session/katesessionchooser.h
@@ -61,9 +61,6 @@ protected Q_SLOTS:
      */
     void selectionChanged(QTreeWidgetItem *current, QTreeWidgetItem *previ=
ous);
 =

-protected:
-    void resizeEvent(QResizeEvent *);
-
 private:
     QTreeWidget *m_sessions;
     QCheckBox *m_useLast;
[prev in list] [next in list] [prev in thread] [next in thread] 

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