Exemplo n.º 1
0
void VSCMainWindows::CreateDockWindows()
{
    QDockWidget *pDockDevicelist = new QDockWidget(tr("Devices"), this);
    //QDockWidget *pDockDevicelist = new QDockWidget(this);
    pDockDevicelist->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);

#if 1
    //pDockDevicelist->setWidget(new VSCDeviceList(pDockDevicelist));
    m_pDeviceList = new VSCDeviceList(pDockDevicelist);
    pDockDevicelist->setWidget(m_pDeviceList);
#else
    QListWidget * customerList = new QListWidget(pDockDevicelist);
    customerList->addItems(QStringList()
            << "John Doe, Harmony Enterprises, 12 Lakeside, Ambleton"
            << "Jane Doe, Memorabilia, 23 Watersedge, Beaton"
            << "Tammy Shea, Tiblanka, 38 Sea Views, Carlton"
            << "Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal"
            << "Sol Harvey, Chicos Coffee, 53 New Springs, Eccleston"
            << "Sally Hobart, Tiroli Tea, 67 Long River, Fedula");
    pDockDevicelist->setWidget(customerList);
#endif



    addDockWidget(Qt::LeftDockWidgetArea, pDockDevicelist);
}
Exemplo n.º 2
0
XtConnectPage::XtConnectPage(QWidget *parent, QSettings &s, ImapPage *imapPage): QWidget(parent), imap(imapPage)
{
    // Take care not to clash with the cache of the GUI
    QString cacheLocation = Common::writablePath(Common::LOCATION_CACHE) + QString::fromAscii("xtconnect-trojita");
    QFormLayout *layout = new QFormLayout(this);
    cacheDir = new QLineEdit(s.value(Common::SettingsNames::xtConnectCacheDirectory, cacheLocation).toString(), this);
    layout->addRow(tr("Cache Directory"), cacheDir);

    QGroupBox *box = new QGroupBox(tr("Mailboxes to synchronize"), this);
    QVBoxLayout *boxLayout = new QVBoxLayout(box);
    QListWidget *mailboxes = new QListWidget(box);
    mailboxes->addItems(s.value(Common::SettingsNames::xtSyncMailboxList).toStringList());
    for (int i = 0; i < mailboxes->count(); ++i) {
        mailboxes->item(i)->setFlags(Qt::ItemIsEnabled);
    }
    mailboxes->setToolTip(tr("Please use context menu inside the main application to select mailboxes to synchronize"));
    boxLayout->addWidget(mailboxes);
    layout->addRow(box);

    QString optionHost = s.value(Common::SettingsNames::xtDbHost).toString();
    int optionPort = s.value(Common::SettingsNames::xtDbPort, QVariant(5432)).toInt();
    QString optionDbname = s.value(Common::SettingsNames::xtDbDbName).toString();
    QString optionUsername = s.value(Common::SettingsNames::xtDbUser).toString();

    QStringList args = QCoreApplication::arguments();
    for (int i = 1; i < args.length(); i++) {
        if (args.at(i) == "-h" && args.length() > i)
            optionHost = args.at(++i);
        else if (args.at(i) == "-d" && args.length() > i)
            optionDbname = args.at(++i);
        else if (args.at(i) == "-p" && args.length() > i)
            optionPort = args.at(++i).toInt();
        else if (args.at(i) == "-U" && args.length() > i)
            optionUsername = args.at(++i);
    }


    hostName = new QLineEdit(optionHost);
    layout->addRow(tr("DB Hostname"), hostName);
    port = new QSpinBox();
    port->setRange(1, 65535);
    port->setValue(optionPort);
    layout->addRow(tr("DB Port"), port);
    dbName = new QLineEdit(optionDbname);
    layout->addRow(tr("DB Name"), dbName);
    username = new QLineEdit(optionUsername);
    layout->addRow(tr("DB Username"), username);

    imapPasswordWarning = new QLabel(tr("Please fill in all IMAP options, including the password, at the IMAP page. "
                                        "If you do not save the password, background synchronization will not run."), this);
    imapPasswordWarning->setWordWrap(true);
    imapPasswordWarning->setStyleSheet(SettingsDialog::warningStyleSheet);
    layout->addRow(imapPasswordWarning);
    debugLog = new QCheckBox();
    layout->addRow(tr("Debugging"), debugLog);

    QPushButton *btn = new QPushButton(tr("Run xTuple Synchronization"));
    connect(btn, SIGNAL(clicked()), this, SLOT(runXtConnect()));
    layout->addRow(btn);
}
KoInlineObject *InsertTextReferenceAction::createInlineObject()
{
    const QList<KoTextLocator*> textLocators = m_manager->textLocators();
    if (textLocators.isEmpty()) {
        KMessageBox::information(m_canvas->canvasWidget(), i18n("Please create an index to reference first."));
        return 0;
    }

    QWidget *widget = new QWidget();
    QVBoxLayout *lay = new QVBoxLayout(widget);
    widget->setLayout(lay);
    lay->setMargin(0);

    QLabel *label = new QLabel(i18n("Select the index you want to reference"), widget);
    lay->addWidget(label);
    QStringList selectionList;
    foreach(KoTextLocator* locator, textLocators)
        selectionList << locator->word() + '(' + QString::number(locator->pageNumber()) + ')';
    QListWidget *list = new QListWidget(widget);
    lay->addWidget(list);
    list->addItems(selectionList);

    KPageDialog dialog(m_canvas->canvasWidget());
    dialog.setCaption(i18n("%1 Options", i18n("Text Reference"))); // reuse the text passed in the constructor
    dialog.addPage(widget, QString());

    KoVariable *variable = 0;
    if (dialog.exec() == KPageDialog::Accepted && list->currentRow() >= 0) {
        KoTextLocator *locator = textLocators[list->currentRow()];
        Q_ASSERT(locator);
        variable = new KoTextReference(locator->id());
    }
    return variable;
}
Exemplo n.º 4
0
void ListBoxControl::update (int pId)
{
  uicontrol::properties& up = properties<uicontrol> ();
  QListWidget* list = qWidget<QListWidget> ();

  switch (pId)
    {
    case uicontrol::properties::ID_STRING:
      m_blockCallback = true;
      list->clear ();
      list->addItems (Utils::fromStringVector (up.get_string_vector ()));
      updateSelection (list, up.get_value ().matrix_value ());
      m_blockCallback = false;
      break;
    case uicontrol::properties::ID_MIN:
    case uicontrol::properties::ID_MAX:
      if ((up.get_max () - up.get_min ()) > 1)
	list->setSelectionMode (QAbstractItemView::ExtendedSelection);
      else
	list->setSelectionMode (QAbstractItemView::SingleSelection);
      break;
    case uicontrol::properties::ID_VALUE:
      m_blockCallback = true;
      updateSelection (list, up.get_value ().matrix_value ());
      m_blockCallback = false;
      break;
    default:
      BaseControl::update (pId);
      break;
    }
}
Exemplo n.º 5
0
void QtPreferencesDialog::fillSerialPorts(QListWidget& aListWidget)
{
#if HAS_SERIAL
	aListWidget.addItems(QtSerialPortHelper::getSerialPorts());
#else
	Q_UNUSED(aListWidget)
#endif
}
Exemplo n.º 6
0
/*
 * When the timer (started in onDisplayMessage) fires, we update lst_debug with the
 * contents of debugListMessages.
 *
 * This happens in the timer event in order to rate limit it to a number of redraws per second
 * (redrawing, and especially scrolling the list view, can be quite resource intensive.)
 */
