[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepim] a148b71: In to-do view, set a decent minimum size for the c
From:       Sergio Martins <iamsergio () gmail ! com>
Date:       2011-01-02 10:40:31
Message-ID: 20110102104031.1F49BA6090 () git ! kde ! org
[Download RAW message or body]

commit a148b7186ee6c84b3397b08652755f4a93b9f8df
branch master
Author: Sergio Martins <iamsergio@gmail.com>
Date:   Sun Jan 2 07:38:07 2011 +0000

    In to-do view, set a decent minimum size for the category combo, so that "Select \
Categories" fits.

diff --git a/korganizer/views/todoview/kotodoviewquicksearch.cpp \
b/korganizer/views/todoview/kotodoviewquicksearch.cpp index c7a276e..ea52249 100644
--- a/korganizer/views/todoview/kotodoviewquicksearch.cpp
+++ b/korganizer/views/todoview/kotodoviewquicksearch.cpp
@@ -34,7 +34,7 @@
 #include <calendarsupport/categoryconfig.h>
 #include <calendarsupport/calendar.h>
 
-#include <kcalcore/calfilter.h>
+#include <KCalCore/CalFilter>
 #include <KLineEdit>
 
 #include <QString>
@@ -75,6 +75,19 @@ KOTodoViewQuickSearch::KOTodoViewQuickSearch( \
CalendarSupport::Calendar *calenda  layout->addWidget( mCategoryCombo, 1 );
   fillCategories();
 
+  { // Make the combo big enough so that "Select Categories" fits.
+    QFontMetrics fm = mCategoryCombo->lineEdit()->fontMetrics();
+
+    // QLineEdit::sizeHint() returns a nice size to fit 17 'x' chars.
+    const int currentPreferedWidth = mCategoryCombo->lineEdit()->sizeHint().width();
+
+    // Calculate a nice size for "Select Categories"
+    const int newPreferedWidth = currentPreferedWidth - fm.width( QLatin1Char('x') \
)*17 + fm.width( mCategoryCombo->defaultText() ); +
+    const int pixelsToAdd = newPreferedWidth - mCategoryCombo->lineEdit()->width();
+    mCategoryCombo->setMinimumWidth( mCategoryCombo->width() + pixelsToAdd );
+  }
+
   setLayout( layout );
 }
 
@@ -135,7 +148,6 @@ void KOTodoViewQuickSearch::fillCategories()
 
 void KOTodoViewQuickSearch::emitSearchCategoryChanged()
 {
-
   /* The display role doesn't work because it represents subcategories as " \
                subcategory", and we want
    * "ParentCollection:subCategory" */
   emit searchCategoryChanged( mCategoryCombo->checkedItems( Qt::UserRole ) );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic