Commit 95f701c9 authored by Yuri Chornoivan's avatar Yuri Chornoivan

Use layouts for QDialogs to make KmPlot adopt the sizes

Summary:
As it was pointed out "KDialog had its own layout, and when porting to QDialog, a layout needs to be added"

BUG: 407980

Test Plan:
1. Open KmPlot, choose "Catesian Plot".
2. Enter something (e.g. "x^2").
3. Click on the Equation Editor button at the right of the input field.
4. Try to resize the window (all interface items are movable now).
5. Press the Constant Editor button.
6. Try to resize the window (all interface items are movable now).
7. Close the windows.
8. Try to choose any item from the "Tools" menu.
9. Try to resize the window (all interface items should be movable).

Reviewers: #kde_edu, cfeck

Reviewed By: cfeck

Subscribers: kde-edu

Tags: #kde_edu

Differential Revision: https://phabricator.kde.org/D21428
parent 30aea317
......@@ -42,9 +42,8 @@ Calculator::Calculator( QWidget * parent )
QWidget * widget = new QWidget( this );
setWindowTitle( i18n("Calculator") );
QVBoxLayout *layout = new QVBoxLayout( widget );
layout->setMargin( 0 );
QVBoxLayout *layout = new QVBoxLayout( this );
m_display = new KTextEdit( widget );
QSizePolicy displaySizePolicy = m_display->sizePolicy();
displaySizePolicy.setVerticalStretch( 10 );
......
......@@ -40,7 +40,9 @@ EquationEditor::EquationEditor(QWidget* parent)
setWindowTitle(i18n("Equation Editor"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
connect(buttonBox, &QDialogButtonBox::rejected, this, &EquationEditor::reject);
m_widget->layout()->addWidget(buttonBox);
QVBoxLayout *dialogLayout = new QVBoxLayout (this);
dialogLayout->addWidget (m_widget);
dialogLayout->addWidget (buttonBox);
connect(m_widget->edit, &EquationEdit::returnPressed, this, &EquationEditor::accept);
}
......
......@@ -45,10 +45,9 @@ FunctionTools::FunctionTools(QWidget *parent )
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
connect(buttonBox, &QDialogButtonBox::rejected, this, &FunctionTools::reject);
m_widget->layout()->addWidget(buttonBox);
// Adjust margins
m_widget->layout()->setMargin( 0 );
QVBoxLayout *dialogLayout = new QVBoxLayout (this);
dialogLayout->addWidget (m_widget);
dialogLayout->addWidget (buttonBox);
init( CalculateArea );
......
......@@ -57,7 +57,9 @@ KConstantEditor::KConstantEditor( QWidget * parent )
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
connect(buttonBox, &QDialogButtonBox::rejected, this, &KConstantEditor::reject);
m_widget->gridLayout->addWidget(buttonBox, 4, 1, 1, 1);
QVBoxLayout *dialogLayout = new QVBoxLayout (this);
dialogLayout->addWidget(m_widget);
dialogLayout->addWidget(buttonBox);
m_widget->cmdNew->setIcon( QIcon::fromTheme("document-new") );
m_widget->cmdDelete->setIcon( QIcon::fromTheme("edit-delete") );
......
......@@ -392,7 +392,7 @@ KGradientDialog::KGradientDialog( QWidget * parent, bool modal )
connect(buttonBox, &QDialogButtonBox::rejected, this, &KGradientDialog::reject);
//BEGIN layout widgets
QVBoxLayout * layout = new QVBoxLayout( widget );
QVBoxLayout * layout = new QVBoxLayout( this );
layout->setMargin( 0 );
m_gradient->setFixedHeight( 24 );
......
......@@ -95,14 +95,12 @@ KSliderWindow::KSliderWindow( QWidget * parent ) :
setModal( false );
QWidget * widget = new QWidget( this );
setWindowTitle( i18n("Sliders") );
QVBoxLayout *layout = new QVBoxLayout( widget );
setLayout(layout);
QVBoxLayout *layout = new QVBoxLayout( this );
layout->addWidget(widget);
Q_ASSERT( SLIDER_COUNT == 4 ); // safety check, in case SLIDER_COUNT is increased but not this code
layout->setMargin( 0 );
for ( int i = 0; i < SLIDER_COUNT; ++i )
{
m_sliders[i] = new SliderWidget( widget, i );
......
......@@ -64,7 +64,10 @@ ParameterAnimator::ParameterAnimator( QWidget * parent, Function * function )
setWindowTitle( i18n("Parameter Animator") );
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
connect(buttonBox, &QDialogButtonBox::rejected, this, &ParameterAnimator::reject);
m_widget->layout()->addWidget(buttonBox);
QVBoxLayout *dialogLayout = new QVBoxLayout( this );
dialogLayout->addWidget(m_widget);
dialogLayout->addWidget(buttonBox);
m_mode = Paused;
m_currentValue = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment