summaryrefslogtreecommitdiff
authoribotty <ibotty>2002-10-14 08:54:34 (UTC)
committer ibotty <ibotty>2002-10-14 08:54:34 (UTC)
commit59d6018e53537e15d27cd0174adefba2ec8b8f6e (patch) (side-by-side diff)
tree5f55e9c314b7918b1abf92d2a98561039a499084
parent2c2d282f3d665035300873bddab6e64c843ebc0e (diff)
downloadopie-59d6018e53537e15d27cd0174adefba2ec8b8f6e.zip
opie-59d6018e53537e15d27cd0174adefba2ec8b8f6e.tar.gz
opie-59d6018e53537e15d27cd0174adefba2ec8b8f6e.tar.bz2
added sizeHint method, hopefully (dont really think so) fixes size problem
VS: ----------------------------------------------------------------------
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/emulation_widget.cpp9
-rw-r--r--noncore/apps/opie-console/emulation_widget.h2
-rw-r--r--noncore/apps/opie-console/widget_layer.cpp6
-rw-r--r--noncore/apps/opie-console/widget_layer.h5
4 files changed, 21 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/emulation_widget.cpp b/noncore/apps/opie-console/emulation_widget.cpp
index e11c5e4..40199fa 100644
--- a/noncore/apps/opie-console/emulation_widget.cpp
+++ b/noncore/apps/opie-console/emulation_widget.cpp
@@ -81,24 +81,31 @@ static QChar vt100extended(QChar c)
case 0x2502 : return 25;
case 0x2264 : return 26;
case 0x2265 : return 27;
case 0x03c0 : return 28;
case 0x2260 : return 29;
case 0x00a3 : return 30;
case 0x00b7 : return 31;
}
return c;
}
+QSize EmulationWidget::calcSize( int cols, int lins ) const
+{
+ int frw = width() - contentsRect().width();
+ int frh = height() - contentsRect().height();
+ int scw = (scrollLoc == SCRNONE? 0 : m_scrollbar->width() );
+ return QSize( f_width * cols + 2 * rimX + frw + scw, f_height * lins + 2 * rimY + frh );
+}
void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int columns )
{
const QPixmap* pm = backgroundPixmap();
QPainter paint;
// dont allow updates, while drawing
setUpdatesEnabled( false );
paint.begin( this );
QPoint tL = contentsRect().topLeft();
@@ -108,25 +115,25 @@ void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int c
int cf = -1;
int cb = -1;
int cr = -1;
int lins = QMIN( m_lines, QMAX( 0, lines ) );
int cols = QMIN( m_columns, QMAX( 0, columns ) );
QArray<QChar> disstrU = QArray<QChar>( cols );
for ( int y = 0; y < lins; ++y )
{ int len;
const Character* lcl = &m_image[y * m_columns];
- const Character* ext = &newimg[y * columns];
+ const Character* ext = &newimg[y * m_columns];
if ( ! m_resizing )
for ( int x = 0; x < cols; ++x )
{
// disable, till widget works, WITHOUT blinking
//hasBlinker |= ( ext[x].r & RE_BLINK );
if ( ext[x] != lcl[x] )
{
cr = ext[x].r;
cb = ext[x].b;
if ( ext[x].f != cf ) cf = ext[x].f;
int lln = cols - x;
diff --git a/noncore/apps/opie-console/emulation_widget.h b/noncore/apps/opie-console/emulation_widget.h
index e185534..5e20dc4 100644
--- a/noncore/apps/opie-console/emulation_widget.h
+++ b/noncore/apps/opie-console/emulation_widget.h
@@ -51,24 +51,26 @@ public:
/**
* sets the scrollbar (not yet implemented)
*/
virtual void setScroll( int cursor, int slines );
/**
* scrolls (not yet implemented)
* @param int value, scroll by this value
*/
virtual void scroll( int value );
+ virtual QSize calcSize( int cols, int lins ) const;
+
protected:
/**
* calculates current image bounds
*/
virtual void calcGeometry();
/**
* @param const ColorEntry* table, the new color table
*/
void setColorTable( const ColorEntry table[] );
diff --git a/noncore/apps/opie-console/widget_layer.cpp b/noncore/apps/opie-console/widget_layer.cpp
index e4b0ede..ac84f8b 100644
--- a/noncore/apps/opie-console/widget_layer.cpp
+++ b/noncore/apps/opie-console/widget_layer.cpp
@@ -44,24 +44,30 @@ WidgetLayer::WidgetLayer( const Profile &config, QWidget *parent, const char *na
qApp->installEventFilter( this );
}
WidgetLayer::~WidgetLayer()
{
// clean up
delete m_image;
}
+QSize WidgetLayer::sizeHint()
+{
+ return size();
+}
+
+
/* --------------------------------- audio ---------------------------------- */
void WidgetLayer::bell()
{
QApplication::beep();
}
bool WidgetLayer::eventFilter( QObject *obj, QEvent *e )
{
if ( (e->type() == QEvent::Accel ||
e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) {
static_cast<QKeyEvent *>( e )->ignore();
diff --git a/noncore/apps/opie-console/widget_layer.h b/noncore/apps/opie-console/widget_layer.h
index 0c290f3..6812711 100644
--- a/noncore/apps/opie-console/widget_layer.h
+++ b/noncore/apps/opie-console/widget_layer.h
@@ -114,24 +114,29 @@ public:
* sets the scrollbar (if implemented by successor of this class)
*/
virtual void setScroll( int cursor, int slines ) = 0;
/**
* scrolls (if implemented, by successor of this class)
* @param int value, how much the widget should scroll up (positive value) or down (negative value)
*/
virtual void scroll( int value ) = 0;
virtual bool eventFilter( QObject *obj, QEvent *event );
+
+
+ QSize sizeHint();
+
+ virtual QSize calcSize( int cols, int lins ) const = 0;
signals:
/**
* key was pressed
*/
void keyPressed( QKeyEvent *e );
/**
* whenever Mouse selects something
* @param int button, the button that us pressed :
* 0 left Button
* 3 Button released