make comboboxes more flexible
authorKonrad Rosenbaum <konrad@silmor.de>
Tue, 4 Jul 2017 20:33:38 +0000 (22:33 +0200)
committerKonrad Rosenbaum <konrad@silmor.de>
Wed, 5 Jul 2017 21:20:24 +0000 (23:20 +0200)
Change-Id: I39cf3162a06a97a13a28e3bfd2fe7013cc757d3a

commonlib/templates/labeldlg.cpp
commonlib/templates/office.cpp
src/dialogs/customerdlg.cpp
src/mwin/carttab.cpp
src/mwin/entrancetab.cpp

index b0a83fb..b24ffca 100644 (file)
@@ -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();
index c82faa0..77daff8 100644 (file)
@@ -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)"));
        QList<QPrinterInfo>aprn=QPrinterInfo::availablePrinters();
        int cprn=0;
index 272d72a..c6ee8e9 100644 (file)
@@ -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...")));
index e1bda4e..26e08e4 100644 (file)
@@ -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);
index 0b96f48..8eeba78 100644 (file)
@@ -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);