void setupUi(QDialog *ExportToDialog) { if (ExportToDialog->objectName().isEmpty()) ExportToDialog->setObjectName(QString::fromUtf8("ExportToDialog")); ExportToDialog->resize(289, 300); vboxLayout = new QVBoxLayout(ExportToDialog); #ifndef Q_OS_MAC vboxLayout->setSpacing(6); #endif #ifndef Q_OS_MAC vboxLayout->setContentsMargins(9, 9, 9, 9); #endif vboxLayout->setObjectName(QString::fromUtf8("vboxLayout")); label = new QLabel(ExportToDialog); label->setObjectName(QString::fromUtf8("label")); vboxLayout->addWidget(label); formats_listWidget = new QListWidget(ExportToDialog); formats_listWidget->setObjectName(QString::fromUtf8("formats_listWidget")); vboxLayout->addWidget(formats_listWidget); hboxLayout = new QHBoxLayout(); #ifndef Q_OS_MAC hboxLayout->setSpacing(6); #endif hboxLayout->setContentsMargins(0, 0, 0, 0); hboxLayout->setObjectName(QString::fromUtf8("hboxLayout")); spacerItem = new QSpacerItem(131, 31, QSizePolicy::Expanding, QSizePolicy::Minimum); hboxLayout->addItem(spacerItem); okButton = new QPushButton(ExportToDialog); okButton->setObjectName(QString::fromUtf8("okButton")); hboxLayout->addWidget(okButton); cancelButton = new QPushButton(ExportToDialog); cancelButton->setObjectName(QString::fromUtf8("cancelButton")); hboxLayout->addWidget(cancelButton); vboxLayout->addLayout(hboxLayout); retranslateUi(ExportToDialog); QObject::connect(okButton, SIGNAL(clicked()), ExportToDialog, SLOT(accept())); QObject::connect(cancelButton, SIGNAL(clicked()), ExportToDialog, SLOT(reject())); QMetaObject::connectSlotsByName(ExportToDialog); } // setupUi
/** Creates and sets up list widget. * \return Poiter to created list widget. * \sa insertItem() */ QListWidget *OptionsDialog::createListWidget() { QListWidget *listWidget = new QListWidget(this); insertItems(listWidget); listWidget->setObjectName(QString::fromUtf8("listWidget")); listWidget->setMaximumWidth(120); listWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); listWidget->setSelectionBehavior(QAbstractItemView::SelectRows); listWidget->setFlow(QListView::LeftToRight); listWidget->setGridSize(QSize(110, 60)); listWidget->setViewMode(QListView::IconMode); return listWidget; }
void setupUi(QDialog *administracion_Producto) { if (administracion_Producto->objectName().isEmpty()) administracion_Producto->setObjectName(QString::fromUtf8("administracion_Producto")); administracion_Producto->resize(492, 255); layoutWidget = new QWidget(administracion_Producto); layoutWidget->setObjectName(QString::fromUtf8("layoutWidget")); layoutWidget->setGeometry(QRect(80, 40, 349, 161)); gridLayout = new QGridLayout(layoutWidget); gridLayout->setObjectName(QString::fromUtf8("gridLayout")); gridLayout->setContentsMargins(0, 0, 0, 0); list_Producto = new QListWidget(layoutWidget); list_Producto->setObjectName(QString::fromUtf8("list_Producto")); gridLayout->addWidget(list_Producto, 0, 0, 5, 1); Crear_Producto = new QPushButton(layoutWidget); Crear_Producto->setObjectName(QString::fromUtf8("Crear_Producto")); gridLayout->addWidget(Crear_Producto, 0, 1, 1, 1); Actualizar_Producto = new QPushButton(layoutWidget); Actualizar_Producto->setObjectName(QString::fromUtf8("Actualizar_Producto")); gridLayout->addWidget(Actualizar_Producto, 1, 1, 1, 1); Consultar_Producto = new QPushButton(layoutWidget); Consultar_Producto->setObjectName(QString::fromUtf8("Consultar_Producto")); gridLayout->addWidget(Consultar_Producto, 2, 1, 1, 1); Eliminar_Producto = new QPushButton(layoutWidget); Eliminar_Producto->setObjectName(QString::fromUtf8("Eliminar_Producto")); gridLayout->addWidget(Eliminar_Producto, 3, 1, 1, 1); Cancelar_Producto = new QPushButton(layoutWidget); Cancelar_Producto->setObjectName(QString::fromUtf8("Cancelar_Producto")); gridLayout->addWidget(Cancelar_Producto, 4, 1, 1, 1); retranslateUi(administracion_Producto); QMetaObject::connectSlotsByName(administracion_Producto); } // setupUi
bool Configurator::loadSection( QDomNode section ) { // make some checks if( false == section.hasChildNodes() ) return false; if( section.nodeName() != c_sectionNodeName ) return false; QDomNamedNodeMap sectionAttributes = section.attributes(); if( false == sectionAttributes.contains(c_attributeName) ) return false; if( false == sectionAttributes.contains(c_attributeText) ) return false; // we have all the attribbutes for this section, now build it usign GUI controls QString sectionName = sectionAttributes.namedItem(c_attributeName).nodeValue(); QString sectionText = sectionAttributes.namedItem(c_attributeText).nodeValue(); // build the UI QListWidget* listWidget = new QListWidget(); listWidget->setObjectName( sectionName ); listWidget->setSelectionBehavior( QAbstractItemView::SelectRows ); connect( listWidget, SIGNAL (currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT (currentItemChanged(QListWidgetItem*,QListWidgetItem*)) ); _sections->addItem( listWidget, sectionText ); // adding items for this section QDomNode sectionItem = section.firstChild(); while( false == sectionItem.isNull() ) { if( QDomNode::CommentNode != section.nodeType() ) if( false == loadSectionItem(sectionItem,*listWidget) ) return false; sectionItem = sectionItem.nextSibling(); } return true; }
monthly_care_plan(QWidget* parent):QWidget(parent){ if (parent->objectName().isEmpty()){ parent->setObjectName(QString::fromUtf8("monthly_care_plan")); } parent->resize(800, 480); QSplitter splitter(Qt::Horizontal); verticalLayoutWidget = new QWidget(parent); verticalLayoutWidget->setObjectName(QString::fromUtf8("verticalLayoutWidget")); verticalLayoutWidget->setGeometry(QRect(0, 0, 160, 480)); verticalLayoutWidget->setMinimumSize(160,480); verticalLayout = new QVBoxLayout(verticalLayoutWidget); verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); verticalLayout->setContentsMargins(0, 0, 0, 0); care_plan_label = new QLabel(verticalLayoutWidget); care_plan_label->setObjectName(QString::fromUtf8("care_plan_label")); QFont font; font.setPointSize(14); care_plan_label->setFont(font); care_plan_label->setAlignment(Qt::AlignCenter); verticalLayout->addWidget(care_plan_label); human_list = new QListWidget(verticalLayoutWidget); human_list->setObjectName(QString::fromUtf8("human_list")); human_list->setMinimumSize(161,440); human_list->setMouseTracking(false); human_list->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); verticalLayout->addWidget(human_list); human_widget = new one_human(this); human_widget->setGeometry(161, 0, 800-160, 480); this->retranslateUi(parent); QMetaObject::connectSlotsByName(parent); this->setMinimumSize(300,480); }
QWidget* WidgetStyle::createWidget(const QString& name) { if(name == "CheckBox") { QCheckBox* box = new QCheckBox("CheckBox"); box->setObjectName("CheckBox"); return setLayoutWidget({ box }, { 100, 30 }); } else if(name == "ComboBox") { QComboBox* box = new QComboBox; box->addItem("Item1"); box->addItem("Item3"); box->addItem("Item3"); box->setObjectName("ComboBox"); return setLayoutWidget({ box }, { 70, 30 }); } else if(name == "DateEdit") { QDateEdit* date = new QDateEdit; date->setObjectName("DateEdit"); return setLayoutWidget({ date }, { 110, 40 }); } else if(name == "DateTimeEdit") { QDateTimeEdit* date = new QDateTimeEdit; date->setObjectName("DateTimeEdit"); return setLayoutWidget({ date }, { 160, 30 }); } else if(name == "Dialog") { QDialog* dialog = new QDialog; dialog->setObjectName("Dialog"); return setLayoutWidget({ dialog }, { 160, 110 }); } else if(name == "DockWidget") //? { QDockWidget* widget = new QDockWidget; widget->setObjectName("DockWidget"); widget->resize(61, 22); return widget; } else if(name == "DoubleSpinBox") { QDoubleSpinBox* box = new QDoubleSpinBox; box->setObjectName("DoubleSpinBox"); return setLayoutWidget({ box }, { 90, 40 }); } else if(name == "Frame") //?? { QFrame* frame = new QFrame; frame->setObjectName("Frame"); frame->resize(150, 100); return frame; } else if(name == "GroupBox") { QGroupBox* box = new QGroupBox("GroupBox"); box->setObjectName("GroupBox"); return setLayoutWidget({ box }, { 160, 110 }); } else if(name == "Label") { QLabel* label = new QLabel("Label"); label->setObjectName("Label"); return setLayoutWidget({ label }, { 40, 20}); } else if(name == "LineEdit") { QLineEdit* line = new QLineEdit; line->setObjectName("LineEdit"); return setLayoutWidget({ line }, { 30, 30 }); } else if(name == "ListView") //?? { QListView* view = new QListView; view->setObjectName("ListView"); view->resize(71, 71); return view; } else if(name == "ListWidget") { QListWidget* list = new QListWidget; list->setObjectName("ListWidget"); for(int i = 0; i < 20; i++) list->addItem(QString("Item %1").arg(i)); return setLayoutWidget({ list }, { 80, 80 }); } else if(name == "MainWindow") { QMainWindow* window = new QMainWindow; window->setObjectName("MainWindow"); return setLayoutWidget({ window }, { 160, 110 }); } else if(name == "Menu") { QMenu* parentMenu = new QMenu; parentMenu->setObjectName("Menu"); parentMenu->addMenu("Menu1"); QMenu* menu1 = parentMenu->addMenu("Menu2"); menu1->addMenu("Menu1"); menu1->addMenu("Menu2"); parentMenu->addSeparator(); parentMenu->addMenu("Menu3"); return setLayoutWidget({ parentMenu }, { 160, 110 }); } else if(name == "MenuBar") { QMenuBar* bar = new QMenuBar; bar->setObjectName("QMenuBar"); QMenu* menu1 = bar->addMenu("MenuBar1"); menu1->addMenu("Menu1"); menu1->addSeparator(); menu1->addMenu("Menu2"); QMenu* menu2 = bar->addMenu("MenuBar2"); menu2->addMenu("Menu1"); menu2->addSeparator(); menu2->addMenu("Menu2"); QMenu* menu3 = bar->addMenu("MenuBar3"); menu3->addMenu("Menu1"); menu3->addSeparator(); menu3->addMenu("Menu2"); return setLayoutWidget({ bar }, { 280, 60 }); } else if(name == "ProgressBar") { QProgressBar* bar = new QProgressBar; bar->setObjectName("ProgressBar"); bar->setRange(0, 100); bar->setValue(0); QTimer* timer = new QTimer(bar); this->connect(timer, &QTimer::timeout, this, [bar]() { if(bar->value() == 100) bar->setValue(0); else bar->setValue(bar->value() + 1); }); timer->start(100); return setLayoutWidget({ bar }, { 110, 30 }); } else if(name == "PushButton") { QPushButton* button = new QPushButton("PushButton"); button->setObjectName("PushButton"); return setLayoutWidget({ button }, { 125, 30 }); } else if(name == "RadioButton") { QRadioButton* button = new QRadioButton("RadioButton"); button->setObjectName("RadioButton"); return setLayoutWidget({ button }, { 125, 30 }); } else if(name == "ScrollBar") { QScrollBar* barH = new QScrollBar(Qt::Horizontal); QScrollBar* barV = new QScrollBar(Qt::Vertical); barH->setObjectName("ScrollBarH"); barV->setObjectName("ScrollBarV"); return setLayoutWidget({ barH, barV }, { 200, 100 }); } else if(name == "Slider") { QSlider* sliderH = new QSlider(Qt::Horizontal); QSlider* sliderV = new QSlider(Qt::Vertical); sliderH->setObjectName("SliderH"); sliderV->setObjectName("SliderV"); return setLayoutWidget({ sliderH, sliderV }, { 200, 100 }); } else if(name == "SpinBox") { QSpinBox* spinBox = new QSpinBox; spinBox->setObjectName("SpinBox"); return setLayoutWidget({ spinBox }, { 60, 35 }); } else if(name == "Splitter") { QSplitter* splitterV = new QSplitter(Qt::Vertical); QSplitter* splitterH = new QSplitter(Qt::Horizontal); splitterV->setObjectName("SplitterV"); splitterH->setObjectName("SplitterH"); splitterV->addWidget(new QPushButton("PushButton1")); splitterV->addWidget(new QPushButton("PushButton2")); splitterH->addWidget(splitterV); splitterH->addWidget(new QPushButton("PushButton3")); return setLayoutWidget({ splitterH }, { 250, 110 }); } else if(name == "TabWidget") { QTabWidget* tab = new QTabWidget; tab->addTab(new QWidget, "Widget1"); tab->addTab(new QWidget, "Widget2"); tab->addTab(new QWidget, "Widget3"); tab->setObjectName("TabWidget"); return setLayoutWidget({ tab }, { 210, 110 }); } else if(name == "TableView") //? { QTableView* view = new QTableView; view->setObjectName("TableView"); view->resize(200, 100); return view; } else if(name == "TableWidget") { const int n = 100; QStringList list = { "one", "two", "three" }; QTableWidget* table = new QTableWidget(n, n); table->setObjectName("TableWidget"); table->setHorizontalHeaderLabels(list); table->setVerticalHeaderLabels(list); for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) table->setItem(i, j, new QTableWidgetItem(QString("%1, %2").arg(i).arg(j))); return setLayoutWidget({ table }, { 210, 110 }); } else if(name == "TextEdit") { QTextEdit* text = new QTextEdit; text->setObjectName("TextEdit"); return setLayoutWidget({ text }, { 80, 80 }); } else if(name == "TimeEdit") { QTimeEdit* time = new QTimeEdit; time->setObjectName("TimeEdit"); return setLayoutWidget({ time }, { 80, 80 }); } else if(name == "ToolButton") { QToolButton* button = new QToolButton; button->setText("ToolButton"); button->setObjectName("ToolButton"); return setLayoutWidget({ button }, { 95, 25 }); } else if(name == "ToolBox") { QToolBox* box = new QToolBox; box->addItem(new QWidget, "Widget1"); box->addItem(new QWidget, "Widget2"); box->addItem(new QWidget, "Widget3"); box->setObjectName("ToolBox"); return setLayoutWidget({ box }, { 110, 180 }); } else if(name == "TreeView") //? { QTreeView* tree = new QTreeView; tree->setObjectName("TreeView"); tree->resize(200, 100); return tree; } else if(name == "TreeWidget") { QTreeWidget* tree = new QTreeWidget; tree->setObjectName("TreeWidget"); tree->setHeaderLabels({ "Folders", "Used Space" }); QTreeWidgetItem* item = new QTreeWidgetItem(tree); item->setText(0, "Local Disk"); for(int i = 1; i < 20; i++) { QTreeWidgetItem* dir = new QTreeWidgetItem(item); dir->setText(0, "Directory" + QString::number(i)); dir->setText(1, QString::number(i) + "MB"); } tree->setItemExpanded(item, true); return setLayoutWidget({ tree }, { 210, 110 }); } else if(name == "Widget") { QWidget* widget = new QWidget; widget->setObjectName("Widget"); return setLayoutWidget({ widget }, { 210, 110 }); } return nullptr; }
void setupUi(QDialog *MVPPlayerRemoteDialog) { if (MVPPlayerRemoteDialog->objectName().isEmpty()) MVPPlayerRemoteDialog->setObjectName(QStringLiteral("MVPPlayerRemoteDialog")); MVPPlayerRemoteDialog->resize(380, 396); MVPPlayerRemoteDialog->setAcceptDrops(true); verticalLayout_4 = new QVBoxLayout(MVPPlayerRemoteDialog); verticalLayout_4->setObjectName(QStringLiteral("verticalLayout_4")); verticalLayout_2 = new QVBoxLayout(); #ifndef Q_OS_MAC verticalLayout_2->setSpacing(-1); #endif verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2")); verticalLayout_2->setContentsMargins(-1, 0, 0, -1); verticalLayout_3 = new QVBoxLayout(); verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3")); verticalLayout_3->setSizeConstraint(QLayout::SetMinimumSize); horizontalLayout_4 = new QHBoxLayout(); horizontalLayout_4->setObjectName(QStringLiteral("horizontalLayout_4")); horizontalLayout_4->setSizeConstraint(QLayout::SetMinimumSize); sliderVolume = new QSlider(MVPPlayerRemoteDialog); sliderVolume->setObjectName(QStringLiteral("sliderVolume")); QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(sliderVolume->sizePolicy().hasHeightForWidth()); sliderVolume->setSizePolicy(sizePolicy); sliderVolume->setMinimumSize(QSize(0, 0)); sliderVolume->setMaximum(100); sliderVolume->setValue(100); sliderVolume->setOrientation(Qt::Horizontal); horizontalLayout_4->addWidget(sliderVolume); lblVol = new QLabel(MVPPlayerRemoteDialog); lblVol->setObjectName(QStringLiteral("lblVol")); QSizePolicy sizePolicy1(QSizePolicy::Maximum, QSizePolicy::Preferred); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(lblVol->sizePolicy().hasHeightForWidth()); lblVol->setSizePolicy(sizePolicy1); lblVol->setPixmap(QPixmap(QString::fromUtf8(":/mvpplayer/app/icon.png"))); lblVol->setAlignment(Qt::AlignCenter); horizontalLayout_4->addWidget(lblVol); verticalLayout_3->addLayout(horizontalLayout_4); layoutButtonsBar = new QHBoxLayout(); layoutButtonsBar->setObjectName(QStringLiteral("layoutButtonsBar")); btnServer = new QToolButton(MVPPlayerRemoteDialog); btnServer->setObjectName(QStringLiteral("btnServer")); QIcon icon; icon.addFile(QStringLiteral(":/mvpplayer/toolbar/connection.png"), QSize(), QIcon::Normal, QIcon::Off); btnServer->setIcon(icon); btnServer->setIconSize(QSize(32, 32)); btnServer->setCheckable(true); layoutButtonsBar->addWidget(btnServer); verticalLayout_3->addLayout(layoutButtonsBar); verticalLayout_2->addLayout(verticalLayout_3); line_2 = new QFrame(MVPPlayerRemoteDialog); line_2->setObjectName(QStringLiteral("line_2")); line_2->setFrameShape(QFrame::HLine); line_2->setFrameShadow(QFrame::Sunken); verticalLayout_2->addWidget(line_2); cbMute = new QCheckBox(MVPPlayerRemoteDialog); cbMute->setObjectName(QStringLiteral("cbMute")); cbMute->setChecked(true); verticalLayout_2->addWidget(cbMute); verticalLayout = new QVBoxLayout(); verticalLayout->setObjectName(QStringLiteral("verticalLayout")); verticalLayout->setSizeConstraint(QLayout::SetNoConstraint); horizontalLayout_2 = new QHBoxLayout(); horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2")); label = new QLabel(MVPPlayerRemoteDialog); label->setObjectName(QStringLiteral("label")); horizontalLayout_2->addWidget(label); lblCurrentTrack = new QLabel(MVPPlayerRemoteDialog); lblCurrentTrack->setObjectName(QStringLiteral("lblCurrentTrack")); QSizePolicy sizePolicy2(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); sizePolicy2.setHorizontalStretch(0); sizePolicy2.setVerticalStretch(0); sizePolicy2.setHeightForWidth(lblCurrentTrack->sizePolicy().hasHeightForWidth()); lblCurrentTrack->setSizePolicy(sizePolicy2); lblCurrentTrack->setWordWrap(true); horizontalLayout_2->addWidget(lblCurrentTrack); lblTrackLength = new QLabel(MVPPlayerRemoteDialog); lblTrackLength->setObjectName(QStringLiteral("lblTrackLength")); lblTrackLength->setAlignment(Qt::AlignCenter); horizontalLayout_2->addWidget(lblTrackLength); verticalLayout->addLayout(horizontalLayout_2); horizontalLayout_3 = new QHBoxLayout(); horizontalLayout_3->setObjectName(QStringLiteral("horizontalLayout_3")); sliderPosition = new QSlider(MVPPlayerRemoteDialog); sliderPosition->setObjectName(QStringLiteral("sliderPosition")); sliderPosition->setMaximum(100); sliderPosition->setOrientation(Qt::Horizontal); sliderPosition->setInvertedAppearance(false); sliderPosition->setInvertedControls(false); sliderPosition->setTickPosition(QSlider::TicksBelow); sliderPosition->setTickInterval(1); horizontalLayout_3->addWidget(sliderPosition); verticalLayout->addLayout(horizontalLayout_3); horizontalLayout_5 = new QHBoxLayout(); horizontalLayout_5->setObjectName(QStringLiteral("horizontalLayout_5")); btnClearPlaylist = new QToolButton(MVPPlayerRemoteDialog); btnClearPlaylist->setObjectName(QStringLiteral("btnClearPlaylist")); QIcon icon1; icon1.addFile(QStringLiteral(":/mvpplayer/action/cancel.png"), QSize(), QIcon::Normal, QIcon::Off); btnClearPlaylist->setIcon(icon1); horizontalLayout_5->addWidget(btnClearPlaylist); lblPlaylist = new QLabel(MVPPlayerRemoteDialog); lblPlaylist->setObjectName(QStringLiteral("lblPlaylist")); horizontalLayout_5->addWidget(lblPlaylist); verticalLayout->addLayout(horizontalLayout_5); playlist = new QListWidget(MVPPlayerRemoteDialog); playlist->setObjectName(QStringLiteral("playlist")); QSizePolicy sizePolicy3(QSizePolicy::Expanding, QSizePolicy::Maximum); sizePolicy3.setHorizontalStretch(0); sizePolicy3.setVerticalStretch(0); sizePolicy3.setHeightForWidth(playlist->sizePolicy().hasHeightForWidth()); playlist->setSizePolicy(sizePolicy3); playlist->setDragDropMode(QAbstractItemView::DropOnly); verticalLayout->addWidget(playlist); verticalLayout_2->addLayout(verticalLayout); verticalLayout_4->addLayout(verticalLayout_2); QWidget::setTabOrder(cbMute, sliderPosition); QWidget::setTabOrder(sliderPosition, playlist); retranslateUi(MVPPlayerRemoteDialog); QMetaObject::connectSlotsByName(MVPPlayerRemoteDialog); } // setupUi
static QList<QWidget*> getFormWidgets(QList<FormField> formFields, const QObject *receiver) { QList<QWidget*> formWidgets; for (int i = 0; i < formFields.size(); ++i) { Poppler::FormField *formField = formFields.at(i).field; if (formField->type() == Poppler::FormField::FormText) { Poppler::FormFieldText *formFieldText = static_cast<Poppler::FormFieldText*>(formField); switch (formFieldText->textType()) { case Poppler::FormFieldText::FileSelect: { // TODO replace this by a file selection widget QLineEdit *lineEdit = new QLineEdit; lineEdit->setText(formFieldText->text()); lineEdit->setObjectName(QLatin1String("PageItem::formField") + QString::number(i)); QObject::connect(lineEdit, SIGNAL(textEdited(QString)), receiver, SLOT(slotSetFormData(QString))); formWidgets << lineEdit; } break; case Poppler::FormFieldText::Multiline: { QTextEdit *textEdit = new QTextEdit; textEdit->setText(formFieldText->text()); textEdit->setObjectName(QLatin1String("PageItem::formField") + QString::number(i)); QObject::connect(textEdit, SIGNAL(textChanged()), receiver, SLOT(slotSetFormData())); formWidgets << textEdit; } break; case Poppler::FormFieldText::Normal: default: { QLineEdit *lineEdit = new QLineEdit; lineEdit->setText(formFieldText->text()); lineEdit->setObjectName(QLatin1String("PageItem::formField") + QString::number(i)); QObject::connect(lineEdit, SIGNAL(textEdited(QString)), receiver, SLOT(slotSetFormData(QString))); formWidgets << lineEdit; } break; } } else if (formField->type() == Poppler::FormField::FormButton) { Poppler::FormFieldButton *formFieldButton = static_cast<Poppler::FormFieldButton*>(formField); switch (formFieldButton->buttonType()) { case Poppler::FormFieldButton::CheckBox: { QCheckBox *checkBox = new QCheckBox; // checkBox->setText(formFieldButton->caption()); checkBox->setChecked(formFieldButton->state()); checkBox->setObjectName(QLatin1String("PageItem::formField") + QString::number(i)); QObject::connect(checkBox, SIGNAL(toggled(bool)), receiver, SLOT(slotSetFormData(bool))); formWidgets << checkBox; } break; case Poppler::FormFieldButton::Radio: { QRadioButton *radioButton = new QRadioButton; radioButton->setText(formFieldButton->caption()); radioButton->setChecked(formFieldButton->state()); radioButton->setObjectName(QLatin1String("PageItem::formField") + QString::number(i)); QObject::connect(radioButton, SIGNAL(toggled(bool)), receiver, SLOT(slotSetFormData(bool))); formWidgets << radioButton; } break; case Poppler::FormFieldButton::Push: default: { QPushButton *pushButton = new QPushButton; pushButton->setText(formFieldButton->caption()); pushButton->setChecked(formFieldButton->state()); pushButton->setObjectName(QLatin1String("PageItem::formField") + QString::number(i)); QObject::connect(pushButton, SIGNAL(toggled(bool)), receiver, SLOT(slotSetFormData(bool))); formWidgets << pushButton; } break; } } else if (formField->type() == Poppler::FormField::FormChoice) { Poppler::FormFieldChoice *formFieldChoice = static_cast<Poppler::FormFieldChoice*>(formField); switch (formFieldChoice->choiceType()) { case Poppler::FormFieldChoice::ComboBox: { QComboBox *comboBox = new QComboBox; comboBox->addItems(formFieldChoice->choices()); comboBox->setEditable(formFieldChoice->isEditable()); comboBox->setCurrentIndex(formFieldChoice->currentChoices().at(0)); comboBox->setObjectName(QLatin1String("PageItem::formField") + QString::number(i)); QObject::connect(comboBox, SIGNAL(currentIndexChanged(int)), receiver, SLOT(slotSetFormData(int))); formWidgets << comboBox; } break; case Poppler::FormFieldChoice::ListBox: default: { QListWidget *listWidget = new QListWidget; listWidget->addItems(formFieldChoice->choices()); if (formFieldChoice->isEditable()) { for (int j = 0; j < listWidget->count(); ++j) listWidget->item(j)->setFlags(listWidget->item(j)->flags() | Qt::ItemIsEditable); } else { for (int j = 0; j < listWidget->count(); ++j) listWidget->item(j)->setFlags(listWidget->item(j)->flags() & ~Qt::ItemIsEditable); } QList<int> currentChoices = formFieldChoice->currentChoices(); for (int j = 0; j < currentChoices.size(); ++j) listWidget->item(currentChoices.at(j))->setSelected(true); listWidget->setObjectName(QLatin1String("PageItem::formField") + QString::number(i)); QObject::connect(listWidget, SIGNAL(itemSelectionChanged()), receiver, SLOT(slotSetFormData())); formWidgets << listWidget; } break; } } else if (formField->type() == Poppler::FormField::FormSignature) { // TODO formWidgets << new QWidget; } else // make sure that m_formWidgets.at(i) corresponds to m_formFields.at(i) formWidgets << new QWidget; } return formWidgets; }