Index: scribus/ui/newdocdialog.cpp =================================================================== --- scribus/ui/newdocdialog.cpp (Revision 26436) +++ scribus/ui/newdocdialog.cpp (Arbeitskopie) @@ -47,27 +47,23 @@ #include "ui/widgets/pagesizelist.h" -NewDocDialog::NewDocDialog(QWidget* parent, const QStringList& recentDocs, bool startUp, const QString& lang) : QDialog(parent), +NewDocDialog::NewDocDialog(QWidget* parent, const QStringList& recentDocs, bool startUp, const QString& lang) : ScDialog(parent, "NewDocumentWindow"), prefsManager(PrefsManager::instance()), m_onStartup(startUp) { setupUi(this); - windowFitInScreen(); + IconManager &iconManager = IconManager::instance(); - setObjectName(QString::fromLocal8Bit("NewDocumentWindow")); setModal(true); + setWindowTitle( tr( "New Document" ) ); - IconManager &iconManager = IconManager::instance(); - + m_labelVisibity = !prefsManager.appPrefs.uiPrefs.hideLabels; m_unitIndex = prefsManager.appPrefs.docSetupPrefs.docUnitIndex; m_unitRatio = unitGetRatioFromIndex(m_unitIndex); m_unitSuffix = unitGetSuffixFromIndex(m_unitIndex); m_orientation = prefsManager.appPrefs.docSetupPrefs.pageOrientation; - setWindowTitle( tr( "New Document" ) ); - setWindowIcon(iconManager.loadIcon("AppIcon.png")); - buttonVertical->setIcon(iconManager.loadIcon("page-orientation-vertical")); buttonHorizontal->setIcon(iconManager.loadIcon("page-orientation-horizontal")); labelColumns->setPixmap(iconManager.loadPixmap("paragraph-columns")); @@ -191,6 +187,9 @@ pageCountSpinBox->setMaximum( 10000 ); pageCountSpinBox->setMinimum( 1 ); + IconManager &iconManager = IconManager::instance(); + pageCountLabel->setPixmap(iconManager.loadPixmap("panel-page")); + pageLayouts->updateSchemeSelector(prefsManager.appPrefs.pageSets, prefsManager.appPrefs.pageSets[pagePositioning].FirstPage); setDocLayout(pagePositioning); @@ -234,12 +233,16 @@ sectionTextFrame->setCanSaveState(true); sectionTextFrame->restorePreferences(); - // We have to calculate the width of the properties panel manually, - // because QSizePolicy::Minimum doesn't work as expected + labelColumns->setLabelVisibility(m_labelVisibity); + labelGap->setLabelVisibility(m_labelVisibity); + pageCountLabel->setLabelVisibility(m_labelVisibity); + orientationLabel->setLabelVisibility(m_labelVisibity); + pageLayouts->toggleLabelVisibility(m_labelVisibity); + + // We have to install an event filter to resize the scroll container width based on the content width. + // The content width can change after we calculated the initial ui layout. + scrollAreaWidgetContents->installEventFilter(this); scrollAreaWidgetContents->adjustSize(); - //scrollAreaWidgetContents->setFixedWidth(scrollAreaWidgetContents->width()); - scrollArea->setWidgetResizable(true); - scrollArea->setFixedWidth(scrollAreaWidgetContents->width() + qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent)); } @@ -330,6 +333,7 @@ QSignalBlocker sigFormats(listPageFormats); listPageFormats->setOrientation(m_orientation); } + } void NewDocDialog::setHeight(double) @@ -384,25 +388,15 @@ listPageFormats->setSortMode(static_cast(comboSortSizes->currentData().toInt())); } -void NewDocDialog::windowFitInScreen() +bool NewDocDialog::eventFilter(QObject *object, QEvent *event) { - QScreen* activeScreen = nullptr; - QWidget* widget = this; - - while (widget) + if (object->objectName() == "scrollAreaWidgetContents" && event->type() == QEvent::Resize) { - activeScreen = widget->screen(); - if (activeScreen != nullptr) - break; - widget = widget->parentWidget(); + int currentWidth = scrollArea->minimumWidth(); + scrollArea->setMinimumWidth(qMax(scrollAreaWidgetContents->sizeHint().width() + qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent), currentWidth)); + return true; } - - if (activeScreen) - { - int w = qMin(width(), activeScreen->availableSize().width()); - int h = qMin(height(), activeScreen->availableSize().height()); - resize(w, h); - } + return false; } void NewDocDialog::handleAutoFrame() @@ -439,6 +433,8 @@ bleedGroup->setPageWidth(m_pageWidth); connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double))); connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double))); + + } void NewDocDialog::ExitOK() @@ -523,6 +519,7 @@ marginGroup->setPageSize(size); bleedGroup->setPageSize(size); + } void NewDocDialog::setSize(const QString& gr) Index: scribus/ui/newdocdialog.h =================================================================== --- scribus/ui/newdocdialog.h (Revision 26436) +++ scribus/ui/newdocdialog.h (Arbeitskopie) @@ -29,6 +29,7 @@ class QPushButton; class QSpinBox; +#include "scdialog.h" #include "scribusapi.h" #include "scribusstructs.h" #include "ui/customfdialog.h" @@ -40,7 +41,7 @@ class PrefsManager; class ScrSpinBox; -class SCRIBUS_API NewDocDialog : public QDialog, public Ui::newDocDialog +class SCRIBUS_API NewDocDialog : public ScDialog, public Ui::newDocDialog { Q_OBJECT @@ -137,8 +138,9 @@ double m_bleedTop { 0.0 }; double m_bleedLeft { 0.0 }; double m_bleedRight { 0.0 }; + bool m_labelVisibity {true}; - void windowFitInScreen(); + bool eventFilter(QObject *object, QEvent *event); }; #endif // NEWDOC_H