void BaseOrdinalPropertyWidgetQt::generateWidget() {
    signalMapperSetPropertyValue_ = new QSignalMapper(this);
    signalMapperContextMenu_ = new QSignalMapper(this);
    
    QHBoxLayout* hLayout = new QHBoxLayout(); 
    hLayout->setContentsMargins(0,0,0,0);
    hLayout->setSpacing(7);

    label_ = new EditableLabelQt(this, property_);
    hLayout->addWidget(label_);
 
    QWidget* sliderWidget = new QWidget();

    sliderWidgets_ = makeSliders(sliderWidget);

    for(size_t i = 0; i < sliderWidgets_.size(); i++) {
        sliderWidgets_[i]->setContextMenuPolicy(Qt::CustomContextMenu);
        connect(sliderWidgets_[i],
                SIGNAL(customContextMenuRequested(const QPoint&)),
                signalMapperContextMenu_,
                SLOT(map()));

        connect(sliderWidgets_[i],
                SIGNAL(valueChanged()),
                signalMapperSetPropertyValue_,
                SLOT(map()));

        signalMapperContextMenu_->setMapping(sliderWidgets_[i], static_cast<int>(i));
        signalMapperSetPropertyValue_->setMapping(sliderWidgets_[i], static_cast<int>(i));
    }

    hLayout->addWidget(sliderWidget);

    sliderWidget->setMinimumHeight(sliderWidget->sizeHint().height());
    QSizePolicy sp = sliderWidget->sizePolicy();
    sp.setVerticalPolicy(QSizePolicy::Fixed);
    sliderWidget->setSizePolicy(sp);

    connect(signalMapperContextMenu_,
            SIGNAL(mapped(int)),
            this,
            SLOT(showContextMenuSlider(int)));

    connect(signalMapperSetPropertyValue_,
            SIGNAL(mapped(int)),
            this,
            SLOT(setPropertyValue(int)));

    setLayout(hLayout);

    setFixedHeight(sizeHint().height());
    sp = sizePolicy();
    sp.setVerticalPolicy(QSizePolicy::Fixed);
    setSizePolicy(sp);
}
QWidget* QCamAutoAlign::buildGUI(QWidget * parent) {
   QSizePolicy sizePolicyMax;
   sizePolicyMax.setVerticalPolicy(QSizePolicy::Expanding);
   sizePolicyMax.setHorizontalPolicy(QSizePolicy::Expanding);

   QSizePolicy sizePolicyMin;
   sizePolicyMin.setVerticalPolicy(QSizePolicy::Minimum);
   sizePolicyMin.setHorizontalPolicy(QSizePolicy::Minimum);

   QWidget* remoteCTRL= QCam::buildGUI(parent);

   QCamUtilities::registerWidget(remoteCTRL);

   QPushButton* resetCenter = new QPushButton(tr("reset"),remoteCTRL);
   connect(resetCenter,SIGNAL(pressed()),this,SLOT(reset()));
   findShiftWidget_=new QCamHGroupBox(tr("Find Shift Ctrl"),remoteCTRL);
   if (tracker_) {
      findShiftCtrl_=tracker_->buildGUI(findShiftWidget_);
   }

   cropSlider_=new QCamSlider(tr("crop"),false,remoteCTRL,1,100);
   cropSlider_->setSizePolicy(sizePolicyMin);
   connect(cropSlider_, SIGNAL(valueChange(int)),
           this,SLOT(setCropValue(int)));
   cropSlider_->setValue((int)round(cropValue_*100));
   cropSlider_->setToolTip(tr("% of image to keep when crooping"));
   centerButton_=new QCheckBox(tr("Center image"),remoteCTRL);
   connect(centerButton_,SIGNAL(toggled(bool)),this,SLOT(setImageCenter(bool)));
   centerButton_->setToolTip(tr("Center shifted images on the center of the frame"));

#if ONE_MAP
   scaleSlider_=new QCamSlider(tr("Display scale"),false,remoteCTRL,1,100);
   scaleSlider_->setSizePolicy(sizePolicyMin);
   scaleSlider_->setToolTip(tr("Scale of the shift history Map"));

   shiftMap_= new QVectorMap(remoteCTRL);
   shiftMap_->setSizePolicy(sizePolicyMax);
   shiftMap_->setMode(DrawLine);
   connect(scaleSlider_, SIGNAL(valueChange(int)),shiftMap_,SLOT(setScale(int)));
   shiftMap_->setToolTip(tr("Show the history of the frame shift"));
#else
   shiftXhisto_ = new QHistogram(remoteCTRL);
   shiftXhisto_->setDataSize(200);
   shiftXhisto_->setAutoShift(true);
   shiftXhisto_->setAverage(4);
   shiftYhisto_ = new QHistogram(remoteCTRL);
   shiftYhisto_->setDataSize(200);
   shiftYhisto_->setAutoShift(true);
   shiftYhisto_->setAverage(4);
#endif

   resetCenter->show();

   return remoteCTRL;
}
Exemple #3
0
ChatWidget::ChatWidget(QWidget *parent) : QScrollArea(parent), ui(new Ui::ChatWidget) {
    ui->setupUi(this);

	this->setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOn);
	this->setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAsNeeded);

	QSizePolicy selfSizePolicy = this->sizePolicy();
	selfSizePolicy.setHeightForWidth(true);
	this->setSizePolicy(selfSizePolicy);
	this->setWidgetResizable(true);
	
	QSizePolicy contentsSizePolicy = ui->scrollAreaWidgetContents->sizePolicy();
	contentsSizePolicy.setHorizontalPolicy(QSizePolicy::Expanding);
	contentsSizePolicy.setVerticalPolicy(QSizePolicy::Expanding);
	contentsSizePolicy.setHeightForWidth(true);
	ui->scrollAreaWidgetContents->setSizePolicy(contentsSizePolicy);
	ui->scrollAreaWidgetContents->setMinimumWidth(400);

	this->setWidget(ui->scrollAreaWidgetContents);

	topLayout = new QVBoxLayout();
	ui->scrollAreaWidgetContents->setLayout(topLayout);

	QPalette myPalette(palette());
	myPalette.setColor(QPalette::Background, Qt::white);
	this->setAutoFillBackground(true);
	this->setPalette(myPalette);
}
Exemple #4
0
KisProgressWidget::KisProgressWidget(QWidget* parent)
    : QWidget(parent)
{
    QHBoxLayout* layout = new QHBoxLayout(this);
    m_cancelButton = new EscapeButton(this);
    m_cancelButton->setIcon(koIcon("process-stop"));

    QSizePolicy sizePolicy = m_cancelButton->sizePolicy();
    sizePolicy.setVerticalPolicy(QSizePolicy::Ignored);
    m_cancelButton->setSizePolicy(sizePolicy);

    connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(cancel()));

    m_progressBar = new KoProgressBar(this);
    connect(m_progressBar, SIGNAL(valueChanged(int)), SLOT(correctVisibility(int)));
    layout->addWidget(m_progressBar);
    layout->addWidget(m_cancelButton);
    layout->setContentsMargins(0, 0, 0, 0);

    m_progressBar->setVisible(false);
    m_cancelButton->setVisible(false);

    setMaximumWidth(225);
    setMinimumWidth(225);
}
void EditorMultiLineInputDialog::setup_ui()
{
 QSizePolicy sizePolicy;
 sizePolicy.setHorizontalPolicy(QSizePolicy::Expanding);
 sizePolicy.setVerticalPolicy(QSizePolicy::Expanding);

 textArea=new QTextEdit(this);
 textArea->setAcceptRichText(false);
 textArea->setSizePolicy(sizePolicy);

 buttonBox=new QDialogButtonBox(Qt::Horizontal);
 buttonBox->addButton(tr("OK"),QDialogButtonBox::AcceptRole);
 buttonBox->addButton(tr("Cancel"),QDialogButtonBox::RejectRole);

 // Устанавливается размер окна, равныи виджету, из которого
 // этот виджет был вызван
 if(this->parent()->isWidgetType())
  {
   QWidget *parentWidget=qobject_cast<QWidget *>(this->parent());
   QRect geom(parentWidget->pos(), parentWidget->size());

   qDebug() << "Parent window geometry " << geom.x() << geom.y() << geom.width() << geom.height();

   setMinimumSize(parentWidget->size());
  }
}
void StringMultilinePropertyWidgetQt::generateWidget() {
    QHBoxLayout *hLayout = new QHBoxLayout;
    setSpacingAndMargins(hLayout);

    // QVBoxLayout* vLayout = new QVBoxLayout;
    // vLayout->setContentsMargins(0, 0, 0, 0);
    // vLayout->setSpacing(0);

    label_ = new EditableLabelQt(this, property_);
    // vLayout->addWidget(label_);
    // vLayout->addStretch();
    // hLayout->addLayout(vLayout);

    hLayout->addWidget(label_);

    textEdit_ = new MultilineTextEdit;
    // if(property_->getSemantics().getString() == "Password"){
    //    textEdit_->setEchoMode(QLineEdit::PasswordEchoOnEdit);
    //}

    QSizePolicy sp = textEdit_->sizePolicy();
    sp.setHorizontalStretch(3);
    sp.setVerticalPolicy(QSizePolicy::Preferred);
    textEdit_->setSizePolicy(sp);

    hLayout->addWidget(textEdit_);

    setLayout(hLayout);
    connect(textEdit_, SIGNAL(editingFinished()), this, SLOT(setPropertyValue()));
}
Exemple #7
0
// Insert a widget at a specific index in the stack. Inserting at \c index = -1 is equivalent to appending to the end. The AMVerticalStackWidget takes ownership of the widget.
void AMVerticalStackWidget::insertItem(int index, const QString& titleText, QWidget* widget, bool collapsable) {
	if(index < 0 || index > count())
		index = count();

	if(widget->windowTitle() != titleText)
		widget->setWindowTitle(titleText);

	QStandardItem* item = new QStandardItem(titleText);
	item->setData(qVariantFromValue(widget), AM::PointerRole);
	item->setData(false, Qt::CheckStateRole);
	item->setFlags( collapsable ? (Qt::ItemIsEnabled | Qt::ItemIsUserCheckable) : Qt::ItemIsEnabled);

	AMHeaderButton* header = new AMHeaderButton();
	header->setText(titleText);
	header->setArrowType(Qt::DownArrow);
	item->setData(qVariantFromValue(header), AM::WidgetRole);
	connect(header, SIGNAL(clicked()), this, SLOT(onHeaderButtonClicked()));

	widget->installEventFilter(this);

	QSizePolicy sp = widget->sizePolicy();
	sp.setVerticalPolicy(QSizePolicy::Preferred);
	widget->setSizePolicy(sp);

	vl_->insertWidget(2*index, header);
	vl_->insertWidget(2*index+1, widget);

	model_.insertRow(index, item);
}
Exemple #8
0
pictoController::pictoController(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::pictoController){

    ui->setupUi(this);

    subwidget = new subWidget();
    subwidget->setWindowTitle("subWidget");
    QSizePolicy policy;
    policy.setVerticalPolicy(QSizePolicy::Fixed);
    policy.setHorizontalPolicy(QSizePolicy::Fixed);
    subwidget->setSizePolicy(policy);
    subwidget->setFixedSize(385,216);
    ui->gridLayout_3->addWidget(subwidget, 0, 2, 1, 1);

    move(1300,0);

    //preset tab settings
    ui->tableWidget->setColumnWidth(0, 300);

    QFont font;
    font.setPointSize(7);
    font.setFamily("MS UI Gothic");
    font.setBold(true);
    ui->tableWidget->horizontalHeader()->setFont(font);

    //ui->tableWidget->horizontalHeaderItem(1)->setFlags(Qt::ItemFlag::);
}
SettingsWidget::SettingsWidget()
    : ui(new Ui::SettingsWidget)
{
	ui->setupUi(this);
	QSizePolicy policy = ui->answersList->sizePolicy();
	policy.setVerticalPolicy(QSizePolicy::MinimumExpanding);
	ui->answersList->setSizePolicy(policy);
	listenChildrenStates(QWidgetList() << ui->answersList);
}
Exemple #10
0
MapWidget::MapWidget(QWidget* parent) : QWebView(parent)
{
    mapPage = new MapPage(this);
    this->setPage(mapPage);

    createActions();

    QSizePolicy policy = this->sizePolicy();
    policy.setVerticalPolicy(QSizePolicy::Expanding);
    this->setSizePolicy(policy);
}
Exemple #11
0
void OpenconnectAuthWidget::viewServerLogToggled(bool toggled)
{
    Q_D(OpenconnectAuthWidget);
    d->ui.lblLogLevel->setVisible(toggled);
    d->ui.cmbLogLevel->setVisible(toggled);
    if (toggled) {
        delete d->ui.verticalLayout->takeAt(5);
        QSizePolicy policy = d->ui.serverLogBox->sizePolicy();
        policy.setVerticalPolicy(QSizePolicy::Expanding);
        d->ui.serverLogBox->setSizePolicy(policy);
        d->ui.serverLog->setVisible(true);
    } else {
        QSpacerItem *verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
        d->ui.verticalLayout->addItem(verticalSpacer);
        d->ui.serverLog->setVisible(false);
        QSizePolicy policy = d->ui.serverLogBox->sizePolicy();
        policy.setVerticalPolicy(QSizePolicy::Fixed);
        d->ui.serverLogBox->setSizePolicy(policy);
    }
}
Exemple #12
0
QRcodeWidget::QRcodeWidget(QWidget *parent) :
    QWidget(parent)
{
    QSizePolicy sizePolicy;
    sizePolicy.setHorizontalPolicy(QSizePolicy::Fixed);
    sizePolicy.setVerticalPolicy(QSizePolicy::Fixed);
    
    this->setSizePolicy(sizePolicy);
    this->resize(QSize(200, 200));
    this->setMinimumSize(this->size());
    code = NULL;
}
void QtnPropertyWidget::updateParts()
{
    // clear layout
    while (!m_layout->isEmpty())
        m_layout->takeAt(0);

    // check toolbar

    // check description panel
    if (m_parts & QtnPropertyWidgetPartsDescriptionPanel)
    {
        if (!m_descriptionSplitter)
        {
            // create splitter
            Q_ASSERT(!m_descriptionPanel);
            QSplitter* splitter = new QSplitter(Qt::Vertical, this);

            // add property view
            splitter->addWidget(m_propertyView);

            // create description panel
            m_descriptionPanel = new QLabel(splitter);
            m_descriptionPanel->setTextFormat(Qt::RichText);
            m_descriptionPanel->setAlignment(Qt::AlignTop);
            m_descriptionPanel->setWordWrap(true);
            m_descriptionPanel->setFrameStyle(QFrame::Box | QFrame::Sunken);
            m_descriptionPanel->setMinimumSize(0, 0);
            QSizePolicy p = m_descriptionPanel->sizePolicy();
            p.setVerticalPolicy(QSizePolicy::Ignored);
            p.setHorizontalPolicy(QSizePolicy::Ignored);
            m_descriptionPanel->setSizePolicy(p);

            // setup DblClick handler
            splitter->handle(1)->installEventFilter(new QtnSplitterEventsHandler(splitter));

            m_descriptionSplitter = splitter;
        }

        m_layout->addWidget(m_descriptionSplitter);
    }
    else
    {
        if (m_descriptionSplitter)
        {
            delete m_descriptionSplitter;
            m_descriptionSplitter = nullptr;
            m_descriptionPanel = nullptr;
        }

        m_layout->addWidget(m_propertyView);
    }
}
Exemple #14
0
/*! \internal
    Adds a widget to the scroll bar container.
*/
void QAbstractScrollAreaScrollBarContainer::addWidget(QWidget *widget, LogicalPosition position)
{
    QSizePolicy policy = widget->sizePolicy();
    if (orientation == Qt::Vertical)
        policy.setHorizontalPolicy(QSizePolicy::Ignored);
    else
        policy.setVerticalPolicy(QSizePolicy::Ignored);
    widget->setSizePolicy(policy);
    widget->setParent(this);

    const int insertIndex = (position & LogicalLeft) ? 0 : scrollBarLayoutIndex() + 1;
    layout->insertWidget(insertIndex, widget);
}
Exemple #15
0
LineCbBox::LineCbBox(QWidget *pParent)
	:QComboBox(pParent)
{
	setParent(pParent);
	m_Style = 0;
	m_Width = 1;
	m_Color = QColor(255,100,50);

	QSizePolicy szPolicyExpanding;
	szPolicyExpanding.setHorizontalPolicy(QSizePolicy::MinimumExpanding);
	szPolicyExpanding.setVerticalPolicy(QSizePolicy::Minimum);
	setSizePolicy(szPolicyExpanding);
}
OutputPanePlaceHolder::OutputPanePlaceHolder(Core::IMode *mode, QSplitter* parent)
   : QWidget(parent), m_mode(mode), m_closeable(true)
{
    m_splitter = parent;
    setVisible(false);
    setLayout(new QVBoxLayout);
    QSizePolicy sp;
    sp.setHorizontalPolicy(QSizePolicy::Preferred);
    sp.setVerticalPolicy(QSizePolicy::Preferred);
    sp.setHorizontalStretch(0);
    setSizePolicy(sp);
    layout()->setMargin(0);
    connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode *)),
            this, SLOT(currentModeChanged(Core::IMode *)));
}
CalculatorWidget::CalculatorWidget(QWidget *parent, Qt::WindowFlags flags) : QWidget(parent, flags) {
    QGridLayout *layout = new QGridLayout(this);
    layout->setSizeConstraint(QLayout::SetFixedSize);
    setLayout(layout);

    QSizePolicy policy = sizePolicy();

    displayLabel = new QLabel(this);
    layout->addWidget(displayLabel, 0, 0, 1, 3);
    displayLabel->setAutoFillBackground(true);
    displayLabel->setBackgroundRole(QPalette::Base);
    displayLabel->setAlignment(Qt::AlignRight);
    displayLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    policy = displayLabel->sizePolicy();
    policy.setVerticalPolicy(QSizePolicy::Fixed);
    displayLabel->setSizePolicy(policy);

    signalMapper = new QSignalMapper(this);
    QPushButton *button = new QPushButton(QString::number(0), this);
    QObject::connect(button, SIGNAL(clicked()), signalMapper, SLOT(map()));
    signalMapper->setMapping(button, 0);
    layout->addWidget(button, 4, 1);
    digitButtons.push_back(button);
    for (unsigned int i = 1; i < 10; ++i) {
        QPushButton *button = new QPushButton(QString::number(i), this);
        QObject::connect(button, SIGNAL(clicked()), signalMapper, SLOT(map()));
        signalMapper->setMapping(button, i);
        layout->addWidget(button, 1+(9-i)/3, (i-1)%3);
        digitButtons.push_back(button);
    }
    QObject::connect(signalMapper, SIGNAL(mapped(int)), SLOT(buttonClicked(int)));

    clearButton = new QPushButton("C", this);
    layout->addWidget(clearButton, 1, 4);
    QObject::connect(clearButton, SIGNAL(clicked()), SLOT(clearButtonClicked()));

    additionButton = new QPushButton("+", this);
    layout->addWidget(additionButton, 2, 4);
    QObject::connect(additionButton, SIGNAL(clicked()), SLOT(addButtonClicked()));

    subtractionButton = new QPushButton("-", this);
    layout->addWidget(subtractionButton, 3, 4);
    QObject::connect(subtractionButton, SIGNAL(clicked()), SLOT(subtractButtonClicked()));

    calculateButton = new QPushButton("=", this);
    layout->addWidget(calculateButton, 4, 4);
    QObject::connect(calculateButton, SIGNAL(clicked()), SLOT(calculateButtonClicked()));
}
Exemple #18
0
MiniMap::MiniMap(const QPixmap& overview, QWidget *parent) 
  : QWidget(parent),
    _overview(overview),
    _fieldOfView(QRectF()),
    _aspectRatio(1),
    _manager(NULL),
    _drawCoverageMap(true)
{
  QSizePolicy policy;
  policy.setHeightForWidth(true);
  policy.setHorizontalPolicy(QSizePolicy::Fixed);
  policy.setVerticalPolicy(QSizePolicy::Fixed);
  setSizePolicy(policy);
  if (!overview.isNull()) {
    _aspectRatio = static_cast<float>(_overview.width()) / _overview.height();
  }
}
Exemple #19
0
BookmarkList::BookmarkList( Okular::Document *document, QWidget *parent )
    : QWidget( parent ), m_document( document ), m_currentDocumentItem( 0 )
{
    QVBoxLayout *mainlay = new QVBoxLayout( this );
    mainlay->setMargin( 0 );
    mainlay->setSpacing( 6 );

    m_searchLine = new KTreeWidgetSearchLine( this );
    mainlay->addWidget( m_searchLine );

    m_tree = new QTreeWidget( this );
    mainlay->addWidget( m_tree );
    QStringList cols;
    cols.append( "Bookmarks" );
    m_tree->setContextMenuPolicy(  Qt::CustomContextMenu );
    m_tree->setHeaderLabels( cols );
    m_tree->setSortingEnabled( false );
    m_tree->setRootIsDecorated( true );
    m_tree->setAlternatingRowColors( true );
    m_tree->setItemDelegate( new PageItemDelegate( m_tree ) );
    m_tree->header()->hide();
    m_tree->setSelectionBehavior( QAbstractItemView::SelectRows );
    m_tree->setEditTriggers( QAbstractItemView::EditKeyPressed );
    connect( m_tree, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(slotExecuted(QTreeWidgetItem*)) );
    connect( m_tree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenu(QPoint)) );
    m_searchLine->addTreeWidget( m_tree );

    QToolBar * bookmarkController = new QToolBar( this );
    mainlay->addWidget( bookmarkController );
    bookmarkController->setObjectName( QLatin1String( "BookmarkControlBar" ) );
    // change toolbar appearance
    bookmarkController->setIconSize( QSize( 16, 16 ) );
    bookmarkController->setMovable( false );
    QSizePolicy sp = bookmarkController->sizePolicy();
    sp.setVerticalPolicy( QSizePolicy::Minimum );
    bookmarkController->setSizePolicy( sp );
    // insert a togglebutton [show only bookmarks in the current document]
    m_showBoomarkOnlyAction = bookmarkController->addAction( KIcon( "bookmarks" ), i18n( "Current document only" ) );
    m_showBoomarkOnlyAction->setCheckable( true );
    connect( m_showBoomarkOnlyAction, SIGNAL(toggled(bool)), this, SLOT(slotFilterBookmarks(bool)) );

    connect( m_document->bookmarkManager(), SIGNAL(bookmarksChanged(KUrl)), this, SLOT(slotBookmarksChanged(KUrl)) );

    rebuildTree( m_showBoomarkOnlyAction->isChecked() );
}
CarGroupBox::CarGroupBox(QWidget *parent) :
    QGroupBox(parent),
    ui(new Ui::CarGroupBox)
{
    ui->setupUi(this);

    // Create a button group and set to exclusive.
    m_buttonGroup = new QButtonGroup(this);
    m_buttonGroup->addButton(ui->autoRadioButton, CarMode::Auto);
    m_buttonGroup->addButton(ui->assistedRadioButton, CarMode::Assisted);
    m_buttonGroup->addButton(ui->manualRadioButton, CarMode::Manual);
    m_buttonGroup->addButton(ui->notConnectedRadioButton, CarMode::NotConnected);
    m_buttonGroup->setExclusive(true);

    // Add filters.
    ui->filterComboBox->addItem("EKF", (int)FilterType::EKF);
    ui->filterComboBox->addItem("ParticleFilter", (int)FilterType::ParticleFilter);
    ui->filterComboBox->addItem("NoFilter", (int)FilterType::NoFilter);
    // Add motion models.
    ui->motionModelComboBox->addItem("CTModel", (int)MotionModelType::CTModel);
    ui->motionModelComboBox->addItem("STModel", (int)MotionModelType::STModel);

    // Add hand controllers
    ui->handControllercomboBox->addItem("Hand Controller 1", (int)HandController::HandControl_1);
    ui->handControllercomboBox->addItem("Hand Controller 2", (int)HandController::HandControl_2);

    // Add controllers.
    ui->controllerComboBox->addItem("PIDdefault", (int)ControllerType::PIDdefault);
    ui->controllerComboBox->addItem("PIDuser", (int)ControllerType::PIDuser);
    ui->controllerComboBox->addItem("PIDadaptiveGain", (int)ControllerType::PIDadaptiveGain);
    ui->controllerComboBox->addItem("PIDadaptiveSection", (int)ControllerType::PIDadaptiveSection);



    // Set fixed width of combo boxes (not optimal solution, but it works).
    ui->filterComboBox->setFixedWidth(70);
    ui->motionModelComboBox->setFixedWidth(100);
    ui->controllerComboBox->setFixedWidth(130);

    QSizePolicy policy = sizePolicy();
    policy.setHorizontalPolicy(QSizePolicy::Fixed);
    policy.setVerticalPolicy(QSizePolicy::Fixed);
    setSizePolicy(policy);
}
void EditorMultiLineInputDialog::setupUi()
{
  QSizePolicy sizePolicy;
  sizePolicy.setHorizontalPolicy(QSizePolicy::Expanding);
  sizePolicy.setVerticalPolicy(QSizePolicy::Expanding);

  textArea=new QTextEdit(this);
  textArea->setAcceptRichText(false);
  textArea->setSizePolicy(sizePolicy);

  buttonBox=new QDialogButtonBox(Qt::Horizontal);
  buttonBox->addButton(tr("OK"),QDialogButtonBox::AcceptRole);
  buttonBox->addButton(tr("Cancel"),QDialogButtonBox::RejectRole);

  // Устанавливается размер окна, основанный на размере виджета, из которого
  // этот виджет был вызван
  if(this->parent()->isWidgetType())
    updateSize();
}
OutputPanePlaceHolder::OutputPanePlaceHolder(Core::IMode *mode, QSplitter* parent)
   : QWidget(parent), d(new OutputPanePlaceHolderPrivate(mode, parent))
{
    setVisible(false);
    setLayout(new QVBoxLayout);
    QSizePolicy sp;
    sp.setHorizontalPolicy(QSizePolicy::Preferred);
    sp.setVerticalPolicy(QSizePolicy::Preferred);
    sp.setHorizontalStretch(0);
    setSizePolicy(sp);
    layout()->setMargin(0);
    connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
            this, SLOT(currentModeChanged(Core::IMode*)));

