TableSettingsDialog::TableSettingsDialog(QWidget * parent) :
    QDialog(parent),
    ui(new Ui::TableSettingsDialog)
{
    ui->setupUi(this);

    ui->warningLine->clear();
    ui->warningLine->setHidden(true);

    QComboBox * pTableWidthModeComboBox = ui->tableWidthModeComboBox;
    pTableWidthModeComboBox->addItem(QObject::tr("pixels"));
    pTableWidthModeComboBox->addItem(QObject::tr("% of page width"));
    pTableWidthModeComboBox->setCurrentIndex(1);

    QObject::connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onOkButtonPressed()));
    QObject::connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onCancelButtonPressed()));
}
Esempio n. 2
0
void text_input_dialog::create_window(const QRectF &window_geometry,
                                            const QString &window_title,
                                            const QPointF &window_pos) {
  if (has_attribute("geometry")) {
    priv->mBoundingRect = attributes()["geometry"].toRect();
  } else {
    priv->mBoundingRect = QRectF(0.0, 0.0, 320.0, 240.0);
  }

  // todo: invoke UI
  priv->mFrame = new cherry_kit::window();
  priv->mFrame->setGeometry(geometry());
  priv->mFrame->setVisible(true);
  priv->mFrame->set_widget_name("Message Dialog");

  priv->mFrame->set_widget_flag(
      cherry_kit::widget::kRenderBackground);
  priv->mFrame->set_widget_flag(
      cherry_kit::widget::kConvertToWindowType);
  priv->mFrame->set_widget_flag(
      cherry_kit::widget::kRenderDropShadow);

  priv->mBackgroundEffect = new QGraphicsBlurEffect(this);
  priv->mBackgroundEffect->setBlurHints(
      QGraphicsBlurEffect::PerformanceHint);
  priv->mBackgroundEffect->setBlurRadius(0.0);
  priv->mBackgroundEffect->setEnabled(true);

  priv->mLayoutBase =
      new cherry_kit::widget(priv->mFrame);
  priv->mLayoutBase->setPos(0.0, 72.0);
  priv->mVLayout =
      new QGraphicsLinearLayout(priv->mLayoutBase);
  priv->mVLayout->setOrientation(Qt::Vertical);

  QRectF _layoutRect(0.0, 0.0, geometry().width(), geometry().height() - 64.0);
  priv->mVLayout->setGeometry(_layoutRect);
  priv->mVLayout->setMaximumHeight(_layoutRect.height());

  priv->mHLayoutBase =
      new cherry_kit::widget(priv->mLayoutBase);

  priv->mOkButton =
      new cherry_kit::button(priv->mHLayoutBase);
  priv->mCancelButton =
      new cherry_kit::button(priv->mHLayoutBase);

  QRectF _editorRect(
      0.0, 0.0, geometry().width(),
      geometry().height() -
          (96 + priv->mOkButton->boundingRect().height()));
  priv->mEditor =
      new cherry_kit::text_editor(priv->mLayoutBase);
  priv->mVLayout->addItem(priv->mEditor);

  priv->mHLayout =
      new QGraphicsLinearLayout(priv->mHLayoutBase);
  priv->mHLayout->setOrientation(Qt::Horizontal);

  priv->mOkButton->set_label(tr("Post"));
  priv->mCancelButton->set_label(tr("Cancel"));

  priv->mHLayout->setContentsMargins(25.0, 0.0, 25.0, 25.0);
  priv->mVLayout->setContentsMargins(10.0, 10.0, 10.0, 10.0);
  priv->mVLayout->addItem(priv->mHLayoutBase);
  priv->mHLayout->addStretch(1);
  priv->mHLayout->addItem(priv->mCancelButton);
  priv->mHLayout->addItem(priv->mOkButton);

  priv->mEditor->setFocus();

  connect(priv->mCancelButton, SIGNAL(clicked()), this,
          SIGNAL(canceled()));
  connect(priv->mOkButton, SIGNAL(clicked()), this,
          SLOT(onOkButtonPressed()));

  this->exec();
  show_activity();
}