author | zautrix <zautrix> | 2005-03-21 09:40:04 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-21 09:40:04 (UTC) |
commit | fd372d97084c401aacb999e89f8bdd94056a3b59 (patch) (side-by-side diff) | |
tree | 8443519b847537711d6b423ef903ca132410a682 | |
parent | cd02f3880c5567a4bbb7b56e7034787005df7da8 (diff) | |
download | kdepimpi-fd372d97084c401aacb999e89f8bdd94056a3b59.zip kdepimpi-fd372d97084c401aacb999e89f8bdd94056a3b59.tar.gz kdepimpi-fd372d97084c401aacb999e89f8bdd94056a3b59.tar.bz2 |
layout fix
-rw-r--r-- | korganizer/navigatorbar.cpp | 22 | ||||
-rw-r--r-- | korganizer/navigatorbar.h | 4 |
2 files changed, 26 insertions, 0 deletions
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 4a51bba..e4abbf7 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp @@ -152,16 +152,35 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam mSelectMonth->setFocusPolicy(NoFocus); setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); } NavigatorBar::~NavigatorBar() { } +QSize NavigatorBar::sizeHint() const +{ + int wid = mCurrentMinWid ; + if ( mPrevYear->isVisible() ) + wid += mCurrentButtonMinWid; + if ( mPrevMonth->isVisible() ) + wid += mCurrentButtonMinWid; + if ( mPrevWeek->isVisible() ) + wid += mCurrentButtonMinWid; + if ( mNextMonth->isVisible() ) + wid += mCurrentButtonMinWid; + if ( mNextWeek->isVisible() ) + wid += mCurrentButtonMinWid; + if ( mNextYear->isVisible() ) + wid += mCurrentButtonMinWid; + //qDebug("ret %d %d ", wid, mCurrentHei); + int add = 2; + return QSize ( wid+add, mCurrentHei+add ); +} void NavigatorBar::resetFont ( QFont fo ) { QFont tfont = fo; if ( QApplication::desktop()->width() >= 480 ) tfont.setPointSize(tfont.pointSize()+2); tfont.setBold(true); @@ -180,16 +199,19 @@ void NavigatorBar::resetFont ( QFont fo ) mSelectMonth->setMinimumWidth( maxwidth ); mSelectMonth->setFixedHeight( size ); mPrevYear->setFixedHeight( size ); mPrevMonth->setFixedHeight( size ); mPrevWeek->setFixedHeight( size ); mNextMonth->setFixedHeight( size ); mNextWeek->setFixedHeight( size ); mNextYear->setFixedHeight ( size ); + mCurrentHei = size; + mCurrentMinWid = maxwidth; + mCurrentButtonMinWid = mPrevYear->sizeHint().width()+2; } void NavigatorBar::showButtons( bool left, bool right ) { if ( left ) { mPrevYear->show(); mPrevMonth->show(); } else { diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h index 0b2f60b..5d5aff4 100644 --- a/korganizer/navigatorbar.h +++ b/korganizer/navigatorbar.h @@ -35,31 +35,35 @@ class QLabel; class NavigatorBar: public QWidget { Q_OBJECT public: NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 ); ~NavigatorBar(); void showButtons( bool left, bool right ); void resetFont ( QFont fo ); + QSize sizeHint() const; public slots: void selectDates( const KCal::DateList & ); void selectMonth(); signals: void goNextMonth(); void goPrevMonth(); void goNextWeek(); void goPrevWeek(); void goNextYear(); void goPrevYear(); void monthSelected( int ); private: + int mCurrentHei; + int mCurrentMinWid; + int mCurrentButtonMinWid; QFrame *mCtrlFrame; QPushButton *mPrevYear; QPushButton *mPrevMonth; QPushButton *mNextMonth; QPushButton *mPrevWeek; QPushButton *mNextWeek; QPushButton *mNextYear; |