Beispiel #1
0
bool VibesScene2D::setDimY(int dimY)
{
    if (dimY>=0 && dimY<nbDim() && dimY!=this->dimY() && dimY!=dimX())
    {
        _dimY = dimY;
        emit changedDimY(dimY);
        emit dimensionsChanged();
        updateDims();
        return true;
    } else {
        // Notify that invalid change has been refused
        if (dimY != this->dimY()) { emit changedDimY(this->dimY()); emit dimensionsChanged(); }
        return false;
    }
}
Beispiel #2
0
void Content::setDimensions(int width, int height)
{
    width_ = width;
    height_ = height;

    emit(dimensionsChanged(width_, height_));
}
Beispiel #3
0
void VolumeResample::keepVoxelRatioChanged() {
    if (blockSignals_)
        return;

    if (keepVoxelRatio_.get())
        dimensionsChanged(0);
}
LabelItemDialog::LabelItemDialog(LabelItem *item, QWidget *parent)
    : ViewItemDialog(item, parent), _labelItem(item) {

  _propertiesTab = new LabelPropertiesTab(this);
  DialogPage *propertiesPage = new DialogPage(this);
  propertiesPage->setPageTitle(tr("Properties"));
  propertiesPage->addDialogTab(_propertiesTab);
  addDialogPage(propertiesPage);
  selectDialogPage(propertiesPage);
  connect(_propertiesTab, SIGNAL(apply()), this, SLOT(propertiesChanged()));

  setupProperties();
  _saveAsDefault->show();

  _labelDimensionsTab = new LabelDimensionsTab(item, this);

  DialogPage *labelDimensionsPage = new DialogPage(this);
  labelDimensionsPage->setPageTitle(tr("Size/Position"));
  labelDimensionsPage->addDialogTab(_labelDimensionsTab);
  addDialogPage(labelDimensionsPage);
  selectDialogPage(labelDimensionsPage);

  connect(_labelDimensionsTab, SIGNAL(apply()), this, SLOT(dimensionsChanged()));

  setupDimensions();

  connect(_labelDimensionsTab, SIGNAL(tabModified()), this, SLOT(modified()));
  connect(_saveAsDefault, SIGNAL(clicked()), this, SLOT(modified()));

}
Beispiel #5
0
void ViewmdaModel::setD3(int d) {
	if (m_d3==d) return;
	if (m_d1==d) m_d1=m_d3;
	if (m_d2==d) m_d2=m_d3;
	m_d3=d;
	reset_selections();
	emit dimensionsChanged();
}
Beispiel #6
0
Figure2D::Figure2D(QWidget *parent) :
    QGraphicsView(parent),
    lbProjX(new QLabel("xlabelhere",this)),
    lbProjY(new QLabel("ylabelhere",this))
{
    setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);

    // Create a new scene
    setScene(new VibesScene2D(this));
    this->scale(1.0, -1.0);
    this->show();
    setDragMode(ScrollHandDrag);
    // Force full viewport update (avoid problems with axes)
    setViewportUpdateMode(FullViewportUpdate);
    // Never show the scrollbars
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    // Keep the view centered when resizing window
    setResizeAnchor(AnchorViewCenter);

    lbProjX->setAlignment(Qt::AlignRight);
    lbProjX->move(width()-50, 0);
    lbProjX->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored);
    lbProjX->resize(100, 20);
    lbProjX->installEventFilter(this);
    lbProjX->show();

    lbProjY->move(5, 15);
    lbProjY->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored);
    lbProjY->resize(100, 20);
    lbProjY->installEventFilter(this);
    lbProjY->show();

    cbProjX = new QComboBox(lbProjX);
    cbProjX->setMaximumSize(lbProjX->size());
    connect(cbProjX, SIGNAL(currentTextChanged(QString)), lbProjX, SLOT(setText(QString)));
    connect(cbProjX, SIGNAL(currentIndexChanged(QString)), lbProjX, SLOT(setText(QString)));
    for (int i=0; i<3; ++i)
        cbProjX->addItem(QString("x: dim %1").arg(i), i);
    cbProjX->setCurrentIndex(scene()->dimX());
    //cbProjX->installEventFilter(this);
    connect(cbProjX, SIGNAL(currentIndexChanged(int)), scene(), SLOT(setDimX(int)));
    connect(scene(), SIGNAL(changedDimX(int)), cbProjX, SLOT(setCurrentIndex(int)));

    cbProjY = new QComboBox(lbProjY);
    cbProjY->setMaximumSize(lbProjY->size());
    connect(cbProjY, SIGNAL(currentTextChanged(QString)), lbProjY, SLOT(setText(QString)));
    connect(cbProjY, SIGNAL(currentIndexChanged(QString)), lbProjY, SLOT(setText(QString)));
    for (int i=0; i<3; ++i)
        cbProjY->addItem(QString("y: dim %1").arg(i), i);
    cbProjY->setCurrentIndex(scene()->dimY());
    //cbProjY->installEventFilter(this);
    connect(cbProjY, SIGNAL(currentIndexChanged(int)), scene(), SLOT(setDimY(int)));
    connect(scene(), SIGNAL(changedDimY(int)), cbProjY, SLOT(setCurrentIndex(int)));

    connect(scene(), SIGNAL(dimensionsChanged()), this, SLOT(refreshProjectionSelectors()));
}
void ViewmdaWidget1D::setModel(ViewmdaModel *M) {
	m_model=M;
	
	connect(m_model,SIGNAL(arrayChanged()),this,SLOT(slot_update_plot()));
	connect(m_model,SIGNAL(dimensionsChanged()),this,SLOT(slot_update_plot()));
	connect(m_model,SIGNAL(currentIndexChanged()),this,SLOT(slot_update_plot()));
	connect(m_model,SIGNAL(currentSliceChanged()),this,SLOT(slot_update_plot()));
	connect(m_model,SIGNAL(selectedPointsChanged()),this,SLOT(slot_update_plot()));
	connect(m_model,SIGNAL(selectedRectChanged()),this,SLOT(slot_update_plot()));
	connect(m_model,SIGNAL(zoomRectChanged()),this,SLOT(slot_update_plot()));
	connect(m_model,SIGNAL(windowsChanged()),this,SLOT(slot_update_plot()));
}
Beispiel #8
0
CircleItemDialog::CircleItemDialog(CircleItem *item, QWidget *parent)
  : ViewItemDialog(item, parent), _viewItem(item) {

  _circleDimensionsTab = new CircleDimensionsTab(item, this);

  DialogPage *circleDimensionsPage = new DialogPage(this);
  circleDimensionsPage->setPageTitle(tr("Size/Position"));
  circleDimensionsPage->addDialogTab(_circleDimensionsTab);
  addDialogPage(circleDimensionsPage);
  selectDialogPage(circleDimensionsPage);

  connect(_circleDimensionsTab, SIGNAL(apply()), this, SLOT(dimensionsChanged()));

  setupDimensions();

  connect(_circleDimensionsTab, SIGNAL(tabModified()), this, SLOT(modified()));

}
bool ResizeAwareQuickWidget::setupQmlSource(const QUrl &url)
{
    setSource(url);

    // Set the pixels in the corners to the MainWindow's background color.
    // FIXME/TODO: too bad that this doesn't really work when that color
    // happens to be a gradient, like in Linux' KDE5...
    QPalette myPalette = QApplication::palette(this);
    QColor myBackgroundColor = myPalette.color(QPalette::Window);
    setClearColor(myBackgroundColor);

    if (status() == QQuickWidget::Error)
        return false;

    theGameViewPtr = qobject_cast<ViewWorldItem*>(rootObject()->findChild<QQuickItem*>("gameView"));
    assert(nullptr != theGameViewPtr);
    if (nullptr == theGameViewPtr) {
        return false;
    }
    connect(theGameViewPtr, SIGNAL(dimensionsChanged(qreal, qreal)), this, SLOT(updateWorldSize(qreal,qreal)));

    return true;
}
Beispiel #10
0
static int
brl_construct (BrailleDisplay *brl, char **parameters, const char *device) {
  if (!allocateCommandDescriptors()) return 0;

  inputLength = 0;
  inputStart = 0;
  inputEnd = 0;
  outputLength = 0;

  if (isQualifiedDevice(&device, "client")) {
    static const ModeEntry clientModeEntry = {
#ifdef AF_LOCAL
      requestLocalConnection,
#endif /* AF_LOCAL */

#ifdef __MINGW32__
      requestNamedPipeConnection,
#endif /* __MINGW32__ */

      requestInetConnection
    };
    mode = &clientModeEntry;
  } else if (isQualifiedDevice(&device, "server")) {
    static const ModeEntry serverModeEntry = {
#ifdef AF_LOCAL
      acceptLocalConnection,
#endif /* AF_LOCAL */

#ifdef __MINGW32__
      acceptNamedPipeConnection,
#endif /* __MINGW32__ */

      acceptInetConnection
    };
    mode = &serverModeEntry;
  } else {
    unsupportedDevice(device);
    goto failed;
  }
  if (!*device) device = VR_DEFAULT_SOCKET;

#ifdef AF_LOCAL
  if (device[0] == '/') {
    struct sockaddr_un address;
    if (setLocalAddress(device, &address)) {
      fileDescriptor = mode->getLocalConnection(&address);
    }
  } else
#endif /* AF_LOCAL */

#ifdef __MINGW32__
  if (device[0] == '\\') {
    fileDescriptor = mode->getNamedPipeConnection(device);
  } else {
    static WSADATA wsadata;
    if (WSAStartup(MAKEWORD(1, 1), &wsadata)) {
      logWindowsSystemError("socket library start");
      goto failed;
    }
  }
#endif /* __MINGW32__ */

  {
    struct sockaddr_in address;
    if (setInetAddress(device, &address)) {
      fileDescriptor = mode->getInetConnection(&address);
    }
  }

  if (fileDescriptor != -1) {
    char *line = NULL;

    while (1) {
      if (line) free(line);
      if ((line = readCommandLine())) {
        const char *word;
        logMessage(LOG_DEBUG, "command received: %s", line);

        if ((word = strtok(line, inputDelimiters))) {
          if (testWord(word, "cells")) {
            if (dimensionsChanged(brl)) {
              free(line);
              return 1;
            }
          } else if (testWord(word, "quit")) {
            break;
          } else {
            logMessage(LOG_WARNING, "unexpected command: %s", word);
          }
        }
      } else {
        asyncWait(1000);
      }
    }
    if (line) free(line);

    close(fileDescriptor);
    fileDescriptor = -1;
  }

failed:
  deallocateCommandDescriptors();
  return 0;
}
ViewItemDialog::ViewItemDialog(ViewItem *item, QWidget *parent)
    : Dialog(parent), _mode(Single), _item(item) {

  setWindowTitle(tr("Edit View Item"));

  // semi-hack: set the width of the list widget to 15 characters, which is enough
  // to say "X-Axis Markers" in english.  This is better than setting it to a fixed
  // number of pixels, as it scales with font size or screen resolution, but
  // it won't necessairly survive translations, or someone adding a option like
  // "Do something super important", which has more than 15 characters.
  // We have to do it here, before the layout is set, and we don't yet know how
  // what is going into the listWidget.
  _listWidget->setMinimumWidth(_listWidget->fontMetrics().averageCharWidth()*15);

  QWidget *extension = extensionWidget();

  QVBoxLayout *extensionLayout = new QVBoxLayout(extension);
  extensionLayout->setContentsMargins(0, -1, 0, -1);

  _editMultipleWidget = new EditMultipleWidget();
  extensionLayout->addWidget(_editMultipleWidget);

  extension->setLayout(extensionLayout);

  _editMultipleBox = topCustomWidget();

  QHBoxLayout *layout = new QHBoxLayout(_editMultipleBox);

  _tagStringLabel = new QLabel(tr("&Name:"), _editMultipleBox);
  _tagStringLabel->setObjectName("_tagStringLabel");
  _tagString = new QLineEdit(_editMultipleBox);
  connect(_tagString, SIGNAL(textChanged(QString)), this, SLOT(modified()));
  _tagStringLabel->setBuddy(_tagString);

  _editMultipleButton = new QPushButton(tr("Edit Multiple >>"));
  _editMultipleButton->setObjectName("_editMultipleButton");
  connect(_editMultipleButton, SIGNAL(clicked()), this, SLOT(slotEditMultiple()));

  layout->addWidget(_tagStringLabel);
  layout->addWidget(_tagString);
  layout->addWidget(_editMultipleButton);

  _editMultipleBox->setLayout(layout);

  setSupportsMultipleEdit(false);

  if (_item->hasBrush()) {
    _fillTab = new FillTab(this);
    connect(_fillTab, SIGNAL(apply()), this, SLOT(fillChanged()));
  }
  if (_item->hasStroke()) {
    _strokeTab = new StrokeTab(this);
    connect(_strokeTab, SIGNAL(apply()), this, SLOT(strokeChanged()));
  }
  _layoutTab = new LayoutTab(this);
  connect(_layoutTab, SIGNAL(apply()), this, SLOT(layoutChanged()));

  DialogPageTab *page = new DialogPageTab(this);
  page->setPageTitle(tr("Appearance"));
  if (_item->hasBrush()) {
    page->addDialogTab(_fillTab);
  }

  if (_item->hasStroke()) {
    page->addDialogTab(_strokeTab);
  }
  page->addDialogTab(_layoutTab);
  addDialogPage(page);

  if (!_item->customDimensionsTab()) {
    _dimensionsTab = new DimensionsTab(_item, this);
    DialogPage *dimensionsPage = new DialogPage(this);
    dimensionsPage->setPageTitle(tr("Size/Position"));
    dimensionsPage->addDialogTab(_dimensionsTab);
    addDialogPage(dimensionsPage);
    connect(_dimensionsTab, SIGNAL(apply()), this, SLOT(dimensionsChanged()));
  } else {
    _dimensionsTab = 0;
  }

  QList<DialogPage*> dialogPages = _item->dialogPages();
  foreach (DialogPage *dialogPage, dialogPages)
    addDialogPage(dialogPage);

  setupFill();
  setupStroke();
  setupLayout();
  setupDimensions();

  selectDialogPage(page);

  if (!_item->customDimensionsTab()) {
    connect(_dimensionsTab, SIGNAL(tabModified()), this, SLOT(modified()));
  }

  connect(this, SIGNAL(editMultipleMode()), this, SLOT(setMultipleEdit()));
  connect(this, SIGNAL(editSingleMode()), this, SLOT(setSingleEdit()));
  connect(_item, SIGNAL(relativeSizeUpdated()), this, SLOT(setupDimensions()));
  connect(_saveAsDefault, SIGNAL(clicked()), this, SLOT(modified()));

  _saveAsDefault->show();

  _tagStringLabel->setProperty("si","&Name:");
  _editMultipleButton->setProperty("si","Edit Multiple >>");
}
Beispiel #12
0
void Parser::processDimensions(const QString &t_message) const
{
    emit dimensionsChanged(dimensionsFromString(t_message));
}