Commit dec0c433 authored by Yuri Chornoivan's avatar Yuri Chornoivan
Browse files

Port away from deprecated KDialog

parent e28755d8
......@@ -31,17 +31,17 @@
#include <QScrollBar>
#include <QVBoxLayout>
#include <KConfigGroup>
#include <QDialogButtonBox>
//BEGIN class Calculator
Calculator::Calculator( QWidget * parent )
: KDialog( parent )
: QDialog( parent )
{
setModal( false );
QWidget * widget = new QWidget( this );
setMainWidget( widget );
setCaption( i18n("Calculator") );
setButtons( Close );
setWindowTitle( i18n("Calculator") );
QVBoxLayout *layout = new QVBoxLayout( widget );
layout->setMargin( 0 );
......@@ -51,16 +51,23 @@ Calculator::Calculator( QWidget * parent )
displaySizePolicy.setVerticalPolicy( QSizePolicy::MinimumExpanding );
m_display->setSizePolicy( displaySizePolicy );
layout->addWidget( m_display );
m_input = new EquationEditorWidget( this );
m_input = new EquationEditorWidget( this );
layout->addWidget( m_input );
m_display->setReadOnly( true );
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
layout->addWidget( buttonBox );
connect(m_input->edit, &EquationEdit::returnPressed, this, &Calculator::calculate);
resize( layout->minimumSize() );
// Set minimum size and margin to avoid cutting the right side
resize( 1.05*layout->minimumSize() );
m_input->edit->setFocus();
}
......
......@@ -25,7 +25,7 @@
#ifndef CALCULATOR_H
#define CALCULATOR_H
#include <KDialog>
#include <QDialog>
class EquationEditorWidget;
class KTextEdit;
......@@ -34,7 +34,7 @@ class KTextEdit;
* Mini-calculator for calculating values of functions, etc.
* @author David Saxton
*/
class Calculator : public KDialog
class Calculator : public QDialog
{
Q_OBJECT
public:
......
......@@ -24,23 +24,24 @@
#include "equationeditor.h"
#include <QDialogButtonBox>
#include "equationeditorwidget.h"
#include "equationeditwidget.h"
EquationEditor::EquationEditor(QWidget* parent)
: KDialog(parent)
: QDialog(parent)
{
m_widget = new EquationEditorWidget(this);
m_widget->edit->showEditButton(false);
m_widget->edit->m_equationEditWidget->setClearSelectionOnFocusOut(false);
m_widget->layout()->setMargin(0);
setMainWidget(m_widget);
setCaption(i18n("Equation Editor"));
setButtons(Close);
showButtonSeparator(true);
setWindowTitle(i18n("Equation Editor"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
connect(buttonBox, &QDialogButtonBox::rejected, this, &EquationEditor::reject);
m_widget->layout()->addWidget(buttonBox);
connect(m_widget->edit, &EquationEdit::returnPressed, this, &EquationEditor::accept);
}
......
......@@ -25,7 +25,7 @@
#ifndef EQUATIONEDITOR_H
#define EQUATIONEDITOR_H
#include <KDialog>
#include <QDialog>
class EquationEdit;
class EquationEditorWidget;
......@@ -36,7 +36,7 @@ class EquationEditorWidget;
* special characters.
* \author David Saxton
*/
class EquationEditor : public KDialog
class EquationEditor : public QDialog
{
Q_OBJECT
......
......@@ -27,6 +27,7 @@
#include "ui_functiontools.h"
#include "view.h"
#include "xparser.h"
#include <QDialogButtonBox>
class FunctionToolsWidget : public QWidget, public Ui::FunctionTools
{
......@@ -38,11 +39,13 @@ class FunctionToolsWidget : public QWidget, public Ui::FunctionTools
//BEGIN class FunctionTools
FunctionTools::FunctionTools(QWidget *parent )
: KDialog( parent )
: QDialog( parent )
{
m_widget = new FunctionToolsWidget( this );
setMainWidget( m_widget );
setButtons( Close );
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 );
......@@ -69,21 +72,21 @@ void FunctionTools::init( Mode m )
case FindMinimum:
{
m_widget->rangeTitle->setText( i18n("Search between:") );
setCaption(i18n("Find Minimum Point"));
setWindowTitle(i18n("Find Minimum Point"));
break;
}
case FindMaximum:
{
m_widget->rangeTitle->setText( i18n("Search between:") );
setCaption(i18n("Find Maximum Point"));
setWindowTitle(i18n("Find Maximum Point"));
break;
}
case CalculateArea:
{
m_widget->rangeTitle->setText( i18n("Calculate the area between:") );
setCaption(i18n("Area Under Graph"));
setWindowTitle(i18n("Area Under Graph"));
break;
}
}
......
......@@ -28,7 +28,7 @@
#include "function.h"
#include <kdialog.h>
#include <QDialog>
#include <QPair>
class FunctionToolsWidget;
......@@ -38,7 +38,7 @@ typedef QPair< Plot, int > EquationPair;
@author Fredrik Edemar, David Saxton
*/
/// FunctionTools handles all the dialogs for the items in the tool-menu.
class FunctionTools : public KDialog
class FunctionTools : public QDialog
{
Q_OBJECT
public:
......
......@@ -37,6 +37,8 @@
#include <QTimer>
#include <assert.h>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include "ui_constantseditor.h"
......@@ -52,19 +54,20 @@ class ConstantsEditorWidget : public QWidget, public Ui::ConstantsEditor
//BEGIN class KConstantEditor
KConstantEditor::KConstantEditor( QWidget * parent )
: KDialog( parent )
: QDialog( parent )
{
m_widget = new ConstantsEditorWidget( this );
m_widget->layout()->setMargin( 0 );
setMainWidget( m_widget );
setButtons( Close );
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
connect(buttonBox, &QDialogButtonBox::rejected, this, &KConstantEditor::reject);
m_widget->gridLayout->addWidget(buttonBox, 4, 1, 1, 1);
m_widget->cmdNew->setIcon( QIcon::fromTheme("document-new") );
m_widget->cmdDelete->setIcon( QIcon::fromTheme("edit-delete") );
setCaption( i18n("Constants Editor") );
setWindowTitle( i18n("Constants Editor") );
connect( this, SIGNAL(finished()), this, SLOT(dialogFinished()) );
connect( this, SIGNAL(finished()), this, SLOT(dialogFinished()) );
m_constantValidator = new ConstantValidator( this );
m_widget->nameEdit->setValidator( m_constantValidator );
......
......@@ -26,7 +26,7 @@
#ifndef KCONSTANTEDITOR_H
#define KCONSTANTEDITOR_H
#include "kdialog.h"
#include <QDialog>
#include <QValidator>
class Constant;
......@@ -38,7 +38,7 @@ class QTreeWidgetItem;
* Handles all the constants.
* @author Fredrik Edemar, David Saxton
*/
class KConstantEditor : public KDialog
class KConstantEditor : public QDialog
{
Q_OBJECT
public:
......
......@@ -38,6 +38,7 @@
#include <QStyleOptionButton>
#include <QVBoxLayout>
#include <qdrawutil.h>
#include <QDialogButtonBox>
const double SQRT_3 = 1.732050808;
const double ArrowLength = 8;
......@@ -373,7 +374,7 @@ double KGradientEditor::fromArrowPos( double pos ) const
//BEGIN class KGradientDialog
KGradientDialog::KGradientDialog( QWidget * parent, bool modal )
: KDialog( parent )
: QDialog( parent )
{
QWidget * widget = new QWidget( this );
m_gradient = new KGradientEditor( widget );
......@@ -383,7 +384,11 @@ KGradientDialog::KGradientDialog( QWidget * parent, bool modal )
QLabel * label = new QLabel( i18n("(Double-click on the gradient to add a stop)"), widget );
QPushButton * button = new QPushButton( i18n("Remove stop"), widget );
connect( button, SIGNAL(clicked()), m_gradient, SLOT(removeStop()) );
QDialogButtonBox *buttonBox = new QDialogButtonBox(modal ? QDialogButtonBox::Ok|QDialogButtonBox::Cancel : QDialogButtonBox::Close);
connect(buttonBox, &QDialogButtonBox::accepted, this, &KGradientDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &KGradientDialog::reject);
//BEGIN layout widgets
QVBoxLayout * layout = new QVBoxLayout( widget );
layout->setMargin( 0 );
......@@ -396,15 +401,13 @@ KGradientDialog::KGradientDialog( QWidget * parent, bool modal )
hLayout->addStretch( 1 );
hLayout->addWidget( button );
layout->addLayout( hLayout );
layout->addWidget( m_colorDialog->mainWidget() );
layout->addWidget( buttonBox );
resize( layout->minimumSize() );
//END layout widgets
setMainWidget( widget );
setCaption( i18n("Choose a Gradient") );
setButtons( modal ? Ok|Cancel : Close );
showButtonSeparator( true );
setWindowTitle( i18n("Choose a Gradient") );
setModal( modal );
connect( m_gradient, SIGNAL(colorSelected(QColor)), m_colorDialog, SLOT(setColor(QColor)) );
......
......@@ -25,7 +25,7 @@
#ifndef KGRADIENTDIALOG_H
#define KGRADIENTDIALOG_H
#include <kdialog.h>
#include <QDialog>
#include <QGradient>
#include <QPushButton>
#include <QWidget>
......@@ -171,7 +171,7 @@ class KGradientEditor : public QWidget
* ...
* \endcode
*/
class KGradientDialog : public KDialog
class KGradientDialog : public QDialog
{
Q_OBJECT
......
......@@ -39,6 +39,7 @@
#include "maindlg.h"
#include <ktoolinvocation.h>
#include <ktogglefullscreenaction.h>
#include <KConfigGroup>
#include "kmplotadaptor.h"
......@@ -157,7 +158,7 @@ bool KmPlot::load(const QUrl& url)
m_part->openUrl( url );
if (m_part->url().isEmpty())
return false;
setCaption(url.toDisplayString());
setWindowTitle(url.toDisplayString());
return true;
}
......
......@@ -29,29 +29,42 @@
#include <kfiledialog.h>
#include <kinputdialog.h>
#include <kio/netaccess.h>
#include <kmessagebox.h>
#include <kpushbutton.h>
#include <KMessageBox>
#include <KPushButton>
#include <QTemporaryFile>
#include <kurl.h>
#include <qfile.h>
#include <qtextstream.h>
#include <QFile>
#include <QTextStream>
#include <QList>
#include <QListWidget>
#include <assert.h>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
class ParameterValueList;
KParameterEditor::KParameterEditor( QList<Value> *l, QWidget *parent )
: KDialog( parent ),
: QDialog( parent ),
m_parameter(l)
{
setCaption( i18n( "Parameter Editor" ) );
setButtons( Ok | Cancel );
m_mainWidget = new QParameterEditor( this );
m_mainWidget->layout()->setMargin( 0 );
setMainWidget( m_mainWidget );
setWindowTitle( i18n( "Parameter Editor" ) );
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(m_mainWidget);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
mainLayout->addWidget(buttonBox);
mainLayout->setMargin( 0 );
m_mainWidget->cmdNew->setIcon( QIcon::fromTheme("document-new" ) );
m_mainWidget->cmdDelete->setIcon( QIcon::fromTheme("edit-delete" ) );
......@@ -106,7 +119,7 @@ void KParameterEditor::accept()
}
}
KDialog::accept();
QDialog::accept();
}
......
......@@ -30,7 +30,7 @@
#include <QList>
#include "xparser.h"
#include <kdialog.h>
#include <QDialog>
class QParameterEditor;
......@@ -38,7 +38,7 @@ class QParameterEditor;
@author Fredrik Edemar
*/
/// This class handles the parameter values: it can create, remove, edit and import values.
class KParameterEditor : public KDialog
class KParameterEditor : public QDialog
{
Q_OBJECT
public:
......
......@@ -31,7 +31,6 @@
#include <QLabel>
// KDE includes
#include <kdialog.h>
#include <KLocalizedString>
// local includes
......@@ -44,8 +43,6 @@ KPrinterDlg::KPrinterDlg( QWidget *parent )
setWindowTitle( i18n( "KmPlot Options" ) );
QGridLayout *layout = new QGridLayout( this );
layout->setMargin( KDialog::marginHint() );
layout->setSpacing( KDialog::spacingHint() );
m_printHeaderTable = new QCheckBox( i18n( "Print header table" ), this );
m_transparentBackground = new QCheckBox( i18n( "Transparent background" ), this );
......
......@@ -31,6 +31,9 @@
#include <QCloseEvent>
#include <QGroupBox>
#include <QVBoxLayout>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
//BEGIN class SliderWidget
SliderWidget::SliderWidget( QWidget *parent, int number )
......@@ -86,17 +89,17 @@ double SliderWidget::value()
//BEGIN class KSliderWindow
KSliderWindow::KSliderWindow( QWidget * parent ) :
KDialog( parent )
QDialog( parent )
{
setModal( false );
QWidget * widget = new QWidget( this );
setMainWidget( widget );
setCaption( i18n("Sliders") );
setButtons( Close );
setWindowTitle( i18n("Sliders") );
QVBoxLayout *layout = new QVBoxLayout( widget );
setLayout(layout);
layout->addWidget(widget);
Q_ASSERT( SLIDER_COUNT == 4 ); // safety check, incase SLIDER_COUNT is increased but not this code
Q_ASSERT( SLIDER_COUNT == 4 ); // safety check, in case SLIDER_COUNT is increased but not this code
QVBoxLayout *layout = new QVBoxLayout( widget );
layout->setMargin( 0 );
for ( int i = 0; i < SLIDER_COUNT; ++i )
......@@ -105,7 +108,10 @@ KSliderWindow::KSliderWindow( QWidget * parent ) :
connect( m_sliders[i], SIGNAL(valueChanged()), this, SIGNAL(valueChanged()) );
layout->addWidget( m_sliders[i] );
}
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
layout->addWidget(buttonBox);
resize( layout->minimumSize() );
}
......
......@@ -26,14 +26,14 @@
#ifndef KSLIDERWINDOW_H
#define KSLIDERWINDOW_H
#include <KDialog>
#include <QDialog>
#include <QGroupBox>
class SliderWidget;
class QCloseEvent;
/** @short Slider window for changing a parameter value */
class KSliderWindow : public KDialog
class KSliderWindow : public QDialog
{
Q_OBJECT
public:
......
......@@ -200,7 +200,7 @@ MainDlg::MainDlg(QWidget *parentWidget, QObject *parent, const QVariantList& ) :
m_fontsSettings = new SettingsPageFonts( View::self() );
m_diagramSettings = new SettingsPageDiagram( View::self() );
// Make sure the dialog is at a good default size (hmm kdialog should do this automatically?)
// Make sure the dialog is at a good default size (hmm QDialog should do this automatically?)
QSize minSize = m_generalSettings->layout()->minimumSize()
.expandedTo( m_colorSettings->layout()->minimumSize() )
.expandedTo( m_fontsSettings->layout()->minimumSize() )
......
......@@ -31,6 +31,9 @@
#include <assert.h>
#include <cmath>
#include <KConfigGroup>
#include <QDialogButtonBox>
using namespace std;
#ifndef KDEWIN_MATH_H
......@@ -52,16 +55,16 @@ class ParameterAnimatorWidget : public QWidget, public Ui::ParameterAnimator
//BEGIN class ParameterAnimator
ParameterAnimator::ParameterAnimator( QWidget * parent, Function * function )
: KDialog( parent ),
: QDialog( parent ),
m_function( function )
{
m_widget = new ParameterAnimatorWidget( this );
m_widget->layout()->setMargin( 0 );
setMainWidget( m_widget );
setCaption( i18n("Parameter Animator") );
setButtons( Close );
setWindowTitle( i18n("Parameter Animator") );
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
m_widget->layout()->addWidget(buttonBox);
m_mode = Paused;
m_currentValue = 0;
m_function->m_parameters.animating = true;
......
......@@ -25,7 +25,7 @@
#ifndef PARAMETERANIMATOR_H
#define PARAMETERANIMATOR_H
#include <kdialog.h>
#include <QDialog>
class Function;
class ParameterAnimatorWidget;
......@@ -34,7 +34,7 @@ class QTimer;
/**
@author David Saxton
*/
class ParameterAnimator : public KDialog
class ParameterAnimator : public QDialog
{
Q_OBJECT
public:
......
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