Commit 3425d290 authored by Laurent Montel's avatar Laurent Montel 😁

Minor optimization

parent 86f23452
......@@ -238,8 +238,7 @@ CompletionOrderWidget::CompletionOrderWidget(QWidget *parent)
new CompletionOrderEditorAdaptor(this);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/"), this, QDBusConnection::ExportAdaptors);
QHBoxLayout *hbox = new QHBoxLayout;
setLayout(hbox);
QHBoxLayout *hbox = new QHBoxLayout(this);
QWidget *page = new QWidget(this);
QHBoxLayout *pageHBoxLayout = new QHBoxLayout(page);
......
......@@ -83,7 +83,7 @@ RecentAddressWidget::~RecentAddressWidget()
void RecentAddressWidget::slotTypedSomething(const QString &text)
{
if (mListView->currentItem()) {
if (mListView->currentItem()->text() != mLineEdit->text() && !mLineEdit->text().isEmpty()) {
if (!mLineEdit->text().isEmpty() && mListView->currentItem()->text() != mLineEdit->text()) {
// IMHO changeItem() shouldn't do anything with the value
// of currentItem() ... like changing it or emitting signals ...
// but TT disagree with me on this one (it's been that way since ages ... grrr)
......@@ -136,8 +136,9 @@ void RecentAddressWidget::updateButtonState()
QList<QListWidgetItem *> selectedItems = mListView->selectedItems();
const int numberOfElementSelected(selectedItems.count());
mRemoveButton->setEnabled(numberOfElementSelected);
mNewButton->setEnabled(numberOfElementSelected <= 1);
mLineEdit->setEnabled(numberOfElementSelected <= 1);
bool enableElement = (numberOfElementSelected <= 1);
mNewButton->setEnabled(enableElement);
mLineEdit->setEnabled(enableElement);
if (numberOfElementSelected == 1) {
const QString text = mListView->currentItem()->text();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment