[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenonbeta/krecipes/src/dialogs
From: Jason Kivlighn <confederacy2 () excite ! com>
Date: 2004-02-02 3:41:30
Message-ID: 20040202034130.7AAAB9961 () office ! kde ! org
[Download RAW message or body]
CVS commit by jkivlighn:
This corrects some odd behavior from the edit box for inputting the amount for \
ingredient properties. 1) The edit box now scrolls with the rest of the content, \
instead of being left behind and 2) When the listview changes items or the property \
list is reloaded (i.e. after a different ingredient is selected), the edit box is \
hidden.
Also, a minor touchup on the UI, the ingredientListView uses one more row in the \
layout (due to adding the "Load USDA Data" button).
M +22 -10 ingredientsdialog.cpp 1.47
--- kdenonbeta/krecipes/src/dialogs/ingredientsdialog.cpp #1.46:1.47
@@ -20,9 +20,11 @@
#include "selectpropertydialog.h"
#include "selectunitdialog.h"
+#include "dependanciesdialog.h"
+
+#include <kdebug.h>
+#include <klocale.h>
#include <qheader.h>
#include <qmessagebox.h>
-#include "dependanciesdialog.h"
-#include <klocale.h>
IngredientsDialog::IngredientsDialog(QWidget* parent, RecipeDB *db):QWidget(parent)
@@ -46,5 +48,5 @@ IngredientsDialog::IngredientsDialog(QWi
ingredientListView=new KreListView (this,i18n("Ingredient list"));
ingredientListView->listView()->setAllColumnsShowFocus(true);
- layout->addMultiCellWidget (ingredientListView,1,9,1,1);
+ layout->addMultiCellWidget (ingredientListView,1,10,1,1);
ingredientListView->listView()->addColumn(i18n("Id"));
ingredientListView->listView()->addColumn(i18n("Ingredient"));
@@ -151,5 +153,6 @@ IngredientsDialog::IngredientsDialog(QWi
layout->addItem(spacer_Prop_Buttons,7,7);
- inputBox=new EditBox(this);
+ inputBox=new EditBox(propertiesListView->listView()->viewport());
+ propertiesListView->listView()->addChild(inputBox);
inputBox->hide();
@@ -170,4 +173,5 @@ IngredientsDialog::IngredientsDialog(QWi
connect(removePropertyButton,SIGNAL(clicked()),this,SLOT(removePropertyFromIngredient()));
connect(propertiesListView->listView(),SIGNAL(executed(QListViewItem*)),this,SLOT(insertPropertyEditBox(QListViewItem*)));
+ connect(propertiesListView->listView(),SIGNAL(selectionChanged()),inputBox,SLOT(hide()));
connect(inputBox,SIGNAL(valueChanged(double)),this,SLOT(setPropertyAmount(double)));
connect(loadUsdaButton,SIGNAL(clicked()),this,SLOT(openUSDADialog()));
@@ -352,4 +356,6 @@ propertiesListView->listView()->clear();
perUnitListBack->clear();
+inputBox->hide();
+
//If none is selected, select first item
@@ -439,15 +445,19 @@ void IngredientsDialog::insertPropertyEd
{
-QRect r;
+QRect r = propertiesListView->listView()->header()->sectionRect(2);
-r=propertiesListView->listView()->header()->sectionRect(2); //Set in position \
reference to qlistview, and with the column size(); \
+//r=propertiesListView->listView()->header()->sectionRect(2); //Set in position \
reference to qlistview, and with the column size();
-r.moveBy(propertiesListView->x(),propertiesListView->y()); // Move to the position \
of the KreListView +//r.moveBy(propertiesListView->x(),propertiesListView->y()); // \
Move to the position of the KreListView
-r.moveBy(propertiesListView->listView()->pos().x(),propertiesListView->listView()->pos().y()); \
// Move to the position of KListView
-r.moveBy(propertiesListView->listView()->header()->x(),propertiesListView->listView()->header()->y()); \
// Move to the position of the KListView Header \
+//r.moveBy(propertiesListView->listView()->pos().x(),propertiesListView->listView()->pos().y()); \
// Move to the position of KListView \
+//r.moveBy(propertiesListView->listView()->header()->x(),propertiesListView->listView()->header()->y()); \
// Move to the position of the KListView Header
-r.moveBy(0,r.height()+propertiesListView->listView()->itemRect(it).y()); //Move down \
to the item, note that its height is same as header's right now. \
+//r.moveBy(propertiesListView->listView()->viewport()->x(),propertiesListView->listView()->viewport()->y()); \
// Move to the position of the KListView viewport +
+//r.moveBy(propertiesListView->listView()->header()->sectionRect(2).x(),0);
+
+r.moveBy(0,propertiesListView->listView()->itemRect(it).y()); //Move down to the \
item, note that its height is same as header's right now.
r.setHeight(it->height()); // Set the item's height
@@ -456,4 +466,6 @@ r.setHeight(it->height()); // Set the it
inputBox->setGeometry(r);
+
+inputBox->setValue( it->text(2).toDouble() );
inputBox->show();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic