aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2014-01-22 11:39:45 (GMT)
committerChristoph Cullmann <cullmann@kde.org>2014-01-22 11:39:45 (GMT)
commit86a3dc664cb4f1bb769bec4fdcf0929ff7b6b920 (patch)
tree046be5424e0817f5b319659b9d7ea2f50420dc61
parent8d86bac77dd4e98893cc7c36f828041f2db3347e (diff)
start to fix resizing mess of status bar
-rw-r--r--src/view/katestatusbar.cpp6
-rw-r--r--src/view/kateviewhelpers.cpp38
-rw-r--r--src/view/kateviewhelpers.h3
3 files changed, 12 insertions, 35 deletions
diff --git a/src/view/katestatusbar.cpp b/src/view/katestatusbar.cpp
index 3eb9575..8ccb87d 100644
--- a/src/view/katestatusbar.cpp
+++ b/src/view/katestatusbar.cpp
@@ -30,7 +30,6 @@
#include <QHBoxLayout>
#include <QFontDatabase>
-#include <QSizeGrip>
KateStatusBar::KateStatusBar(KTextEditor::ViewPrivate *view)
: KateViewBarWidget(false)
@@ -95,11 +94,6 @@ KateStatusBar::KateStatusBar(KTextEditor::ViewPrivate *view)
m_lineColLabel = new QLabel( this );
topLayout->addWidget( m_lineColLabel, 0 );
m_lineColLabel->setFocusProxy(m_view);
-
- /**
- * size grip for window resizing
- */
- topLayout->addWidget(new QSizeGrip(this));
m_modPm = QIcon::fromTheme(QStringLiteral("document-save")).pixmap(16);
m_modDiscPm = QIcon::fromTheme(QStringLiteral("dialog-warning")).pixmap(16);
diff --git a/src/view/kateviewhelpers.cpp b/src/view/kateviewhelpers.cpp
index 83e5cf8..d59bdc4 100644
--- a/src/view/kateviewhelpers.cpp
+++ b/src/view/kateviewhelpers.cpp
@@ -2367,13 +2367,11 @@ void KateViewBar::removeBarWidget(KateViewBarWidget *barWidget)
void KateViewBar::addPermanentBarWidget(KateViewBarWidget *barWidget)
{
- // remove old widget from layout (if any)
- if (m_permanentBarWidget) {
- m_permanentBarWidget->hide();
- m_layout->removeWidget(m_permanentBarWidget);
- }
-
- m_layout->addWidget(barWidget, 0, Qt::AlignBottom);
+ Q_ASSERT(barWidget);
+ Q_ASSERT(!m_permanentBarWidget);
+
+ m_stack->addWidget(barWidget);
+ m_stack->show();
m_permanentBarWidget = barWidget;
m_permanentBarWidget->show();
@@ -2382,17 +2380,10 @@ void KateViewBar::addPermanentBarWidget(KateViewBarWidget *barWidget)
void KateViewBar::removePermanentBarWidget(KateViewBarWidget *barWidget)
{
- if (m_permanentBarWidget != barWidget) {
- qCDebug(LOG_PART) << "no such permanent widget exists in bar";
- return;
- }
-
- if (!m_permanentBarWidget) {
- return;
- }
+ Q_ASSERT(m_permanentBarWidget == barWidget);
m_permanentBarWidget->hide();
- m_layout->removeWidget(m_permanentBarWidget);
+ m_stack->removeWidget(m_permanentBarWidget);
m_permanentBarWidget = 0;
if (!m_stack->isVisible()) {
@@ -2418,14 +2409,7 @@ void KateViewBar::showBarWidget(KateViewBarWidget *barWidget)
barWidget->show();
barWidget->setFocus(Qt::ShortcutFocusReason);
m_stack->show();
-
- // if we have any permanent widget, bar is always visible,
- // no need to show it
- if (m_permanentBarWidget) {
- m_permanentBarWidget->hide();
- } else {
- setViewBarVisible(true);
- }
+ setViewBarVisible(true);
}
bool KateViewBar::hasBarWidget(KateViewBarWidget *barWidget) const
@@ -2439,13 +2423,13 @@ void KateViewBar::hideCurrentBarWidget()
if (current) {
current->closed();
}
- m_stack->hide();
-
+
// if we have any permanent widget, make it visible again
if (m_permanentBarWidget) {
- m_permanentBarWidget->show ();
+ m_stack->setCurrentWidget (m_permanentBarWidget);
} else {
// else: hide the bar
+ m_stack->hide();
setViewBarVisible(false);
}
diff --git a/src/view/kateviewhelpers.h b/src/view/kateviewhelpers.h
index aff4b7f..658f79e 100644
--- a/src/view/kateviewhelpers.h
+++ b/src/view/kateviewhelpers.h
@@ -439,8 +439,7 @@ public:
* OTOH showing/hiding regular barWidgets will work as usual
* (they will be shown above permanent widget)
*
- * If permanent widget already exists, new one replaces old one
- * Old widget is not deleted, caller can do it if it wishes
+ * If permanent widget already exists, asserts!
*/
void addPermanentBarWidget(KateViewBarWidget *barWidget);