void MainWindow::refreshDebugList()
{
    QListWidget *lst = ui->lst_debug;
    while(lst->count() + debugListMessages.size() - scrollbackSize > 0 && lst->count() > 0) {
      delete lst->item(0);
    }
    lst->addItems(debugListMessages);
    debugListMessages.clear();
    lst->scrollToBottom();
}
Exemplo n.º 7
0
int main(int argc, char** argv)
{
    QApplication PackagesMaker(argc, argv);
        Package* tm1 = PackagesMaker::makePackage(Package::TM1_9M100);
        tm1->readRows(QStringList() << ":/1.txt" << ":/2.txt" << ":/3.txt" << ":/4.txt");
        QListWidget lw;
        lw.setWindowTitle("tm test");
        lw.addItems(tm1->getRows());
        lw.show();
    return PackagesMaker.exec();
}
Exemplo n.º 8
0
QListWidget* DMessageBox::createWidgetList(const QStringList& items)
{
    QListWidget* listWidget = 0;

    if (!items.isEmpty())
    {
        listWidget = new QListWidget();
        listWidget->addItems(items);
    }

    return listWidget;
}
Exemplo n.º 9
0
int main(int argc, char** argv)
{
    QApplication TM1Reader(argc, argv);
        QString dir = QFileDialog::getExistingDirectory();
        Package* tm1 = PackagesMaker::makeAndFillPackage(Package::TM1_9M100, dir);
        tm1->writeRows(dir);
        QListWidget lw;
        lw.addItems(tm1->getRows());
        lw.show();
        delete tm1;
    return TM1Reader.exec();
}
Exemplo n.º 10
0
QString QtopiaInputDialog::getItem(QWidget *parent, const QString &title, const QString &label, const QStringList &list,
                                   int current, bool *ok)
{
    QListWidget *listWidget = new QListWidget;
    listWidget->addItems(list);
    listWidget->setCurrentRow(current);
    listWidget->setFrameShadow(QFrame::Plain);

    QtopiaInputDialog dlg(parent, title, label, listWidget);
    bool accepted = (QtopiaApplication::execDialog(&dlg) == QDialog::Accepted);
    if (ok)
        *ok = accepted;
    if (listWidget->currentItem())
        return listWidget->currentItem()->text();
    else
        return QString();
}
Exemplo n.º 11
0
void ListWidgetPrototype::addItems(const QStringList &texts)
{
    QListWidget *widget = qscriptvalue_cast<QListWidget*>(thisObject());
    if (widget)
        widget->addItems(texts);
}
Exemplo n.º 12
0
AboutPlugins::AboutPlugins( Config *_config, QWidget* parent, Qt::WFlags f )
    : KDialog( parent, f ),
    config( _config ),
    currentPlugin( 0 )
{
    setCaption( i18n("About plugins") );
    setWindowIcon( KIcon("preferences-plugin") );
    setButtons( KDialog::Close );
    setButtonFocus( KDialog::Close );

    QWidget *widget = new QWidget( this );
    setMainWidget( widget );
    QHBoxLayout *box = new QHBoxLayout( widget );

    QVBoxLayout *pluginListBox = new QVBoxLayout( widget );
    box->addLayout( pluginListBox );

    QLabel *installedPlugins = new QLabel( i18n("Installed plugins:"), this );
    pluginListBox->addWidget( installedPlugins );

    QListWidget *pluginsList = new QListWidget( this );
    pluginListBox->addWidget( pluginsList );
    connect( pluginsList, SIGNAL(currentTextChanged(const QString&)), this, SLOT(currentPluginChanged(const QString&)) );

    QStringList pluginNames;
    QList<CodecPlugin*> codecPlugins = config->pluginLoader()->getAllCodecPlugins();
    for( int i=0; i<codecPlugins.count(); i++ )
    {
        pluginNames += codecPlugins.at(i)->name();
    }
    pluginNames.sort();
    pluginsList->addItems( pluginNames );

    pluginNames.clear();
    QList<FilterPlugin*> filterPlugins = config->pluginLoader()->getAllFilterPlugins();
    for( int i=0; i<filterPlugins.count(); i++ )
    {
        pluginNames += filterPlugins.at(i)->name();
    }
    pluginNames.sort();
    pluginsList->addItems( pluginNames );

    pluginNames.clear();
    QList<ReplayGainPlugin*> replaygainPlugins = config->pluginLoader()->getAllReplayGainPlugins();
    for( int i=0; i<replaygainPlugins.count(); i++ )
    {
        pluginNames += replaygainPlugins.at(i)->name();
    }
    pluginNames.sort();
    pluginsList->addItems( pluginNames );

    pluginNames.clear();
    QList<RipperPlugin*> ripperPlugins = config->pluginLoader()->getAllRipperPlugins();
    for( int i=0; i<ripperPlugins.count(); i++ )
    {
        pluginNames += ripperPlugins.at(i)->name();
    }
    pluginNames.sort();
    pluginsList->addItems( pluginNames );

    pluginsList->setFixedWidth( 180 );

    box->addSpacing( 10 );

    QVBoxLayout *pluginInfoBox = new QVBoxLayout( widget );
    box->addLayout( pluginInfoBox );

    aboutPluginLabel = new QLabel( this );
    aboutPluginLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
    aboutPluginLabel->setWordWrap( true );
    aboutPluginLabel->setTextFormat( Qt::RichText );
    pluginInfoBox->addWidget( aboutPluginLabel );
    connect( aboutPluginLabel, SIGNAL(linkActivated(const QString&)), this, SLOT(showProblemInfo(const QString&)) );

    pluginInfoBox->addStretch();

    QHBoxLayout *configurePluginBox = new QHBoxLayout( widget );
    pluginInfoBox->addLayout( configurePluginBox );
    configurePlugin = new KPushButton( KIcon("configure"), "", widget );
    configurePlugin->hide();
    configurePluginBox->addWidget( configurePlugin );
    configurePluginBox->addStretch();
    connect( configurePlugin, SIGNAL(clicked()), this, SLOT(configurePluginClicked()) );

    pluginsList->setCurrentRow(0);
    QListWidgetItem *currentItem = pluginsList->currentItem();
    if( currentItem )
    {
        currentPluginChanged( currentItem->text() );
    }

    setInitialSize( QSize(500,300) );
    KSharedConfig::Ptr conf = KGlobal::config();
    KConfigGroup group = conf->group( "AboutPlugins" );
    restoreDialogSize( group );
}
Exemplo n.º 13
0
lv2Description::lv2Description( QWidget * _parent,
						lv2PluginType _type ) :
	QWidget( _parent )
{
	lv2Manager * manager = static_lv2_manager;
/*
	switch( _type )
	{
		case SOURCE:
			plugins = manager->getInstruments();
			break;
		case TRANSFER:
			plugins = manager->getValidEffects();
			break;
		case VALID:
			plugins = manager->getValidEffects();
			break;
		case INVALID:
			plugins = manager->getInvalidEffects();
			break;
		case SINK:
			plugins = manager->getAnalysisTools();
			break;
		case OTHER:
			plugins = manager->getOthers();
			break;
		default:
			break;
	}
*/
 // Simpler : Get all the plugins, and select based on the type...
	l_sortable_plugin_t plugins = manager->getSortedPlugins();

	QList<QString> pluginNames;
	for( l_sortable_plugin_t::iterator it = plugins.begin();
		    it != plugins.end(); it++ )
	{
  lv2ManagerDescription * description=manager->getDescription( ( *it ).second );
		if( description->type == _type  &&
     (
      _type != VALID ||
      description->inputChannels <= engine::mixer()->audioOutputContext()->audioBackend()->channels()
     )
    )
		{
			pluginNames.push_back( ( *it ).first );
			m_pluginKeys.push_back( ( *it ).second );
		}
	}

	QGroupBox * pluginsBox = new QGroupBox( tr( "Plugins" ), this );
	QListWidget * pluginList = new QListWidget( pluginsBox );
	pluginList->addItems( pluginNames );
	connect( pluginList, SIGNAL( currentRowChanged( int ) ),
						SLOT( rowChanged( int ) ) );
	connect( pluginList, SIGNAL( itemDoubleClicked( QListWidgetItem * ) ),
				SLOT( onDoubleClicked( QListWidgetItem * ) ) );
	( new QVBoxLayout( pluginsBox ) )->addWidget( pluginList );

	QGroupBox * descriptionBox = new QGroupBox( tr( "Description" ), this );
	QVBoxLayout * descriptionLayout = new QVBoxLayout( descriptionBox );
	descriptionLayout->setSpacing( 0 );
	descriptionLayout->setMargin( 0 );

	m_scrollArea = new QScrollArea( descriptionBox );
	descriptionLayout->addWidget( m_scrollArea );

	QVBoxLayout * layout = new QVBoxLayout( this );
	layout->addWidget( pluginsBox );
	layout->addWidget( descriptionBox );

	if( pluginList->count() > 0 )
	{
		pluginList->setCurrentRow( 0 );
		m_currentSelection = m_pluginKeys[0];
		update( m_currentSelection );
	}
}
Exemplo n.º 14
0
int KMessageBox::createKMessageBox(KDialog *dialog, const QIcon &icon,
                             const QString &text, const QStringList &strlist,
                             const QString &ask, bool *checkboxReturn, Options options,
                             const QString &details, QMessageBox::Icon notifyType)
{
    QWidget *mainWidget = new QWidget(dialog);
    QVBoxLayout *mainLayout = new QVBoxLayout(mainWidget);
    mainLayout->setSpacing(KDialog::spacingHint() * 2); // provide extra spacing
    mainLayout->setMargin(0);

    QHBoxLayout *hLayout = new QHBoxLayout();
    hLayout->setMargin(0);
    hLayout->setSpacing(-1); // use default spacing
    mainLayout->addLayout(hLayout,5);

    QLabel *iconLabel = new QLabel(mainWidget);

    if (!icon.isNull()) {
        QStyleOption option;
        option.initFrom(mainWidget);
        iconLabel->setPixmap(icon.pixmap(mainWidget->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, &option, mainWidget)));
    }

    QVBoxLayout *iconLayout = new QVBoxLayout();
    iconLayout->addStretch(1);
    iconLayout->addWidget(iconLabel);
    iconLayout->addStretch(5);

    hLayout->addLayout(iconLayout,0);
    hLayout->addSpacing(KDialog::spacingHint());

    QLabel *messageLabel = new QLabel(text, mainWidget);
    messageLabel->setOpenExternalLinks(options & KMessageBox::AllowLink);
    Qt::TextInteractionFlags flags = Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard;
    if (options & KMessageBox::AllowLink) {
        flags |= Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard;
    }
    messageLabel->setTextInteractionFlags(flags);

    QRect desktop = KGlobalSettings::desktopGeometry(dialog);
    bool usingSqueezedTextLabel = false;
    if (messageLabel->sizeHint().width() > desktop.width() * 0.5) {
        // enable automatic wrapping of messages which are longer than 50% of screen width
        messageLabel->setWordWrap(true);
        // display a text widget with scrollbar if still too wide
        usingSqueezedTextLabel = messageLabel->sizeHint().width() > desktop.width() * 0.85;
        if (usingSqueezedTextLabel)
        {
            delete messageLabel;
            messageLabel = new KSqueezedTextLabel(text, mainWidget);
            messageLabel->setOpenExternalLinks(options & KMessageBox::AllowLink);
            messageLabel->setTextInteractionFlags(flags);
        }
    }

    QPalette messagePal(messageLabel->palette());
    messagePal.setColor(QPalette::Window, Qt::transparent);
    messageLabel->setPalette(messagePal);


    bool usingScrollArea=desktop.height() / 3 < messageLabel->sizeHint().height();
    if (usingScrollArea)
    {
        QScrollArea* messageScrollArea = new QScrollArea(mainWidget);
        messageScrollArea->setWidget(messageLabel);
        messageScrollArea->setFrameShape(QFrame::NoFrame);
        messageScrollArea->setWidgetResizable(true);
        QPalette scrollPal(messageScrollArea->palette());
        scrollPal.setColor(QPalette::Window, Qt::transparent);
        messageScrollArea->viewport()->setPalette(scrollPal);
        hLayout->addWidget(messageScrollArea,5);
    }
    else
        hLayout->addWidget(messageLabel,5);


    const bool usingListWidget=!strlist.isEmpty();
    if (usingListWidget) {
        // enable automatic wrapping since the listwidget has already a good initial width
        messageLabel->setWordWrap(true);
        QListWidget *listWidget = new QListWidget(mainWidget);
        listWidget->addItems(strlist);

        QStyleOptionViewItem styleOption;
        styleOption.initFrom(listWidget);
        QFontMetrics fm(styleOption.font);
        int w = listWidget->width();
        Q_FOREACH(const QString &str, strlist) {
            w = qMax(w, fm.width(str));
        }
        const int borderWidth = listWidget->width() - listWidget->viewport()->width() + listWidget->verticalScrollBar()->height();
        w += borderWidth;
        if (w > desktop.width() * 0.85) { // limit listWidget size to 85% of screen width
            w = qRound(desktop.width() * 0.85);
        }
        listWidget->setMinimumWidth(w);

        mainLayout->addWidget(listWidget,usingScrollArea?10:50);
        listWidget->setSelectionMode(QListWidget::NoSelection);
        messageLabel->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Minimum);
    }
