From 8e836914e6cdd605d6f94ba55b838833c16ee09b Mon Sep 17 00:00:00 2001 From: Waldo Bastian Date: Mon, 3 Jan 2000 12:07:49 +0000 Subject: [PATCH] WABA: Fixed resizing (how about changing between 80 <--> 132 cols?) svn path=/trunk/kdebase/konsole/; revision=37491 --- src/TEWidget.C | 10 ++++++++-- src/main.C | 13 ++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/TEWidget.C b/src/TEWidget.C index 465a3990..e1ef1ede 100644 --- a/src/TEWidget.C +++ b/src/TEWidget.C @@ -911,13 +911,19 @@ void TEWidget::makeImage() } // calculate the needed size -QSize TEWidget::calcSize(int cols, int lins) -{ int frw = width() - contentsRect().width(); +QSize TEWidget::calcSize(int cols, int lins) const +{ + int frw = width() - contentsRect().width(); int frh = height() - contentsRect().height(); int scw = (scrollLoc==SCRNONE?0:scrollbar->width()); return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh ); } +QSize TEWidget::sizeHint() const +{ + return size(); +} + void TEWidget::styleChange(QStyle &) { propagateSize(); diff --git a/src/main.C b/src/main.C index 4d70f99e..a5584899 100644 --- a/src/main.C +++ b/src/main.C @@ -104,7 +104,6 @@ TEDemo::TEDemo(const QString& name, QStrList & _args, int login_shell) : KTMainW se = 0L; rootxpm = 0L; menubar = menuBar(); - setMinimumSize(200,100); // session management @@ -171,8 +170,11 @@ TEDemo::TEDemo(const QString& name, QStrList & _args, int login_shell) : KTMainW // activate and run first session ////////////////////////////////////////// - runSession(initial); + // WABA: Make sure all the xxxBars are in place so that + // we can resize our mainWidget to its target size. + updateRects(); + runSession(initial); } /*! @@ -190,14 +192,15 @@ void TEDemo::setColLin(int columns, int lines) defaultSize = te->calcSize(80,24); notifySize(24,80); // set menu items (strange arg order !) } - resize(defaultSize); + te->resize(defaultSize); } else { - resize(te->calcSize(columns,lines)); + QSize size = te->calcSize(columns, lines); + te->resize(size); notifySize(lines,columns); // set menu items (strange arg order !) } - updateRects(); + adjustSize(); } TEDemo::~TEDemo()