summaryrefslogtreecommitdiff
authorzecke <zecke>2003-08-30 08:07:32 (UTC)
committer zecke <zecke>2003-08-30 08:07:32 (UTC)
commitd9b5fcc45b1fef5ac11ef549a47561c7382ff451 (patch) (side-by-side diff)
tree8f9e82d455e22be0285a5a8fc47e893b52c05871
parent18cae99f1deb15213074a8fb96f79eae4b0c5a43 (diff)
downloadopie-d9b5fcc45b1fef5ac11ef549a47561c7382ff451.zip
opie-d9b5fcc45b1fef5ac11ef549a47561c7382ff451.tar.gz
opie-d9b5fcc45b1fef5ac11ef549a47561c7382ff451.tar.bz2
do not rely on scrollbars beeing right
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookweek.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp
index ab7e963..dad1c3f 100644
--- a/core/pim/datebook/datebookweek.cpp
+++ b/core/pim/datebook/datebookweek.cpp
@@ -284,67 +284,68 @@ void DateBookWeekView::drawContents( QPainter *p, int cx, int cy, int cw, int ch
s = "";
s += QString::number( t - 12 ) + tr("p");
} else {
if ( 12 - t < 3 )
s = "";
else
s = " ";
s += QString::number( t );
}
} else {
s = QString::number( t );
if ( s.length() == 1 )
s.prepend( "0" );
}
p->drawText( 1, y+p->fontMetrics().ascent()+1, s );
}
}
QListIterator<DateBookWeekItem> it(items);
for ( ; it.current(); ++it ) {
DateBookWeekItem *i = it.current();
if ( i->geometry().intersects( ur ) ) {
p->setBrush( i->color() );
p->drawRect( i->geometry() );
}
}
}
void DateBookWeekView::resizeEvent( QResizeEvent *e )
{
const int hourWidth = 20;
QScrollView::resizeEvent( e );
- int avail = width()-qApp->style().scrollBarExtent().width()-1;
- header->setGeometry( 0, 0, avail, header->sizeHint().height() );
- setMargins( 0, header->height(), 0, 0 );
+ int avail = visibleWidth();
+ header->setGeometry( leftMargin()+frameWidth()+frameRect().left() , frameWidth(),
+ visibleWidth(), header->sizeHint().height() );
+ setMargins( 0, header->sizeHint().height(), 0, 0 );
header->resizeSection( 0, hourWidth );
int sw = (avail - hourWidth) / 7;
for ( int i = 1; i < 7; i++ )
header->resizeSection( i, sw );
header->resizeSection( 7, avail - hourWidth - sw*6 );
}
void DateBookWeekView::setStartOfWeek( bool bStartOnMonday )
{
bOnMonday = bStartOnMonday;
initNames();
}
//-------------------------------------------------------------------
DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB,
QWidget *parent, const char *name )
: QWidget( parent, name ),
db( newDB ),
startTime( 0 ),
ampm( ap ),
bStartOnMonday( startOnMonday )
{
setFocusPolicy(StrongFocus);
QVBoxLayout *vb = new QVBoxLayout( this );
header = new DateBookWeekHeader( bStartOnMonday, this );
view = new DateBookWeekView( ampm, startOnMonday, this );
vb->addWidget( header );
vb->addWidget( view );
lblDesc = new QLabel( this, "event label" );
lblDesc->setFrameStyle( QFrame::Plain | QFrame::Box );