summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Hartmetz <ahartmetz@gmail.com>2016-09-30 14:27:04 (GMT)
committerAndreas Hartmetz <ahartmetz@gmail.com>2016-09-30 17:41:37 (GMT)
commitd664483ac5e5e01cf13a3f8d9706cd64229b9d15 (patch)
tree3ad15e53416de1b7afe5e0cd0085d9bec2267e3d
parentcdd89582a7c22fdbb8709a0047f324df79e10684 (diff)
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.
-rw-r--r--kate/session/katesessionchooser.cpp14
-rw-r--r--kate/session/katesessionchooser.h3
2 files changed, 3 insertions, 14 deletions
diff --git a/kate/session/katesessionchooser.cpp b/kate/session/katesessionchooser.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() - 32) * 2 / 3);
- m_sessions->header()->resizeSection(1, (m_sessions->size().width() - 32) / 3);
+ m_sessions->header()->setSectionResizeMode(0, QHeaderView::Stretch);
+ m_sessions->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
+ 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() - 32) * 2 / 3);
- m_sessions->header()->resizeSection(1, (m_sessions->size().width() - 32) / 3);
- m_sessions->header()->resizeSection(2, 32);
-}
-
KateSessionChooser::~KateSessionChooser()
{}
diff --git a/kate/session/katesessionchooser.h b/kate/session/katesessionchooser.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 *previous);
-protected:
- void resizeEvent(QResizeEvent *);
-
private:
QTreeWidget *m_sessions;
QCheckBox *m_useLast;