Well, here's the following, apply the fusion style in my app, and unlock the options in my compbobox if they are disproportionate in vertical format, when you click on the same, my preset options are:
It is possible to change the appearance of the coombo box, so that it appears that it is true without applying the fusion style.
#pragma once
#include <QMap>
namespace SW {
enum OpenMode{
NEW,
EDIT
};
enum FormMode{
CLIENT,
DRIVER,
PROVIDER
};
enum Services{
PRODUCT,
SERVICE
};
enum DocumentType{
FACTURA,
BOLETA,
N_CREDITO,
N_DEBITO,
G_REMISION,
BAJAS
};
struct Helper
{
explicit Helper() = delete;
static const QMap<QString, QString>& getUnits() { return units_;}
private:
inline static const QMap<QString, QString>units_{
{"4A", "BOBINAS 4A"},
{"BJ", "BALDE BJ"},
{"BLL", "BARRILES BLL"},
{"BG", "BOLSA BG"},
{"BO", "BOTELLAS BO"},
{"BX", "CAJAS"},
{"CT", "CARTONES CT"},
{"CMK", "CENTIMETRO CUADRADO CMK"},
{"CMQ", "CENTIMETRO CUBICO CMQ"},
{"CMT", "CENTIMETRO LINEAL CMT"},
{"CEN", "CIENTO DE UNIDADES CEN"},
{"CY", "CILINDRO CY"},
{"CJ", "CONOS CJ"},
{"DZN", "DOCENA DZN"},
{"DZP", "DOCENA POR 10**6 DZP"},
{"BE", "FARDO BE"},
{"GLI", "GALON INGLES (4,545956L) GLI"},
{"GRO", "GRUESA GRO"},
{"HLT", "HECTOLITRO HLT"},
{"LEF", "HOJA LEF"},
{"SET", "JUEGO SET"},
{"KGM", "KILOGRAMO KGM"},
{"KTM", "KILOMETRO KTM"},
{"KWH", "KILOVATIO HORA KWH"},
{"KT", "KIT KT"},
{"CA", "LATAS CA"},
{"LBR", "LIBRAS LBR"},
{"LTR", "LITRO LTR"},
{"MWH", "MEGAWATT HORA MWH"},
{"MTR", "METRO MTR"},
{"MTK", "METRO CUADRADO MTK"},
{"MTQ", "METRO CUBICO MTQ"},
{"MGM", "MILIGRAMOS MGM"},
{"MLT", "MILILITRO MLT"},
{"MMT", "MILIMETRO MMT"},
{"MMK", "MILIMETRO CUADRADO MMK"},
{"MMQ", "MILIMETRO CUBICO MMQ"},
{"MIL", "MILLARES MIL"},
{"UM", "MILLON DE UNIDADES UM"},
{"ONZ", "ONZAS ONZ"},
{"PF", "PALETAS PF"},
{"PK", "PAQUETE PK"},
{"PR", "PAR PR"},
{"FOT", "PIES FOT"},
{"FTK", "PIES CUADRADOS FTK"},
{"FTQ", "PIES CUBICOS FTQ"},
{"C62", "PIEZAS C62"},
{"PG", "PLACAS PG"},
{"ST", "PLIEGO ST"},
{"INH", "PULGADAS INH"},
{"RM", "RESMA RM"},
{"DR", "TAMBOR DR"},
{"STN", "TONELADA CORTA STN"},
{"LTN", "TONELADA LARGA LTN"},
{"TNE", "TONELADAS TNE"},
{"TU", "TUBOS TU"},
{"NIU", "UNIDAD (BIENES) NIU"},
{"ZZ", "UNIDAD (SERVICIOS) ZZ"},
{"GLL", "US GALON (3,7843 L) GLL"},
{"YRD", "YARDA YRD"},
{"YDK", "YARDA CUADRADA YDK"},
};
};
} // namespace SW
#pragma once
#include <QDialog>
#include "util/helper.hpp"
namespace Ui { class ComprobanteDialog; }
class ComprobanteDialog : public QDialog
{
Q_OBJECT
public:
explicit ComprobanteDialog(SW::DocumentType docType, QWidget *parent = nullptr);
~ComprobanteDialog();
private:
Ui::ComprobanteDialog *ui;
void setLabelText(const QString text) const;
void loadDataToUnitsCombobox() const;
};
#include "comprobantedialog.hpp"
#include "ui_comprobantedialog.h"
#include "header.hpp"
#include "notasframe.hpp"
ComprobanteDialog::ComprobanteDialog(SW::DocumentType docType, QWidget *parent)
: QDialog(parent), ui(new Ui::ComprobanteDialog)
{
ui->setupUi(this);
setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint);
loadDataToUnitsCombobox();
if(docType == SW::FACTURA || docType == SW::BOLETA){
Header *header = new Header(this);
ui->headerLayout->addWidget(header);
(docType == SW::FACTURA) ? setLabelText("Factura") : setLabelText("Boleta");
}
if(docType == SW::N_CREDITO || docType == SW::N_DEBITO){
NotasFrame *frame = new NotasFrame(this);
ui->headerLayout->addWidget(frame);
(docType == SW::N_CREDITO) ? setLabelText("N. Crédito") : setLabelText("N. Débito");
ui->TipoLbl->setText("Motivo:");
ui->vencimientoDe->setVisible(false);
ui->vencimientoLbl->setVisible(false);
}
}
ComprobanteDialog::~ComprobanteDialog()
{
delete ui;
}
void ComprobanteDialog::setLabelText(const QString text) const{
const auto labelText =QString("<html><head/><body><p><span style=\" font-weight:700;\">%1 N</span>"
"<span style=\" font-weight:700;\"><sup>o</sup></span>"
"</p><p><br/></p></body></html>").arg(text);
ui->label->setText(labelText);
}
void ComprobanteDialog::loadDataToUnitsCombobox() const{
const auto& units = SW::Helper::getUnits();
for (auto iter = units.cbegin(); iter != units.cend(); ++iter) {
ui->unidadesCbo->addItem(iter.value(), iter.key());
}
}
[image: f6ba01b5-b76c-4a64-8e36-ece0804d97d7.png]
If this is the case, it should be recommended that this is the normal way to follow the fusion style.