From e3e2d5501ef51e13e88f1b596a35983ee2f4e8ec Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Tue, 4 Jul 2017 22:33:38 +0200 Subject: [PATCH] make comboboxes more flexible Change-Id: I39cf3162a06a97a13a28e3bfd2fe7013cc757d3a --- commonlib/templates/labeldlg.cpp | 2 ++ commonlib/templates/office.cpp | 2 ++ src/dialogs/customerdlg.cpp | 8 ++++++++ src/mwin/carttab.cpp | 2 ++ src/mwin/entrancetab.cpp | 2 ++ 5 files changed, 16 insertions(+), 0 deletions(-) diff --git a/commonlib/templates/labeldlg.cpp b/commonlib/templates/labeldlg.cpp index b0a83fb..b24ffca 100644 --- a/commonlib/templates/labeldlg.cpp +++ b/commonlib/templates/labeldlg.cpp @@ -701,6 +701,8 @@ MLabelPrintDialog::MLabelPrintDialog(QPrinter* prn, QWidget* parent, Qt::WindowF QFormLayout*fl; setLayout(fl=new QFormLayout); fl->addRow(tr("Printer:"),mprnselect=new QComboBox); + mprnselect->setMinimumContentsLength(10); + mprnselect->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); int cur=-1,def=-1; for(const QPrinterInfo&info:QPrinterInfo::availablePrinters()){ if(info.printerName()==prn->printerName())cur=mprnselect->count(); diff --git a/commonlib/templates/office.cpp b/commonlib/templates/office.cpp index c82faa0..77daff8 100644 --- a/commonlib/templates/office.cpp +++ b/commonlib/templates/office.cpp @@ -144,6 +144,8 @@ MOfficeConfig::MOfficeConfig(QWidget*par) hl->addWidget(new QLabel(tr("Printer:"))); hl->addWidget(printer=new QComboBox,1); printer->setEditable(false); + printer->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); + printer->setMinimumContentsLength(10); printer->addItem(tr("(Default Printer)")); QListaprn=QPrinterInfo::availablePrinters(); int cprn=0; diff --git a/src/dialogs/customerdlg.cpp b/src/dialogs/customerdlg.cpp index 272d72a..c6ee8e9 100644 --- a/src/dialogs/customerdlg.cpp +++ b/src/dialogs/customerdlg.cpp @@ -946,6 +946,8 @@ MNewCustomerWizard::MNewCustomerWizard(QWidget* parent, Qt::WindowFlags f): QDia gl->addLayout(hl=new QHBoxLayout,row,1); hl->addWidget(m_title=new QComboBox,1); m_title->setEditable(true); + m_title->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); + m_title->setMinimumContentsLength(8); m_title->lineEdit()->setPlaceholderText(tr("Title")); for(const QString&tt:titles)m_title->addItem(tt); hl->addWidget(m_name=new QLineEdit,2); @@ -961,16 +963,22 @@ MNewCustomerWizard::MNewCustomerWizard(QWidget* parent, Qt::WindowFlags f): QDia m_zipcode->setPlaceholderText(tr("Zip Code")); hl->addWidget(m_city=new QComboBox,1); m_city->setEditable(true); + m_city->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); + m_city->setMinimumContentsLength(5); m_city->lineEdit()->setPlaceholderText(tr("Chose City")); for(const QString&ct:cities)m_city->addItem(ct); gl->addWidget(new QLabel(tr("State:")),++row,0); gl->addWidget(m_state=new QComboBox,row,1); m_state->setEditable(true); + m_state->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); + m_state->setMinimumContentsLength(8); m_state->lineEdit()->setPlaceholderText(tr("State (optional)")); for(const QString&st:states)m_state->addItem(st); gl->addWidget(new QLabel(tr("Country:")),++row,0); gl->addLayout(hl=new QHBoxLayout,row,1); hl->addWidget(m_country=new QComboBox,1); + m_country->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); + m_country->setMinimumContentsLength(10); updateCountry(); if(req->hasRight(req->RCreateCountry)){ hl->addWidget(p=new QPushButton(tr("New..."))); diff --git a/src/mwin/carttab.cpp b/src/mwin/carttab.cpp index e1bda4e..26e08e4 100644 --- a/src/mwin/carttab.cpp +++ b/src/mwin/carttab.cpp @@ -130,6 +130,8 @@ MCartTab::MCartTab(QString pk) vl2->addWidget(new QLabel(tr("Shipping Method:")),0); vl2->addWidget(cartship=new QComboBox,0); cartship->setEditable(false); + cartship->setMinimumContentsLength(15); + cartship->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); connect(cartship,SIGNAL(currentIndexChanged(int)),this,SLOT(updatePrice())); vl2->addSpacing(10); vl2->addWidget(new QLabel(tr("Comments:")),0); diff --git a/src/mwin/entrancetab.cpp b/src/mwin/entrancetab.cpp index 0b96f48..8eeba78 100644 --- a/src/mwin/entrancetab.cpp +++ b/src/mwin/entrancetab.cpp @@ -44,6 +44,8 @@ MEntranceTab::MEntranceTab(QString pk) setLayout(vl=new QVBoxLayout); vl->addWidget(entranceevent=new QComboBox,0); entranceevent->setEditable(false); + entranceevent->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); + entranceevent->setMinimumContentsLength(20); vl->addSpacing(30); vl->addWidget(new QLabel(tr("Enter or scan Ticket-ID:")),0); vl->addWidget(entrancescan=new MBarcodeLine,0); -- 1.7.2.5