QgsLayoutAddPagesDialog::QgsLayoutAddPagesDialog( QWidget *parent, Qt::WindowFlags flags )
  : QDialog( parent, flags )
{
  setupUi( this );

  mPageOrientationComboBox->addItem( tr( "Portrait" ), QgsLayoutItemPage::Portrait );
  mPageOrientationComboBox->addItem( tr( "Landscape" ), QgsLayoutItemPage::Landscape );
  mPageOrientationComboBox->setCurrentIndex( 1 );

  const auto constEntries = QgsApplication::pageSizeRegistry()->entries();
  for ( const QgsPageSize &size : constEntries )
  {
    mPageSizeComboBox->addItem( size.displayName, size.name );
  }
  mPageSizeComboBox->addItem( tr( "Custom" ) );
  mPageSizeComboBox->setCurrentIndex( mPageSizeComboBox->findData( QStringLiteral( "A4" ) ) );
  pageSizeChanged( mPageSizeComboBox->currentIndex() );
  orientationChanged( 1 );

  mSizeUnitsComboBox->linkToWidget( mWidthSpin );
  mSizeUnitsComboBox->linkToWidget( mHeightSpin );

  mLockAspectRatio->setWidthSpinBox( mWidthSpin );
  mLockAspectRatio->setHeightSpinBox( mHeightSpin );

  connect( mPositionComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutAddPagesDialog::positionChanged );
  mExistingPageSpinBox->setEnabled( false );

  connect( mPageSizeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutAddPagesDialog::pageSizeChanged );
  connect( mPageOrientationComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutAddPagesDialog::orientationChanged );

  connect( mWidthSpin, static_cast< void ( QDoubleSpinBox::* )( double )>( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutAddPagesDialog::setToCustomSize );
  connect( mHeightSpin, static_cast< void ( QDoubleSpinBox::* )( double )>( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutAddPagesDialog::setToCustomSize );
}
Beispiel #2
0
void kdvi::makeToolBar2(QWidget *parent)
{
    QPixmap pm;

    toolBar2 = new QFrame( parent );

    QBoxLayout * gl = new QBoxLayout( toolBar2, QBoxLayout::Down );

    sbox = new ScrollBox( toolBar2 );
    connect( sbox, SIGNAL(valueChanged(QPoint)),
             dviwin, SLOT(scroll(QPoint)) );
    connect( sbox, SIGNAL(button3Pressed()), dviwin, SLOT(nextPage()) );
    connect( sbox, SIGNAL(button2Pressed()), dviwin, SLOT(prevPage()) );
    connect( dviwin, SIGNAL(pageSizeChanged( QSize )),
             sbox, SLOT(setPageSize( QSize )) );
    connect( dviwin, SIGNAL(viewSizeChanged( QSize )),
             sbox, SLOT(setViewSize( QSize )) );
    connect( dviwin, SIGNAL(currentPosChanged( QPoint )),
             sbox, SLOT(setViewPos( QPoint )) );
    QToolTip::add( sbox, 0, tipgroup, i18n("Scroll window and switch the page") );
    sbox->setFixedSize(70,80);
    gl->addWidget( sbox );

    // Create a MarkList

    marklist = new MarkList( toolBar2 );
    connect( marklist, SIGNAL(selected(const char *)),
             SLOT(pageActivated(const char *)) );
    QToolTip::add( marklist, 0, tipgroup, i18n("Select page and mark pages for printing") );

    gl->addWidget( marklist );
    gl->activate();

    sbox->setPageSize( dviwin->pageSize() );
}
void ODataListModel::setPageSize(int newSize) {
    mPageSize = newSize;
    emit pageSizeChanged();
}