Skip to content

Commit 8b1c62b

Browse files
committed
- Added scrollbars for OptionsDialog. Because on some screens with small resolution it is almost impossible to use OptionsDialog.
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24551 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 6f3411b commit 8b1c62b

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

OMEdit/OMEditGUI/Options/OptionsDialog.cpp

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,9 @@ void OptionsDialog::setUpDialog()
771771
mpButtonBox->addButton(mpCancelButton, QDialogButtonBox::ActionRole);
772772
QHBoxLayout *horizontalLayout = new QHBoxLayout;
773773
horizontalLayout->addWidget(mpOptionsList);
774-
horizontalLayout->addWidget(mpPagesWidget, 1);
774+
QScrollArea *pPagesWidgetScrollArea = new QScrollArea;
775+
pPagesWidgetScrollArea->setWidget(mpPagesWidget);
776+
horizontalLayout->addWidget(pPagesWidgetScrollArea, 1);
775777
// Create a layout
776778
QGridLayout *mainLayout = new QGridLayout;
777779
mainLayout->addLayout(horizontalLayout, 0, 0, 1, 2);
@@ -842,6 +844,7 @@ void OptionsDialog::addListItems()
842844
void OptionsDialog::createPages()
843845
{
844846
mpPagesWidget = new QStackedWidget;
847+
mpPagesWidget->setContentsMargins(5, 2, 5, 2);
845848
mpPagesWidget->addWidget(mpGeneralSettingsPage);
846849
mpPagesWidget->addWidget(mpLibrariesPage);
847850
mpPagesWidget->addWidget(mpModelicaTextEditorPage);
@@ -857,6 +860,29 @@ void OptionsDialog::createPages()
857860
mpPagesWidget->addWidget(mpFMIPage);
858861
}
859862

863+
/*!
864+
Saves the OptionsDialog geometry to omedit.ini file.
865+
*/
866+
void OptionsDialog::saveDialogGeometry()
867+
{
868+
/* save the window geometry. */
869+
if (mpGeneralSettingsPage->getPreserveUserCustomizations()) {
870+
mpSettings->setValue("OptionsDialog/geometry", saveGeometry());
871+
}
872+
}
873+
874+
/*!
875+
Reimplementation of QDialog::show method.
876+
*/
877+
void OptionsDialog::show()
878+
{
879+
/* restore the window geometry. */
880+
if (mpGeneralSettingsPage->getPreserveUserCustomizations()) {
881+
restoreGeometry(mpSettings->value("OptionsDialog/geometry").toByteArray());
882+
}
883+
setVisible(true);
884+
}
885+
860886
//! Change the page in Options Widget when the mpOptionsList currentItemChanged Signal is raised.
861887
void OptionsDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
862888
{
@@ -871,6 +897,7 @@ void OptionsDialog::reject()
871897
{
872898
// read the old settings from the file
873899
readSettings();
900+
saveDialogGeometry();
874901
QDialog::reject();
875902
}
876903

@@ -895,6 +922,7 @@ void OptionsDialog::saveSettings()
895922
saveDebuggerSettings();
896923
saveFMISettings();
897924
mpSettings->sync();
925+
saveDialogGeometry();
898926
accept();
899927
}
900928

OMEdit/OMEditGUI/Options/OptionsDialog.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ class OptionsDialog : public QDialog
109109
FigaroPage* getFigaroPage() {return mpFigaroPage;}
110110
DebuggerPage* getDebuggerPage() {return mpDebuggerPage;}
111111
FMIPage* getFMIPage() {return mpFMIPage;}
112+
void saveDialogGeometry();
113+
void show();
112114
signals:
113115
void modelicaTextSettingsChanged();
114116
void updateLineWrapping();

0 commit comments

Comments
 (0)