-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 @@ -158,4 +158,23 @@ 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 ) { @@ -186,4 +205,7 @@ void NavigatorBar::resetFont ( QFont fo ) mNextWeek->setFixedHeight( size ); 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 @@ -41,4 +41,5 @@ class NavigatorBar: public QWidget void showButtons( bool left, bool right ); void resetFont ( QFont fo ); + QSize sizeHint() const; public slots: @@ -56,4 +57,7 @@ class NavigatorBar: public QWidget private: + int mCurrentHei; + int mCurrentMinWid; + int mCurrentButtonMinWid; QFrame *mCtrlFrame; |