//    d->m_current = this;
//    Internal::OutputPaneManager *om = Internal::OutputPaneManager::instance();
//    layout()->addWidget(om);
//    om->show();
//    om->updateStatusButtons(isVisible());
}
ImageCanvas::ImageCanvas(DatabaseHandler * db, QWidget * parent) : QgsMapCanvas(parent),  parent(parent), db(db)  {
//	sizePolicy().setHeightForWidth(true);
	QSizePolicy policy;
	policy.setHorizontalPolicy(QSizePolicy::Expanding);
	policy.setVerticalPolicy(QSizePolicy::Preferred);
	policy.setHeightForWidth(true);
	setSizePolicy(policy);
	setBaseSize(240,240);
	enableAntiAliasing(true);
	setParallelRenderingEnabled( true );
	setCanvasColor(QColor(0, 0, 0));
	freeze(false);
	setCachingEnabled(true);
	setCacheMode(QgsMapCanvas::CacheBackground);
	setMapUnits(QGis::Meters);

	provider_registry = QgsProviderRegistry::instance();
	layer_registry = QgsMapLayerRegistry::instance();

}
void BaseOrdinalMinMaxTextPropertyWidgetQt::generateWidget() {
    makeEditorWidgets();
    
    QHBoxLayout* hLayout = new QHBoxLayout();
    setSpacingAndMargins(hLayout);
    label_ = new EditableLabelQt(this, property_);
    hLayout->addWidget(label_);
    
    QHBoxLayout* textLayout = new QHBoxLayout();
    QWidget* textWidget = new QWidget();
    textWidget->setLayout(textLayout);
    textLayout->setContentsMargins(0,0,0,0);
    
    QSizePolicy sp = QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    sp.setHorizontalStretch(3);

    QLabel* minLabel = new QLabel("Min:");
    textLayout->addWidget(minLabel);
    textLayout->addWidget(min_);
    min_->setSizePolicy(sp);

    QLabel* maxLabel = new QLabel("Max:");
    textLayout->addWidget(maxLabel);
    textLayout->addWidget(max_);
    max_->setSizePolicy(sp);
    
    hLayout->addWidget(textWidget);
    setLayout(hLayout);
    
    QSizePolicy textsp = textWidget->sizePolicy();
    textsp.setHorizontalStretch(3);
    textWidget->setSizePolicy(textsp);
    
    connect(min_, SIGNAL(valueChanged()), this, SLOT(updateFromMin()));
    connect(max_, SIGNAL(valueChanged()), this, SLOT(updateFromMax()));
    
    setFixedHeight(sizeHint().height());
    sp = sizePolicy();
    sp.setVerticalPolicy(QSizePolicy::Fixed);
    setSizePolicy(sp);
}
Exemple #25
0
RazorMainMenu::RazorMainMenu(const RazorPanelPluginStartInfo* startInfo, QWidget* parent):
    RazorPanelPlugin(startInfo, parent),
    mMenu(0)
{
    setObjectName("MainMenu");

    addWidget(&mButton);
    connect(&mButton, SIGNAL(clicked()), this, SLOT(showMenu()));
    mPowerManager = new PowerManager(this);
    mPowerManager->setParentWidget(panel());

    mScreenSaver = new ScreenSaver(this);
    
    mShortcut = new QxtGlobalShortcut(this);
    connect(mShortcut, SIGNAL(activated()), this, SLOT(showMenu()));

    settigsChanged();

    QSizePolicy sp = mButton.sizePolicy();
    sp.setVerticalPolicy(QSizePolicy::Minimum);
    mButton.setSizePolicy(sp);

}
Exemple #26
0
PlayerListArea::PlayerListArea(QWidget *parent) :
    QScrollArea(parent)
{
    setContextMenuPolicy(Qt::DefaultContextMenu);
    setMaximumWidth(240);
    setMinimumWidth(220);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setAttribute(Qt::WA_TranslucentBackground, true);
    mainWidget = new QWidget;
    QSizePolicy policy;
    policy.setVerticalPolicy(QSizePolicy::Preferred);
    mainWidget->setSizePolicy(policy);
    //mainWidget->setMaximumWidth(this->viewport()->width());
    setWidget(mainWidget);
    mainWidgetGLayout = new QGridLayout;
    mainWidget->setLayout(mainWidgetGLayout);
    mainWidgetGLayout->setAlignment(Qt::AlignLeft|Qt::AlignTop);
//    mainWidgetGLayout->setMargin(0);
//    mainWidgetGLayout->setSpacing(0);
    //QTimer::singleShot(1000, this, SLOT(updateList()));
    this->setWidgetResizable(true);
    updateList();
}
Exemple #27
0
Reviews::Reviews( QWidget * parent, Okular::Document * document )
    : QWidget( parent ), m_document( document )
{
    // create widgets and layout them vertically
    QVBoxLayout * vLayout = new QVBoxLayout( this );
    vLayout->setMargin( 0 );
    vLayout->setSpacing( 6 );

    m_view = new TreeView( m_document, this );
    m_view->setAlternatingRowColors( true );
    m_view->setSelectionMode( QAbstractItemView::ExtendedSelection );
    m_view->header()->hide();

    QToolBar *toolBar = new QToolBar( this );
    toolBar->setObjectName( QLatin1String( "reviewOptsBar" ) );
    QSizePolicy sp = toolBar->sizePolicy();
    sp.setVerticalPolicy( QSizePolicy::Minimum );
    toolBar->setSizePolicy( sp );

    m_model = new AnnotationModel( m_document, m_view );

    m_filterProxy = new PageFilterProxyModel( m_view );
    m_groupProxy = new PageGroupProxyModel( m_view );
    m_authorProxy  = new AuthorGroupProxyModel( m_view );

    m_filterProxy->setSourceModel( m_model );
    m_groupProxy->setSourceModel( m_filterProxy );
    m_authorProxy->setSourceModel( m_groupProxy );


    m_view->setModel( m_authorProxy );

    m_searchLine = new KTreeViewSearchLine( this, m_view );
    m_searchLine->setCaseSensitivity( Okular::Settings::self()->reviewsSearchCaseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive );
    m_searchLine->setRegularExpression( Okular::Settings::self()->reviewsSearchRegularExpression() );
    connect( m_searchLine, SIGNAL(searchOptionsChanged()), this, SLOT(saveSearchOptions()) );
    vLayout->addWidget( m_searchLine );
    vLayout->addWidget( m_view );
    vLayout->addWidget( toolBar );

    toolBar->setIconSize( QSize( 16, 16 ) );
    toolBar->setMovable( false );
    // - add Page button
    QAction * groupByPageAction = toolBar->addAction( KIcon( "text-x-generic" ), i18n( "Group by Page Hello World!" ) );
    groupByPageAction->setCheckable( true );
    connect( groupByPageAction, SIGNAL(toggled(bool)), this, SLOT(slotPageEnabled(bool)) );
    groupByPageAction->setChecked( Okular::Settings::groupByPage() );
    // - add Author button
    QAction * groupByAuthorAction = toolBar->addAction( KIcon( "user-identity" ), i18n( "Group by Author Hello World!" ) );
    groupByAuthorAction->setCheckable( true );
    connect( groupByAuthorAction, SIGNAL(toggled(bool)), this, SLOT(slotAuthorEnabled(bool)) );
    groupByAuthorAction->setChecked( Okular::Settings::groupByAuthor() );

    // - add separator
    toolBar->addSeparator();
    // - add Current Page Only button
    QAction * curPageOnlyAction = toolBar->addAction( KIcon( "arrow-down" ), i18n( "Show reviews for current page only" ) );
    curPageOnlyAction->setCheckable( true );
    connect( curPageOnlyAction, SIGNAL(toggled(bool)), this, SLOT(slotCurrentPageOnly(bool)) );
    curPageOnlyAction->setChecked( Okular::Settings::currentPageOnly() );

    connect( m_view, SIGNAL(activated(QModelIndex)),
             this, SLOT(activated(QModelIndex)) );

    m_view->setContextMenuPolicy( Qt::CustomContextMenu );
    connect( m_view, SIGNAL(customContextMenuRequested(QPoint)),
             this, SLOT(contextMenuRequested(QPoint)) );

}
Exemple #28
0
void VlcWidget::GenerateToolBar ()
{
    Bar_ = new QToolBar (this);
    OpenButton_ = new QToolButton (Bar_);
    Open_ = new QAction (OpenButton_);
    Open_->setProperty ("ActionIcon", "folder");
    Open_->setToolTip (tr ("Open file"));
    OpenButton_->setMenu (GenerateMenuForOpenAction ());
    OpenButton_->setPopupMode (QToolButton::MenuButtonPopup);
    OpenButton_->setDefaultAction (Open_);
    Bar_->addWidget (OpenButton_);

    Prev_ = Bar_->addAction (tr ("Prev"));
    Prev_->setProperty ("ActionIcon", "media-seek-backward");
    Manager_->RegisterAction ("org.vtyulc.prev", Prev_);

    connect (Prev_,
             SIGNAL (triggered ()),
             PlaylistWidget_,
             SLOT (prev ()));

    TogglePlay_ = Bar_->addAction (tr ("Play"));
    Manager_->RegisterAction ("org.vtyulc.toggle_play", TogglePlay_);
    TogglePlay_->setProperty ("ActionIcon", "media-playback-start");
    TogglePlay_->setProperty ("WatchActionIconChange", true);

    Stop_ = Bar_->addAction (tr ("Stop"));
    Stop_->setProperty ("ActionIcon", "media-playback-stop");

    Next_ = Bar_->addAction (tr ("Next"));
    Next_->setProperty ("ActionIcon", "media-seek-forward");
    Manager_->RegisterAction ("org.vtyulc.next", Next_);

    connect (Next_,
             SIGNAL (triggered ()),
             PlaylistWidget_,
             SLOT (next ()));

    FullScreenAction_ = Bar_->addAction (tr ("Fullscreen"));
    FullScreenAction_->setProperty ("ActionIcon", "view-fullscreen");
    Manager_->RegisterAction ("org.vtyulc.toggle_fullscreen", FullScreenAction_);

    TimeLeft_ = new QLabel (this);
    TimeLeft_->setToolTip (tr ("Time left"));
    Bar_->addWidget (TimeLeft_);
    ScrollBar_ = new VlcScrollBar;
    ScrollBar_->setBaseSize (200, 25);
    QWidget *tmp = new QWidget (this);
    QVBoxLayout *layout = new QVBoxLayout;
    layout->setContentsMargins (2, 2, 2, 2);
    layout->addWidget (ScrollBar_);
    tmp->setLayout (layout);
    QSizePolicy pol;
    pol.setHorizontalStretch (255);
    pol.setHorizontalPolicy (QSizePolicy::Ignored);
    pol.setVerticalPolicy (QSizePolicy::Expanding);
    tmp->setSizePolicy(pol);
    Bar_->addWidget (tmp);
    TimeAll_ = new QLabel;
    TimeAll_->setToolTip (tr ("Length"));
    Bar_->addWidget (TimeAll_);
    SoundWidget_ = new SoundWidget (this, VlcPlayer_->GetPlayer ());
    SoundWidget_->setFixedSize (100, 25);
    SoundWidget_->setToolTip (tr ("Volume"));
    layout = new QVBoxLayout;
    layout->addWidget (SoundWidget_);
    layout->setContentsMargins (2, 2, 2, 2);
    tmp = new QWidget (this);
    tmp->setLayout (layout);
    Bar_->addWidget (tmp);
}
Exemple #29
0
void WAdvancedDlg::SetupLayout()
{
	QSizePolicy szPolicyMaximum;
	szPolicyMaximum.setHorizontalPolicy(QSizePolicy::Maximum);
	szPolicyMaximum.setVerticalPolicy(QSizePolicy::Maximum);

	QSizePolicy szPolicyMinimum;
	szPolicyMinimum.setHorizontalPolicy(QSizePolicy::Minimum);
	szPolicyMinimum.setVerticalPolicy(QSizePolicy::Minimum);




	QGroupBox *AllBox = new QGroupBox(tr("All Analysis"));
	{
		QHBoxLayout *AllLayout = new QHBoxLayout;
		{
			m_pctrlLogFile     = new QCheckBox(tr("View Log File after errors"));
			m_pctrlKeepOutOpps = new QCheckBox(tr("Store points outside the polar mesh"));
			AllLayout->addWidget(m_pctrlLogFile);
			AllLayout->addWidget(m_pctrlKeepOutOpps);
		}
		AllBox->setLayout(AllLayout);
	}

	QGroupBox *VLMPanelBox = new QGroupBox(tr("VLM and Panel Methods"));
	{
		QVBoxLayout *VLMPanelLayout = new QVBoxLayout;
		{
			QHBoxLayout *WingPanelLayout = new QHBoxLayout;
			{
				m_pctrlMinPanelSize = new DoubleEdit(1.00,2);
				m_pctrlLength  = new QLabel("");
				QLabel *lab5 = new QLabel(tr("Ignore wing panels with span <"));
				lab5->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
				WingPanelLayout->addStretch(1);
				WingPanelLayout->addWidget(lab5);
				WingPanelLayout->addWidget(m_pctrlMinPanelSize);
				WingPanelLayout->addWidget(m_pctrlLength);
			}
			QHBoxLayout *CoreSizeLayout = new QHBoxLayout;
			{
				m_pctrlLength2 = new QLabel("");
				m_pctrlCoreSize     = new DoubleEdit(.0001, 4);
				QLabel *lab10 = new QLabel(tr("Core Size"));
				lab10->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
				CoreSizeLayout->addStretch(1);
				CoreSizeLayout->addWidget(lab10);
				CoreSizeLayout->addWidget(m_pctrlCoreSize);
				CoreSizeLayout->addWidget(m_pctrlLength2);
			}
			VLMPanelLayout->addLayout(WingPanelLayout);
			VLMPanelLayout->addLayout(CoreSizeLayout);
		}
		VLMPanelBox->setLayout(VLMPanelLayout);
	}

	QGroupBox *VLMBox = new QGroupBox(tr("VLM Method"));
	{
		QGridLayout *VLMLayout = new QGridLayout;
		{
			m_pctrlVortexPos    = new DoubleEdit(25.0, 2);
			m_pctrlControlPos   = new DoubleEdit(75.0, 2);
			QLabel *lab6 = new QLabel(tr("Vortex Position"));
			QLabel *lab7 = new QLabel(tr("Control Point Position"));
			QLabel *lab8 = new QLabel("%");
			QLabel *lab9 = new QLabel("%");
			lab6->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
			lab7->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
			lab8->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
			lab9->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
			VLMLayout->addWidget(lab6,1,1);
			VLMLayout->addWidget(lab7,2,1);
			VLMLayout->addWidget(m_pctrlVortexPos,1,2);
			VLMLayout->addWidget(m_pctrlControlPos,2,2);
			VLMLayout->addWidget(lab8,1,3);
			VLMLayout->addWidget(lab9,2,3);
		}
		VLMBox->setLayout(VLMLayout);
	}

	QGroupBox *LLTBox = new QGroupBox(tr("Lifting Line Method"));
	{
		QGridLayout *LLTLayout = new QGridLayout;
		{
			m_pctrlNStation     = new IntEdit(20, this);
			m_pctrlRelax        = new DoubleEdit(20,1);
			m_pctrlAlphaPrec    = new DoubleEdit(.01, 4);
			m_pctrlIterMax      = new IntEdit(100, this);
			QLabel *lab1 = new QLabel(tr("Number of spanwise stations"));
			QLabel *lab2 = new QLabel(tr("Relax. factor"));
			QLabel *lab3 = new QLabel(tr("Alpha Precision"));
			QLabel *lab4 = new QLabel(tr("Max. Iterations"));
			lab1->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
			lab2->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
			lab3->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
			lab4->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
			LLTLayout->addWidget(lab1,1,1);
			LLTLayout->addWidget(lab2,2,1);
			LLTLayout->addWidget(lab3,3,1);
			LLTLayout->addWidget(lab4,4,1);
			LLTLayout->addWidget(m_pctrlNStation,1,2);
			LLTLayout->addWidget(m_pctrlRelax,2,2);
			LLTLayout->addWidget(m_pctrlAlphaPrec,3,2);
			LLTLayout->addWidget(m_pctrlIterMax,4,2);
		}
		LLTBox->setLayout(LLTLayout);
	}

	QGroupBox *PanelBCBox = new QGroupBox(tr("3D Panel boundary conditions"));
	{
		QVBoxLayout *PanelBCLayout = new QVBoxLayout;
		{
			m_pctrlDirichlet = new QRadioButton("Dirichlet");
			m_pCtrlNeumann = new QRadioButton("Neumann");
			PanelBCLayout->addWidget(m_pctrlDirichlet);
			PanelBCLayout->addWidget(m_pCtrlNeumann);
		}
		PanelBCBox->setLayout((PanelBCLayout));
	}

	QHBoxLayout *CommandButtons = new QHBoxLayout;
	{
		OKButton = new QPushButton(tr("OK"));
		CancelButton = new QPushButton(tr("Cancel"));
		QPushButton *ResetButton = new QPushButton(tr("Reset Defaults"));
		CommandButtons->addStretch(1);
		CommandButtons->addWidget(OKButton);
		CommandButtons->addStretch(1);
		CommandButtons->addWidget(CancelButton);
		CommandButtons->addStretch(1);
		CommandButtons->addWidget(ResetButton);
		CommandButtons->addStretch(1);
		connect(OKButton, SIGNAL(clicked()),this, SLOT(OnOK()));
		connect(CancelButton, SIGNAL(clicked()), this, SLOT(reject()));
		connect(ResetButton, SIGNAL(clicked()), this, SLOT(OnResetDefaults()));
	}

	QHBoxLayout *BothSides = new QHBoxLayout;
	{
		QVBoxLayout *LeftSide  = new QVBoxLayout;
		{
			LeftSide->addWidget(LLTBox);
			LeftSide->addStretch(1);
			LeftSide->addWidget(PanelBCBox);
			LeftSide->addStretch(1);
		}
		QVBoxLayout *RightSide = new QVBoxLayout;
		{
			RightSide->addWidget(VLMBox);
			RightSide->addStretch(1);
			RightSide->addWidget(VLMPanelBox);
			RightSide->addStretch(1);
		}
		BothSides->addLayout(LeftSide);
		BothSides->addLayout(RightSide);
	}

	QVBoxLayout *MainLayout = new QVBoxLayout;
	{
		MainLayout->addLayout(BothSides);
		MainLayout->addStretch(1);
		MainLayout->addWidget(AllBox);
		MainLayout->addStretch(1);
		MainLayout->addSpacing(30);
		MainLayout->addLayout(CommandButtons);
	}

	setSizePolicy(szPolicyMaximum);

	setLayout(MainLayout);
}
Exemple #30
0
// Convert simple DOM types
QVariant domPropertyToVariant(const DomProperty *p)
{
    // requires non-const virtual nameToIcon, etc.
    switch(p->kind()) {
    case DomProperty::Bool:
        return QVariant(p->elementBool() == QFormBuilderStrings::instance().trueValue);

    case DomProperty::Cstring:
        return QVariant(p->elementCstring().toUtf8());

    case DomProperty::Point: {
        const DomPoint *point = p->elementPoint();
        return QVariant(QPoint(point->elementX(), point->elementY()));
    }

    case DomProperty::PointF: {
        const DomPointF *pointf = p->elementPointF();
        return QVariant(QPointF(pointf->elementX(), pointf->elementY()));
    }

    case DomProperty::Size: {
        const DomSize *size = p->elementSize();
        return QVariant(QSize(size->elementWidth(), size->elementHeight()));
    }

    case DomProperty::SizeF: {
        const DomSizeF *sizef = p->elementSizeF();
        return QVariant(QSizeF(sizef->elementWidth(), sizef->elementHeight()));
    }

    case DomProperty::Rect: {
        const DomRect *rc = p->elementRect();
        const QRect g(rc->elementX(), rc->elementY(), rc->elementWidth(), rc->elementHeight());
        return QVariant(g);
    }

    case DomProperty::RectF: {
        const DomRectF *rcf = p->elementRectF();
        const QRectF g(rcf->elementX(), rcf->elementY(), rcf->elementWidth(), rcf->elementHeight());
        return QVariant(g);
    }

    case DomProperty::String:
        return QVariant(p->elementString()->text());

    case DomProperty::Number:
        return QVariant(p->elementNumber());

    case DomProperty::UInt:
        return QVariant(p->elementUInt());

    case DomProperty::LongLong:
        return QVariant(p->elementLongLong());

    case DomProperty::ULongLong:
        return QVariant(p->elementULongLong());

    case DomProperty::Double:
        return QVariant(p->elementDouble());

    case DomProperty::Char: {
        const DomChar *character = p->elementChar();
        const QChar c(character->elementUnicode());
        return QVariant::fromValue(c);
    }

    case DomProperty::Color: {
        const DomColor *color = p->elementColor();
        QColor c(color->elementRed(), color->elementGreen(), color->elementBlue());
        if (color->hasAttributeAlpha())
            c.setAlpha(color->attributeAlpha());
        return QVariant::fromValue(c);
    }

    case DomProperty::Font: {
        const DomFont *font = p->elementFont();

        QFont f;
        if (font->hasElementFamily() && !font->elementFamily().isEmpty())
            f.setFamily(font->elementFamily());
        if (font->hasElementPointSize() && font->elementPointSize() > 0)
            f.setPointSize(font->elementPointSize());
        if (font->hasElementWeight() && font->elementWeight() > 0)
            f.setWeight(font->elementWeight());
        if (font->hasElementItalic())
            f.setItalic(font->elementItalic());
        if (font->hasElementBold())
            f.setBold(font->elementBold());
        if (font->hasElementUnderline())
            f.setUnderline(font->elementUnderline());
        if (font->hasElementStrikeOut())
            f.setStrikeOut(font->elementStrikeOut());
        if (font->hasElementKerning())
            f.setKerning(font->elementKerning());
        if (font->hasElementAntialiasing())
            f.setStyleStrategy(font->elementAntialiasing() ? QFont::PreferDefault : QFont::NoAntialias);
        if (font->hasElementStyleStrategy()) {
            f.setStyleStrategy(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QFont::StyleStrategy>("styleStrategy", font->elementStyleStrategy().toLatin1()));
        }
        return QVariant::fromValue(f);
    }

    case DomProperty::Date: {
        const DomDate *date = p->elementDate();
        return QVariant(QDate(date->elementYear(), date->elementMonth(), date->elementDay()));
    }

    case DomProperty::Time: {
        const DomTime *t = p->elementTime();
        return QVariant(QTime(t->elementHour(), t->elementMinute(), t->elementSecond()));
    }

    case DomProperty::DateTime: {
        const DomDateTime *dateTime = p->elementDateTime();
        const QDate d(dateTime->elementYear(), dateTime->elementMonth(), dateTime->elementDay());
        const QTime tm(dateTime->elementHour(), dateTime->elementMinute(), dateTime->elementSecond());
        return QVariant(QDateTime(d, tm));
    }

    case DomProperty::Url: {
        const DomUrl *url = p->elementUrl();
        return QVariant(QUrl(url->elementString()->text()));
    }

#ifndef QT_NO_CURSOR
    case DomProperty::Cursor:
        return QVariant::fromValue(QCursor(static_cast<Qt::CursorShape>(p->elementCursor())));

    case DomProperty::CursorShape:
        return QVariant::fromValue(QCursor(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::CursorShape>("cursorShape", p->elementCursorShape().toLatin1())));
#endif

    case DomProperty::Locale: {
        const DomLocale *locale = p->elementLocale();
        return QVariant::fromValue(QLocale(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Language>("language", locale->attributeLanguage().toLatin1()),
                    enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Country>("country", locale->attributeCountry().toLatin1())));
    }
    case DomProperty::SizePolicy: {
        const DomSizePolicy *sizep = p->elementSizePolicy();

        QSizePolicy sizePolicy;
        sizePolicy.setHorizontalStretch(sizep->elementHorStretch());
        sizePolicy.setVerticalStretch(sizep->elementVerStretch());

        const QMetaEnum sizeType_enum = metaEnum<QAbstractFormBuilderGadget>("sizeType");

        if (sizep->hasElementHSizeType()) {
            sizePolicy.setHorizontalPolicy((QSizePolicy::Policy) sizep->elementHSizeType());
        } else if (sizep->hasAttributeHSizeType()) {
            const QSizePolicy::Policy sp = enumKeyToValue<QSizePolicy::Policy>(sizeType_enum, sizep->attributeHSizeType().toLatin1());
            sizePolicy.setHorizontalPolicy(sp);
        }

        if (sizep->hasElementVSizeType()) {
            sizePolicy.setVerticalPolicy((QSizePolicy::Policy) sizep->elementVSizeType());
        } else if (sizep->hasAttributeVSizeType()) {
            const  QSizePolicy::Policy sp = enumKeyToValue<QSizePolicy::Policy>(sizeType_enum, sizep->attributeVSizeType().toLatin1());
            sizePolicy.setVerticalPolicy(sp);
        }

        return QVariant::fromValue(sizePolicy);
    }

    case DomProperty::StringList:
        return QVariant(p->elementStringList()->elementString());

    default:
        uiLibWarning(QCoreApplication::translate("QFormBuilder", "Reading properties of the type %1 is not supported yet.").arg(p->kind()));
        break;
    }

    return QVariant();
}