summaryrefslogtreecommitdiffabout
path: root/microkde/kdatetbl.cpp
authorzautrix <zautrix>2005-04-30 07:32:03 (UTC)
committer zautrix <zautrix>2005-04-30 07:32:03 (UTC)
commit7c31102a00920834ab8e3778f0f459b96b2fb309 (patch) (side-by-side diff)
tree9f238caaaab4ba150e4f14708d85162af0ea5092 /microkde/kdatetbl.cpp
parentbdaded2da25b0ccef80d6e638fa12f92a4f8744d (diff)
downloadkdepimpi-7c31102a00920834ab8e3778f0f459b96b2fb309.zip
kdepimpi-7c31102a00920834ab8e3778f0f459b96b2fb309.tar.gz
kdepimpi-7c31102a00920834ab8e3778f0f459b96b2fb309.tar.bz2
fixes
Diffstat (limited to 'microkde/kdatetbl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdatetbl.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp
index 2d97c8c..4271b55 100644
--- a/microkde/kdatetbl.cpp
+++ b/microkde/kdatetbl.cpp
@@ -781,18 +781,23 @@ KDateInternalWeekPicker::KDateInternalWeekPicker
int add = 2;
if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
add += 6;
font.setPointSize(fontsize+add);
setFont(font);
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
setFrameStyle(QFrame::NoFrame);
- setNumRows(13);
- setNumCols(4);
+ if ( QApplication::desktop()->height() > 240 ) {
+ setNumRows(13);
+ setNumCols(4);
+ } else {
+ setNumRows(4);
+ setNumCols(13);
+ }
// enable to find drawing failures:
// setTableFlags(Tbl_clipCellPainting);
#if 0
viewport()->setEraseColor(lightGray); // for consistency with the datepicker
#endif
// ----- find the preferred size
// (this is slow, possibly, but unfortunatly it is needed here):
QFontMetrics metrics(font);
@@ -826,27 +831,27 @@ void
KDateInternalWeekPicker::setupPainter(QPainter *p)
{
p->setPen(black);
}
void
KDateInternalWeekPicker::viewportResizeEvent(QResizeEvent*)
{
- setCellWidth(width()/4);
- setCellHeight(height()/13);
+ setCellWidth(width()/ numCols());
+ setCellHeight(height()/ numRows());
}
void
KDateInternalWeekPicker::paintCell(QPainter* painter, int row, int col)
{
int index;
QString text;
// ----- find the number of the cell:
- index=4*row+col+1;
+ index=numCols()*row+col+1;
text=QString::number( index );
painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text);
if ( activeCol == col && activeRow == row )
painter->drawRect( 0, 0, cellWidth(), cellHeight() );
}
void
KDateInternalWeekPicker::contentsMousePressEvent(QMouseEvent *e)
@@ -928,12 +933,12 @@ KDateInternalWeekPicker::contentsMouseReleaseEvent(QMouseEvent *e)
// -----
mouseCoord = e->pos();
row=rowAt(mouseCoord.y());
col=columnAt(mouseCoord.x());
if(row<0 || col<0)
{ // the user clicked on the frame of the table
emit(closeMe(0));
}
- pos=4*row+col+1;
+ pos=numCols()*row+col+1;
result=pos;
emit(closeMe(1));
}