Beispiel #1
0
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;
}
Beispiel #2
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);
}
Beispiel #3
0
MyInputDialog::MyInputDialog(const char * title, const QString & msg,
                             const QStringList & list, const QString & init,
                             bool existing)
    : QDialog(0/*, title, TRUE*/), le(0)
{
    setWindowTitle(title);
    move(QCursor::pos());

    QVBoxLayout * vbox = new QVBoxLayout(this);
    QHBoxLayout * hbox;

    vbox->setMargin(5);

    hbox = new QHBoxLayout();
    vbox->addLayout(hbox);
    hbox->setMargin(5);
    hbox->addWidget(new QLabel(msg, this));
    cb = new QComboBox(this);
    cb->setEditable(!existing);

    if (! existing)
        cb->addItem(init);

    cb->addItems(list);

    if (! existing) {
        cb->setCurrentIndex(0);
        cb->setAutoCompletion(completion());
    }

    hbox->addWidget(cb);

    QSizePolicy sp = cb->sizePolicy();

    sp.setHorizontalPolicy(QSizePolicy::Expanding);
    cb->setSizePolicy(sp);

    QFontMetrics fm(QApplication::font());

    cb->setMinimumWidth(fm.width("azertyuiopqsdfghjklm"));

    hbox = new QHBoxLayout();
    vbox->addLayout(hbox);
    hbox->setMargin(5);
    QPushButton * ok = new QPushButton(tr("&OK"), this);
    QPushButton * cancel = new QPushButton(tr("&Cancel"), this);
    QSize bs(cancel->sizeHint());

    ok->setDefault(TRUE);
    ok->setFixedSize(bs);
    cancel->setFixedSize(bs);

    hbox->addWidget(ok);
    hbox->addWidget(cancel);

    connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
    connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));

    cb->setFocus();
}
Beispiel #4
0
void GLSLTextEditorWidget::createToolBar(GLSLEditorEditable *editable)
{
    m_outlineCombo = new QComboBox;
    m_outlineCombo->setMinimumContentsLength(22);

    // ### m_outlineCombo->setModel(m_outlineModel);

    QTreeView *treeView = new QTreeView;
    treeView->header()->hide();
    treeView->setItemsExpandable(false);
    treeView->setRootIsDecorated(false);
    m_outlineCombo->setView(treeView);
    treeView->expandAll();

    //m_outlineCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);

    // Make the combo box prefer to expand
    QSizePolicy policy = m_outlineCombo->sizePolicy();
    policy.setHorizontalPolicy(QSizePolicy::Expanding);
    m_outlineCombo->setSizePolicy(policy);

    QToolBar *toolBar = static_cast<QToolBar*>(editable->toolBar());

    QList<QAction*> actions = toolBar->actions();
    toolBar->insertWidget(actions.first(), m_outlineCombo);
}
Beispiel #5
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::);
}
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());
  }
}
Beispiel #7
0
Tab::Tab(QWidget* parent):
    QWidget(parent),
    m_Page(new Page(this))
{
    QSizePolicy sp;
    sp.setHorizontalPolicy(QSizePolicy::Maximum);

    m_Page->headersArea().get()->setFixedHeight(70);
    m_Page->linksArea().get()->setFixedHeight(100);
    //m_Page->headersArea().get()->setSizePolicy(sp);
    //m_Page->headersArea().get()->setSizeAdjustPolicy();

    m_Page->headersArea().get()->setReadOnly(true);
    m_Page->linksArea().get()->setReadOnly(true);
    m_Page->bodyArea().get()->setReadOnly(true);

    m_VertLayout.reset(new QVBoxLayout(this));
    m_VertLayout->addWidget(m_Page->headersArea().get());
    m_VertLayout->addWidget(m_Page->linksArea().get());
    m_VertLayout->addWidget(m_Page->bodyArea().get());

    setLayout(m_VertLayout.get());

    QObject::connect(this, SIGNAL(needReloadPage()), this, SLOT(reloadPage()));
}
Beispiel #8
0
void tst_QLayout::smartMaxSize()
{
    QVector<int> expectedWidths;

    QFile f(QFINDTESTDATA("baseline/smartmaxsize"));

    QCOMPARE(f.open(QIODevice::ReadOnly | QIODevice::Text), true);

    QTextStream stream(&f);

    while(!stream.atEnd()) {
        QString line = stream.readLine(200);
        expectedWidths.append(line.section(QLatin1Char(' '), 6, -1, QString::SectionSkipEmpty).toInt());
    }
    f.close();

    int sizeCombinations[] = { 0, 10, 20, QWIDGETSIZE_MAX};
    QSizePolicy::Policy policies[] = {  QSizePolicy::Fixed,
                                        QSizePolicy::Minimum,
                                        QSizePolicy::Maximum,
                                        QSizePolicy::Preferred,
                                        QSizePolicy::Expanding,
                                        QSizePolicy::MinimumExpanding,
                                        QSizePolicy::Ignored
                                        };
    Qt::Alignment alignments[] = {  0,
                                    Qt::AlignLeft,
                                    Qt::AlignRight,
                                    Qt::AlignHCenter
                                    };

    int expectedIndex = 0;
    int regressionCount = 0;
    for (size_t p = 0; p < sizeof(policies)/sizeof(QSizePolicy::Policy); ++p) {
        QSizePolicy sizePolicy;
        sizePolicy.setHorizontalPolicy(policies[p]);
        for (size_t min = 0; min < sizeof(sizeCombinations)/sizeof(int); ++min) {
            int minSize = sizeCombinations[min];
            for (size_t max = 0; max < sizeof(sizeCombinations)/sizeof(int); ++max) {
                int maxSize = sizeCombinations[max];
                for (size_t sh = 0; sh < sizeof(sizeCombinations)/sizeof(int); ++sh) {
                    int sizeHint = sizeCombinations[sh];
                    for (size_t a = 0; a < sizeof(alignments)/sizeof(int); ++a) {
                        Qt::Alignment align = alignments[a];
                        QSize sz = qSmartMaxSize(QSize(sizeHint, 1), QSize(minSize, 1), QSize(maxSize, 1), sizePolicy, align);
                        int width = sz.width();
                        int expectedWidth = expectedWidths[expectedIndex];
                        if (width != expectedWidth) {
                            qDebug() << "error at index" << expectedIndex << ":" << sizePolicy.horizontalPolicy() << align << minSize << sizeHint << maxSize << width;
                            ++regressionCount;
                        }
                        ++expectedIndex;
                    }
                }
            }
        }
    }
    QCOMPARE(regressionCount, 0);
}
Beispiel #9
0
void ComponentDialog::init_uml_tab()
{
    bool visit = !hasOkButton();

    BrowserComponent * bn = (BrowserComponent *) data->get_browser_node();
    VVBox * vbox;
    GridBox * grid = new GridBox(2, this);

    umltab = grid;
    grid->setMargin(5);
    grid->setSpacing(5);

    grid->addWidget(new QLabel(tr("name : "), grid));
    grid->addWidget(edname = new LineEdit(bn->get_name(), grid));
    edname->setReadOnly(visit);

    grid->addWidget(new QLabel(tr("stereotype : "), grid));
    grid->addWidget(edstereotype = new QComboBox(grid));
    edstereotype->setEditable(true);
    edstereotype->addItem(toUnicode(data->get_stereotype()));

    if (! visit) {
        edstereotype->addItems(BrowserComponent::default_stereotypes());
        edstereotype->addItems(ProfiledStereotypes::defaults(UmlComponent));
        edstereotype->setAutoCompletion(completion());
    }

    edstereotype->setCurrentIndex(0);
    QSizePolicy sp = edstereotype->sizePolicy();
    sp.setHorizontalPolicy(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    grid->addWidget(vbox = new VVBox(grid));
    vbox->addWidget(new QLabel(tr("description :"), vbox));

    if (! visit)
    {
        SmallPushButton* sButton;
        connect(sButton = new SmallPushButton(tr("Editor"), vbox), SIGNAL(clicked()),
                this, SLOT(edit_description()));
        vbox->addWidget(sButton);
    }

    grid->addWidget(comment = new MultiLineEdit(grid));
    comment->setReadOnly(visit);
    comment->setText(bn->get_comment());
    QFont font = comment->font();

    if (! hasCodec())
        font.setFamily("Courier");

    font.setFixedPitch(TRUE);
    comment->setFont(font);

    addTab(grid, "Uml");
}
Beispiel #10
0
void ComponentDialog::init_l_tab(VVBox *& page, QComboBox *& stereotypefilter,
                                 void (ComponentDialog::* filteractivated)(const QString & st),
                                 const char * slt,
                                 const char * add_slt, const char * remove_slt,
                                 QListWidget *& lb_available, QListWidget *& lb,
                                 const QList<BrowserClass *> & cls,
                                 QString lbl)
{
    bool visit = !hasOkButton();
    HHBox * hbox;
    VVBox * vbox;
    QPushButton * button;
        QLabel* label;
    page = new VVBox(this);

    if (!visit) {
        page->addWidget(hbox = new HHBox(page));
        hbox->setMargin(5);
        hbox->addWidget(new QLabel(tr("Stereotype filtering  "), hbox));
        hbox->addWidget(stereotypefilter = new QComboBox(hbox));
        stereotypefilter->setEditable(true);
        stereotypefilter->setAutoCompletion(completion());
        stereotypefilter->addItem("");
        stereotypefilter->addItems(BrowserClass::default_stereotypes());
        stereotypefilter->addItems(ProfiledStereotypes::defaults(UmlComponent));
        stereotypefilter->setCurrentIndex(0);
        QSizePolicy sp = stereotypefilter->sizePolicy();
        sp.setHorizontalPolicy(QSizePolicy::Expanding);
        stereotypefilter->setSizePolicy(sp);
        connect(stereotypefilter, SIGNAL(activated(const QString &)),
                this, slt);

        page->addWidget(hbox = new HHBox(page));
        hbox->addWidget(vbox = new VVBox(hbox));
        vbox->setMargin(5);
        (label = new QLabel(tr("Available classes"), vbox))->setAlignment(Qt::AlignCenter);
        vbox->addWidget(label);
        vbox->addWidget(lb_available = new QListWidget(vbox));
        lb_available->setSelectionMode(QListWidget::MultiSelection);

        hbox->addWidget(vbox = new VVBox(hbox));
        vbox->setMargin(5);
        (label = new QLabel("", vbox))->setScaledContents(TRUE);
        vbox->addWidget(label);
        vbox->addWidget(button = new QPushButton(vbox));
        button->setIcon(*rightPixmap);
        connect(button, SIGNAL(clicked()), this, add_slt);
        (label = new QLabel("", vbox))->setScaledContents(TRUE);
        vbox->addWidget(label);
        vbox->addWidget(button = new QPushButton(vbox));
        button->setIcon(*leftPixmap);
        connect(button, SIGNAL(clicked()), this, remove_slt);
        (label = new QLabel("", vbox))->setScaledContents(TRUE);
        vbox->addWidget(label);
        hbox->addWidget(vbox = new VVBox(hbox));
    }
/*!
    Sets the \a widget to show below the progress bar.
    This will be destroyed when the progress indicator is destroyed.
    Default is to show no widget below the progress indicator.
*/
void FutureProgress::setWidget(QWidget *widget)
{
    delete d->m_widget;
    QSizePolicy sp = widget->sizePolicy();
    sp.setHorizontalPolicy(QSizePolicy::Ignored);
    widget->setSizePolicy(sp);
    d->m_widget = widget;
    if (d->m_widget)
        d->m_widgetLayout->addWidget(d->m_widget);
}
void TFutureProgress::SetWidget(QWidget *Widget)
   {
      Q_D(TFutureProgress);
      delete d->Widget;
      QSizePolicy sp = Widget->sizePolicy();
      sp.setHorizontalPolicy(QSizePolicy::Ignored);
      Widget->setSizePolicy(sp);
      d->Widget = Widget;
      if(d->Widget)
         d->WidgetLayout->addWidget(d->Widget);
   }
VcsBaseDiffEditor::VcsBaseDiffEditor(VcsBaseEditorWidget *w, const VcsBaseEditorParameters *type) :
    VcsBaseEditor(w, type),
    m_diffFileBrowseComboBox(new QComboBox)
{
    m_diffFileBrowseComboBox->setMinimumContentsLength(20);
    // Make the combo box prefer to expand
    QSizePolicy policy = m_diffFileBrowseComboBox->sizePolicy();
    policy.setHorizontalPolicy(QSizePolicy::Expanding);
    m_diffFileBrowseComboBox->setSizePolicy(policy);

    insertExtraToolBarWidget(Left, m_diffFileBrowseComboBox);
}
Beispiel #14
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);
    }
}
Beispiel #16
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);
}
Beispiel #17
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 *)));
}
DlangTextEditorOutline::DlangTextEditorOutline(DlangTextEditorWidget *editorWidget)
    : QWidget(editorWidget), m_editorWidget(editorWidget)
{
    m_combo = new ::Utils::TreeViewComboBox(this);
    m_combo->setModel(m_editorWidget->outline());

    m_combo->setMinimumContentsLength(22);
    QSizePolicy policy = this->sizePolicy();
    policy.setHorizontalPolicy(QSizePolicy::Expanding);
    this->setSizePolicy(policy);

    connect(editorWidget->outline(), SIGNAL(modelUpdated()), this, SLOT(update()));
    connect(m_editorWidget, SIGNAL(cursorPositionChanged()), this, SLOT(updateSelectionInCombo()));
    connect(m_combo, SIGNAL(activated(int)), this, SLOT(onItemActivated()));

    update();
}
Beispiel #20
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();
  }
}
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();
}
Beispiel #23
0
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();

}
Beispiel #25
0
WListItem::WListItem(const QString &city, const QString &state, const QString &id, QListWidget *citiesList)
    : m_id(id), m_name(city), m_state(state)
{
	QString title = QString::fromLatin1("%1<br>%2")
	        .arg(Qt::escape(city), Qt::escape(state));
	m_label = new QLabel(title, this);
	QSizePolicy policy = m_label->sizePolicy();
	policy.setHorizontalPolicy(QSizePolicy::MinimumExpanding);
	m_label->setSizePolicy(policy);
	m_button = new QPushButton(tr("Remove"), this);
	m_button->setIcon(qutim_sdk_0_3::Icon(QLatin1String("list-remove")));
	connect(m_button, SIGNAL(clicked(bool)), this, SIGNAL(buttonClicked()));
	
	QHBoxLayout *layout = new QHBoxLayout(this);
	layout->addWidget(m_label);
	layout->addWidget(m_button);

	m_item = new QListWidgetItem(citiesList);
	m_item->setData(Qt::UserRole, qVariantFromValue(Guard(this)));
	m_item->setData(Qt::SizeHintRole, sizeHint());
	citiesList->setItemWidget(m_item, this);
}
Beispiel #26
0
void GLSLTextEditorWidget::createToolBar(GLSLEditorEditable *editor)
{
    m_outlineCombo = new QComboBox;
    m_outlineCombo->setMinimumContentsLength(22);

    // ### m_outlineCombo->setModel(m_outlineModel);

    QTreeView *treeView = new QTreeView;
    treeView->header()->hide();
    treeView->setItemsExpandable(false);
    treeView->setRootIsDecorated(false);
    m_outlineCombo->setView(treeView);
    treeView->expandAll();

    //m_outlineCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);

    // Make the combo box prefer to expand
    QSizePolicy policy = m_outlineCombo->sizePolicy();
    policy.setHorizontalPolicy(QSizePolicy::Expanding);
    m_outlineCombo->setSizePolicy(policy);

    editor->insertExtraToolBarWidget(TextEditor::BaseTextEditor::Left, m_outlineCombo);
}
LuaEditorWidget::LuaEditorWidget()
	: m_outlineCombo(new QComboBox)
{
	m_updateDocumentTimer.setInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
	m_updateDocumentTimer.setSingleShot(true);
	connect(&m_updateDocumentTimer, QTimer::timeout, this, LuaEditorWidget::updateDocument);
	connect(this, QPlainTextEdit::textChanged, [this](){m_updateDocumentTimer.start();});
	
	m_outlineCombo->setMinimumContentsLength(22);
	
	QTreeView* treeView = new QTreeView;
	treeView->header()->hide();
	treeView->setItemsExpandable(false);
	treeView->setRootIsDecorated(false);
		m_outlineCombo->setView(treeView);
	treeView->expandAll();
	
	QSizePolicy policy = m_outlineCombo->sizePolicy();
	policy.setHorizontalPolicy(QSizePolicy::Expanding);
	m_outlineCombo->setSizePolicy(policy);
	
	insertExtraToolBarWidget(TextEditorWidget::Left, m_outlineCombo);
}
Beispiel #28
0
ServicesList :: ServicesList (QWidget *parent_p)
: QListWidget (parent_p)
{
  sl_stacked_widgets_p = new QStackedWidget (this);
  sl_services_p = new QListWidget (this);

  connect (sl_services_p, &QAbstractItemView :: clicked, this, &ServicesList :: SetCurrentService);
  connect (sl_services_p, &QAbstractItemView :: doubleClicked, this, &ServicesList :: ToggleServiceRunStatus);
  connect (sl_services_p, &QListWidget :: itemChanged, this, &ServicesList :: CheckServiceRunStatus);

  QGroupBox *box_p = new QGroupBox (tr ("Services"));
  box_p -> setAlignment (Qt :: AlignRight);
  QHBoxLayout *services_layout_p = new QHBoxLayout;

  services_layout_p -> addWidget (sl_services_p);
  box_p -> setLayout (services_layout_p);


	QHBoxLayout *layout_p = new QHBoxLayout;

	/*
	layout_p -> addWidget (box_p);
	layout_p -> addWidget (sl_stacked_widgets_p);
	*/

	QSplitter *splitter_p = new QSplitter (this);
	splitter_p -> setHandleWidth (2);
	splitter_p -> addWidget (box_p);
	splitter_p -> addWidget (sl_stacked_widgets_p);
	layout_p -> addWidget (splitter_p);

  setLayout (layout_p);

	QSizePolicy p;
	p.setHorizontalPolicy (QSizePolicy :: MinimumExpanding);
	sl_services_p -> setSizePolicy (p);
}
Beispiel #29
0
EventView::EventView( QToolBar* toolBar, QWidget* parent )
    : QWidget( parent )
    , m_model( 0 )
    , m_actionNewEvent( this )
    , m_actionEditEvent( this )
    , m_actionDeleteEvent( this )
    , m_actionCreateTimeSheet( this )
    , m_comboBox( new QComboBox( this ) )
    , m_labelTotal( new QLabel( this ) )
    , m_listView( new QListView( this ) )
{
    QVBoxLayout* layout = new QVBoxLayout( this );
    layout->setContentsMargins( 0, 0, 0, 0 );
    layout->addWidget( m_listView );

    m_listView->setAlternatingRowColors( true );
    m_listView->setContextMenuPolicy( Qt::CustomContextMenu );
    connect( m_listView,
             SIGNAL( customContextMenuRequested( const QPoint& ) ),
             SLOT( slotContextMenuRequested( const QPoint& ) ) );
    connect( m_listView,
             SIGNAL( doubleClicked( const QModelIndex& ) ),
             SLOT( slotEventDoubleClicked( const QModelIndex& ) ) );
    connect( &m_actionNewEvent, SIGNAL( triggered() ),
             SLOT( slotNewEvent() ) );
    connect( &m_actionEditEvent, SIGNAL( triggered() ),
             SLOT( slotEditEvent() ) );
    connect( &m_actionDeleteEvent, SIGNAL( triggered() ),
             SLOT( slotDeleteEvent() ) );
    connect( &m_actionCreateTimeSheet, SIGNAL( triggered() ),
             SLOT( slotCreateTimeSheet() ) );
//     connect( &m_commitTimer, SIGNAL( timeout() ),
//              SLOT( slotCommitTimeout() ) );
//     m_commitTimer.setSingleShot( true );


    m_actionNewEvent.setText( tr( "New Event..." ) );
    m_actionNewEvent.setToolTip( tr( "Create a new Event" ) );
    m_actionNewEvent.setIcon( Data::newTaskIcon() );
    m_actionNewEvent.setShortcut( QKeySequence::New );
    toolBar->addAction( &m_actionNewEvent );

    m_actionEditEvent.setText( tr( "Edit Event...") );
    m_actionEditEvent.setShortcut( Qt::CTRL + Qt::Key_E );
    m_actionEditEvent.setIcon( Data::editEventIcon() );
    toolBar->addAction( &m_actionEditEvent );

    m_actionDeleteEvent.setText( tr( "Delete Event..." ) );
    QList<QKeySequence> deleteShortcuts;
    deleteShortcuts << QKeySequence::Delete;
#ifdef Q_WS_MAC
    deleteShortcuts << Qt::Key_Backspace;
#endif
    m_actionDeleteEvent.setShortcuts(deleteShortcuts);
    m_actionDeleteEvent.setIcon( Data::deleteTaskIcon() );
    toolBar->addAction( &m_actionDeleteEvent );

    m_actionCreateTimeSheet.setText( tr( "Time Sheet..." ) );
    m_actionCreateTimeSheet.setToolTip( tr( "Create a Time Sheet for this time period " ) );
    m_actionCreateTimeSheet.setIcon( Data::createReportIcon() );
    toolBar->addAction( &m_actionCreateTimeSheet );

    // disable all actions, action state will be set when the current
    // item changes:
    m_actionNewEvent.setEnabled( true ); // always on
    m_actionEditEvent.setEnabled( false );
    m_actionDeleteEvent.setEnabled( false );

    toolBar->addWidget( new QLabel( tr( "See events from:" ) , this ) );

    toolBar->addWidget( m_comboBox );
    connect( m_comboBox, SIGNAL( currentIndexChanged( int ) ),
             SLOT( timeFrameChanged( int ) ) );

    QWidget *spacer = new QWidget( this );
    QSizePolicy spacerSizePolicy = spacer->sizePolicy();
    spacerSizePolicy.setHorizontalPolicy( QSizePolicy::Expanding );
    spacer->setSizePolicy( spacerSizePolicy );
    toolBar->addWidget( spacer );

    toolBar->addWidget( m_labelTotal );

    QTimer::singleShot( 0, this, SLOT( delayedInitialization() ) );

    // I hate doing this but the stupid default view sizeHints suck badly.
    setMinimumHeight( 200 );
}
Beispiel #30
0
StateDialog::StateDialog(StateData * d)
    : TabDialog(0, 0, FALSE, Qt::WA_DeleteOnClose), state(d)
{
    d->browser_node->edit_start();

    if (d->browser_node->is_writable()) {
        setOkButton(tr("OK"));
        setCancelButton(tr("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(tr("Close"));
    }

    setWindowTitle(tr("State dialog"));
    visit = !hasOkButton();

    BrowserNode * bn = state->browser_node;
    GridBox * grid;

    //
    // general tab
    //

    grid = new GridBox(2, this);
    umltab = grid;
    grid->setMargin(5);
    grid->setSpacing(5);

    grid->addWidget(new QLabel(tr("name : "), grid));
    grid->addWidget(edname = new LineEdit(bn->get_name(), grid));
    edname->setReadOnly(visit);

    grid->addWidget(new QLabel(tr("stereotype : "), grid));
    grid->addWidget(edstereotype = new QComboBox( grid));
    edstereotype->setEditable(!visit);
    edstereotype->addItem(toUnicode(state->get_stereotype()));

    if (!visit) {
        edstereotype->addItems(BrowserState::default_stereotypes());
        edstereotype->addItems(ProfiledStereotypes::defaults(UmlState));
        edstereotype->setAutoCompletion(completion());
    }

    edstereotype->setCurrentIndex(0);
    QSizePolicy sp = edstereotype->sizePolicy();
    sp.setHorizontalPolicy(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);
    SmallPushButton* sButton;
    connect(sButton = new SmallPushButton(tr("specification :"), grid), SIGNAL(clicked()),
            this, SLOT(menu_specification()));
    grid->addWidget(sButton);
    grid->addWidget(edspecification = new QComboBox(grid));
    edspecification->setSizePolicy(sp);

    if (visit) {
        if (state->get_specification() == 0)
            edspecification->addItem("");
        else
            edspecification->addItem(state->get_specification()->full_name(TRUE));
    }
    else {
        edspecification->addItem("");
        edspecification->setAutoCompletion(completion());
        BrowserOperation::instances(opers);
        opers.full_names(speclist);
        edspecification->addItems(speclist);
        edspecification->setCurrentIndex((state->get_specification() == 0)
                                         ? 0
                                         : opers.indexOf(state->get_specification()) + 1);
    }

    switch (((BrowserNode *) bn->parent())->get_type()) {
    case UmlState:
    case UmlRegion:
        if ((state->get_reference() != 0) || (bn->firstChild() == 0)) {
            connect(sButton = new SmallPushButton(tr("reference :"), grid), SIGNAL(clicked()),
                    this, SLOT(menu_reference()));
            grid->addWidget(sButton);
            grid->addWidget(edreference = new QComboBox(grid));
            edreference->setSizePolicy(sp);

            if (visit) {
                if (state->get_reference() == 0)
                    edreference->addItem("");
                else
                    edreference->addItem(state->get_reference()->full_name(TRUE));
            }
            else {
                edreference->addItem("");
                edreference->setAutoCompletion(completion());

                if (((BrowserState *) bn)->can_reference()) {
                    BrowserState::instances(states, TRUE);

                    QMutableListIterator<BrowserNode *> it(states);

                    while (it.hasNext()) {
                        BrowserState *state = (BrowserState *)it.next();
                        if (!((BrowserState *) bn)->can_reference(state) ||
                                state->is_ref()) {
                            it.remove();
                        }
                    }
                }
                else
                    states.append(state->get_reference());

                states.full_names(reflist);
                edreference->addItems(reflist);
                edreference->setCurrentIndex((state->get_reference() == 0)
                                             ? 0
                                             : states.indexOf(state->get_reference()) + 1);

                connect(edreference, SIGNAL(activated(int)), this, SLOT(ed_ref_activated(int)));
            }

            break;
        }

        // no break
    default:
        edreference = 0;
    }