-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 @@ -159,2 +159,21 @@ 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 ) @@ -187,2 +206,5 @@ void NavigatorBar::resetFont ( QFont fo ) mNextYear->setFixedHeight ( size ); + mCurrentHei = size; + mCurrentMinWid = maxwidth; + mCurrentButtonMinWid = mPrevYear->sizeHint().width()+2; } diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h index 0b2f60b..5d5aff4 100644 --- a/korganizer/navigatorbar.h +++ b/korganizer/navigatorbar.h @@ -42,2 +42,3 @@ class NavigatorBar: public QWidget void resetFont ( QFont fo ); + QSize sizeHint() const; @@ -57,2 +58,5 @@ class NavigatorBar: public QWidget private: + int mCurrentHei; + int mCurrentMinWid; + int mCurrentButtonMinWid; QFrame *mCtrlFrame; |