Exemplo n.º 15
0
/**
  * @brief get here when receiver data is ready...
  * @param net the network connection
  */
void OpenNIC::dataReady(OpenNICNet* net)
{
	QMapIterator<QString, QVariant>i(net->rxPacket().data());
	mBalloonStatus.clear();
	while (i.hasNext())
	{
		i.next();
		QString key = i.key();
		QVariant value = i.value();
		if ( key == OpenNICPacket::tcp_listen_port )					mTcpListenPort			=	value.toInt();
		else if ( key == OpenNICPacket::resolver_cache )
		{
			QStringList serverResolverCache = value.toStringList();
			QStringList localResolverCache;
			localResolverCache.clear();
			for(int n=0;n < serverResolverCache.count(); n++)
			{
				QStringList parts = serverResolverCache.at(n).split(";");
				localResolverCache.append(parts.at(3));
			}
			QString newText = localResolverCache.join("\n");
			QString currentText = ui->cache->toPlainText();
			if ( newText != currentText )
			{
				ui->cache->setPlainText(localResolverCache.join("\n"));
			}
		}
		else if ( key == OpenNICPacket::refresh_timer_period )
		{
			if ( ui->refreshRate->value() !=  value.toInt() )
			{
				ui->refreshRate->setValue(value.toInt());
			}
		}
		else if ( key == OpenNICPacket::resolver_cache_size )
		{
			if ( ui->resolverCount->value() != value.toInt() )
			{
				ui->resolverCount->setValue(value.toInt());
			}
		}
		else if ( key == OpenNICPacket::bootstrap_t1_list )
		{
			QString currentText = ui->t1List->toPlainText();
			QString newText = value.toStringList().join("\n");
			if ( currentText != newText )
			{
				ui->t1List->setPlainText(newText);
			}
		}
		else if ( key == OpenNICPacket::bootstrap_domains )
		{
			QString currentText = ui->domainList->toPlainText();
			QString newText = value.toStringList().join("\n");
			if ( currentText != newText )
			{
				ui->domainList->setPlainText(newText);
			}
		}
		else if ( key == OpenNICPacket::resolver_pool )				updateResolverPool(value.toStringList());
		else if ( key == OpenNICPacket::system_text )				ui->systemText->setPlainText(value.toString());
		else if ( key == OpenNICPacket::journal_text )
		{
			QStringList journalText = value.toStringList();
			QListWidget* journal = ui->journalList;
			while(journal->count()>200)
			{
				QListWidgetItem* item = journal->takeItem(0);
				if ( item != NULL )
				{
					delete item;
				}
			}
			journal->addItems(journalText);
		}
		else if ( key == OpenNICPacket::async_message && !value.toString().isEmpty() )
		{
			QMessageBox::information(this,tr("Sevice Message"),value.toString());
		}
		else if ( key == OpenNICPacket::score_rules && !value.toString().isEmpty() )
		{
			ui->scoreRuleEditor->setPlainText(value.toString());
		}
		else if ( key == OpenNICPacket::score_internal )
		{
			ui->useBuiltInScoreRule->setChecked(value.toBool());
		}
	}
}
Exemplo n.º 16
0
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;
}