summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebookdayallday.cpp23
-rw-r--r--core/pim/datebook/datebookdayallday.h4
2 files changed, 18 insertions, 9 deletions
diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp
index 985f31a..6014eca 100644
--- a/core/pim/datebook/datebookdayallday.cpp
+++ b/core/pim/datebook/datebookdayallday.cpp
@@ -26,20 +26,27 @@
#include "datebookday.h"
/*
* Constructs a DatebookdayAllday which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
-DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const char* name, WFlags fl )
- : QWidget( parent, name,fl ),item_count(0),dateBook(db)
+DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const char* name, WFlags )
+ : QScrollView( parent, name ),item_count(0),dateBook(db)
{
if ( !name )
setName( "DatebookdayAllday" );
setMinimumSize( QSize( 0, 0 ) );
+ setMaximumHeight(3* (QFontMetrics(font()).height()+4) );
- datebookdayalldayLayout = new QVBoxLayout( this );
+ m_MainFrame = new QFrame(viewport());
+ m_MainFrame->setFrameStyle(QFrame::NoFrame|QFrame::Plain);
+ setFrameStyle(QFrame::NoFrame|QFrame::Plain);
+ setResizePolicy( QScrollView::AutoOneFit );
+ addChild(m_MainFrame);
+
+ datebookdayalldayLayout = new QVBoxLayout( m_MainFrame );
datebookdayalldayLayout->setSpacing( 0 );
datebookdayalldayLayout->setMargin( 0 );
lblDesc = new DatebookEventDesc(parent->parentWidget(),"");
lblDesc->setBackgroundColor(Qt::yellow);
lblDesc->hide();
@@ -54,13 +61,13 @@ DatebookdayAllday::~DatebookdayAllday()
// no need to delete child widgets, Qt does it all for us
}
DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev)
{
DatebookAlldayDisp * lb;
- lb = new DatebookAlldayDisp(dateBook,ev,this,NULL);
+ lb = new DatebookAlldayDisp(dateBook,ev,m_MainFrame,NULL);
datebookdayalldayLayout->addWidget(lb);
subWidgets.append(lb);
connect(lb,SIGNAL(displayMe(const Event &)),lblDesc,SLOT(disp_event(const Event&)));
++item_count;
@@ -79,15 +86,16 @@ DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev,
{
QString strDesc = m_Ev.description();
strDesc = strDesc.replace(QRegExp("<"),"&#60;");
setBackgroundColor(yellow);
setText(strDesc);
setFrameStyle(QFrame::Raised|QFrame::Panel);
- QSize s = sizeHint();
- setMaximumSize( QSize( 32767, s.height()-4 ) );
- setMinimumSize( QSize( 0, s.height()-4 ) );
+
+ int s = QFontMetrics(font()).height()+4;
+ setMaximumHeight( s );
+ setMinimumSize( QSize( 0, s ) );
}
DatebookAlldayDisp::~DatebookAlldayDisp()
{
}
@@ -220,7 +228,6 @@ void DatebookEventDesc::disp_event(const Event&e)
resize(s);
move( QMAX(0,(parentWidget()->width()-width()) / 2),
(parentWidget()->height()-height())/2 );
show();
m_Timer->start(2000,true);
}
-
diff --git a/core/pim/datebook/datebookdayallday.h b/core/pim/datebook/datebookdayallday.h
index c781785..f5867e5 100644
--- a/core/pim/datebook/datebookdayallday.h
+++ b/core/pim/datebook/datebookdayallday.h
@@ -1,23 +1,24 @@
#ifndef DATEBOOKDAYALLDAYBASE_H
#define DATEBOOKDAYALLDAYBASE_H
#include <qvariant.h>
#include <qframe.h>
+#include <qscrollview.h>
#include <qlabel.h>
#include <qlist.h>
#include <qpe/event.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class DatebookAlldayDisp;
class DatebookEventDesc;
class DateBookDB;
-class DatebookdayAllday : public QWidget
+class DatebookdayAllday : public QScrollView
{
Q_OBJECT
public:
DatebookdayAllday(DateBookDB* db,
QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
@@ -26,12 +27,13 @@ public:
const unsigned int items()const{return item_count;}
public slots:
void removeAllEvents();
protected:
+ QFrame * m_MainFrame;
QVBoxLayout* datebookdayalldayLayout;
DatebookEventDesc * lblDesc;
unsigned int item_count;
QList<DatebookAlldayDisp> subWidgets;
DateBookDB *dateBook;
};